summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/client/client.c2
-rw-r--r--source/client/smbmount.c2
-rw-r--r--source/lib/access.c6
-rw-r--r--source/libsmb/nmblib.c8
-rw-r--r--source/nmbd/nmbd.c8
-rw-r--r--source/nmbd/nmbd_become_dmb.c59
-rw-r--r--source/passdb/ldap.c12
-rw-r--r--source/smbd/message.c8
-rw-r--r--source/smbd/nttrans.c8
-rw-r--r--source/smbd/pipes.c5
-rw-r--r--source/smbd/reply.c218
-rw-r--r--source/smbd/server.c239
-rw-r--r--source/smbd/ssl.c7
-rw-r--r--source/smbd/trans2.c27
-rw-r--r--source/smbd/uid.c3
-rw-r--r--source/smbd/vt_mode.c2
16 files changed, 341 insertions, 273 deletions
diff --git a/source/client/client.c b/source/client/client.c
index b72a6207307..ea1555beb42 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -3733,7 +3733,7 @@ static void usage(char *pname)
}
- DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION));
+ DEBUG( 3, ( "Client started (version %s).\n", VERSION ) );
if (tar_type) {
recurse=True;
diff --git a/source/client/smbmount.c b/source/client/smbmount.c
index 2424513d687..2fc38def9d2 100644
--- a/source/client/smbmount.c
+++ b/source/client/smbmount.c
@@ -803,7 +803,7 @@ static void usage(char *pname)
}
- DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION));
+ DEBUG( 3, ( "Client started (version %s)\n", VERSION ) );
if(!get_myname(myhostname,NULL))
{
diff --git a/source/lib/access.c b/source/lib/access.c
index d5e81eb50fc..a565f437dad 100644
--- a/source/lib/access.c
+++ b/source/lib/access.c
@@ -71,9 +71,9 @@ BOOL check_access(int snum)
}
else
if (snum >= 0)
- DEBUG(0,("%s Denied connection from %s (%s) to %s\n",
- timestring(), client_name(Client),client_addr(Client),
- lp_servicename(snum)));
+ DEBUG( 0, ( "Denied connection from %s (%s) to %s\n",
+ client_name(Client),client_addr(Client),
+ lp_servicename(snum) ) );
}
if (denyl) free(denyl);
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index 66f85d40fd5..62c3f22b1ae 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -678,8 +678,8 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
num_good_receives++;
- DEBUG(5,("%s received a packet of len %d from (%s) port %d\n",
- timestring(),length,inet_ntoa(packet->ip),packet->port));
+ DEBUG(5,("Received a packet of len %d from (%s) port %d\n",
+ length, inet_ntoa(packet->ip), packet->port ) );
return(packet);
}
@@ -699,8 +699,8 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
sock_out.sin_port = htons( port );
sock_out.sin_family = AF_INET;
- DEBUG(5,("%s sending a packet of len %d to (%s) on port %d\n",
- timestring(),len,inet_ntoa(ip),port));
+ DEBUG( 5, ( "Sending a packet of len %d to (%s) on port %d\n",
+ len, inet_ntoa(ip), port ) );
ret = (sendto(fd,buf,len,0,(struct sockaddr *)&sock_out,
sizeof(sock_out)) >= 0);
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index 3fa749b883c..af12911e7e7 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -656,12 +656,12 @@ int main(int argc,char *argv[])
reopen_logs();
- DEBUG(1,("%s netbios nameserver version %s started\n",timestring(),VERSION));
- DEBUG(1,("Copyright Andrew Tridgell 1994-1997\n"));
+ DEBUG( 1, ( "Netbios nameserver version %s started.\n", VERSION ) );
+ DEBUGADD( 1, ( "Copyright Andrew Tridgell 1994-1997\n" ) );
if( !get_myname( myhostname, NULL) )
{
- DEBUG(0,("Unable to get my hostname - exiting.\n"));
+ DEBUG( 0, ( "Unable to get my hostname - exiting.\n" ) );
return -1;
}
@@ -693,7 +693,7 @@ int main(int argc,char *argv[])
if (is_daemon)
{
- DEBUG(2,("%s becoming a daemon\n",timestring()));
+ DEBUG( 2, ( "Becoming a daemon.\n" ) );
become_daemon();
}
diff --git a/source/nmbd/nmbd_become_dmb.c b/source/nmbd/nmbd_become_dmb.c
index d01bf18310c..01f1126b217 100644
--- a/source/nmbd/nmbd_become_dmb.c
+++ b/source/nmbd/nmbd_become_dmb.c
@@ -81,8 +81,13 @@ in workgroup %s on subnet %s\n",
bzero((char *)&work->dmb_name, sizeof(work->dmb_name));
putip((char *)&work->dmb_addr, &ipzero);
- DEBUG(0,("\n%s ***** Samba server %s has stopped being a domain master browser \
-for workgroup %s on subnet %s *****\n\n", timestring(), global_myname, work->work_group, subrec->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "*****\n\nSamba server %s ", global_myname );
+ dbgtext( "has stopped being a domain master browser " );
+ dbgtext( "for workgroup %s ", work->work_group );
+ dbgtext( "on subnet %s.\n\n*****\n", subrec->subnet_name );
+ }
}
@@ -94,8 +99,12 @@ static void unbecome_dmb_fail(struct subnet_record *subrec,
struct response_record *rrec,
struct nmb_name *released_name)
{
- DEBUG(0,("unbecome_dmb_fail: Failed to unbecome domain master browser for \
-workgroup %s on subnet %s.\n", released_name->name, subrec->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "unbecome_dmb_fail: Failed to unbecome domain master browser " );
+ dbgtext( "for workgroup %s ", released_name->name );
+ dbgtext( "on subnet %s.\n", subrec->subnet_name );
+ }
}
/*******************************************************************
@@ -214,11 +223,15 @@ in workgroup %s on subnet %s\n",
/* Tell the namelist writer to write out a change. */
subrec->work_changed = True;
- DEBUG(0,("\n%s ***** Samba server %s is now a domain master browser for \
-workgroup %s on subnet %s *****\n\n", timestring(),global_myname, work->work_group,
-subrec->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "*****\n\nSamba server %s ", global_myname );
+ dbgtext( "is now a domain master browser for " );
+ dbgtext( "workgroup %s ", work->work_group );
+ dbgtext( "on subnet %s\n\n*****\n", subrec->subnet_name );
+ }
- if(subrec == unicast_subnet)
+ if( subrec == unicast_subnet )
{
struct nmb_name nmbname;
struct in_addr my_first_ip;
@@ -313,9 +326,13 @@ Continuing with domain master code.\n",
}
else
{
- DEBUG(0,("%s become_domain_master_query_success: There is already a domain \
-master browser at IP %s for workgroup %s registered on subnet %s.\n",
- timestring(), inet_ntoa(ip), nmbname->name, subrec->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "become_domain_master_query_success:\n" );
+ dbgtext( "There is already a domain master browser at " );
+ dbgtext( "IP %s for workgroup %s ", inet_ntoa(ip), nmbname->name );
+ dbgtext( "registered on subnet %s.\n", subrec->subnet_name );
+ }
}
}
@@ -367,9 +384,13 @@ static void become_domain_master_browser_bcast(char *workgroup_name)
if (find_name_on_subnet(subrec, &nmbname, FIND_SELF_NAME) == NULL)
{
- DEBUG(0,("become_domain_master_browser_bcast: At time %s attempting to become domain \
-master browser on workgroup %s on subnet %s\n", timestring(),
- workgroup_name, subrec->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "become_domain_master_browser_bcast:\n" );
+ dbgtext( "Attempting to become domain master browser on " );
+ dbgtext( "workgroup %s on subnet %s\n",
+ workgroup_name, subrec->subnet_name );
+ }
/* Send out a query to establish whether there's a
domain controller on the local subnet. If not,
@@ -411,9 +432,13 @@ static void become_domain_master_browser_wins(char *workgroup_name)
if (find_name_on_subnet(unicast_subnet, &nmbname, FIND_SELF_NAME) == NULL)
{
- DEBUG(0,("%s become_domain_master_browser_wins: attempting to become domain \
-master browser on workgroup %s, subnet %s.\n",
- timestring(), workgroup_name, unicast_subnet->subnet_name));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "become_domain_master_browser_wins:\n" );
+ dbgtext( "Attempting to become domain master browser " );
+ dbgtext( "on workgroup %s, subnet %s.\n",
+ workgroup_name, unicast_subnet->subnet_name );
+ }
/* Send out a query to establish whether there's a
domain master broswer registered with WINS. If not,
diff --git a/source/passdb/ldap.c b/source/passdb/ldap.c
index 2e98cad4be2..ea25f48605a 100644
--- a/source/passdb/ldap.c
+++ b/source/passdb/ldap.c
@@ -39,8 +39,8 @@ static BOOL ldap_open_connection(LDAP **ldap_struct)
{
if ( (*ldap_struct = ldap_open(lp_ldap_server(),lp_ldap_port()) ) == NULL)
{
- DEBUG(0,("%s: The LDAP server is not responding !\n",timestring()));
- return(False);
+ DEBUG( 0, ( "The LDAP server is not responding !\n" ) );
+ return( False );
}
DEBUG(2,("ldap_open_connection: connection opened\n"));
return (True);
@@ -55,7 +55,7 @@ static BOOL ldap_connect_anonymous(LDAP *ldap_struct)
{
if ( ldap_simple_bind_s(ldap_struct,lp_ldap_root(),lp_ldap_rootpasswd()) ! = LDAP_SUCCESS)
{
- DEBUG(0,("%s: Couldn't bind to the LDAP server !\n", timestring() ));
+ DEBUG( 0, ( "Couldn't bind to the LDAP server !\n" ) );
return(False);
}
return (True);
@@ -69,7 +69,7 @@ static BOOL ldap_connect_system(LDAP *ldap_struct)
{
if ( ldap_simple_bind_s(ldap_struct,lp_ldap_root(),lp_ldap_rootpasswd()) ! = LDAP_SUCCESS)
{
- DEBUG(0,("%s: Couldn't bind to the LDAP server !\n", timestring() ));
+ DEBUG( 0, ( "Couldn't bind to the LDAP server!\n" ) );
return(False);
}
DEBUG(2,("ldap_connect_system: succesful connection to the LDAP server\n"));
@@ -83,7 +83,7 @@ static BOOL ldap_connect_user(LDAP *ldap_struct, char *user, char *password)
{
if ( ldap_simple_bind_s(ldap_struct,lp_ldap_root(),lp_ldap_rootpasswd()) ! = LDAP_SUCCESS)
{
- DEBUG(0,("%s: Couldn't bind to the LDAP server !\n", timestring() ));
+ DEBUG( 0, ( "Couldn't bind to the LDAP server !\n" ) );
return(False);
}
DEBUG(2,("ldap_connect_user: succesful connection to the LDAP server\n"));
@@ -104,7 +104,7 @@ static BOOL ldap_search_one_user(LDAP *ldap_struct, char *filter, LDAPMessage **
if (rc ! = LDAP_SUCCESS )
{
- DEBUG(0,("%s: Problem during the LDAP search\n",timestring()));
+ DEBUG( 0, ( "Problem during the LDAP search\n" ) );
return(False);
}
return (True);
diff --git a/source/smbd/message.c b/source/smbd/message.c
index b368c4d031a..44ae272bdd2 100644
--- a/source/smbd/message.c
+++ b/source/smbd/message.c
@@ -117,7 +117,7 @@ int reply_sends(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
memcpy(&msgbuf[msgpos],msg+2,len);
msgpos += len;
- DEBUG(3,("%s SMBsends (from %s to %s)\n",timestring(),orig,dest));
+ DEBUG( 3, ( "SMBsends (from %s to %s)\n", orig, dest ) );
msg_deliver();
@@ -146,7 +146,7 @@ int reply_sendstrt(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
fstrcpy(msgfrom,orig);
fstrcpy(msgto,dest);
- DEBUG(3,("%s SMBsendstrt (from %s to %s)\n",timestring(),msgfrom,msgto));
+ DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );
return(outsize);
}
@@ -174,7 +174,7 @@ int reply_sendtxt(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
memcpy(&msgbuf[msgpos],msg+2,len);
msgpos += len;
- DEBUG(3,("%s SMBsendtxt\n",timestring()));
+ DEBUG( 3, ( "SMBsendtxt\n" ) );
return(outsize);
}
@@ -192,7 +192,7 @@ int reply_sendend(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s SMBsendend\n",timestring()));
+ DEBUG( 3, ( "%s SMBsendend\n" ) );
msg_deliver();
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index 4e857c183c0..d845076f363 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -1019,8 +1019,8 @@ int reply_nttrans(char *inbuf,char *outbuf,int length,int bufsize)
* Queue this open message as we are the process of an oplock break.
*/
- DEBUG(2,("%s: reply_nttrans: queueing message NT_TRANSACT_CREATE \
-due to being in oplock break state.\n", timestring() ));
+ DEBUG( 2, ( "reply_nttrans: queueing message NT_TRANSACT_CREATE " ) );
+ DEBUGADD( 2, ( "due to being in oplock break state.\n" ) );
push_oplock_pending_smb_message( inbuf, length);
return -1;
@@ -1145,8 +1145,8 @@ due to being in oplock break state.\n", timestring() ));
break;
default:
/* Error in request */
- DEBUG(0,("reply_nttrans: %s Unknown request %d in nttrans call\n",timestring(),
- function_code));
+ DEBUG( 0, ( "reply_nttrans: Unknown request %d in nttrans call\n",
+ function_code ) );
if(setup)
free(setup);
if(params)
diff --git a/source/smbd/pipes.c b/source/smbd/pipes.c
index f0c5c3ba7fc..34884aa6d38 100644
--- a/source/smbd/pipes.c
+++ b/source/smbd/pipes.c
@@ -161,9 +161,8 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
SSVAL(smb_buf(outbuf),-2,nread);
- DEBUG(3,("%s readX pnum=%04x cnum=%d min=%d max=%d nread=%d\n",
- timestring(),pnum,cnum,
- smb_mincnt,smb_maxcnt,nread));
+ DEBUG( 3, ( "readX pnum=%04x cnum=%d min=%d max=%d nread=%d\n",
+ pnum, cnum, smb_mincnt, smb_maxcnt, nread ) );
set_chain_pnum(pnum);
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 2845d5650a9..71544c1b19a 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -55,9 +55,13 @@ report a possible attack via the password buffer overflow bug
****************************************************************************/
static void overflow_attack(int len)
{
- DEBUG(0,("%s: ERROR: Invalid password length %d\n", timestring(), len));
- DEBUG(0,("your machine may be under attack by a user exploiting an old bug\n"));
- DEBUG(0,("Attack was from IP=%s\n", client_addr(Client)));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "ERROR: Invalid password length %d.\n", len );
+ dbgtext( "Your machine may be under attack by someone " );
+ dbgtext( "attempting to exploit an old bug.\n" );
+ dbgtext( "Attack was from IP = %s.\n", client_addr(Client) );
+ }
exit_server("possible attack");
}
@@ -143,8 +147,8 @@ int reply_special(char *inbuf,char *outbuf)
return(0);
}
- DEBUG(5,("%s init msg_type=0x%x msg_flags=0x%x\n",
- timestring(),msg_type,msg_flags));
+ DEBUG( 5, ( "init msg_type=0x%x msg_flags=0x%x\n",
+ msg_type, msg_flags ) );
return(outsize);
}
@@ -254,7 +258,7 @@ int reply_tcon(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_vwv1,connection_num);
SSVAL(outbuf,smb_tid,connection_num);
- DEBUG(3,("%s tcon service=%s user=%s cnum=%d\n",timestring(),service,user,connection_num));
+ DEBUG(3,("tcon service=%s user=%s cnum=%d\n", service, user, connection_num));
return(outsize);
}
@@ -350,7 +354,8 @@ int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize)
SSVAL(outbuf, smb_vwv2, 0x0); /* optional support */
}
- DEBUG(3,("%s tconX service=%s user=%s cnum=%d\n",timestring(),service,user,connection_num));
+ DEBUG( 3, ( "tconX service=%s user=%s cnum=%d\n",
+ service, user, connection_num ) );
/* set the incoming and outgoing tid to the just created one */
SSVAL(inbuf,smb_tid,connection_num);
@@ -370,10 +375,8 @@ int reply_unknown(char *inbuf,char *outbuf)
cnum = SVAL(inbuf,smb_tid);
type = CVAL(inbuf,smb_com);
- DEBUG(0,("%s unknown command type (%s): cnum=%d type=%d (0x%X)\n",
- timestring(),
- smb_fn_name(type),
- cnum,type,type));
+ DEBUG(0,("unknown command type (%s): cnum=%d type=%d (0x%X)\n",
+ smb_fn_name(type), cnum, type, type));
return(ERROR(ERRSRV,ERRunknownsmb));
}
@@ -807,11 +810,11 @@ int reply_chkpth(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
return(UNIXERROR(ERRDOS,ERRbadpath));
}
-
+
outsize = set_message(outbuf,0,0,True);
-
- DEBUG(3,("%s chkpth %s cnum=%d mode=%d\n",timestring(),name,cnum,mode));
-
+
+ DEBUG( 3, ( "chkpth %s cnum=%d mode=%d\n", name, cnum, mode ) );
+
return(outsize);
}
@@ -890,7 +893,7 @@ int reply_getatr(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_flg2,flg2 | 0x40); /* IS_LONG_NAME */
}
- DEBUG(3,("%s getatr name=%s mode=%d size=%d\n",timestring(),fname,mode,size));
+ DEBUG( 3, ( "getatr name=%s mode=%d size=%d\n", fname, mode, size ) );
return(outsize);
}
@@ -937,7 +940,7 @@ int reply_setatr(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s setatr name=%s mode=%d\n",timestring(),fname,mode));
+ DEBUG( 3, ( "setatr name=%s mode=%d\n", fname, mode ) );
return(outsize);
}
@@ -962,9 +965,9 @@ int reply_dskattr(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_vwv1,bsize/512);
SSVAL(outbuf,smb_vwv2,512);
SSVAL(outbuf,smb_vwv3,dfree);
-
- DEBUG(3,("%s dskattr cnum=%d dfree=%d\n",timestring(),cnum,dfree));
-
+
+ DEBUG( 3, ( "dskattr cnum=%d dfree=%d\n", cnum, dfree ) );
+
return(outsize);
}
@@ -1210,10 +1213,9 @@ int reply_search(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if ((! *directory) && dptr_path(dptr_num))
slprintf(directory, sizeof(directory)-1, "(%s)",dptr_path(dptr_num));
- DEBUG(4,("%s %s mask=%s path=%s cnum=%d dtype=%d nument=%d of %d\n",
- timestring(),
+ DEBUG( 4, ( "%s mask=%s path=%s cnum=%d dtype=%d nument=%d of %d\n",
smb_fn_name(CVAL(inbuf,smb_com)),
- mask,directory,cnum,dirtype,numentries,maxentries));
+ mask, directory, cnum, dirtype, numentries, maxentries ) );
return(outsize);
}
@@ -1250,7 +1252,7 @@ int reply_fclose(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_vwv0,0);
- DEBUG(3,("%s search close cnum=%d\n",timestring(),cnum));
+ DEBUG( 3, ( "%s search close cnum=%d\n", cnum ) );
return(outsize);
}
@@ -1508,7 +1510,7 @@ int reply_ulogoffX(char *inbuf,char *outbuf,int length,int bufsize)
set_message(outbuf,2,0,True);
- DEBUG(3,("%s ulogoffX vuid=%d\n",timestring(),vuid));
+ DEBUG( 3, ( "ulogoffX vuid=%d\n", vuid ) );
return chain_reply(inbuf,outbuf,length,bufsize);
}
@@ -1597,10 +1599,10 @@ int reply_mknew(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if(fsp->granted_oplock)
CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED;
- DEBUG(2,("new file %s\n",fname));
- DEBUG(3,("%s mknew %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
- timestring(),fname,fsp->f_u.fd_ptr->fd,fnum,cnum,createmode,unixmode));
-
+ DEBUG( 2, ( "new file %s\n", fname ) );
+ DEBUG( 3, ( "mknew %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
+ fname, fsp->f_u.fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
+
return(outsize);
}
@@ -1676,10 +1678,10 @@ int reply_ctemp(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if(fsp->granted_oplock)
CVAL(outbuf,smb_flg) |= CORE_OPLOCK_GRANTED;
- DEBUG(2,("created temp file %s\n",fname2));
- DEBUG(3,("%s ctemp %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
- timestring(),fname2,fsp->f_u.fd_ptr->fd,fnum,cnum,createmode,unixmode));
-
+ DEBUG( 2, ( "created temp file %s\n", fname2 ) );
+ DEBUG( 3, ( "ctemp %s fd=%d fnum=%d cnum=%d dmode=%d umode=%o\n",
+ fname2, fsp->f_u.fd_ptr->fd, fnum, cnum, createmode, unixmode ) );
+
return(outsize);
}
@@ -1885,10 +1887,9 @@ int reply_readbraw(char *inbuf, char *outbuf, int dum_size, int dum_buffsize)
if (nread < mincount)
nread = 0;
- DEBUG(3,("%s readbraw fnum=%d cnum=%d start=%d max=%d min=%d nread=%d\n",
- timestring(),
- fnum,cnum,startpos,
- maxcount,mincount,nread));
+ DEBUG( 3, ( "readbraw fnum=%d cnum=%d start=%d max=%d min=%d nread=%d\n",
+ fnum, cnum, startpos,
+ maxcount, mincount, nread ) );
#if UNSAFE_READRAW
{
@@ -1955,17 +1956,18 @@ int reply_lockread(char *inbuf,char *outbuf, int dum_size, int dum_buffsiz)
return (ERROR(eclass,ecode));
nread = read_file(fnum,data,startpos,numtoread);
-
+
if (nread < 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
-
+
outsize += nread;
SSVAL(outbuf,smb_vwv0,nread);
SSVAL(outbuf,smb_vwv5,nread+3);
SSVAL(smb_buf(outbuf),1,nread);
-
- DEBUG(3,("%s lockread fnum=%d cnum=%d num=%d nread=%d\n",timestring(),fnum,cnum,numtoread,nread));
-
+
+ DEBUG( 3, ( "lockread fnum=%d cnum=%d num=%d nread=%d\n",
+ fnum, cnum, numtoread, nread ) );
+
return(outsize);
}
@@ -2010,8 +2012,9 @@ int reply_read(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
CVAL(smb_buf(outbuf),0) = 1;
SSVAL(smb_buf(outbuf),1,nread);
- DEBUG(3,("%s read fnum=%d cnum=%d num=%d nread=%d\n",timestring(),fnum,cnum,numtoread,nread));
-
+ DEBUG( 3, ( "read fnum=%d cnum=%d num=%d nread=%d\n",
+ fnum, cnum, numtoread, nread ) );
+
return(outsize);
}
@@ -2055,9 +2058,9 @@ int reply_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
SSVAL(smb_buf(outbuf),-2,nread);
- DEBUG(3,("%s readX fnum=%d cnum=%d min=%d max=%d nread=%d\n",
- timestring(),fnum,cnum,
- smb_mincnt,smb_maxcnt,nread));
+ DEBUG( 3, ( "readX fnum=%d cnum=%d min=%d max=%d nread=%d\n",
+ fnum, cnum,
+ smb_mincnt, smb_maxcnt, nread ) );
chain_fnum = fnum;
@@ -2114,8 +2117,8 @@ int reply_writebraw(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if (numtowrite>0)
nwritten = write_file(fnum,data,numtowrite);
- DEBUG(3,("%s writebraw1 fnum=%d cnum=%d start=%d num=%d wrote=%d sync=%d\n",
- timestring(),fnum,cnum,startpos,numtowrite,nwritten,write_through));
+ DEBUG( 3, ( "writebraw1 fnum=%d cnum=%d start=%d num=%d wrote=%d sync=%d\n",
+ fnum, cnum, startpos, numtowrite, nwritten, write_through ) );
if (nwritten < numtowrite)
return(UNIXERROR(ERRHRD,ERRdiskfull));
@@ -2160,8 +2163,8 @@ int reply_writebraw(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if (lp_syncalways(SNUM(cnum)) || write_through)
sync_file(cnum,fnum);
- DEBUG(3,("%s writebraw2 fnum=%d cnum=%d start=%d num=%d wrote=%d\n",
- timestring(),fnum,cnum,startpos,numtowrite,total_written));
+ DEBUG( 3, ( "writebraw2 fnum=%d cnum=%d start=%d num=%d wrote=%d\n",
+ fnum, cnum, startpos, numtowrite, total_written ) );
/* we won't return a status if write through is not selected - this
follows what WfWg does */
@@ -2222,9 +2225,9 @@ int reply_writeunlock(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVAL(outbuf,smb_vwv0,nwritten);
- DEBUG(3,("%s writeunlock fnum=%d cnum=%d num=%d wrote=%d\n",
- timestring(),fnum,cnum,numtowrite,nwritten));
-
+ DEBUG( 3, ( "writeunlock fnum=%d cnum=%d num=%d wrote=%d\n",
+ fnum, cnum, numtowrite, nwritten ) );
+
return(outsize);
}
@@ -2279,8 +2282,9 @@ int reply_write(char *inbuf,char *outbuf,int dum_size,int dum_buffsize)
SSVAL(outbuf,smb_err,ERRdiskfull);
}
- DEBUG(3,("%s write fnum=%d cnum=%d num=%d wrote=%d\n",timestring(),fnum,cnum,numtowrite,nwritten));
-
+ DEBUG( 3, ( "%s write fnum=%d cnum=%d num=%d wrote=%d\n",
+ fnum, cnum, numtowrite, nwritten ) );
+
return(outsize);
}
@@ -2333,7 +2337,8 @@ int reply_write_and_X(char *inbuf,char *outbuf,int length,int bufsize)
SSVAL(outbuf,smb_err,ERRdiskfull);
}
- DEBUG(3,("%s writeX fnum=%d cnum=%d num=%d wrote=%d\n",timestring(),fnum,cnum,smb_dsize,nwritten));
+ DEBUG( 3, ( "%s writeX fnum=%d cnum=%d num=%d wrote=%d\n",
+ fnum, cnum, smb_dsize, nwritten ) );
chain_fnum = fnum;
@@ -2382,8 +2387,9 @@ int reply_lseek(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,2,0,True);
SIVALS(outbuf,smb_vwv0,res);
- DEBUG(3,("%s lseek fnum=%d cnum=%d ofs=%d mode=%d\n",timestring(),fnum,cnum,startpos,mode));
-
+ DEBUG( 3, ( "lseek fnum=%d cnum=%d ofs=%d mode=%d\n",
+ fnum, cnum, startpos, mode ) );
+
return(outsize);
}
@@ -2414,7 +2420,7 @@ int reply_flush(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
else
sync_file(cnum,fnum);
- DEBUG(3,("%s flush fnum=%d\n",timestring(),fnum));
+ DEBUG( 3, ( "flush fnum=%d\n", fnum ) );
return(outsize);
}
@@ -2425,8 +2431,8 @@ int reply_flush(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
int reply_exit(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
int outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s exit\n",timestring()));
-
+ DEBUG( 3, ( "exit\n" ) );
+
return(outsize);
}
@@ -2472,9 +2478,9 @@ int reply_close(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
* Special case - close NT SMB directory
* handle.
*/
- DEBUG(3,("%s close directory fnum=%d cnum=%d\n",
- timestring(), fnum, cnum ));
- close_directory(fnum);
+ DEBUG( 3, ( "close directory fnum=%d cnum=%d\n",
+ fnum, cnum ) );
+ close_directory( fnum );
} else {
/*
* Close ordinary file.
@@ -2484,9 +2490,9 @@ int reply_close(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
/* try and set the date */
set_filetime(cnum, fsp->name,mtime);
- DEBUG(3,("%s close fd=%d fnum=%d cnum=%d (numopen=%d)\n",
- timestring(),fsp->f_u.fd_ptr->fd,fnum,cnum,
- Connections[cnum].num_files_open));
+ DEBUG( 3, ( "close fd=%d fnum=%d cnum=%d (numopen=%d)\n",
+ fsp->f_u.fd_ptr->fd, fnum, cnum,
+ Connections[cnum].num_files_open ) );
close_file(fnum,True);
}
@@ -2534,9 +2540,9 @@ int reply_writeclose(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
close_file(fnum,True);
- DEBUG(3,("%s writeclose fnum=%d cnum=%d num=%d wrote=%d (numopen=%d)\n",
- timestring(),fnum,cnum,numtowrite,nwritten,
- Connections[cnum].num_files_open));
+ DEBUG( 3, ( "writeclose fnum=%d cnum=%d num=%d wrote=%d (numopen=%d)\n",
+ fnum, cnum, numtowrite, nwritten,
+ Connections[cnum].num_files_open ) );
if (nwritten <= 0)
return(UNIXERROR(ERRDOS,ERRnoaccess));
@@ -2568,12 +2574,12 @@ int reply_lock(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
count = IVAL(inbuf,smb_vwv1);
offset = IVAL(inbuf,smb_vwv3);
- DEBUG(3,("%s lock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
- timestring(),Files[fnum].f_u.fd_ptr->fd,fnum,cnum,offset,count));
+ DEBUG( 3, ("lock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
+ Files[fnum].f_u.fd_ptr->fd, fnum, cnum, offset, count ) );
if(!do_lock( fnum, cnum, count, offset, F_WRLCK, &eclass, &ecode))
return (ERROR(eclass,ecode));
-
+
return(outsize);
}
@@ -2601,8 +2607,8 @@ int reply_unlock(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if(!do_unlock(fnum, cnum, count, offset, &eclass, &ecode))
return (ERROR(eclass,ecode));
- DEBUG(3,("%s unlock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
- timestring(),Files[fnum].f_u.fd_ptr->fd,fnum,cnum,offset,count));
+ DEBUG( 3, ( "unlock fd=%d fnum=%d cnum=%d ofs=%d cnt=%d\n",
+ Files[fnum].f_u.fd_ptr->fd, fnum, cnum, offset, count ) );
return(outsize);
}
@@ -2629,7 +2635,7 @@ int reply_tdis(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
close_cnum(cnum,vuid);
- DEBUG(3,("%s tdis cnum=%d\n",timestring(),cnum));
+ DEBUG( 3, ( "tdis cnum=%d\n", cnum ) );
return outsize;
}
@@ -2680,7 +2686,7 @@ int reply_echo(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
send_smb(Client,outbuf);
}
- DEBUG(3,("%s echo %d times cnum=%d\n",timestring(),smb_reverb,cnum));
+ DEBUG( 3, ( "echo %d times cnum=%d\n", smb_reverb, cnum ) );
return -1;
}
@@ -2750,9 +2756,9 @@ int reply_printopen(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,1,0,True);
SSVAL(outbuf,smb_vwv0,fnum);
- DEBUG(3,("%s openprint %s fd=%d fnum=%d cnum=%d\n",
- timestring(),fname2,fsp->f_u.fd_ptr->fd,fnum,cnum));
-
+ DEBUG( 3, ("openprint %s fd=%d fnum=%d cnum=%d\n",
+ fname2, fsp->f_u.fd_ptr->fd, fnum, cnum ) );
+
return(outsize);
}
@@ -2774,8 +2780,8 @@ int reply_printclose(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if (!CAN_PRINT(cnum))
return(ERROR(ERRDOS,ERRnoaccess));
- DEBUG(3,("%s printclose fd=%d fnum=%d cnum=%d\n",
- timestring(),Files[fnum].f_u.fd_ptr->fd,fnum,cnum));
+ DEBUG( 3, ( "printclose fd=%d fnum=%d cnum=%d\n",
+ Files[fnum].f_u.fd_ptr->fd,fnum,cnum));
close_file(fnum,True);
@@ -2808,8 +2814,8 @@ int reply_printqueue(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
CVAL(smb_buf(outbuf),0) = 1;
SSVAL(smb_buf(outbuf),1,0);
- DEBUG(3,("%s printqueue cnum=%d start_index=%d max_count=%d\n",
- timestring(),cnum,start_index,max_count));
+ DEBUG( 3, ( "printqueue cnum=%d start_index=%d max_count=%d\n",
+ cnum, start_index, max_count ) );
if (!OPEN_CNUM(cnum) || !Connections[cnum].printer)
{
@@ -2903,7 +2909,7 @@ int reply_printwrite(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if (write_file(fnum,data,numtowrite) != numtowrite)
return(UNIXERROR(ERRDOS,ERRnoaccess));
- DEBUG(3,("%s printwrite fnum=%d cnum=%d num=%d\n",timestring(),fnum,cnum,numtowrite));
+ DEBUG( 3, ( "printwrite fnum=%d cnum=%d num=%d\n", fnum, cnum, numtowrite ) );
return(outsize);
}
@@ -2935,11 +2941,11 @@ int reply_mkdir(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
}
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
-
+
outsize = set_message(outbuf,0,0,True);
-
- DEBUG(3,("%s mkdir %s cnum=%d ret=%d\n",timestring(),directory,cnum,ret));
-
+
+ DEBUG( 3, ( "mkdir %s cnum=%d ret=%d\n", directory, cnum, ret ) );
+
return(outsize);
}
@@ -3111,7 +3117,7 @@ int reply_rmdir(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s rmdir %s\n",timestring(),directory));
+ DEBUG( 3, ( "rmdir %s\n", directory ) );
return(outsize);
}
@@ -3650,9 +3656,9 @@ int reply_setdir(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
outsize = set_message(outbuf,0,0,True);
CVAL(outbuf,smb_reh) = CVAL(inbuf,smb_reh);
-
- DEBUG(3,("%s setdir %s cnum=%d\n",timestring(),newdir,cnum));
-
+
+ DEBUG( 3, ( "setdir %s cnum=%d\n", newdir, cnum ) );
+
return(outsize);
}
@@ -3766,8 +3772,8 @@ dev = %x, inode = %x\n",
set_message(outbuf,2,0,True);
- DEBUG(3,("%s lockingX fnum=%d cnum=%d type=%d num_locks=%d num_ulocks=%d\n",
- timestring(),fnum,cnum,(unsigned int)locktype,num_locks,num_ulocks));
+ DEBUG( 3, ( "lockingX fnum=%d cnum=%d type=%d num_locks=%d num_ulocks=%d\n",
+ fnum, cnum, (unsigned int)locktype, num_locks, num_ulocks ) );
chain_fnum = fnum;
@@ -3922,9 +3928,9 @@ int reply_writebmpx(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
SSVALS(outbuf,smb_vwv0,-1); /* We don't support smb_remaining */
- DEBUG(3,("%s writebmpx fnum=%d cnum=%d num=%d wrote=%d\n",
- timestring(),fnum,cnum,numtowrite,nwritten));
-
+ DEBUG( 3, ( "writebmpx fnum=%d cnum=%d num=%d wrote=%d\n",
+ fnum, cnum, numtowrite, nwritten ) );
+
if (write_through && tcount==nwritten) {
/* we need to send both a primary and a secondary response */
smb_setlen(outbuf,outsize - 4);
@@ -4052,9 +4058,11 @@ int reply_setattrE(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
if ((unix_times.actime == 0) && (unix_times.modtime == 0))
{
/* Ignore request */
- DEBUG(3,("%s reply_setattrE fnum=%d cnum=%d ignoring zero request - \
-not setting timestamps of 0\n",
- timestring(), fnum,cnum,unix_times.actime,unix_times.modtime));
+ if( DEBUGLVL( 3 ) )
+ {
+ dbgtext( "reply_setattrE fnum=%d cnum=%d ", fnum, cnum );
+ dbgtext( "ignoring zero request - not setting timestamps of 0\n" );
+ }
return(outsize);
}
else if ((unix_times.actime != 0) && (unix_times.modtime == 0))
@@ -4067,8 +4075,8 @@ not setting timestamps of 0\n",
if(file_utime(cnum, Files[fnum].name, &unix_times))
return(ERROR(ERRDOS,ERRnoaccess));
- DEBUG(3,("%s reply_setattrE fnum=%d cnum=%d actime=%d modtime=%d\n",
- timestring(), fnum,cnum,unix_times.actime,unix_times.modtime));
+ DEBUG( 3, ( "reply_setattrE fnum=%d cnum=%d actime=%d modtime=%d\n",
+ fnum, cnum, unix_times.actime, unix_times.modtime ) );
return(outsize);
}
@@ -4116,7 +4124,7 @@ int reply_getattrE(char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
}
SSVAL(outbuf,smb_vwv10, mode);
- DEBUG(3,("%s reply_getattrE fnum=%d cnum=%d\n",timestring(),fnum,cnum));
+ DEBUG( 3, ( "reply_getattrE fnum=%d cnum=%d\n", fnum, cnum ) );
return(outsize);
}
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 056611a8864..2fc6bd2007e 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -1302,11 +1302,10 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
write_file(fnum,"%!\n",3);
}
- DEBUG(2,("%s %s opened file %s read=%s write=%s (numopen=%d fnum=%d)\n",
- timestring(),
+ DEBUG( 2, ( "%s opened file %s read=%s write=%s (numopen=%d fnum=%d)\n",
*sesssetup_user ? sesssetup_user : Connections[cnum].user,fname,
- BOOLSTR(fsp->can_read),BOOLSTR(fsp->can_write),
- Connections[cnum].num_files_open,fnum));
+ BOOLSTR(fsp->can_read), BOOLSTR(fsp->can_write),
+ Connections[cnum].num_files_open,fnum ) );
}
@@ -1452,9 +1451,9 @@ void close_file(int fnum, BOOL normal_close)
fs_p->sent_oplock_break = False;
- DEBUG(2,("%s %s closed file %s (numopen=%d)\n",
- timestring(),Connections[cnum].user,fs_p->name,
- Connections[cnum].num_files_open));
+ DEBUG( 2, ( "%s closed file %s (numopen=%d)\n",
+ Connections[cnum].user,fs_p->name,
+ Connections[cnum].num_files_open ) );
if (fs_p->name) {
string_free(&fs_p->name);
@@ -2201,8 +2200,8 @@ BOOL become_service(int cnum,BOOL do_chdir)
ChDir(Connections[cnum].connectpath) != 0 &&
ChDir(Connections[cnum].origpath) != 0)
{
- DEBUG(0,("%s chdir (%s) failed cnum=%d\n",timestring(),
- Connections[cnum].connectpath,cnum));
+ DEBUG( 0, ( "chdir (%s) failed cnum=%d\n",
+ Connections[cnum].connectpath, cnum ) );
return(False);
}
@@ -2419,20 +2418,19 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int
{
SIVAL(outbuf,smb_rcls,error_code);
- DEBUG(3,("%s 32 bit error packet at line %d cmd=%d (%s) eclass=%08x [%s]\n",
- timestring(), line, cmd, smb_fn_name(cmd), error_code, smb_errstr(outbuf)));
+ DEBUG( 3, ( "32 bit error packet at line %d cmd=%d (%s) eclass=%08x [%s]\n",
+ line, cmd, smb_fn_name(cmd), error_code, smb_errstr(outbuf) ) );
}
else
{
CVAL(outbuf,smb_rcls) = error_class;
SSVAL(outbuf,smb_err,error_code);
- DEBUG(3,("%s error packet at line %d cmd=%d (%s) eclass=%d ecode=%d\n",
- timestring(),
- line,
- (int)CVAL(inbuf,smb_com),
- smb_fn_name(CVAL(inbuf,smb_com)),
- error_class,
- error_code));
+ DEBUG( 3, ( "error packet at line %d cmd=%d (%s) eclass=%d ecode=%d\n",
+ line,
+ (int)CVAL(inbuf,smb_com),
+ smb_fn_name(CVAL(inbuf,smb_com)),
+ error_class,
+ error_code ) );
}
@@ -2680,15 +2678,15 @@ static void process_smb(char *inbuf, char *outbuf)
/* send a negative session response "not listining on calling
name" */
static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
- DEBUG(1,("%s Connection denied from %s\n",
- timestring(),client_addr(Client)));
+ 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,("%s Transaction %d of length %d\n",timestring(),trans_num,nread));
+ 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){
@@ -2908,8 +2906,11 @@ BOOL oplock_break(uint32 dev, uint32 inode, struct timeval *tval)
int saved_vuid;
pstring saved_dir;
- DEBUG(3,("%s oplock_break: called for dev = %x, inode = %x. Current \
-global_oplocks_open = %d\n", timestring(), dev, inode, global_oplocks_open));
+ if( DEBUGLVL( 3 ) )
+ {
+ dbgtext( "oplock_break: called for dev = %x, inode = %x.\n", dev, inode );
+ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open );
+ }
/* We need to search the file open table for the
entry containing this dev and inode, and ensure
@@ -2930,8 +2931,12 @@ global_oplocks_open = %d\n", timestring(), dev, inode, global_oplocks_open));
if(fsp == NULL)
{
/* The file could have been closed in the meantime - return success. */
- DEBUG(0,("%s oplock_break: cannot find open file with dev = %x, inode = %x (fnum = %d) \
-allowing break to succeed.\n", timestring(), dev, inode, fnum));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "oplock_break: cannot find open file with " );
+ dbgtext( "dev = %x, inode = %x (fnum = %d) ", dev, inode, fnum );
+ dbgtext( "allowing break to succeed.\n" );
+ }
return True;
}
@@ -2946,18 +2951,30 @@ allowing break to succeed.\n", timestring(), dev, inode, fnum));
if(!fsp->granted_oplock)
{
- DEBUG(0,("%s oplock_break: file %s (fnum = %d, dev = %x, inode = %x) has no oplock. Allowing break to succeed regardless.\n", timestring(), fsp->name, fnum, dev, inode));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "oplock_break: file %s (fnum = %d, ", fsp->name, fnum );
+ dbgtext( "dev = %x, inode = %x) has no oplock.\n", dev, inode );
+ dbgtext( "Allowing break to succeed regardless.\n" );
+ }
return True;
}
/* mark the oplock break as sent - we don't want to send twice! */
if (fsp->sent_oplock_break)
{
- DEBUG(0,("%s oplock_break: ERROR: oplock_break already sent for file %s (fnum = %d, dev = %x, inode = %x)\n", timestring(), fsp->name, fnum, dev, inode));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "oplock_break: ERROR: oplock_break already sent for " );
+ dbgtext( "file %s (fnum = %d, ", fsp->name, fnum );
+ dbgtext( "dev = %x, inode = %x)\n", dev, inode );
+ }
- /* We have to fail the open here as we cannot send another oplock break on this
- file whilst we are awaiting a response from the client - neither can we
- allow another open to succeed while we are waiting for the client. */
+ /* We have to fail the open here as we cannot send another oplock break on
+ this file whilst we are awaiting a response from the client - neither
+ can we allow another open to succeed while we are waiting for the
+ client.
+ */
return False;
}
@@ -3030,18 +3047,17 @@ allowing break to succeed.\n", timestring(), dev, inode, fnum));
*/
if (smb_read_error == READ_EOF)
- DEBUG(0,("%s oplock_break: end of file from client\n", timestring()));
+ DEBUG( 0, ( "oplock_break: end of file from client\n" ) );
if (smb_read_error == READ_ERROR)
- DEBUG(0,("%s oplock_break: receive_smb error (%s)\n",
- timestring(), strerror(errno)));
+ DEBUG( 0, ("oplock_break: receive_smb error (%s)\n", strerror(errno)) );
if (smb_read_error == READ_TIMEOUT)
- DEBUG(0,("%s oplock_break: receive_smb timed out after %d seconds.\n",
- timestring(), OPLOCK_BREAK_TIMEOUT));
+ DEBUG( 0, ( "oplock_break: receive_smb timed out after %d seconds.\n",
+ OPLOCK_BREAK_TIMEOUT ) );
- DEBUG(0,("%s oplock_break failed for file %s (fnum = %d, dev = %x, \
-inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
+ DEBUGADD( 0, ( "oplock_break failed for file %s ", fsp->name ) );
+ DEBUGADD( 0, ( "(fnum = %d, dev = %x, inode = %x).\n", fnum, dev, inode));
shutdown_server = True;
break;
}
@@ -3063,10 +3079,13 @@ inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
if((time(NULL) - start_time) > OPLOCK_BREAK_TIMEOUT)
{
- DEBUG(0,("%s oplock_break: no break received from client within \
-%d seconds.\n", timestring(), OPLOCK_BREAK_TIMEOUT));
- DEBUG(0,("%s oplock_break failed for file %s (fnum = %d, dev = %x, \
-inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "oplock_break: no break received from client " );
+ dbgtext( "within %d seconds.\n", OPLOCK_BREAK_TIMEOUT );
+ dbgtext( "oplock_break failed for file %s ", fsp->name );
+ dbgtext( "(fnum = %d, dev = %x, inode = %x).\n", fnum, dev, inode );
+ }
shutdown_server = True;
break;
}
@@ -3078,8 +3097,8 @@ inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
*/
if(!become_user(&Connections[saved_cnum], saved_cnum, saved_vuid))
{
- DEBUG(0,("%s oplock_break: unable to re-become user ! Shutting down server\n",
- timestring()));
+ DEBUG( 0, ( "oplock_break: unable to re-become user!" ) );
+ DEBUGADD( 0, ( "Shutting down server\n" ) );
close_sockets();
close(oplock_sock);
exit_server("unable to re-become user");
@@ -3101,8 +3120,8 @@ inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
if(shutdown_server)
{
- DEBUG(0,("%s oplock_break: client failure in break - shutting down this smbd.\n",
- timestring()));
+ DEBUG( 0, ( "oplock_break: client failure in break - " ) );
+ DEBUGADD( 0, ( "shutting down this smbd.\n" ) );
close_sockets();
close(oplock_sock);
exit_server("oplock break failure");
@@ -3126,8 +3145,12 @@ inode = %x).\n", timestring(), fsp->name, fnum, dev, inode));
exit_server("oplock_break: global_oplocks_open < 0");
}
- DEBUG(3,("%s oplock_break: returning success for fnum = %d, dev = %x, inode = %x. Current \
-global_oplocks_open = %d\n", timestring(), fnum, dev, inode, global_oplocks_open));
+ if( DEBUGLVL( 3 ) )
+ {
+ dbgtext( "oplock_break: returning success for " );
+ dbgtext( "fnum = %d, dev = %x, inode = %x.\n", fnum, dev, inode );
+ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open );
+ }
return True;
}
@@ -3178,16 +3201,24 @@ should be %d\n", pid, share_entry->op_port, oplock_port));
addr_out.sin_port = htons( share_entry->op_port );
addr_out.sin_family = AF_INET;
- DEBUG(3,("%s request_oplock_break: sending a oplock break message to pid %d on port %d \
-for dev = %x, inode = %x\n", timestring(), share_entry->pid, share_entry->op_port, dev, inode));
+ if( DEBUGLVL( 3 ) )
+ {
+ dbgtext( "request_oplock_break: sending a oplock break message to " );
+ dbgtext( "pid %d on port %d ", share_entry->pid, share_entry->op_port );
+ dbgtext( "for dev = %x, inode = %x\n", dev, inode );
+ }
if(sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0,
(struct sockaddr *)&addr_out,sizeof(addr_out)) < 0)
{
- DEBUG(0,("%s request_oplock_break: failed when sending a oplock break message \
-to pid %d on port %d for dev = %x, inode = %x. Error was %s\n",
- timestring(), share_entry->pid, share_entry->op_port, dev, inode,
- strerror(errno)));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "request_oplock_break: failed when sending a oplock " );
+ dbgtext( "break message to pid %d ", share_entry->pid );
+ dbgtext( "on port %d ", share_entry->op_port );
+ dbgtext( "for dev = %x, inode = %x.\n", dev, inode );
+ dbgtext( "Error was %s\n", strerror(errno) );
+ }
return False;
}
@@ -3213,9 +3244,13 @@ to pid %d on port %d for dev = %x, inode = %x. Error was %s\n",
{
if(smb_read_error == READ_TIMEOUT)
{
- DEBUG(0,("%s request_oplock_break: no response received to oplock break request to \
-pid %d on port %d for dev = %x, inode = %x\n", timestring(), share_entry->pid,
- share_entry->op_port, dev, inode));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "request_oplock_break: no response received to oplock " );
+ dbgtext( "break request to pid %d ", share_entry->pid );
+ dbgtext( "on port %d ", share_entry->op_port );
+ dbgtext( "for dev = %x, inode = %x\n", dev, inode );
+ }
/*
* This is a hack to make handling of failing clients more robust.
* If a oplock break response message is not received in the timeout
@@ -3226,9 +3261,14 @@ pid %d on port %d for dev = %x, inode = %x\n", timestring(), share_entry->pid,
break;
}
else
- DEBUG(0,("%s request_oplock_break: error in response received to oplock break request to \
-pid %d on port %d for dev = %x, inode = %x. Error was (%s).\n", timestring, share_entry->pid,
- share_entry->op_port, dev, inode, strerror(errno)));
+ if( DEBUGLVL( 0 ) )
+ {
+ dbgtext( "request_oplock_break: error in response received " );
+ dbgtext( "to oplock break request to pid %d ", share_entry->pid );
+ dbgtext( "on port %d ", share_entry->op_port );
+ dbgtext( "for dev = %x, inode = %x.\n", dev, inode );
+ dbgtext( "Error was (%s).\n", strerror(errno) );
+ }
return False;
}
@@ -3240,8 +3280,8 @@ pid %d on port %d for dev = %x, inode = %x. Error was (%s).\n", timestring, shar
if(reply_msg_len != OPLOCK_BREAK_MSG_LEN)
{
/* Ignore it. */
- DEBUG(0,("%s request_oplock_break: invalid message length received. Ignoring\n",
- timestring()));
+ DEBUG( 0, ( "request_oplock_break: invalid message length received." ) );
+ DEBUGADD( 0, ( " Ignoring.\n" ) );
continue;
}
@@ -3278,7 +3318,7 @@ pid %d on port %d for dev = %x, inode = %x. Error was (%s).\n", timestring, shar
time_left -= (time(NULL) - start_time);
}
- DEBUG(3,("%s request_oplock_break: broke oplock.\n", timestring()));
+ DEBUG( 3, ( "%s request_oplock_break: broke oplock.\n" ) );
return True;
}
@@ -3422,12 +3462,13 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
{
extern int Client;
if (strequal(service,"IPC$"))
- {
- DEBUG(3,("%s refusing IPC connection\n",timestring()));
- return(-3);
+ {
+ DEBUG( 3, ( "refusing IPC connection\n" ) );
+ return( -3 );
}
- DEBUG(0,("%s %s (%s) couldn't find service %s\n",timestring(),remote_machine,client_addr(Client),service));
+ DEBUG( 0, ( "%s (%s) couldn't find service %s\n",
+ remote_machine, client_addr(Client), service ) );
return(-2);
}
@@ -3489,14 +3530,14 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
/* shall we let them in? */
if (!authorise_login(snum,user,password,pwlen,&guest,&force,vuid))
{
- DEBUG(2,("%s invalid username/password for %s\n",timestring(),service));
+ DEBUG( 2, ( "Invalid username/password for %s\n", service ) );
return(-1);
}
- cnum = find_free_connection(str_checksum(service) + str_checksum(user));
+ cnum = find_free_connection( str_checksum(service) + str_checksum(user) );
if (cnum < 0)
{
- DEBUG(0,("%s couldn't find free connection\n",timestring()));
+ DEBUG( 0, ( "Couldn't find free connection.\n" ) );
return(-1);
}
@@ -3508,7 +3549,7 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
if (pass == NULL)
{
- DEBUG(0,("%s couldn't find account %s\n",timestring(),user));
+ DEBUG( 0, ( "Couldn't find account %s\n", user ) );
return(-7);
}
@@ -3711,17 +3752,16 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
set_namearray( &pcon->veto_oplock_list, lp_veto_oplocks(SNUM(cnum)));
}
- {
+ if( DEBUGLVL( IS_IPC(cnum) ? 3 : 1 ) )
+ {
extern int Client;
- DEBUG(IS_IPC(cnum)?3:1,("%s %s (%s) connect to service %s as user %s (uid=%d,gid=%d) (pid %d)\n",
- timestring(),
- remote_machine,
- client_addr(Client),
- lp_servicename(SNUM(cnum)),user,
- pcon->uid,
- pcon->gid,
- (int)getpid()));
- }
+
+ dbgtext( "%s (%s) ", remote_machine, client_addr(Client) );
+ dbgtext( "connect to service %s ", lp_servicename(SNUM(cnum)) );
+ dbgtext( "as user %s ", user );
+ dbgtext( "(uid=%d, gid=%d) ", pcon->uid, pcon->gid );
+ dbgtext( "(pid %d)\n", (int)getpid() );
+ }
return(cnum);
}
@@ -4235,7 +4275,7 @@ static int reply_negprot(char *inbuf,char *outbuf, int dum_size, int dum_buffsiz
}
SSVAL(outbuf,smb_vwv0,choice);
- DEBUG(5,("%s negprot index=%d\n",timestring(),choice));
+ DEBUG( 5, ( "negprot index=%d\n", choice ) );
return(outsize);
}
@@ -4274,10 +4314,9 @@ void close_cnum(int cnum, uint16 vuid)
return;
}
- DEBUG(IS_IPC(cnum)?3:1,("%s %s (%s) closed connection to service %s\n",
- timestring(),
- remote_machine,client_addr(Client),
- lp_servicename(SNUM(cnum))));
+ DEBUG( IS_IPC(cnum)?3:1, ( "%s (%s) closed connection to service %s\n",
+ remote_machine,client_addr(Client),
+ lp_servicename(SNUM(cnum)) ) );
yield_connection(cnum,
lp_servicename(SNUM(cnum)),
@@ -4400,7 +4439,7 @@ void exit_server(char *reason)
locking_end();
- DEBUG(3,("%s Server exit (%s)\n",timestring(),reason?reason:""));
+ DEBUG( 3, ( "Server exit (%s)\n", (reason ? reason : "") ) );
exit(0);
}
@@ -4645,10 +4684,10 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize
* Queue this message as we are the process of an oplock break.
*/
- DEBUG(2,("%s: switch_message: queueing message due to being in oplock break state.\n",
- timestring() ));
+ DEBUG( 2, ( "switch_message: queueing message due to being in " ) );
+ DEBUGADD( 2, ( "oplock break state.\n" ) );
- push_oplock_pending_smb_message( inbuf, size);
+ push_oplock_pending_smb_message( inbuf, size );
return -1;
}
@@ -4995,15 +5034,15 @@ static void process(void)
/* automatic timeout if all connections are closed */
if (num_connections_open==0 && counter >= IDLE_CLOSED_TIMEOUT)
{
- DEBUG(2,("%s Closing idle connection\n",timestring()));
+ DEBUG( 2, ( "Closing idle connection\n" ) );
return;
}
if (keepalive && (counter-last_keepalive)>keepalive)
{
struct cli_state *cli = server_client();
- if (!send_keepalive(Client)) {
- DEBUG(2,("%s Keepalive failed - exiting\n",timestring()));
+ if (!send_keepalive(Client)) {
+ DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
return;
}
/* also send a keepalive to the password server if its still
@@ -5028,7 +5067,7 @@ static void process(void)
if (allidle && num_connections_open>0)
{
- DEBUG(2,("%s Closing idle connection 2\n",timestring()));
+ DEBUG( 2, ( "Closing idle connection 2.\n" ) );
return;
}
@@ -5281,8 +5320,8 @@ static void usage(char *pname)
reopen_logs();
- DEBUG(2,("%s smbd version %s started\n",timestring(),VERSION));
- DEBUG(2,("Copyright Andrew Tridgell 1992-1997\n"));
+ DEBUG( 1, ( "smbd version %s started.\n", VERSION ) );
+ DEBUGADD( 1, ( "Copyright Andrew Tridgell 1992-1997\n" ) );
#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_NOFILE
@@ -5353,7 +5392,7 @@ static void usage(char *pname)
#endif /* SIGUSR2 */
#endif /* MEM_MAN */
- DEBUG(3,("%s loaded services\n",timestring()));
+ DEBUG( 3, ( "loaded services\n" ) );
if (!is_daemon && !is_a_socket(0))
{
@@ -5363,7 +5402,7 @@ static void usage(char *pname)
if (is_daemon)
{
- DEBUG(3,("%s becoming a daemon\n",timestring()));
+ DEBUG( 3, ( "Becoming a daemon.\n" ) );
become_daemon();
}
@@ -5392,11 +5431,11 @@ static void usage(char *pname)
if (*lp_rootdir())
{
if (sys_chroot(lp_rootdir()) == 0)
- DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir()));
+ DEBUG( 2, ( "Changed root to %s\n", lp_rootdir() ) );
}
/* Setup the oplock IPC socket. */
- if(!open_oplock_ipc())
+ if( !open_oplock_ipc() )
exit(1);
process();
diff --git a/source/smbd/ssl.c b/source/smbd/ssl.c
index 68b45016b82..27bb8f3a525 100644
--- a/source/smbd/ssl.c
+++ b/source/smbd/ssl.c
@@ -246,16 +246,15 @@ char *reqHosts, *resignHosts;
return 0;
}
if(msg_type != 0x81){ /* first packet must be a session request */
- DEBUG(0, ("%s Client %s did not use session setup; access denied\n",
- timestring(), client_addr(fd)));
+ DEBUG( 0, ( "Client %s did not use session setup; access denied\n",
+ client_addr(fd) ) );
send_smb(fd, (char *)buf);
return -1;
}
buf[4] = 0x8e; /* negative session response: use SSL */
send_smb(fd, (char *)buf);
if(sslutil_accept(fd) != 0){
- DEBUG(0, ("%s Client %s failed SSL negotiation!\n",
- timestring(), client_addr(fd)));
+ DEBUG( 0, ( "Client %s failed SSL negotiation!\n", client_addr(fd) ) );
return -1;
}
return 1;
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index 08f68030050..7f34187bd6d 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -807,10 +807,9 @@ static int call_trans2findfirst(char *inbuf, char *outbuf, int bufsize, int cnum
if ((! *directory) && dptr_path(dptr_num))
slprintf(directory,sizeof(directory)-1, "(%s)",dptr_path(dptr_num));
- DEBUG(4,("%s %s mask=%s directory=%s cnum=%d dirtype=%d numentries=%d\n",
- timestring(),
- smb_fn_name(CVAL(inbuf,smb_com)),
- mask,directory,cnum,dirtype,numentries));
+ DEBUG( 4, ( "%s mask=%s directory=%s cnum=%d dirtype=%d numentries=%d\n",
+ smb_fn_name(CVAL(inbuf,smb_com)),
+ mask, directory, cnum, dirtype, numentries ) );
return(-1);
}
@@ -1020,10 +1019,9 @@ resume_key = %d resume name = %s continue=%d level = %d\n",
if ((! *directory) && dptr_path(dptr_num))
slprintf(directory,sizeof(directory)-1, "(%s)",dptr_path(dptr_num));
- DEBUG(3,("%s %s mask=%s directory=%s cnum=%d dirtype=%d numentries=%d\n",
- timestring(),
- smb_fn_name(CVAL(inbuf,smb_com)),
- mask,directory,cnum,dirtype,numentries));
+ DEBUG( 3, ( "%s mask=%s directory=%s cnum=%d dirtype=%d numentries=%d\n",
+ smb_fn_name(CVAL(inbuf,smb_com)),
+ mask, directory, cnum, dirtype, numentries ) );
return(-1);
}
@@ -1133,7 +1131,8 @@ static int call_trans2qfsinfo(char *inbuf, char *outbuf, int length, int bufsize
send_trans2_replies( outbuf, bufsize, params, 0, pdata, data_len);
- DEBUG(4,("%s %s info_level =%d\n",timestring(),smb_fn_name(CVAL(inbuf,smb_com)), info_level));
+ DEBUG( 4, ( "%s info_level = %d\n",
+ smb_fn_name(CVAL(inbuf,smb_com)), info_level) );
return -1;
}
@@ -1719,7 +1718,7 @@ int reply_findclose(char *inbuf,char *outbuf,int length,int bufsize)
outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s SMBfindclose cnum=%d, dptr_num = %d\n",timestring(),cnum,dptr_num));
+ DEBUG( 3, ( "SMBfindclose cnum=%d, dptr_num = %d\n", cnum, dptr_num ) );
return(outsize);
}
@@ -1744,7 +1743,7 @@ int reply_findnclose(char *inbuf,char *outbuf,int length,int bufsize)
outsize = set_message(outbuf,0,0,True);
- DEBUG(3,("%s SMB_findnclose cnum=%d, dptr_num = %d\n",timestring(),cnum,dptr_num));
+ DEBUG( 3, ( "SMB_findnclose cnum=%d, dptr_num = %d\n", cnum, dptr_num ) );
return(outsize);
}
@@ -1787,8 +1786,8 @@ int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize)
* Queue this open message as we are the process of an oplock break.
*/
- DEBUG(2,("%s: reply_trans2: queueing message trans2open due to being in oplock break state.\n",
- timestring() ));
+ DEBUG( 2, ( "reply_trans2: queueing message trans2open due to being " ) );
+ DEBUGADD( 2, ( "in oplock break state.\n" ) );
push_oplock_pending_smb_message( inbuf, length);
return -1;
@@ -1915,7 +1914,7 @@ int reply_trans2(char *inbuf,char *outbuf,int length,int bufsize)
break;
default:
/* Error in request */
- DEBUG(2,("%s Unknown request %d in trans2 call\n",timestring(), tran_call));
+ DEBUG( 2, ( "Unknown request %d in trans2 call\n", tran_call ) );
if(params)
free(params);
if(data)
diff --git a/source/smbd/uid.c b/source/smbd/uid.c
index 173fdaca03c..82ff7ee7cea 100644
--- a/source/smbd/uid.c
+++ b/source/smbd/uid.c
@@ -327,8 +327,7 @@ BOOL unbecome_user(void )
current_user.gid = initial_gid;
if (ChDir(OriginalDir) != 0)
- DEBUG(0,("%s chdir(%s) failed in unbecome_user\n",
- timestring(),OriginalDir));
+ DEBUG( 0, ( "chdir(%s) failed in unbecome_user\n", OriginalDir ) );
DEBUG(5,("unbecome_user now uid=(%d,%d) gid=(%d,%d)\n",
getuid(),geteuid(),getgid(),getegid()));
diff --git a/source/smbd/vt_mode.c b/source/smbd/vt_mode.c
index 6e95bac3c25..64272ed8dad 100644
--- a/source/smbd/vt_mode.c
+++ b/source/smbd/vt_mode.c
@@ -452,7 +452,7 @@ void VT_Process(void)
nread = len + 4;
- DEBUG(3,("%s Transaction %d of length %d\n",timestring(),trans_num,nread));
+ DEBUG( 3, ("Transaction %d of length %d\n", trans_num, nread ) );
if(msg_type == 0)
VT_Output(InBuffer);