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>
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;
}