]> code.citadel.org Git - citadel.git/blobdiff - citadel/ldap.c
fix possible buffer underrun (by 1;-)
[citadel.git] / citadel / ldap.c
index 8efc6e59075bc7d6f8ab9b7e167e11c05b4ad434..9d280186487556576427f29861f72846533a586b 100644 (file)
@@ -2,9 +2,9 @@
  * These functions implement the portions of AUTHMODE_LDAP and AUTHMODE_LDAP_AD which
  * actually speak to the LDAP server.
  *
- * Copyright (c) 2010 by Art Cancro and the citadel.org development team.
+ * Copyright (c) 2011 by Art Cancro and the citadel.org development team.
  *
- * This program is free software; you can redistribute it and/or modify
+ * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
@@ -99,6 +99,7 @@ int CtdlTryUserLDAP(char *username,
        }
 
        ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
+       ldap_set_option(ldserver, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
 
        striplt(config.c_ldap_bind_dn);
        striplt(config.c_ldap_bind_pw);
@@ -123,7 +124,8 @@ int CtdlTryUserLDAP(char *username,
        }
 
        syslog(LOG_DEBUG, "LDAP search: %s\n", searchstring);
-       i = ldap_search_ext_s(ldserver,                         /* ld                           */
+       (void) ldap_search_ext_s(
+               ldserver,                                       /* ld                           */
                config.c_ldap_base_dn,                          /* base                         */
                LDAP_SCOPE_SUBTREE,                             /* scope                        */
                searchstring,                                   /* filter                       */
@@ -242,6 +244,7 @@ int CtdlTryPasswordLDAP(char *user_dn, const char *password)
                else {
                        syslog(LOG_DEBUG, "LDAP: Cannot bind: %s (%d)\n", ldap_err2string(i), i);
                }
+               ldap_set_option(ldserver, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
                ldap_unbind(ldserver);
        }