- fixed a bunch of warnings and minor errors
authorAndrew Tridgell <tridge@samba.org>
Thu, 8 Oct 1998 06:21:33 +0000 (06:21 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 8 Oct 1998 06:21:33 +0000 (06:21 +0000)
- got smbtorture to compile
- removed %D from some of lukes code - Luke, what is %D? it ain't
  portable anyway
(This used to be commit 91597c12fb593f49b23c7cea5b64dbb89a0428b3)

source3/include/proto.h
source3/libsmb/clientgen.c
source3/libsmb/namequery.c
source3/rpcclient/cmd_srvsvc.c
source3/smbd/dir.c
source3/smbd/files.c
source3/smbd/pipes.c
source3/smbwrapper/smbw.c
source3/utils/torture.c

index 062fe3526489086cb03a918caecf4577a74f82d7..1c31c1076bc4f5aaed9ceccc26c92f39b47cf787 100644 (file)
@@ -454,7 +454,7 @@ FILE *startlmhosts(char *fname);
 BOOL getlmhostsent( FILE *fp, char *name, int *name_type, struct in_addr *ipaddr);
 void endlmhosts(FILE *fp);
 BOOL resolve_name(char *name, struct in_addr *return_ip, int name_type);
-BOOL find_master(char *group, struct in_addr *master_ip);
+BOOL find_master_ip(char *group, struct in_addr *master_ip);
 
 /*The following definitions come from  libsmb/nmblib.c  */
 
index 657523b3bebd067ee54eaf7a2d1093e83a5f68ab..d454cbdd3cf16db97f15c58e8e1bb8d31c51b849 100644 (file)
@@ -621,7 +621,7 @@ prots[] =
 
 
 /****************************************************************************
-send a session setup
+send a session setup 
 ****************************************************************************/
 BOOL cli_session_setup(struct cli_state *cli, 
                       char *user, 
index 22fb59a27d9f057aa0e12d03dbfcabecdb1fdf15..500618bd8a6e0d5b67a08c3dfab8c284b4752320 100644 (file)
@@ -631,7 +631,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip, int name_type)
 /********************************************************
 find the IP address of the master browser or DMB for a workgroup
 *********************************************************/
-BOOL find_master(char *group, struct in_addr *master_ip)
+BOOL find_master_ip(char *group, struct in_addr *master_ip)
 {
        if (resolve_name(group, master_ip, 0x1D)) return True;
 
index 063174a1d1c845d40273d28d234607a9e535b200..4d4fb791a9254a23dfa0b9b812f8807408a4e02c 100644 (file)
@@ -61,8 +61,8 @@ void cmd_srv_query_info(struct client_info *info)
                info_level = strtoul(tmp, (char**)NULL, 10);
        }
 
-       DEBUG(4,("cmd_srv_query_info: server:%s info level: %D\n",
-                               dest_srv, info_level));
+       DEBUG(4,("cmd_srv_query_info: server:%s info level: %d\n",
+                               dest_srv, (int)info_level));
 
        DEBUG(5, ("cmd_srv_query_info: smb_cli->fd:%d\n", smb_cli->fd));
 
@@ -119,8 +119,8 @@ void cmd_srv_enum_conn(struct client_info *info)
                info_level = strtoul(tmp, (char**)NULL, 10);
        }
 
-       DEBUG(4,("cmd_srv_enum_conn: server:%s info level: %D\n",
-                               dest_srv, info_level));
+       DEBUG(4,("cmd_srv_enum_conn: server:%s info level: %d\n",
+                               dest_srv, (int)info_level));
 
        DEBUG(5, ("cmd_srv_enum_conn: smb_cli->fd:%d\n", smb_cli->fd));
 
@@ -179,8 +179,8 @@ void cmd_srv_enum_shares(struct client_info *info)
                info_level = strtoul(tmp, (char**)NULL, 10);
        }
 
-       DEBUG(4,("cmd_srv_enum_shares: server:%s info level: %D\n",
-                               dest_srv, info_level));
+       DEBUG(4,("cmd_srv_enum_shares: server:%s info level: %d\n",
+                               dest_srv, (int)info_level));
 
        DEBUG(5, ("cmd_srv_enum_shares: smb_cli->fd:%d\n", smb_cli->fd));
 
@@ -239,8 +239,8 @@ void cmd_srv_enum_sess(struct client_info *info)
                info_level = strtoul(tmp, (char**)NULL, 10);
        }
 
-       DEBUG(4,("cmd_srv_enum_sess: server:%s info level: %D\n",
-                               dest_srv, info_level));
+       DEBUG(4,("cmd_srv_enum_sess: server:%s info level: %d\n",
+                               dest_srv, (int)info_level));
 
        DEBUG(5, ("cmd_srv_enum_sess: smb_cli->fd:%d\n", smb_cli->fd));
 
@@ -291,8 +291,8 @@ void cmd_srv_enum_files(struct client_info *info)
                info_level = strtoul(tmp, (char**)NULL, 10);
        }
 
-       DEBUG(4,("cmd_srv_enum_files: server:%s info level: %D\n",
-                               dest_srv, info_level));
+       DEBUG(4,("cmd_srv_enum_files: server:%s info level: %d\n",
+                               dest_srv, (int)info_level));
 
        DEBUG(5, ("cmd_srv_enum_files: smb_cli->fd:%d\n", smb_cli->fd));
 
index da907b27a20eefe52b86d347e93bcbc8f3f8caaf..4b1a58016c0e39e2de4f392ae4c705316cd6107d 100644 (file)
@@ -356,7 +356,7 @@ BOOL dptr_fill(char *buf1,unsigned int key)
   }
   offset = TellDir(p);
   DEBUG(6,("fill on key %ld dirptr 0x%x now at %d\n",key,
-          (long)p,offset));
+          (long)p,(int)offset));
   buf[0] = key;
   SIVAL(buf,1,offset | DPTR_MASK);
   return(True);
index 6afa0597535ba18416078361eab58d662be76863..4030ad4c498ea59b08e17c7a9a00c7c506f4500d 100644 (file)
@@ -202,7 +202,7 @@ initialise file structures
 
 void file_init(void)
 {
-       int real_max_open_files, lim;
+       int lim;
 
        lim = set_maxfiles();
        lim = MIN(lim, lp_max_open_files());
index 65da9337b2e7096300b93410113e9dc413f0931e..3e10065711dea0da32f2c2aaa06020136b0e9a06 100644 (file)
@@ -116,7 +116,6 @@ int reply_pipe_write_and_X(char *inbuf,char *outbuf,int length,int bufsize)
        pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv2);
        uint32 smb_offs = IVAL(inbuf,smb_vwv3);
        size_t numtowrite = SVAL(inbuf,smb_vwv10);
-       BOOL write_through = BITSETW(inbuf+smb_vwv7, 0);
        int nwritten = -1;
        int smb_doff = SVAL(inbuf, smb_vwv11);
        char *data;
index 9a22854ae3cc07321dc3e41c17cbf88bf0eaa854..f84623d3df0de8298593a11d565818a0c3928de7 100644 (file)
@@ -398,7 +398,7 @@ struct smbw_server *smbw_server(char *server, char *share)
                fstrcpy(group, server_n);
                p = strchr(group,'#');
                *p = 0;
-               if (!find_master(group, &ip)) {
+               if (!find_master_ip(group, &ip)) {
                        errno = ENOENT;
                        return NULL;
                }
index b49ad61263796c2b8decc666d9596660fd39f8a5..94c94966df49f0d84bc600a503e167c2e5f828ab 100644 (file)
@@ -45,12 +45,17 @@ static double end_timer(void)
 
 static BOOL open_connection(struct cli_state *c)
 {
+       struct nmb_name called, calling;
+
        if (!cli_initialise(c) || !cli_connect(c, host, NULL)) {
                printf("Failed to connect with %s\n", host);
                return False;
        }
 
-       if (!cli_session_request(c, host, 0x20, myname)) {
+       make_nmb_name(&calling, myname, 0x0, "");
+       make_nmb_name(&called , host, 0x20, "");
+
+       if (!cli_session_request(c, &calling, &called)) {
                printf("%s rejected the session\n",host);
                cli_shutdown(c);
                return False;
@@ -94,16 +99,30 @@ static void close_connection(struct cli_state *c)
 }
 
 
+/* check if the server produced the expected error code */
+static BOOL check_error(struct cli_state *c, 
+                       uint8 eclass, uint32 ecode, uint32 nterr)
+{
+       uint8 class;
+       uint32 num;
+       int eno;
+       eno = cli_error(c, &eclass, &num);
+       if ((eclass != class || ecode != num) &&
+           num != (nterr&0xFFFFFF)) {
+               printf("unexpected error code class=%d code=%d\n", 
+                        (int)class, (int)num);
+               printf(" expected %d/%d %d\n", 
+                      (int)eclass, (int)ecode, (int)nterr);
+               return False;
+       }
+       return True;
+}
+
+
 static BOOL wait_lock(struct cli_state *c, int fnum, uint32 offset, uint32 len)
 {
        while (!cli_lock(c, fnum, offset, len, -1)) {
-               int eclass, num;
-               cli_error(c, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("lock failed (%s)\n", 
-                              cli_errstr(c));
-                       return False;
-               }
+               if (!check_error(c, ERRDOS, ERRlock, 0)) return False;
        }
        return True;
 }
@@ -272,13 +291,7 @@ static void run_locktest1(void)
                printf("lock2 succeeded! This is a locking bug\n");
                return;
        } else {
-               int eclass, num;
-               cli_error(&cli2, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("error should have been ERRDOS/ERRlock (%s)\n", 
-                              cli_errstr(&cli2));
-                       return;
-               }
+               if (!check_error(&cli2, ERRDOS, ERRlock, 0)) return;
        }
 
 
@@ -288,13 +301,7 @@ static void run_locktest1(void)
                printf("lock3 succeeded! This is a locking bug\n");
                return;
        } else {
-               int eclass, num;
-               cli_error(&cli2, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("error should have been ERRDOS/ERRlock (%s)\n", 
-                              cli_errstr(&cli2));
-                       return;
-               }
+               if (!check_error(&cli2, ERRDOS, ERRlock, 0)) return;
        }
        t2 = time(NULL);
 
@@ -311,13 +318,7 @@ static void run_locktest1(void)
                printf("lock4 succeeded! This is a locking bug\n");
                return;
        } else {
-               int eclass, num;
-               cli_error(&cli2, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("error should have been ERRDOS/ERRlock (%s)\n", 
-                              cli_errstr(&cli2));
-                       return;
-               }
+               if (!check_error(&cli2, ERRDOS, ERRlock, 0)) return;
        }
 
        if (!cli_close(&cli1, fnum1)) {
@@ -402,13 +403,7 @@ static void run_locktest2(void)
        if (cli_lock(&cli, fnum2, 0, 4, 0)) {
                printf("lock2 succeeded! This is a locking bug\n");
        } else {
-               int eclass, num;
-               cli_error(&cli, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("error should have been ERRDOS/ERRlock (%s)\n", 
-                              cli_errstr(&cli));
-                       return;
-               }
+               if (!check_error(&cli, ERRDOS, ERRlock, 0)) return;
        }
 
        cli_setpid(&cli, 2);
@@ -420,13 +415,7 @@ static void run_locktest2(void)
        if (cli_lock(&cli, fnum3, 0, 4, 0)) {
                printf("lock3 succeeded! This is a locking bug\n");
        } else {
-               int eclass, num;
-               cli_error(&cli, &eclass, &num);
-               if (eclass != ERRDOS || num != ERRlock) {
-                       printf("error should have been ERRDOS/ERRlock (%s)\n", 
-                              cli_errstr(&cli));
-                       return;
-               }
+               if (!check_error(&cli, ERRDOS, ERRlock, 0)) return;
        }
 
        cli_setpid(&cli, 1);
@@ -625,12 +614,6 @@ static void run_randomipc(void)
        pstring param;
        int api, param_len, i;
        static struct cli_state cli;
-       struct {
-               int api, level;
-               char *format;
-               char *subformat;
-               int len;
-       } foo;
 
        printf("starting random ipc test\n");
 
@@ -660,7 +643,8 @@ static void run_randomipc(void)
 
 
 
-static void browse_callback(char *sname, uint32 stype, char *comment)
+static void browse_callback(const char *sname, uint32 stype, 
+                           const char *comment)
 {
        printf("\t%20.20s %08x %s\n", sname, stype, comment);
 }
@@ -809,7 +793,7 @@ static void run_trans2test(void)
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
        cli_close(&cli, fnum);
        if (!cli_qpathinfo2(&cli, fname, &c_time, &a_time, &m_time, 
-                           &w_time, &size, NULL, NULL)) {
+                           &w_time, &size, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        } else {
                if (w_time < 60*60*24*2) {
@@ -828,7 +812,7 @@ static void run_trans2test(void)
        }
        sleep(3);
        if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time, 
-                           &w_time, &size, NULL, NULL)) {
+                           &w_time, &size, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        }
 
@@ -837,7 +821,7 @@ static void run_trans2test(void)
        cli_write(&cli, fnum,  (char *)&fnum, 0, sizeof(fnum));
        cli_close(&cli, fnum);
        if (!cli_qpathinfo2(&cli, "\\trans2\\", &c_time, &a_time, &m_time2, 
-                           &w_time, &size, NULL, NULL)) {
+                           &w_time, &size, NULL)) {
                printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(&cli));
        } else {
                if (m_time2 == m_time)