r14720: Add torture_context argument to all torture tests
[kamenim/samba.git] / source4 / torture / rpc / netlogon.c
index bdeda0561382fc34a9834bb763e8d4ebafa5a71a..b66ea719cc6612409a3d91b919566f24685b1b28 100644 (file)
 #include "torture/torture.h"
 #include "lib/events/events.h"
 #include "auth/auth.h"
+#include "smb.h"
 #include "lib/cmdline/popt_common.h"
+#include "torture/rpc/rpc.h"
+#include "libcli/auth/libcli_auth.h"
+#include "librpc/gen_ndr/ndr_netlogon_c.h"
+#include "librpc/gen_ndr/ndr_lsa_c.h"
 
 static const char *machine_password;
 
@@ -537,7 +542,7 @@ BOOL test_netlogon_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        ninfo.identity_info.workstation.string = cli_credentials_get_workstation(credentials);
 
        r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
-       r.in.workstation = cli_credentials_get_workstation(credentials);
+       r.in.computer_name = cli_credentials_get_workstation(credentials);
        r.in.credential = &auth;
        r.in.return_authenticator = &auth2;
        r.in.logon_level = 2;
@@ -562,7 +567,6 @@ BOOL test_netlogon_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                        printf("Credential chaining failed\n");
                        ret = False;
                }
-               
        }
 
        r.in.credential = NULL;
@@ -571,7 +575,7 @@ BOOL test_netlogon_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
                r.in.validation_level = i;
 
-               printf("Testing SamLogon with validation level %d\n", i);
+               printf("Testing SamLogon with validation level %d and a NULL credential\n", i);
 
                status = dcerpc_netr_LogonSamLogon(p, mem_ctx, &r);
                if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
@@ -1403,7 +1407,6 @@ static BOOL test_GetDomainInfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 static BOOL test_ManyGetDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
        NTSTATUS status;
-       struct dcerpc_binding *b;
        struct dcerpc_pipe *p2;
        struct lsa_ObjectAttribute attr;
        struct lsa_QosInfo qos;
@@ -1424,13 +1427,7 @@ static BOOL test_ManyGetDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 
        printf("Torturing GetDCName\n");
 
-       status = dcerpc_parse_binding(mem_ctx, p->conn->binding_string, &b);
-       if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to parse dcerpc binding '%s'\n", p->conn->binding_string);
-               return False;
-       }
-
-       status = dcerpc_secondary_connection(p, &p2, b);
+       status = dcerpc_secondary_connection(p, &p2, p->binding);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to create secondary connection\n");
                return False;
@@ -1504,7 +1501,7 @@ static BOOL test_ManyGetDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 }
 
 
-BOOL torture_rpc_netlogon(void)
+BOOL torture_rpc_netlogon(struct torture_context *torture)
 {
         NTSTATUS status;
         struct dcerpc_pipe *p;