#endif
-static void util_ldap_strdup (char *str, const char *newstr)
+static void util_ldap_strdup (char **str, const char *newstr)
{
- if (str) {
- free(str);
- str = NULL;
+ if (*str) {
+ free(*str);
+ *str = NULL;
}
if (newstr) {
- str = calloc(1, strlen(newstr)+1);
- strcpy (str, newstr);
+ *str = calloc(1, strlen(newstr)+1);
+ strcpy (*str, newstr);
}
}
/* the bind credentials have changed */
l->bound = 0;
- util_ldap_strdup((char*)l->binddn, binddn);
- util_ldap_strdup((char*)l->bindpw, bindpw);
+ util_ldap_strdup((char**)&(l->binddn), binddn);
+ util_ldap_strdup((char**)&(l->bindpw), bindpw);
break;
}
#if APR_HAS_THREADS
l->host = apr_pstrdup(st->pool, host);
l->port = port;
l->deref = deref;
- util_ldap_strdup((char*)l->binddn, binddn);
- util_ldap_strdup((char*)l->bindpw, bindpw);
+ util_ldap_strdup((char**)&(l->binddn), binddn);
+ util_ldap_strdup((char**)&(l->bindpw), bindpw);
l->secure = secure;
/* add the cleanup to the pool */
* it is bound to the original user id specified ldc->binddn when in fact it is
* bound to a completely different user id.
*/
- util_ldap_strdup((char*)ldc->binddn, *binddn);
- util_ldap_strdup((char*)ldc->bindpw, bindpw);
+ util_ldap_strdup((char**)&(ldc->binddn), *binddn);
+ util_ldap_strdup((char**)&(ldc->bindpw), bindpw);
}
/*