s4: cracknames.c: Change the handling of the NT_STATUS_NO_MEMORY status results
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Thu, 13 Aug 2009 07:50:19 +0000 (09:50 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Thu, 13 Aug 2009 22:14:14 +0000 (00:14 +0200)
With the previous check I got random failures when trying to connect to the
LDAP server.

source4/dsdb/samdb/cracknames.c

index 8e97c45e7e8a80a2cef348f7560f9a3182f67267..723f51356a5c36a512298379d5405b7a172077fe 100644 (file)
@@ -1278,6 +1278,9 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
        }
 
        *nt4_domain = talloc_strdup(mem_ctx, info1.result_name);
+       if (*nt4_domain == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
        p = strchr(*nt4_domain, '\\');
        if (!p) {
@@ -1287,10 +1290,9 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
 
        if (p[1]) {
                *nt4_account = talloc_strdup(mem_ctx, &p[1]);
-       }
-
-       if (!*nt4_account || !*nt4_domain) {
-               return NT_STATUS_NO_MEMORY;
+               if (*nt4_account == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
        }
 
        return NT_STATUS_OK;