summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-05 05:07:05 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-05 05:07:05 +0000
commite9ea36e4d2270bd7d32da12ef6d6e2299641582d (patch)
tree34905bbfb6adde96be7234d122562e678aa6efd8 /source3/smbd
parent766aa4ff5c6007669010d8c284de20111e633b25 (diff)
downloadsamba-e9ea36e4d2270bd7d32da12ef6d6e2299641582d.tar.gz
samba-e9ea36e4d2270bd7d32da12ef6d6e2299641582d.tar.bz2
samba-e9ea36e4d2270bd7d32da12ef6d6e2299641582d.zip
tridge the destroyer returns!
prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c2
-rw-r--r--source3/smbd/filename.c10
-rw-r--r--source3/smbd/files.c5
-rw-r--r--source3/smbd/ipc.c2
-rw-r--r--source3/smbd/nttrans.c4
-rw-r--r--source3/smbd/open.c190
-rw-r--r--source3/smbd/oplock.c4
-rw-r--r--source3/smbd/password.c4
-rw-r--r--source3/smbd/process.c286
-rw-r--r--source3/smbd/server.c4
-rw-r--r--source3/smbd/trans2.c2
11 files changed, 247 insertions, 266 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index c9478166c4..68cbe9b35b 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -292,7 +292,7 @@ static int talktochild(int master, char *chatsequence)
}
-BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL as_root)
+static BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequence, BOOL as_root)
{
char *slavedev;
int master;
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 656bb8997c..115ff699c7 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -28,12 +28,13 @@ extern BOOL short_case_preserve;
extern fstring remote_machine;
extern BOOL use_mangled_map;
+static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache);
+
/****************************************************************************
Check if two filenames are equal.
This needs to be careful about whether we are case sensitive.
****************************************************************************/
-
-BOOL fname_equal(char *name1, char *name2)
+static BOOL fname_equal(char *name1, char *name2)
{
int l1 = strlen(name1);
int l2 = strlen(name2);
@@ -68,8 +69,7 @@ BOOL fname_equal(char *name1, char *name2)
/****************************************************************************
Mangle the 2nd name and check if it is then equal to the first name.
****************************************************************************/
-
-BOOL mangled_equal(char *name1, char *name2)
+static BOOL mangled_equal(char *name1, char *name2)
{
pstring tmpname;
@@ -633,7 +633,7 @@ scan a directory to find a filename, matching without case sensitivity
If the name looks like a mangled name then try via the mangling functions
****************************************************************************/
-BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache)
+static BOOL scan_directory(char *path, char *name,connection_struct *conn,BOOL docache)
{
void *cur_dir;
char *dname;
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 0b72bcf0fa..0fe6a4ebd1 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -133,8 +133,9 @@ file_fd_struct *fd_get_already_open(SMB_STRUCT_STAT *sbuf)
(unsigned int)fd_ptr->dev, (double)fd_ptr->inode,
fd_ptr->ref_count));
#else /* LARGE_SMB_INO_T */
- DEBUG(3,("Re-used file_fd_struct dev = %x, inode = %lx, ref_count = %d\n",
- (unsigned int)fd_ptr->dev, (unsigned long)fd_ptr->inode,
+ DEBUG(3,("Re-used file_fd_struct dev = %x, inode = %x, ref_count = %d\n",
+ (unsigned int)fd_ptr->dev,
+ (unsigned int)fd_ptr->inode,
fd_ptr->ref_count));
#endif /* LARGE_SMB_INO_T */
return fd_ptr;
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 048afe35cd..8f7b1a9e15 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -725,7 +725,7 @@ static void fill_printq_info(connection_struct *conn, int snum, int uLevel,
}
/* This function returns the number of files for a given driver */
-int get_printerdrivernumber(int snum)
+static int get_printerdrivernumber(int snum)
{
int i=0,ok=0;
pstring tok;
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 3fdee043dc..0f50145d7f 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -33,6 +33,8 @@ extern BOOL case_sensitive;
extern BOOL case_preserve;
extern BOOL short_case_preserve;
+static void remove_pending_change_notify_requests_by_mid(int mid);
+
static char *known_nt_pipes[] = {
"\\LANMAN",
"\\srvsvc",
@@ -1045,7 +1047,7 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp)
Delete entries by mid from the change notify pending queue. Always send reply.
*****************************************************************************/
-void remove_pending_change_notify_requests_by_mid(int mid)
+static void remove_pending_change_notify_requests_by_mid(int mid)
{
change_notify_buf *cnbp = (change_notify_buf *)ubi_slFirst( &change_notify_queue );
change_notify_buf *prev = NULL;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a72469f2b2..e6289b1cdb 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -589,6 +589,102 @@ static void truncate_unless_locked(files_struct *fsp, connection_struct *conn, i
}
+enum {AFAIL,AREAD,AWRITE,AALL};
+
+/*******************************************************************
+reproduce the share mode access table
+********************************************************************/
+static int access_table(int new_deny,int old_deny,int old_mode,
+ int share_pid,char *fname)
+{
+ if (new_deny == DENY_ALL || old_deny == DENY_ALL) return(AFAIL);
+
+ if (new_deny == DENY_DOS || old_deny == DENY_DOS) {
+ int pid = getpid();
+ if (old_deny == new_deny && share_pid == pid)
+ return(AALL);
+
+ if (old_mode == 0) return(AREAD);
+
+ /* the new smbpub.zip spec says that if the file extension is
+ .com, .dll, .exe or .sym then allow the open. I will force
+ it to read-only as this seems sensible although the spec is
+ a little unclear on this. */
+ if ((fname = strrchr(fname,'.'))) {
+ if (strequal(fname,".com") ||
+ strequal(fname,".dll") ||
+ strequal(fname,".exe") ||
+ strequal(fname,".sym"))
+ return(AREAD);
+ }
+
+ return(AFAIL);
+ }
+
+ switch (new_deny)
+ {
+ case DENY_WRITE:
+ if (old_deny==DENY_WRITE && old_mode==0) return(AREAD);
+ if (old_deny==DENY_READ && old_mode==0) return(AWRITE);
+ if (old_deny==DENY_NONE && old_mode==0) return(AALL);
+ return(AFAIL);
+ case DENY_READ:
+ if (old_deny==DENY_WRITE && old_mode==1) return(AREAD);
+ if (old_deny==DENY_READ && old_mode==1) return(AWRITE);
+ if (old_deny==DENY_NONE && old_mode==1) return(AALL);
+ return(AFAIL);
+ case DENY_NONE:
+ if (old_deny==DENY_WRITE) return(AREAD);
+ if (old_deny==DENY_READ) return(AWRITE);
+ if (old_deny==DENY_NONE) return(AALL);
+ return(AFAIL);
+ }
+ return(AFAIL);
+}
+
+
+/****************************************************************************
+check if we can open a file with a share mode
+****************************************************************************/
+static int check_share_mode( share_mode_entry *share, int deny_mode,
+ char *fname,
+ BOOL fcbopen, int *flags)
+{
+ int old_open_mode = share->share_mode &0xF;
+ int old_deny_mode = (share->share_mode >>4)&7;
+
+ if (old_deny_mode > 4 || old_open_mode > 2)
+ {
+ DEBUG(0,("Invalid share mode found (%d,%d,%d) on file %s\n",
+ deny_mode,old_deny_mode,old_open_mode,fname));
+ return False;
+ }
+
+ {
+ int access_allowed = access_table(deny_mode,old_deny_mode,old_open_mode,
+ share->pid,fname);
+
+ if ((access_allowed == AFAIL) ||
+ (!fcbopen && (access_allowed == AREAD && *flags == O_RDWR)) ||
+ (access_allowed == AREAD && *flags == O_WRONLY) ||
+ (access_allowed == AWRITE && *flags == O_RDONLY))
+ {
+ DEBUG(2,("Share violation on file (%d,%d,%d,%d,%s,fcbopen = %d, flags = %d) = %d\n",
+ deny_mode,old_deny_mode,old_open_mode,
+ share->pid,fname, fcbopen, *flags, access_allowed));
+ return False;
+ }
+
+ if (access_allowed == AREAD)
+ *flags = O_RDONLY;
+
+ if (access_allowed == AWRITE)
+ *flags = O_WRONLY;
+
+ }
+ return True;
+}
+
/****************************************************************************
open a file with a share mode
@@ -852,7 +948,7 @@ dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsi
dev = %x, inode = %.0f\n", oplock_request, fname, (unsigned int)dev, (double)inode));
#else /* LARGE_SMB_INO_T */
DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \
-dev = %x, inode = %lx\n", oplock_request, fname, (unsigned int)dev, (double)inode));
+dev = %x, inode = %lx\n", oplock_request, fname, (unsigned int)dev, (unsigned long)inode));
#endif /* LARGE_SMB_INO_T */
}
@@ -953,58 +1049,6 @@ int open_directory(files_struct *fsp,connection_struct *conn,
return 0;
}
-enum {AFAIL,AREAD,AWRITE,AALL};
-
-/*******************************************************************
-reproduce the share mode access table
-********************************************************************/
-static int access_table(int new_deny,int old_deny,int old_mode,
- int share_pid,char *fname)
-{
- if (new_deny == DENY_ALL || old_deny == DENY_ALL) return(AFAIL);
-
- if (new_deny == DENY_DOS || old_deny == DENY_DOS) {
- int pid = getpid();
- if (old_deny == new_deny && share_pid == pid)
- return(AALL);
-
- if (old_mode == 0) return(AREAD);
-
- /* the new smbpub.zip spec says that if the file extension is
- .com, .dll, .exe or .sym then allow the open. I will force
- it to read-only as this seems sensible although the spec is
- a little unclear on this. */
- if ((fname = strrchr(fname,'.'))) {
- if (strequal(fname,".com") ||
- strequal(fname,".dll") ||
- strequal(fname,".exe") ||
- strequal(fname,".sym"))
- return(AREAD);
- }
-
- return(AFAIL);
- }
-
- switch (new_deny)
- {
- case DENY_WRITE:
- if (old_deny==DENY_WRITE && old_mode==0) return(AREAD);
- if (old_deny==DENY_READ && old_mode==0) return(AWRITE);
- if (old_deny==DENY_NONE && old_mode==0) return(AALL);
- return(AFAIL);
- case DENY_READ:
- if (old_deny==DENY_WRITE && old_mode==1) return(AREAD);
- if (old_deny==DENY_READ && old_mode==1) return(AWRITE);
- if (old_deny==DENY_NONE && old_mode==1) return(AALL);
- return(AFAIL);
- case DENY_NONE:
- if (old_deny==DENY_WRITE) return(AREAD);
- if (old_deny==DENY_READ) return(AWRITE);
- if (old_deny==DENY_NONE) return(AALL);
- return(AFAIL);
- }
- return(AFAIL);
-}
/*******************************************************************
check if the share mode on a file allows it to be deleted or unlinked
@@ -1153,44 +1197,4 @@ free_and_exit:
return(ret);
}
-/****************************************************************************
-check if we can open a file with a share mode
-****************************************************************************/
-int check_share_mode( share_mode_entry *share, int deny_mode, char *fname,
- BOOL fcbopen, int *flags)
-{
- int old_open_mode = share->share_mode &0xF;
- int old_deny_mode = (share->share_mode >>4)&7;
-
- if (old_deny_mode > 4 || old_open_mode > 2)
- {
- DEBUG(0,("Invalid share mode found (%d,%d,%d) on file %s\n",
- deny_mode,old_deny_mode,old_open_mode,fname));
- return False;
- }
-
- {
- int access_allowed = access_table(deny_mode,old_deny_mode,old_open_mode,
- share->pid,fname);
-
- if ((access_allowed == AFAIL) ||
- (!fcbopen && (access_allowed == AREAD && *flags == O_RDWR)) ||
- (access_allowed == AREAD && *flags == O_WRONLY) ||
- (access_allowed == AWRITE && *flags == O_RDONLY))
- {
- DEBUG(2,("Share violation on file (%d,%d,%d,%d,%s,fcbopen = %d, flags = %d) = %d\n",
- deny_mode,old_deny_mode,old_open_mode,
- share->pid,fname, fcbopen, *flags, access_allowed));
- return False;
- }
-
- if (access_allowed == AREAD)
- *flags = O_RDONLY;
-
- if (access_allowed == AWRITE)
- *flags = O_WRONLY;
-
- }
- return True;
-}
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 6e675b56ef..dd882d08cc 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -34,6 +34,8 @@ BOOL global_oplock_break = False;
extern int smb_read_error;
+static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval);
+
/****************************************************************************
open the oplock IPC socket communication
@@ -230,7 +232,7 @@ pid %d, port %d, dev = %x, inode = %lx\n", remotepid, from_port, (unsigned int)d
/****************************************************************************
Process an oplock break directly.
****************************************************************************/
-BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval)
+static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval)
{
extern struct current_user current_user;
extern int Client;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index dadbcad11e..684420f4c3 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -84,7 +84,7 @@ BOOL set_challenge(char *challenge)
/*******************************************************************
get the last challenge sent
********************************************************************/
-BOOL last_challenge(unsigned char *challenge)
+static BOOL last_challenge(unsigned char *challenge)
{
if (!challenge_sent) return(False);
memcpy(challenge,saved_challenge,8);
@@ -299,7 +299,7 @@ void add_session_user(char *user)
/****************************************************************************
update the encrypted smbpasswd file from the plaintext username and password
*****************************************************************************/
-BOOL update_smbpassword_file(char *user, char *password)
+static BOOL update_smbpassword_file(char *user, char *password)
{
struct smb_passwd *smbpw;
BOOL ret;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 63e51dc242..b72178013d 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -89,86 +89,6 @@ BOOL receive_next_smb(int smbfd, int oplockfd, char *inbuf, int bufsize, int tim
}
-
-/****************************************************************************
- process an smb from the client - split out from the process() code so
- it can be used by the oplock break code.
-****************************************************************************/
-void process_smb(char *inbuf, char *outbuf)
-{
- extern int Client;
-#ifdef WITH_SSL
- extern BOOL sslEnabled; /* don't use function for performance reasons */
- static int sslConnected = 0;
-#endif /* WITH_SSL */
- static int trans_num;
- int msg_type = CVAL(inbuf,0);
- int32 len = smb_len(inbuf);
- int nread = len + 4;
-
- if (trans_num == 0) {
- /* on the first packet, check the global hosts allow/ hosts
- deny parameters before doing any parsing of the packet
- passed to us by the client. This prevents attacks on our
- parsing code from hosts not in the hosts allow list */
- if (!check_access(Client, lp_hostsallow(-1), lp_hostsdeny(-1))) {
- /* send a negative session response "not listining on calling
- name" */
- static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
- DEBUG( 1, ( "Connection denied from %s\n",
- client_addr(Client) ) );
- send_smb(Client,(char *)buf);
- exit_server("connection denied");
- }
- }
-
- DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type, len ) );
- DEBUG( 3, ( "Transaction %d of length %d\n", trans_num, nread ) );
-
-#ifdef WITH_SSL
- if(sslEnabled && !sslConnected){
- sslConnected = sslutil_negotiate_ssl(Client, msg_type);
- if(sslConnected < 0){ /* an error occured */
- exit_server("SSL negotiation failed");
- }else if(sslConnected){
- trans_num++;
- return;
- }
- }
-#endif /* WITH_SSL */
-
-#ifdef WITH_VTP
- if(trans_num == 1 && VT_Check(inbuf))
- {
- VT_Process();
- return;
- }
-#endif
-
- if (msg_type == 0)
- show_msg(inbuf);
- else if(msg_type == 0x85)
- return; /* Keepalive packet. */
-
- nread = construct_reply(inbuf,outbuf,nread,max_send);
-
- if(nread > 0)
- {
- if (CVAL(outbuf,0) == 0)
- show_msg(outbuf);
-
- if (nread != smb_len(outbuf) + 4)
- {
- DEBUG(0,("ERROR: Invalid message response size! %d %d\n",
- nread, smb_len(outbuf)));
- }
- else
- send_smb(Client,outbuf);
- }
- trans_num++;
-}
-
-
/*
These flags determine some of the permissions required to do an operation
@@ -194,9 +114,6 @@ struct smb_message_struct
char *name;
int (*fn)(connection_struct *conn, char *, char *, int, int);
int flags;
-#if PROFILING
- unsigned long time;
-#endif
}
smb_messages[] = {
@@ -302,26 +219,6 @@ struct smb_message_struct
{SMBgetmac,"SMBgetmac",NULL,AS_GUEST}
};
-/****************************************************************************
-return a string containing the function name of a SMB command
-****************************************************************************/
-char *smb_fn_name(int type)
-{
- static char *unknown_name = "SMBunknown";
- static int num_smb_messages =
- sizeof(smb_messages) / sizeof(struct smb_message_struct);
- int match;
-
- for (match=0;match<num_smb_messages;match++)
- if (smb_messages[match].code == type)
- break;
-
- if (match == num_smb_messages)
- return(unknown_name);
-
- return(smb_messages[match].name);
-}
-
/****************************************************************************
do a switch on the message type, and return the response size
@@ -335,14 +232,6 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
int match;
extern int Client;
-#if PROFILING
- struct timeval msg_start_time;
- struct timeval msg_end_time;
- static unsigned long total_time = 0;
-
- GetTimeOfDay(&msg_start_time);
-#endif
-
if (pid == -1)
pid = getpid();
@@ -462,28 +351,142 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
}
}
-#if PROFILING
- GetTimeOfDay(&msg_end_time);
- if (!(smb_messages[match].flags & TIME_INIT))
- {
- smb_messages[match].time = 0;
- smb_messages[match].flags |= TIME_INIT;
+ return(outsize);
+}
+
+
+/****************************************************************************
+ construct a reply to the incoming packet
+****************************************************************************/
+static int construct_reply(char *inbuf,char *outbuf,int size,int bufsize)
+{
+ int type = CVAL(inbuf,smb_com);
+ int outsize = 0;
+ int msg_type = CVAL(inbuf,0);
+ extern int chain_size;
+
+ smb_last_time = time(NULL);
+
+ chain_size = 0;
+ file_chain_reset();
+ reset_chain_p();
+
+ if (msg_type != 0)
+ return(reply_special(inbuf,outbuf));
+
+ construct_reply_common(inbuf, outbuf);
+
+ outsize = switch_message(type,inbuf,outbuf,size,bufsize);
+
+ outsize += chain_size;
+
+ if(outsize > 4)
+ smb_setlen(outbuf,outsize - 4);
+ return(outsize);
+}
+
+
+/****************************************************************************
+ process an smb from the client - split out from the process() code so
+ it can be used by the oplock break code.
+****************************************************************************/
+void process_smb(char *inbuf, char *outbuf)
+{
+ extern int Client;
+#ifdef WITH_SSL
+ extern BOOL sslEnabled; /* don't use function for performance reasons */
+ static int sslConnected = 0;
+#endif /* WITH_SSL */
+ static int trans_num;
+ int msg_type = CVAL(inbuf,0);
+ int32 len = smb_len(inbuf);
+ int nread = len + 4;
+
+ if (trans_num == 0) {
+ /* on the first packet, check the global hosts allow/ hosts
+ deny parameters before doing any parsing of the packet
+ passed to us by the client. This prevents attacks on our
+ parsing code from hosts not in the hosts allow list */
+ if (!check_access(Client, lp_hostsallow(-1), lp_hostsdeny(-1))) {
+ /* send a negative session response "not listining on calling
+ name" */
+ static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
+ DEBUG( 1, ( "Connection denied from %s\n",
+ client_addr(Client) ) );
+ send_smb(Client,(char *)buf);
+ exit_server("connection denied");
+ }
}
+
+ DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type, len ) );
+ DEBUG( 3, ( "Transaction %d of length %d\n", trans_num, nread ) );
+
+#ifdef WITH_SSL
+ if(sslEnabled && !sslConnected){
+ sslConnected = sslutil_negotiate_ssl(Client, msg_type);
+ if(sslConnected < 0){ /* an error occured */
+ exit_server("SSL negotiation failed");
+ }else if(sslConnected){
+ trans_num++;
+ return;
+ }
+ }
+#endif /* WITH_SSL */
+
+#ifdef WITH_VTP
+ if(trans_num == 1 && VT_Check(inbuf))
{
- unsigned long this_time =
- (msg_end_time.tv_sec - msg_start_time.tv_sec)*1e6 +
- (msg_end_time.tv_usec - msg_start_time.tv_usec);
- smb_messages[match].time += this_time;
- total_time += this_time;
+ VT_Process();
+ return;
}
- DEBUG(2,("TIME %s %d usecs %g pct\n",
- smb_fn_name(type),smb_messages[match].time,
- (100.0*smb_messages[match].time) / total_time));
#endif
- return(outsize);
+ if (msg_type == 0)
+ show_msg(inbuf);
+ else if(msg_type == 0x85)
+ return; /* Keepalive packet. */
+
+ nread = construct_reply(inbuf,outbuf,nread,max_send);
+
+ if(nread > 0)
+ {
+ if (CVAL(outbuf,0) == 0)
+ show_msg(outbuf);
+
+ if (nread != smb_len(outbuf) + 4)
+ {
+ DEBUG(0,("ERROR: Invalid message response size! %d %d\n",
+ nread, smb_len(outbuf)));
+ }
+ else
+ send_smb(Client,outbuf);
+ }
+ trans_num++;
+}
+
+
+
+/****************************************************************************
+return a string containing the function name of a SMB command
+****************************************************************************/
+char *smb_fn_name(int type)
+{
+ static char *unknown_name = "SMBunknown";
+ static int num_smb_messages =
+ sizeof(smb_messages) / sizeof(struct smb_message_struct);
+ int match;
+
+ for (match=0;match<num_smb_messages;match++)
+ if (smb_messages[match].code == type)
+ break;
+
+ if (match == num_smb_messages)
+ return(unknown_name);
+
+ return(smb_messages[match].name);
}
+
/****************************************************************************
Helper function for contruct_reply.
****************************************************************************/
@@ -591,37 +594,6 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
}
/****************************************************************************
- construct a reply to the incoming packet
-****************************************************************************/
-
-int construct_reply(char *inbuf,char *outbuf,int size,int bufsize)
-{
- int type = CVAL(inbuf,smb_com);
- int outsize = 0;
- int msg_type = CVAL(inbuf,0);
- extern int chain_size;
-
- smb_last_time = time(NULL);
-
- chain_size = 0;
- file_chain_reset();
- reset_chain_p();
-
- if (msg_type != 0)
- return(reply_special(inbuf,outbuf));
-
- construct_reply_common(inbuf, outbuf);
-
- outsize = switch_message(type,inbuf,outbuf,size,bufsize);
-
- outsize += chain_size;
-
- if(outsize > 4)
- smb_setlen(outbuf,outsize - 4);
- return(outsize);
-}
-
-/****************************************************************************
process commands from the client
****************************************************************************/
void smbd_process(void)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index dadf2018c8..5af62fd4a7 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -52,7 +52,7 @@ extern pstring myhostname;
/****************************************************************************
when exiting, take the whole family
****************************************************************************/
-void *dflt_sig(void)
+static void *dflt_sig(void)
{
exit_server("caught signal");
return NULL;
@@ -61,7 +61,7 @@ void *dflt_sig(void)
/****************************************************************************
Send a SIGTERM to our process group.
*****************************************************************************/
-void killkids(void)
+static void killkids(void)
{
if(am_parent) kill(0,SIGTERM);
}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index dd1aa8f48b..f0ed77bd97 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1587,7 +1587,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
#ifdef LARGE_SMB_OFF_T
DEBUG(6,("size: %.0f ", (double)size));
#else /* LARGE_SMB_OFF_T */
- DEBUG(6,("size: %x " , size));
+ DEBUG(6,("size: %x " , (int)size));
#endif /* LARGE_SMB_OFF_T */
DEBUG(6,("mode: %x\n" , mode));