diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-08-14 17:38:29 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-08-14 17:38:29 +0000 |
commit | b9623ab59e813131b1ed3f51616a46e719d59c21 (patch) | |
tree | a1ba04e55e67ca102b05dd22b024bab9e9d51d57 /source3/smbd/connection.c | |
parent | 58fb3c31c03601042fdba71501068fcaea8a821c (diff) | |
download | samba-b9623ab59e813131b1ed3f51616a46e719d59c21.tar.gz samba-b9623ab59e813131b1ed3f51616a46e719d59c21.tar.bz2 samba-b9623ab59e813131b1ed3f51616a46e719d59c21.zip |
this is the bug change to using connection_struct* instead of cnum.
Connections[] is now a local array in server.c
I might have broken something with this change. In particular the
oplock code is suspect and some .dll files aren't being oplocked when
I expected them to be. I'll look at it after I've got some sleep.
(This used to be commit c7ee025ead4a85b6fa44a832047b878451845fb6)
Diffstat (limited to 'source3/smbd/connection.c')
-rw-r--r-- | source3/smbd/connection.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 64b3f153cf..342a5f43bc 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -22,7 +22,6 @@ #include "includes.h" -extern connection_struct Connections[MAX_CONNECTIONS]; extern fstring remote_machine; extern int DEBUGLEVEL; @@ -30,7 +29,7 @@ extern int DEBUGLEVEL; /**************************************************************************** simple routines to do connection counting ****************************************************************************/ -BOOL yield_connection(int cnum,char *name,int max_connections) +BOOL yield_connection(connection_struct *conn,char *name,int max_connections) { struct connect_record crec; pstring fname; @@ -38,7 +37,7 @@ BOOL yield_connection(int cnum,char *name,int max_connections) int mypid = getpid(); int i; - DEBUG(3,("Yielding connection to %d %s\n",cnum,name)); + DEBUG(3,("Yielding connection to %s\n",name)); if (max_connections <= 0) return(True); @@ -73,11 +72,11 @@ BOOL yield_connection(int cnum,char *name,int max_connections) close(fd); return(False); } - if (crec.pid == mypid && crec.cnum == cnum) + if (crec.pid == mypid && crec.cnum == conn->cnum) break; } - if (crec.pid != mypid || crec.cnum != cnum) { + if (crec.pid != mypid || crec.cnum != conn->cnum) { if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) { DEBUG(0,("ERROR: can't release lock on %s\n", fname)); } @@ -113,7 +112,7 @@ BOOL yield_connection(int cnum,char *name,int max_connections) /**************************************************************************** simple routines to do connection counting ****************************************************************************/ -BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear) +BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOOL Clear) { extern int Client; struct connect_record crec; @@ -192,11 +191,14 @@ BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear) bzero((void *)&crec,sizeof(crec)); crec.magic = 0x280267; crec.pid = getpid(); - crec.cnum = cnum; - if (cnum != -1) { - crec.uid = Connections[cnum].uid; - crec.gid = Connections[cnum].gid; - StrnCpy(crec.name,lp_servicename(SNUM(cnum)),sizeof(crec.name)-1); + if (conn) { + crec.cnum = conn->cnum; + crec.uid = conn->uid; + crec.gid = conn->gid; + StrnCpy(crec.name, + lp_servicename(SNUM(conn)),sizeof(crec.name)-1); + } else { + crec.cnum = -1; } crec.start = time(NULL); |