From: Howard Chu Date: Sat, 13 Sep 2003 10:38:23 +0000 (+0000) Subject: Import ITS#2691 patch from HEAD X-Git-Tag: OPENLDAP_REL_ENG_2_1_23~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=af57ee73a685d730cf21ec3661beeee639d1f54b;p=openldap Import ITS#2691 patch from HEAD --- diff --git a/contrib/ldapsasl/ldapdb.c b/contrib/ldapsasl/ldapdb.c index f0f7e4069b..6a35873602 100644 --- a/contrib/ldapsasl/ldapdb.c +++ b/contrib/ldapsasl/ldapdb.c @@ -208,6 +208,7 @@ int ldapdb_auxprop_plug_init(const sasl_utils_t *utils, { ldapctx tmp, *p; const char *s; + unsigned len; if(!out_version || !plug) return SASL_BADPARAM; @@ -217,13 +218,27 @@ int ldapdb_auxprop_plug_init(const sasl_utils_t *utils, if(!tmp.uri) return SASL_BADPARAM; utils->getopt(utils->getopt_context, ldapdb, "ldapdb_id", - (const char **)&tmp.id.bv_val, (unsigned *)&tmp.id.bv_len); + (const char **)&tmp.id.bv_val, &len); + tmp.id.bv_len = len; utils->getopt(utils->getopt_context, ldapdb, "ldapdb_pw", - (const char **)&tmp.pw.bv_val, (unsigned *)&tmp.pw.bv_len); + (const char **)&tmp.pw.bv_val, &len); + tmp.pw.bv_len = len; utils->getopt(utils->getopt_context, ldapdb, "ldapdb_mech", - (const char **)&tmp.mech.bv_val, (unsigned *)&tmp.mech.bv_len); - utils->getopt(utils->getopt_context, ldapdb, "ldapdb_rc", &s, NULL); - if(s && setenv("LDAPRC", s, 1)) return SASL_BADPARAM; + (const char **)&tmp.mech.bv_val, &len); + tmp.mech.bv_len = len; + utils->getopt(utils->getopt_context, ldapdb, "ldapdb_rc", &s, &len); + if(s) + { + char *str = utils->malloc(sizeof("LDAPRC=")+len); + if (!str) return SASL_NOMEM; + strcpy( str, "LDAPRC=" ); + strcpy( str + sizeof("LDAPRC=")-1, s ); + if (putenv(str)) + { + utils->free(str); + return SASL_NOMEM; + } + } p = utils->malloc(sizeof(ldapctx)); if (!p) return SASL_NOMEM;