summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-08 06:21:33 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-08 06:21:33 +0000
commit788263ba2f749c5bb1546ca6c9363fd508e94280 (patch)
treef5b278f2db2295ad17ec2c0ac824ce52c809cb2c
parent60877fdd8d19015214396de02f62b5ff999199f3 (diff)
downloadsamba-788263ba2f749c5bb1546ca6c9363fd508e94280.tar.gz
samba-788263ba2f749c5bb1546ca6c9363fd508e94280.tar.xz
samba-788263ba2f749c5bb1546ca6c9363fd508e94280.zip
- fixed a bunch of warnings and minor errors
- 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)
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/libsmb/clientgen.c2
-rw-r--r--source3/libsmb/namequery.c2
-rw-r--r--source3/rpcclient/cmd_srvsvc.c20
-rw-r--r--source3/smbd/dir.c2
-rw-r--r--source3/smbd/files.c2
-rw-r--r--source3/smbd/pipes.c1
-rw-r--r--source3/smbwrapper/smbw.c2
-rw-r--r--source3/utils/torture.c90
9 files changed, 53 insertions, 70 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 062fe352648..1c31c1076bc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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 */
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 657523b3beb..d454cbdd3cf 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -621,7 +621,7 @@ prots[] =
/****************************************************************************
-send a session setup
+send a session setup
****************************************************************************/
BOOL cli_session_setup(struct cli_state *cli,
char *user,
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 22fb59a27d9..500618bd8a6 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -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;
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 063174a1d1c..4d4fb791a92 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -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));
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index da907b27a20..4b1a58016c0 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -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);
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 6afa0597535..4030ad4c498 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -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());
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 65da9337b2e..3e10065711d 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -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;
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index 9a22854ae3c..f84623d3df0 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -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;
}
diff --git a/source3/utils/torture.c b/source3/utils/torture.c
index b49ad612637..94c94966df4 100644
--- a/source3/utils/torture.c
+++ b/source3/utils/torture.c
@@ -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)