Fix a segv in winbindd caused by trying to free an fstring.
authorGerald (Jerry) Carter <jerry@samba.org>
Mon, 17 Dec 2007 23:33:48 +0000 (17:33 -0600)
committerGerald (Jerry) Carter <jerry@samba.org>
Mon, 17 Dec 2007 23:33:48 +0000 (17:33 -0600)
Make a copy of the machine_password and machine_account strings
in all conditional paths so that SAFE_FREE() will always be valid.
(This used to be commit 194c4640b158457a6d0d5ea91e28d41d619c77de)

source3/winbindd/winbindd_cm.c

index cb366a293c07160f3d758b7797f9e40a7743cf37..6c5633c2b2c90caee983192e7dc55e3f0e133129 100644 (file)
@@ -2005,11 +2005,15 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
                domain_name = domain->name;
                goto schannel;
        } else {
-               machine_password = conn_pwd;
-               machine_account = conn->cli->user_name;
+               machine_password = SMB_STRDUP(conn_pwd);                
+               machine_account = SMB_STRDUP(conn->cli->user_name);
                domain_name = conn->cli->domain;
        }
 
+       if (!machine_password || !machine_account) {
+               result = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
 
        /* We have an authenticated connection. Use a NTLMSSP SPNEGO
           authenticated SAMR pipe with sign & seal. */