s3:rpc_client fix a crash
authorChristian Ambach <ambi@samba.org>
Wed, 20 Feb 2013 15:59:05 +0000 (16:59 +0100)
committerChristian Ambach <ambi@samba.org>
Wed, 20 Feb 2013 18:00:52 +0000 (19:00 +0100)
state->cli->dc does not have to be set (e.g. when running
net rpc join against an older Samba PDC), so check it before dereferencing it

This fixes Bug 9669 - net rpc join crashes against a Samba 3.0.33 PDC

Bug: https://bugzilla.samba.org/show_bug.cgi?id=9669

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Wed Feb 20 19:00:52 CET 2013 on sn-devel-104

source3/rpc_client/cli_pipe.c

index 2743a07ebfd711b9e1ef2dd5aafd4760a3a6254f..2e978efb8d9ff2d676097f3925358fcc994d3c78 100644 (file)
@@ -1805,7 +1805,7 @@ static void rpc_pipe_bind_step_two_done(struct tevent_req *subreq)
        status = dcerpc_netr_LogonGetCapabilities_r_recv(subreq, talloc_tos());
        TALLOC_FREE(subreq);
        if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROCNUM_OUT_OF_RANGE)) {
-               if (state->cli->dc->negotiate_flags &
+               if (state->cli->dc && state->cli->dc->negotiate_flags &
                    NETLOGON_NEG_SUPPORTS_AES) {
                        DEBUG(5, ("AES is not supported and the error was %s\n",
                                  nt_errstr(status)));