credentials: Fix CID 1414796 Explicit null dereferenced
[metze/samba/wip.git] / auth / credentials / credentials_secrets.c
index ae1d23b51c12a2210ab92fa673eeb0edfa8ab786..25c1fddf2ec8fe0cef04af0d3167811a765812bf 100644 (file)
@@ -106,6 +106,11 @@ static NTSTATUS cli_credentials_set_secrets_lct(struct cli_credentials *cred,
        }
 
        password = ldb_msg_find_attr_as_string(msg, "secret", NULL);
+       if (password == NULL) {
+               /* This attribute is mandatory */
+               talloc_free(mem_ctx);
+               return NT_STATUS_NOT_FOUND;
+       }
 
        whenChanged = ldb_msg_find_ldb_val(msg, "whenChanged");
        if (!whenChanged || ldb_val_to_time(whenChanged, &lct) != LDB_SUCCESS) {