]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpcclient: Remove unused global domain sid
authorVolker Lendecke <vl@samba.org>
Sat, 28 Sep 2019 02:24:18 +0000 (19:24 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 3 Oct 2019 17:59:13 +0000 (17:59 +0000)
For the auth_log tests using rpcclient this means one message less

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct  3 17:59:13 UTC 2019 on sn-devel-184

python/samba/tests/auth_log.py
source3/rpcclient/rpcclient.c

index daf088f2f32dd916702126d97e7f46a01b47d9be..06fb841a62bdf97da55e2d77d073ba38c6429a69 100644 (file)
@@ -1129,7 +1129,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_interactive_bad_password(self):
@@ -1162,7 +1162,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_interactive_bad_user(self):
@@ -1195,7 +1195,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network(self):
@@ -1226,7 +1226,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network_bad_password(self):
@@ -1258,7 +1258,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network_bad_user(self):
@@ -1290,7 +1290,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network_mschap(self):
@@ -1323,7 +1323,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network_mschap_bad_password(self):
@@ -1357,7 +1357,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_network_mschap_bad_user(self):
@@ -1391,7 +1391,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
     def test_samlogon_schannel_seal(self):
@@ -1422,7 +1422,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
         # Check the second to last message it should be an Authorization
@@ -1465,7 +1465,7 @@ class AuthLogTests(samba.tests.auth_log_base.AuthLogTestBase):
         messages = self.remove_netlogon_messages(messages)
         received = len(messages)
         self.assertIs(True,
-                      (received == 5 or received == 6),
+                      (received == 4 or received == 5),
                       "Did not receive the expected number of messages")
 
         # Check the second to last message it should be an Authorization
index 0ef41433314fb35d362df7a1eeaeaa57f4f7f93d..9d4f16531c2574e5190d32fcb24e48bcce9475ad 100644 (file)
@@ -44,8 +44,6 @@ enum pipe_auth_type_spnego {
        PIPE_AUTH_TYPE_SPNEGO_KRB5
 };
 
-struct dom_sid domain_sid;
-
 static enum dcerpc_AuthType pipe_default_auth_type = DCERPC_AUTH_TYPE_NONE;
 static enum pipe_auth_type_spnego pipe_default_auth_spnego_type = 0;
 static enum dcerpc_AuthLevel pipe_default_auth_level = DCERPC_AUTH_LEVEL_NONE;
@@ -154,74 +152,6 @@ static char *next_command (char **cmdstr)
        return command;
 }
 
-/* Fetch the SID for this computer */
-
-static void fetch_machine_sid(struct cli_state *cli)
-{
-       struct policy_handle pol;
-       NTSTATUS result = NT_STATUS_OK, status;
-       static bool got_domain_sid;
-       TALLOC_CTX *mem_ctx;
-       struct rpc_pipe_client *lsapipe = NULL;
-       union lsa_PolicyInformation *info = NULL;
-       struct dcerpc_binding_handle *b;
-
-       if (got_domain_sid) return;
-
-       if (!(mem_ctx=talloc_init("fetch_machine_sid"))) {
-               DEBUG(0,("fetch_machine_sid: talloc_init returned NULL!\n"));
-               goto error;
-       }
-
-       result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc,
-                                         &lsapipe);
-       if (!NT_STATUS_IS_OK(result)) {
-               fprintf(stderr, "could not initialise lsa pipe. Error was %s\n", nt_errstr(result) );
-               goto error;
-       }
-
-       b = lsapipe->binding_handle;
-
-       result = rpccli_lsa_open_policy(lsapipe, mem_ctx, True, 
-                                    SEC_FLAG_MAXIMUM_ALLOWED,
-                                    &pol);
-       if (!NT_STATUS_IS_OK(result)) {
-               goto error;
-       }
-
-       status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
-                                           &pol,
-                                           LSA_POLICY_INFO_ACCOUNT_DOMAIN,
-                                           &info,
-                                           &result);
-       if (!NT_STATUS_IS_OK(status)) {
-               result = status;
-               goto error;
-       }
-       if (!NT_STATUS_IS_OK(result)) {
-               goto error;
-       }
-
-       got_domain_sid = True;
-       sid_copy(&domain_sid, info->account_domain.sid);
-
-       dcerpc_lsa_Close(b, mem_ctx, &pol, &result);
-       TALLOC_FREE(lsapipe);
-       talloc_destroy(mem_ctx);
-
-       return;
-
- error:
-
-       if (lsapipe) {
-               TALLOC_FREE(lsapipe);
-       }
-
-       fprintf(stderr, "could not obtain sid from server\n");
-
-       return;
-}
-
 /* List the available commands on a given pipe */
 
 static NTSTATUS cmd_listcommands(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
@@ -1330,8 +1260,6 @@ out_free:
 
        default_transport = dcerpc_binding_get_transport(binding);
 
-       fetch_machine_sid(cli);
-
        /* Do anything specified with -c */
         if (cmdstr && cmdstr[0]) {
                 char    *cmd;