diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-04-11 13:55:53 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-04-11 13:55:53 +0000 |
commit | 5937ab14d222696e40a3fc6f0e6a536f2d7305d3 (patch) | |
tree | c55cd00dbbc16ffb66f21c2ee286c0bb7f16934f /source/smbd/connection.c | |
parent | 707401fc1e697362cdaadcfaac4edc964b80b1a0 (diff) | |
download | samba-5937ab14d222696e40a3fc6f0e6a536f2d7305d3.tar.gz samba-5937ab14d222696e40a3fc6f0e6a536f2d7305d3.tar.xz samba-5937ab14d222696e40a3fc6f0e6a536f2d7305d3.zip |
finally got sick of the "extern int Client" code and the stupid
assumption that we have one socket everywhere
while doing so I discovered a few bugs!
1) the clientgen session retarget code if used from smbd or nmbd would
cause a crash as it called close_sockets() which closed our main
socket! fixed by removing close_sockets() completely - it is unnecessary
2) the caching in client_addr() and client_name() was bogus - it could
easily get fooled and give the wrong result. fixed.
3) the retarget could could recurse, allowing an easy denial of
service attack on nmbd. fixed.
Diffstat (limited to 'source/smbd/connection.c')
-rw-r--r-- | source/smbd/connection.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/smbd/connection.c b/source/smbd/connection.c index c796fee8b57..9c859e4d896 100644 --- a/source/smbd/connection.c +++ b/source/smbd/connection.c @@ -71,7 +71,6 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO struct connections_key key; struct connections_data crec; TDB_DATA kbuf, dbuf; - extern int Client; if (max_connections <= 0) return(True); @@ -106,7 +105,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO crec.start = time(NULL); StrnCpy(crec.machine,remote_machine,sizeof(crec.machine)-1); - StrnCpy(crec.addr,conn?conn->client_address:client_addr(Client),sizeof(crec.addr)-1); + StrnCpy(crec.addr,conn?conn->client_address:client_addr(),sizeof(crec.addr)-1); dbuf.dptr = (char *)&crec; dbuf.dsize = sizeof(crec); @@ -343,7 +342,6 @@ static void utmp_yield(pid_t pid, const connection_struct *conn) static void utmp_claim(const struct connect_record *crec, const connection_struct *conn) { - extern int Client; struct utmp u; if (conn == NULL) { @@ -359,7 +357,7 @@ static void utmp_claim(const struct connect_record *crec, const connection_struc DEBUG(2,("utmp_claim: conn: user:%s cnum:%d i:%d\n", conn->user, conn->cnum, i)); DEBUG(2,("utmp_claim: crec: pid:%d, cnum:%d name:%s addr:%s mach:%s DNS:%s\n", - crec->pid, crec->cnum, crec->name, crec->addr, crec->machine, client_name(Client))); + crec->pid, crec->cnum, crec->name, crec->addr, crec->machine, client_name())); memset((char *)&u, '\0', sizeof(struct utmp)); |