From 4ebbf6c89c537a275c8d387f40411097d311337d Mon Sep 17 00:00:00 2001 From: Brendan Powers Date: Mon, 14 Dec 2009 20:40:26 -0500 Subject: [PATCH] s4-dsdb: return an error if samAccountName is not specified when creating a user. Prevents a segfault --- source4/dsdb/samdb/ldb_modules/password_hash.c | 7 +++++++ 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 4d4f500..35ce08f 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; } -- 1.5.4.3