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 | 2fa922611bf7160e2c1ce80c11b50006448bf98d (patch) | |
tree | ed29a6f6c0364ee631b049b26031139b9e74a4ec /source3/smbd/oplock.c | |
parent | 03630a9aa9ce5c00619ad3c4bb498d95054ae03a (diff) | |
download | samba-2fa922611bf7160e2c1ce80c11b50006448bf98d.tar.gz samba-2fa922611bf7160e2c1ce80c11b50006448bf98d.tar.xz samba-2fa922611bf7160e2c1ce80c11b50006448bf98d.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.
(This used to be commit 5937ab14d222696e40a3fc6f0e6a536f2d7305d3)
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r-- | source3/smbd/oplock.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 218961d88cc..e794d2d9235 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -753,7 +753,6 @@ static files_struct *initial_break_processing(SMB_DEV_T dev, SMB_INO_T inode, st BOOL oplock_break_level2(files_struct *fsp, BOOL local_request, int token) { - extern int Client; extern uint32 global_client_caps; char outbuf[128]; BOOL got_lock = False; @@ -781,7 +780,7 @@ BOOL oplock_break_level2(files_struct *fsp, BOOL local_request, int token) /* Prepare the SMBlockingX message. */ prepare_break_message( outbuf, fsp, False); - send_smb(Client, outbuf); + send_smb(smbd_server_fd(), outbuf); } /* @@ -832,7 +831,6 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval, B { extern uint32 global_client_caps; extern struct current_user current_user; - extern int Client; char *inbuf = NULL; char *outbuf = NULL; files_struct *fsp = NULL; @@ -923,7 +921,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval, B fsp->sent_oplock_break = using_levelII? LEVEL_II_BREAK_SENT:EXCLUSIVE_BREAK_SENT; - send_smb(Client, outbuf); + send_smb(smbd_server_fd(), outbuf); /* We need this in case a readraw crosses on the wire. */ global_oplock_break = True; @@ -958,7 +956,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval, B while((fsp = initial_break_processing(dev, inode, tval)) && OPEN_FSP(fsp) && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) { - if(receive_smb(Client,inbuf, timeout) == False) + if(receive_smb(smbd_server_fd(),inbuf, timeout) == False) { /* * Die if we got an error. @@ -1019,7 +1017,6 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval, B { 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"); } @@ -1059,7 +1056,6 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval, B { 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"); } |