r14448: * protect against NULL cli_state* pointers in cli_rpc_pipe_open()
authorGerald Carter <jerry@samba.org>
Wed, 15 Mar 2006 14:58:39 +0000 (14:58 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:30 +0000 (11:15 -0500)
* Fix inverted logic check for machine accounts in get_md4pw()
(This used to be commit a36529535dcb5a262e7627b80fb62a31240dc8ad)

source3/rpc_client/cli_pipe.c
source3/rpc_server/srv_netlog_nt.c

index 45b2e96baca4832aea00fede1e02c56f5fd86b23..a2e0dab990fbe5bf70cfdf10e8e97f91936aabb9 100644 (file)
@@ -2171,6 +2171,12 @@ static struct rpc_pipe_client *cli_rpc_pipe_open(struct cli_state *cli, int pipe
 
        *perr = NT_STATUS_NO_MEMORY;
 
+       /* sanity check to protect against crashes */
+
+       if ( !cli ) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
        /* The pipe name index must fall within our array */
        SMB_ASSERT((pipe_idx >= 0) && (pipe_idx < PI_MAX_PIPES));
 
index f3200cbdd7dc15dee55eac53b8a31dcc1c2a141f..cafef5ab7fdaddf3a0f24f9eae29c722ec666ec5 100644 (file)
@@ -251,9 +251,10 @@ static NTSTATUS get_md4pw(char *md4pw, char *mach_acct, uint16 sec_chan_type)
                return NT_STATUS_ACCOUNT_DISABLED;
        }
 
-       if (!(acct_ctrl & ACB_SVRTRUST) ||
-           !(acct_ctrl & ACB_WSTRUST) ||
-           !(acct_ctrl & ACB_DOMTRUST)) {
+       if (!(acct_ctrl & ACB_SVRTRUST) &&
+           !(acct_ctrl & ACB_WSTRUST) &&
+           !(acct_ctrl & ACB_DOMTRUST)) 
+       {
                DEBUG(0,("get_md4pw: Workstation %s: account is not a trust account\n", mach_acct));
                TALLOC_FREE(sampass);
                return NT_STATUS_NO_TRUST_SAM_ACCOUNT;