r16741: add a RPC-LSA-GETUSER test,
authorStefan Metzmacher <metze@samba.org>
Sat, 1 Jul 2006 14:41:01 +0000 (14:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:09:43 +0000 (14:09 -0500)
which is very useful for analysing a windows machine remotely

with this I found that vista-beta2 doesn't have an 'administrator' account
and mapps any not known user to MACHINENAME\Guest

metze
(This used to be commit 97ae93627527f65b6ecded9884a26d4cffa1409d)

source4/torture/rpc/lsa.c
source4/torture/rpc/rpc.c

index 28b3b615bac84785adea0a14cbef819b5244b8b2..24f7bbbd01c543f8b74c8f99dd51038c8433c807 100644 (file)
@@ -1755,9 +1755,7 @@ static BOOL test_QueryInfoPolicy2(struct dcerpc_pipe *p,
        return ret;
 }
 
-static BOOL test_GetUserName(struct dcerpc_pipe *p, 
-                                 TALLOC_CTX *mem_ctx, 
-                                 struct policy_handle *handle)
+static BOOL test_GetUserName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
        struct lsa_GetUserName r;
        NTSTATUS status;
@@ -1766,8 +1764,8 @@ static BOOL test_GetUserName(struct dcerpc_pipe *p,
 
        printf("\nTesting GetUserName\n");
 
-       r.in.system_name = "\\";        
-       r.in.account_name = NULL;       
+       r.in.system_name = "\\";
+       r.in.account_name = NULL;
        r.in.authority_name = &authority_name_p;
        authority_name_p.string = NULL;
 
@@ -1873,10 +1871,6 @@ BOOL torture_rpc_lsa(struct torture_context *torture)
                        ret = False;
                }
                
-               if (!test_GetUserName(p, mem_ctx, handle)) {
-                       ret = False;
-               }
-               
 #if 0
                if (!test_Delete(p, mem_ctx, handle)) {
                        ret = False;
@@ -1895,6 +1889,34 @@ BOOL torture_rpc_lsa(struct torture_context *torture)
                        ret = False;
                }
        }
+
+       if (!test_GetUserName(p, mem_ctx)) {
+               ret = False;
+       }
+               
+       talloc_free(mem_ctx);
+
+       return ret;
+}
+
+BOOL torture_rpc_lsa_get_user(struct torture_context *torture)
+{
+        NTSTATUS status;
+        struct dcerpc_pipe *p;
+       TALLOC_CTX *mem_ctx;
+       BOOL ret = True;
+
+       mem_ctx = talloc_init("torture_rpc_lsa_get_user");
+
+       status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_lsarpc);
+       if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(mem_ctx);
+               return False;
+       }
+
+       if (!test_GetUserName(p, mem_ctx)) {
+               ret = False;
+       }
                
        talloc_free(mem_ctx);
 
index 58a880f8e498019d303683560751e6ea56184b5e..8d33560d65247b6347f2ae3cbad6260ae2f3ea34 100644 (file)
@@ -97,6 +97,7 @@ NTSTATUS torture_rpc_init(void)
 
        register_torture_op("RPC-LSA", torture_rpc_lsa);
        register_torture_op("RPC-LSALOOKUP", torture_rpc_lsa_lookup);
+       register_torture_op("RPC-LSA-GETUSER", torture_rpc_lsa_get_user);
        register_torture_op("RPC-SECRETS", torture_rpc_lsa_secrets);
        register_torture_op("RPC-ECHO", torture_rpc_echo);
        register_torture_op("RPC-DFS", torture_rpc_dfs);