summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorBrendan Powers <brendan0powers@gmail.com>2009-12-14 20:40:26 -0500
committerAndrew Bartlett <abartlet@samba.org>2009-12-18 14:27:43 +1100
commit8b889256540e471c399f020871cf18fb4d89e694 (patch)
treee516eca6e7c82635fbd2ef04345a52d7b9bcf63e /source4
parentd99084ffdb2c898c18bd4b264d8dd297dd0f1f25 (diff)
downloadsamba-8b889256540e471c399f020871cf18fb4d89e694.tar.gz
samba-8b889256540e471c399f020871cf18fb4d89e694.tar.bz2
samba-8b889256540e471c399f020871cf18fb4d89e694.zip
s4-dsdb: return an error if samAccountName is not specified when creating a user.
Makes sure samAccountName has been specified before adding a user. This happened while I was trying to add a user with the posixAccount objectclass. I forgot to specify the user objectClass, and samba segfaulted. It now returns LDB_ERR_CONSTRAINT_VIOLATION. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 4d4f500e87..df4a344298 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1487,6 +1487,13 @@ static int setup_io(struct ph_context *ac,
io->n.lm_hash = samdb_result_hash(io->ac, new_msg, "dBCSPwd");
+ if(io->u.sAMAccountName == NULL)
+ {
+ ldb_asprintf_errstring(ldb, "samAccountName is missing on %s for attempted password set/change",
+ ldb_dn_get_linearized(new_msg->dn));
+ return(LDB_ERR_CONSTRAINT_VIOLATION);
+ }
+
return LDB_SUCCESS;
}