s3-rpc_server: Provide hooks required for JSON message logging for the no-auth case
authorAndrew Bartlett <abartlet@samba.org>
Mon, 13 Mar 2017 22:01:54 +0000 (11:01 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 29 Mar 2017 00:37:28 +0000 (02:37 +0200)
This is triggered in the ncacn_np pass-though case in particular

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
selftest/knownfail
source3/rpc_server/srv_pipe.c

index 707f0e5bba58671d12cdea344b625719af55cc12..e85a8a669075b77f51313c81e7da939eae975b9e 100644 (file)
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_rpc_ncacn_np_krb_dns_smb2
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_rpc_ncacn_np_krb_srv
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_rpc_ncacn_np_krb_srv_sign
-^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_rpc_ncacn_np_ntlm_srv\(ad_dc:local\)
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_smb\(
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_smb_bad_password
 ^samba.tests.auth_log.samba.tests.auth_log.AuthLogTests.test_smb_bad_user
index 95e2cebee8b232e7aaff0a0b5dff9d044a4c583f..251f8991a600c53e4ca7778fbe08ac2b75b39fea 100644 (file)
@@ -822,6 +822,8 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
                        goto err_exit;
                }
        } else {
+               TALLOC_CTX *frame = talloc_stackframe();
+               struct auth4_context *auth4_context;
                const char *transport_protection = AUTHZ_TRANSPORT_PROTECTION_NONE;
                if (p->transport == NCACN_NP) {
                        transport_protection = AUTHZ_TRANSPORT_PROTECTION_SMB;
@@ -831,18 +833,27 @@ static bool api_pipe_bind_req(struct pipes_struct *p,
                p->auth.auth_level = DCERPC_AUTH_LEVEL_NONE;
                p->auth.auth_context_id = 0;
 
+               status = make_auth4_context(frame, &auth4_context);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(0, ("Unable to make auth context for authz log.\n"));
+                       TALLOC_FREE(frame);
+                       goto err_exit;
+               }
+
                /*
                 * Log the authorization to this RPC interface.  This
                 * covered ncacn_np pass-through auth, and anonymous
                 * DCE/RPC (eg epmapper, netlogon etc)
                 */
-               log_successful_authz_event(NULL, NULL,
+               log_successful_authz_event(auth4_context->msg_ctx,
+                                          auth4_context->lp_ctx,
                                           p->remote_address,
                                           p->local_address,
                                           table->name,
                                           derpc_transport_string_by_transport(p->transport),
                                           transport_protection,
                                           p->session_info);
+               TALLOC_FREE(frame);
        }
 
        ZERO_STRUCT(u.bind_ack);