summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2011-03-23 12:09:22 +0100
committerGünther Deschner <gd@samba.org>2011-04-06 11:53:57 +0200
commit6681e451c98cd1716b5a68a02e0840a7ae768c36 (patch)
tree8812911bf6a1ae1b25e5386e0c7c4b8c91b0dbd3 /source3
parent1cbe59e174c3ea66dfb57ab7f4ea493168b4867e (diff)
downloadsamba-6681e451c98cd1716b5a68a02e0840a7ae768c36.tar.gz
samba-6681e451c98cd1716b5a68a02e0840a7ae768c36.tar.bz2
samba-6681e451c98cd1716b5a68a02e0840a7ae768c36.zip
s3-pdb_ipa: Create DN for new object
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/pdb_ipa.c18
1 files changed, 18 insertions, 0 deletions
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;
}