From f996885676f041437430bfd5843a3000611b0923 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 17 Mar 1998 12:31:43 +0000 Subject: this isn't a big commit, it just looks like it :-) I needed the client_name() and client_addr() functions in swat so I could tell who was connecting from where. The problem was that these functions didn't take a file descriptor parameter they just used the global "Client". So I needed to change all calls to pass a parameter ... lots of files. (This used to be commit a776058900a727591bd7b69debdaa25c0e31d693) --- source3/smbd/connection.c | 3 ++- source3/smbd/password.c | 22 +++++++++++----------- source3/smbd/reply.c | 2 +- source3/smbd/server.c | 8 +++++--- 4 files changed, 19 insertions(+), 16 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 610afbc3e5..5cf8b800f2 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -115,6 +115,7 @@ simple routines to do connection counting ****************************************************************************/ BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear) { + extern int Client; struct connect_record crec; pstring fname; int fd=-1; @@ -200,7 +201,7 @@ BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear) crec.start = time(NULL); StrnCpy(crec.machine,remote_machine,sizeof(crec.machine)-1); - StrnCpy(crec.addr,client_addr(),sizeof(crec.addr)-1); + StrnCpy(crec.addr,client_addr(Client),sizeof(crec.addr)-1); /* make our mark */ if (lseek(fd,foundi*sizeof(crec),SEEK_SET) != foundi*sizeof(crec) || diff --git a/source3/smbd/password.c b/source3/smbd/password.c index bb0aacac7e..ffa75d7d0b 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -1640,21 +1640,21 @@ BOOL check_hosts_equiv(char *user) fname = lp_hosts_equiv(); /* note: don't allow hosts.equiv on root */ - if (fname && *fname && (pass->pw_uid != 0)) - { - if (check_user_equiv(user,client_name(),fname)) - return(True); - } + if (fname && *fname && (pass->pw_uid != 0)) { + extern int Client; + if (check_user_equiv(user,client_name(Client),fname)) + return(True); + } if (lp_use_rhosts()) { char *home = get_home_dir(user); - if (home) - { - sprintf(rhostsfile, "%s/.rhosts", home); - if (check_user_equiv(user,client_name(),rhostsfile)) - return(True); - } + if (home) { + extern int Client; + sprintf(rhostsfile, "%s/.rhosts", home); + if (check_user_equiv(user,client_name(Client),rhostsfile)) + return(True); + } } return(False); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 4d163d70a0..8afda69b32 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -57,7 +57,7 @@ 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())); + DEBUG(0,("Attack was from IP=%s\n", client_addr(Client))); exit_server("possible attack"); } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 248a2cee5f..f51342d0e5 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -2625,7 +2625,7 @@ static void process_smb(char *inbuf, char *outbuf) name" */ static unsigned char buf[5] = {0x83, 0, 0, 1, 0x81}; DEBUG(1,("%s Connection denied from %s\n", - timestring(),client_addr())); + timestring(),client_addr(Client))); send_smb(Client,(char *)buf); exit_server("connection denied"); } @@ -3597,10 +3597,11 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de } { + 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_addr(Client), lp_servicename(SNUM(cnum)),user, pcon->uid, pcon->gid, @@ -4143,6 +4144,7 @@ close a cnum ****************************************************************************/ void close_cnum(int cnum, uint16 vuid) { + extern int Client; DirCacheFlush(SNUM(cnum)); unbecome_user(); @@ -4155,7 +4157,7 @@ void close_cnum(int cnum, uint16 vuid) DEBUG(IS_IPC(cnum)?3:1,("%s %s (%s) closed connection to service %s\n", timestring(), - remote_machine,client_addr(), + remote_machine,client_addr(Client), lp_servicename(SNUM(cnum)))); yield_connection(cnum, -- cgit