credentials: Fix CID 1414796 Explicit null dereferenced
authorVolker Lendecke <vl@samba.org>
Wed, 4 Apr 2018 08:26:14 +0000 (10:26 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 4 Apr 2018 23:10:09 +0000 (01:10 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
auth/credentials/credentials_secrets.c

index ae1d23b..25c1fdd 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) {