summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/passdb/pdb_ldap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 685d393eb9..151fbd6b16 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -2210,7 +2210,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
struct smbldap_state *conn = ldap_state->smbldap_state;
pstring filter;
char *attrs[] = { "gidNumber", "sambaSID", NULL };
- char *escape_name = escape_ldap_string_alloc(username);
+ char *escape_name;
int rc;
LDAPMessage *msg = NULL;
LDAPMessage *entry;
@@ -2226,6 +2226,8 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
*sids = NULL;
num_sids = 0;
+ escape_name = escape_ldap_string_alloc(username);
+
if (escape_name == NULL)
return NT_STATUS_UNSUCCESSFUL;