r6799: Remove a rudundent variable from the context structure - we can figure
[samba.git] / source / torture / locktest2.c
index 63f71f2004557732bfd3111d0377c1c95f8f4d18..3eb3398bd17920feb671f9f1d92bd19fcff47cf8 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "system/passwd.h"
 
 static fstring password;
 static fstring username;
@@ -133,17 +134,6 @@ static BOOL try_unlock(struct smbcli_state *c, int fstype,
        return False;
 }      
 
-static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid, 
-                     enum brl_type lock_type,
-                     br_off start, br_off size)
-{
-       printf("%6d   %05x:%05x    %s  %.0f:%.0f(%.0f)\n", 
-              (int)pid, (int)dev, (int)ino, 
-              lock_type==READ_LOCK?"R":"W",
-              (double)start, (double)start+size-1,(double)size);
-
-}
-
 /***************************************************** 
 return a connection to a server
 *******************************************************/
@@ -173,10 +163,9 @@ static struct smbcli_state *connect_one(char *share)
 
        slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
 
-       nt_status = smbcli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
-                                       username, lp_workgroup(), password, 0,
-                                       NULL);
-
+       nt_status = smbcli_full_connection(NULL, 
+                                          &c, myname, server_n, 0, share, NULL,
+                                          username, lp_workgroup(), password);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
                return NULL;
@@ -255,7 +244,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                               op==READ_LOCK?"READ_LOCK":"WRITE_LOCK",
                               ret[0], ret[1]);
                }
-               if (showall) brl_forall(print_brl);
                if (ret[0] != ret[1]) return False;
        } else if (r2 < LOCK_PCT+UNLOCK_PCT) {
                /* unset a lock */
@@ -270,7 +258,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                               start, start+len-1, len,
                               ret[0], ret[1]);
                }
-               if (showall) brl_forall(print_brl);
                if (!hide_unlock_fails && ret[0] != ret[1]) return False;
        } else {
                /* reopen the file */
@@ -286,7 +273,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                if (showall) {
                        printf("reopen conn=%u fstype=%u f=%u\n",
                               conn, fstype, f);
-                       brl_forall(print_brl);
                }
        }
        return True;
@@ -371,7 +357,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
        ZERO_STRUCT(fnum);
        ZERO_STRUCT(cli);
 
-       recorded = (struct record *)malloc(sizeof(*recorded) * numops);
+       recorded = malloc_array_p(struct record, numops);
 
        for (n=0; n<numops; n++) {
                recorded[n].conn = random() % NCONNECTIONS;