s3:locktest2: use cli_session_creds_init() directly
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Nov 2019 15:14:38 +0000 (16:14 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 28 May 2020 06:43:39 +0000 (06:43 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/torture/locktest2.c

index 84fdddbf93c19cc1534bc954d4bb79af74b66045..84c335f959f8d609cad30bc27fde76ac2c89d728 100644 (file)
@@ -177,6 +177,11 @@ static struct cli_state *connect_one(char *share)
        fstring myname;
        static int count;
        NTSTATUS nt_status;
+       bool use_kerberos = false;
+       bool fallback_after_kerberos = false;
+       bool use_ccache = false;
+       bool pw_nt_hash = false;
+       struct cli_credentials *creds = NULL;
 
        fstrcpy(server,share+2);
        share = strchr_m(server,'\\');
@@ -196,12 +201,25 @@ static struct cli_state *connect_one(char *share)
                }
        }
 
-       slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++);
+       creds = cli_session_creds_init(NULL,
+                                      username,
+                                      lp_workgroup(),
+                                      NULL, /* realm (use default) */
+                                      password,
+                                      use_kerberos,
+                                      fallback_after_kerberos,
+                                      use_ccache,
+                                      pw_nt_hash);
+       if (creds == NULL) {
+               DEBUG(0, ("cli_session_creds_init failed\n"));
+               return NULL;
+       }
 
-       nt_status = cli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
-                                       username, lp_workgroup(), password, 0,
-                                       SMB_SIGNING_DEFAULT);
+       slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++);
 
+       nt_status = cli_full_connection_creds(&c, myname, server_n, NULL, 0, share, "?????",
+                                             creds, 0, SMB_SIGNING_DEFAULT);
+       TALLOC_FREE(creds);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("cli_full_connection failed with error %s\n", nt_errstr(nt_status)));
                return NULL;