From 6681e451c98cd1716b5a68a02e0840a7ae768c36 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Wed, 23 Mar 2011 12:09:22 +0100 Subject: s3-pdb_ipa: Create DN for new object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/passdb/pdb_ipa.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/passdb/pdb_ipa.c') diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c index e276fa9801..c98f33eb43 100644 --- a/source3/passdb/pdb_ipa.c +++ b/source3/passdb/pdb_ipa.c @@ -1292,7 +1292,25 @@ static NTSTATUS ipasam_create_user(struct pdb_methods *pdb_methods, if (NT_STATUS_IS_OK(status)) { ldap_op = LDAP_MOD_REPLACE; } else if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { + char *escape_username; ldap_op = LDAP_MOD_ADD; + escape_username = escape_rdn_val_string_alloc(name); + if (!escape_username) { + return NT_STATUS_NO_MEMORY; + } + if (name[strlen(name)-1] == '$') { + dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", + escape_username, + lp_ldap_machine_suffix()); + } else { + dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", + escape_username, + lp_ldap_user_suffix()); + } + SAFE_FREE(escape_username); + if (!dn) { + return NT_STATUS_NO_MEMORY; + } } else { return status; } -- cgit