ldap.c (168515) | ldap.c (173340) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2001-2006 Sendmail, Inc. and its suppliers. | 2 * Copyright (c) 2001-2007 Sendmail, Inc. and its suppliers. |
3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 */ 9 10/* some "deprecated" calls are used, e.g., ldap_get_values() */ 11#define LDAP_DEPRECATED 1 12 13#include <sm/gen.h> | 3 * All rights reserved. 4 * 5 * By using this file, you agree to the terms and conditions set 6 * forth in the LICENSE file which can be found at the top level of 7 * the sendmail distribution. 8 */ 9 10/* some "deprecated" calls are used, e.g., ldap_get_values() */ 11#define LDAP_DEPRECATED 1 12 13#include <sm/gen.h> |
14SM_RCSID("@(#)$Id: ldap.c,v 1.78 2006/08/30 22:56:59 ca Exp $") | 14SM_RCSID("@(#)$Id: ldap.c,v 1.80 2007/10/12 00:19:44 ca Exp $") |
15 16#if LDAPMAP 17# include <sys/types.h> 18# include <errno.h> 19# include <setjmp.h> 20# include <stdlib.h> 21# include <unistd.h> 22 --- 1075 unchanged lines hidden (view full) --- 1098 1099 if (ret == 0) 1100 save_errno = ETIMEDOUT; 1101 else 1102 save_errno = sm_ldap_geterrno(lmap->ldap_ld); 1103 if (save_errno != LDAP_SUCCESS) 1104 { 1105 statp = EX_TEMPFAIL; | 15 16#if LDAPMAP 17# include <sys/types.h> 18# include <errno.h> 19# include <setjmp.h> 20# include <stdlib.h> 21# include <unistd.h> 22 --- 1075 unchanged lines hidden (view full) --- 1098 1099 if (ret == 0) 1100 save_errno = ETIMEDOUT; 1101 else 1102 save_errno = sm_ldap_geterrno(lmap->ldap_ld); 1103 if (save_errno != LDAP_SUCCESS) 1104 { 1105 statp = EX_TEMPFAIL; |
1106 if (ret != 0) | 1106 switch (save_errno) |
1107 { | 1107 { |
1108 switch (save_errno) 1109 { | |
1110#ifdef LDAP_SERVER_DOWN | 1108#ifdef LDAP_SERVER_DOWN |
1111 case LDAP_SERVER_DOWN: | 1109 case LDAP_SERVER_DOWN: |
1112#endif /* LDAP_SERVER_DOWN */ | 1110#endif /* LDAP_SERVER_DOWN */ |
1113 case LDAP_TIMEOUT: 1114 case LDAP_UNAVAILABLE: | 1111 case LDAP_TIMEOUT: 1112 case ETIMEDOUT: 1113 case LDAP_UNAVAILABLE: |
1115 | 1114 |
1116 /* 1117 ** server disappeared, 1118 ** try reopen on next search 1119 */ | 1115 /* 1116 ** server disappeared, 1117 ** try reopen on next search 1118 */ |
1120 | 1119 |
1121 statp = EX_RESTART; 1122 break; 1123 } 1124 save_errno += E_LDAPBASE; | 1120 statp = EX_RESTART; 1121 break; |
1125 } | 1122 } |
1123 if (ret != 0) 1124 save_errno += E_LDAPBASE; |
|
1126 SM_LDAP_ERROR_CLEANUP(); 1127 errno = save_errno; 1128 return statp; 1129 } 1130 1131 if (lmap->ldap_res != NULL) 1132 { 1133 ldap_msgfree(lmap->ldap_res); --- 133 unchanged lines hidden (view full) --- 1267 save_errno = sm_ldap_geterrno(lmap->ldap_ld); 1268 statp = EX_TEMPFAIL; 1269 switch (save_errno) 1270 { 1271#ifdef LDAP_SERVER_DOWN 1272 case LDAP_SERVER_DOWN: 1273#endif /* LDAP_SERVER_DOWN */ 1274 case LDAP_TIMEOUT: | 1125 SM_LDAP_ERROR_CLEANUP(); 1126 errno = save_errno; 1127 return statp; 1128 } 1129 1130 if (lmap->ldap_res != NULL) 1131 { 1132 ldap_msgfree(lmap->ldap_res); --- 133 unchanged lines hidden (view full) --- 1266 save_errno = sm_ldap_geterrno(lmap->ldap_ld); 1267 statp = EX_TEMPFAIL; 1268 switch (save_errno) 1269 { 1270#ifdef LDAP_SERVER_DOWN 1271 case LDAP_SERVER_DOWN: 1272#endif /* LDAP_SERVER_DOWN */ 1273 case LDAP_TIMEOUT: |
1274 case ETIMEDOUT: |
|
1275 case LDAP_UNAVAILABLE: 1276 1277 /* 1278 ** server disappeared, 1279 ** try reopen on next search 1280 */ 1281 1282 statp = EX_RESTART; --- 82 unchanged lines hidden (view full) --- 1365 } 1366 ldap_set_option(ld, LDAP_OPT_DEREF, &lmap->ldap_deref); 1367 if (bitset(LDAP_OPT_REFERRALS, lmap->ldap_options)) 1368 ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON); 1369 else 1370 ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF); 1371 ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &lmap->ldap_sizelimit); 1372 ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &lmap->ldap_timelimit); | 1275 case LDAP_UNAVAILABLE: 1276 1277 /* 1278 ** server disappeared, 1279 ** try reopen on next search 1280 */ 1281 1282 statp = EX_RESTART; --- 82 unchanged lines hidden (view full) --- 1365 } 1366 ldap_set_option(ld, LDAP_OPT_DEREF, &lmap->ldap_deref); 1367 if (bitset(LDAP_OPT_REFERRALS, lmap->ldap_options)) 1368 ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON); 1369 else 1370 ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF); 1371 ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &lmap->ldap_sizelimit); 1372 ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &lmap->ldap_timelimit); |
1373# if _FFR_LDAP_NETWORK_TIMEOUT && defined(LDAP_OPT_NETWORK_TIMEOUT) 1374 ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &lmap->ldap_networktmo); 1375# endif /* _FFR_LDAP_NETWORK_TIMEOUT && defined(LDAP_OPT_NETWORK_TIMEOUT) */ |
|
1373# ifdef LDAP_OPT_RESTART 1374 ldap_set_option(ld, LDAP_OPT_RESTART, LDAP_OPT_ON); 1375# endif /* LDAP_OPT_RESTART */ 1376# else /* USE_LDAP_SET_OPTION */ 1377 /* From here on in we can use ldap internal timelimits */ 1378 ld->ld_deref = lmap->ldap_deref; 1379 ld->ld_options = lmap->ldap_options; 1380 ld->ld_sizelimit = lmap->ldap_sizelimit; --- 40 unchanged lines hidden --- | 1376# ifdef LDAP_OPT_RESTART 1377 ldap_set_option(ld, LDAP_OPT_RESTART, LDAP_OPT_ON); 1378# endif /* LDAP_OPT_RESTART */ 1379# else /* USE_LDAP_SET_OPTION */ 1380 /* From here on in we can use ldap internal timelimits */ 1381 ld->ld_deref = lmap->ldap_deref; 1382 ld->ld_options = lmap->ldap_options; 1383 ld->ld_sizelimit = lmap->ldap_sizelimit; --- 40 unchanged lines hidden --- |