mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
ITS#2691 use putenv() instead of setenv() for portability
This commit is contained in:
parent
370fd22870
commit
ffab52e529
@ -222,8 +222,19 @@ static int ldapdb_auxprop_plug_init(const sasl_utils_t *utils,
|
|||||||
utils->getopt(utils->getopt_context, ldapdb, "ldapdb_mech",
|
utils->getopt(utils->getopt_context, ldapdb, "ldapdb_mech",
|
||||||
(const char **)&tmp.mech.bv_val, &len);
|
(const char **)&tmp.mech.bv_val, &len);
|
||||||
tmp.mech.bv_len = len;
|
tmp.mech.bv_len = len;
|
||||||
utils->getopt(utils->getopt_context, ldapdb, "ldapdb_rc", &s, NULL);
|
utils->getopt(utils->getopt_context, ldapdb, "ldapdb_rc", &s, &len);
|
||||||
if(s && setenv("LDAPRC", s, 1)) return SASL_BADPARAM;
|
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));
|
p = utils->malloc(sizeof(ldapctx));
|
||||||
if (!p) return SASL_NOMEM;
|
if (!p) return SASL_NOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user