diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/torture/locktest.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/torture/locktest.c')
-rw-r--r-- | source3/torture/locktest.c | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index d52a8de460..d27eb5fa54 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "libsmb/libsmb.h" #include "system/filesys.h" #include "locking/proto.h" #include "libsmb/nmblib.h" @@ -163,10 +164,8 @@ return a connection to a server static struct cli_state *connect_one(char *share, int snum) { struct cli_state *c; - struct nmb_name called, calling; char *server_n; fstring server; - struct sockaddr_storage ss; fstring myname; static int count; NTSTATUS status; @@ -179,42 +178,20 @@ static struct cli_state *connect_one(char *share, int snum) server_n = server; - zero_sockaddr(&ss); - slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); - make_nmb_name(&calling, myname, 0x0); - make_nmb_name(&called , server, 0x20); - - again: - zero_sockaddr(&ss); - /* have to open a new connection */ - if (!(c=cli_initialise())) { - DEBUG(0,("Connection to %s failed\n", server_n)); - return NULL; - } - status = cli_connect(c, server_n, &ss); + status = cli_connect_nb(server_n, NULL, 0, 0x20, myname, Undefined, + &c); if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Connection to %s failed. Error %s\n", server_n, nt_errstr(status) )); + DEBUG(0, ("Connection to %s failed. Error %s\n", server_n, + nt_errstr(status))); return NULL; } c->use_kerberos = use_kerberos; - if (!cli_session_request(c, &calling, &called)) { - DEBUG(0,("session request to %s failed\n", called.name)); - cli_shutdown(c); - if (strcmp(called.name, "*SMBSERVER")) { - make_nmb_name(&called , "*SMBSERVER", 0x20); - goto again; - } - return NULL; - } - - DEBUG(4,(" session request ok\n")); - status = cli_negprot(c); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("protocol negotiation failed: %s\n", @@ -232,8 +209,8 @@ static struct cli_state *connect_one(char *share, int snum) } if (got_pass == 1) { - fstrcpy(password[1], password[0]); - fstrcpy(username[1], username[0]); + strlcpy(password[1], password[0],sizeof(password[1])); + strlcpy(username[1], username[0],sizeof(username[1])); } status = cli_session_setup(c, username[snum], @@ -400,7 +377,7 @@ static void close_files(struct cli_state *cli[NSERVERS][NCONNECTIONS], } } for (server=0;server<NSERVERS;server++) { - cli_unlink(cli[server][0], FILENAME, aSYSTEM | aHIDDEN); + cli_unlink(cli[server][0], FILENAME, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); } } |