diff options
| author | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2010-01-26 04:17:18 +0000 |
|---|---|---|
| committer | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2010-01-26 04:17:18 +0000 |
| commit | 09b16018d032d94de7fbaf59c4d6fc4a43c4d610 (patch) | |
| tree | 25902a53d874255d42002dd157e36601e71e2df5 /libsm/mbdb.c | |
| parent | 7db286411e6127edcdd31f558ac20de5c63055b0 (diff) | |
Notes
Diffstat (limited to 'libsm/mbdb.c')
| -rw-r--r-- | libsm/mbdb.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libsm/mbdb.c b/libsm/mbdb.c index ad0e7ccbd13f..3bb514df5164 100644 --- a/libsm/mbdb.c +++ b/libsm/mbdb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 2001-2003,2009 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -8,7 +8,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Id: mbdb.c,v 1.40 2003/12/10 03:19:07 gshapiro Exp $") +SM_RCSID("@(#)$Id: mbdb.c,v 1.41 2009/06/19 22:02:26 guenther Exp $") #include <sys/param.h> @@ -564,7 +564,20 @@ mbdb_ldap_lookup(name, user) entry = ldap_first_entry(LDAPLMAP.ldap_ld, LDAPLMAP.ldap_res); if (entry == NULL) { - save_errno = sm_ldap_geterrno(LDAPLMAP.ldap_ld); + int rc; + + /* + ** We may have gotten an LDAP_RES_SEARCH_RESULT response + ** with an error inside it, so we have to extract that + ** with ldap_parse_result(). This can happen when talking + ** to an LDAP proxy whose backend has gone down. + */ + + save_errno = ldap_parse_result(LDAPLMAP.ldap_ld, + LDAPLMAP.ldap_res, &rc, NULL, + NULL, NULL, NULL, 0); + if (save_errno == LDAP_SUCCESS) + save_errno = rc; if (save_errno == LDAP_SUCCESS) { errno = ENOENT; |
