summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-21 09:39:08 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-21 09:39:08 +0000
commit60328722098bf291664a8a63a245b35cb96fae28 (patch)
treed2a60526f279ac9782a353519b56d892f2c8e6d7
parent0891bb6a910841455162876be09a92107cd9df00 (diff)
downloadsamba-60328722098bf291664a8a63a245b35cb96fae28.tar.gz
samba-60328722098bf291664a8a63a245b35cb96fae28.tar.bz2
samba-60328722098bf291664a8a63a245b35cb96fae28.zip
some cleanups in the clientutil.c code.
I'm actually hoping to remove this module completely once we convert nmbd to using the new (much cleaner) clientgen.c smbclient now also reports if it connects as a guest user (This used to be commit 3af8d855facfc436cb4b64fa58aca8c056a5348e)
-rw-r--r--source3/client/client.c13
-rw-r--r--source3/client/clientutil.c65
2 files changed, 46 insertions, 32 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 98c7714691..7abdfc886c 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3413,6 +3413,13 @@ static BOOL send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setu
uid = SVAL(inbuf,smb_uid);
}
+ if (SVAL(inbuf, smb_vwv2) & 1)
+ DEBUG(1,("connected as guest "));
+ if (sec_mode & 1)
+ DEBUG(1,("security=user\n"));
+ else
+ DEBUG(1,("security=share\n"));
+
/* now we've got a connection - send a tcon message */
bzero(outbuf,smb_size);
@@ -3520,6 +3527,7 @@ static BOOL send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setu
free(inbuf);
free(outbuf);
}
+
return True;
}
@@ -3693,6 +3701,7 @@ static BOOL send_trans_request(char *outbuf,int trans,
return(True);
}
+
/****************************************************************************
try and browse available connections on a host
****************************************************************************/
@@ -4118,7 +4127,7 @@ static BOOL open_sockets(int port )
strcpy(desthost,host);
}
- if (*myname == 0) {
+ if (!(*myname)) {
get_myname(myname,NULL);
}
strupper(myname);
@@ -4661,7 +4670,7 @@ static void usage(char *pname)
strcpy(workgroup,lp_workgroup());
load_interfaces();
- get_myname(*myname?NULL:myname,NULL);
+ get_myname((*myname)?NULL:myname,NULL);
strupper(myname);
if (tar_type) {
diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c
index 01b4a09321..9dd1dc040e 100644
--- a/source3/client/clientutil.c
+++ b/source3/client/clientutil.c
@@ -77,7 +77,7 @@ extern int Client;
/****************************************************************************
setup basics in a outgoing packet
****************************************************************************/
-void cli_setup_pkt(char *outbuf)
+static void cli_setup_pkt(char *outbuf)
{
SSVAL(outbuf,smb_pid,pid);
SSVAL(outbuf,smb_uid,uid);
@@ -89,11 +89,14 @@ void cli_setup_pkt(char *outbuf)
}
}
+
+
/****************************************************************************
receive a SMB trans or trans2 response allocating the necessary memory
****************************************************************************/
-BOOL cli_receive_trans_response(char *inbuf,int trans,int *data_len,
- int *param_len, char **data,char **param)
+static BOOL cli_receive_trans_response(char *inbuf,int trans,int *data_len,
+ int *param_len, char **data,
+ char **param)
{
int total_data=0;
int total_param=0;
@@ -171,7 +174,7 @@ BOOL cli_receive_trans_response(char *inbuf,int trans,int *data_len,
/****************************************************************************
send a session request
****************************************************************************/
-BOOL cli_send_session_request(char *inbuf, char *outbuf)
+static BOOL cli_send_session_request(char *inbuf, char *outbuf)
{
fstring dest;
char *p;
@@ -667,35 +670,12 @@ void cli_send_logout(void)
}
-
-/****************************************************************************
-call a remote api
-****************************************************************************/
-BOOL cli_call_api(int prcnt,int drcnt,int mprcnt,int mdrcnt,int *rprcnt,
- int *rdrcnt, char *param,char *data, char **rparam,char **rdata)
-{
- static char *inbuf=NULL;
- static char *outbuf=NULL;
-
- if (!inbuf) inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
- if (!outbuf) outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
-
- cli_send_trans_request(outbuf,SMBtrans,"\\PIPE\\LANMAN",0,0,
- data,param,NULL,
- drcnt,prcnt,0,
- mdrcnt,mprcnt,0);
-
- return (cli_receive_trans_response(inbuf,SMBtrans,
- rdrcnt,rprcnt,
- rdata,rparam));
-}
-
/****************************************************************************
send a SMB trans or trans2 request
****************************************************************************/
-BOOL cli_send_trans_request(char *outbuf, int trans, char *name, int fid, int flags,
- char *data,char *param,uint16 *setup, int ldata,int lparam,
- int lsetup,int mdata,int mparam,int msetup)
+static BOOL cli_send_trans_request(char *outbuf, int trans, char *name, int fid, int flags,
+ char *data,char *param,uint16 *setup, int ldata,int lparam,
+ int lsetup,int mdata,int mparam,int msetup)
{
int i;
int this_ldata,this_lparam;
@@ -803,6 +783,31 @@ BOOL cli_send_trans_request(char *outbuf, int trans, char *name, int fid, int fl
}
+
+/****************************************************************************
+call a remote api
+****************************************************************************/
+BOOL cli_call_api(int prcnt,int drcnt,int mprcnt,int mdrcnt,int *rprcnt,
+ int *rdrcnt, char *param,char *data,
+ char **rparam, char **rdata)
+{
+ static char *inbuf=NULL;
+ static char *outbuf=NULL;
+
+ if (!inbuf) inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
+ if (!outbuf) outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
+
+ cli_send_trans_request(outbuf,SMBtrans,"\\PIPE\\LANMAN",0,0,
+ data,param,NULL,
+ drcnt,prcnt,0,
+ mdrcnt,mprcnt,0);
+
+ return (cli_receive_trans_response(inbuf,SMBtrans,
+ rdrcnt,rprcnt,
+ rdata,rparam));
+}
+
+
/****************************************************************************
open the client sockets
****************************************************************************/