diff options
Diffstat (limited to 'source3/smbd/process.c')
-rw-r--r-- | source3/smbd/process.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7958fc761d..558d403948 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -900,10 +900,11 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize { int outsize = 0; int flags; - static uint16 last_session_tag = UID_FIELD_INVALID; uint16 session_tag; connection_struct *conn; + static uint16 last_session_tag = UID_FIELD_INVALID; + type &= 0xff; errno = 0; @@ -929,12 +930,10 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize /* In share mode security we must ignore the vuid. */ session_tag = (lp_security() == SEC_SHARE) ? UID_FIELD_INVALID : SVAL(inbuf,smb_uid); - conn = conn_find(SVAL(inbuf,smb_tid)); - DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", - smb_fn_name(type), (int)sys_getpid(), - (unsigned long)conn)); + DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type), + (int)sys_getpid(), (unsigned long)conn)); smb_dump(smb_fn_name(type), 1, inbuf, size); @@ -946,7 +945,8 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize * really ugly bugfix for problems with multiple session_setup_and_X's * being done and allowing %U and %G substitutions to work correctly. * There is a reason this code is done here, don't move it unless you - * know what you're doing... :-). JRA. + * know what you're doing... :-). + * JRA. */ if (session_tag != last_session_tag) { @@ -954,7 +954,7 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize last_session_tag = session_tag; if(session_tag != UID_FIELD_INVALID) { - vuser = get_valid_user_struct(session_tag); + vuser = get_valid_user_struct(session_tag); if (vuser) { set_current_user_info(&vuser->user); } @@ -966,7 +966,10 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize /* Does this call need a valid tree connection? */ if (!conn) { - /* Amazingly, the error code depends on the command (from Samba4). */ + /* + * Amazingly, the error code depends on the command + * (from Samba4). + */ if (type == SMBntcreateX) { return ERROR_NT(NT_STATUS_INVALID_HANDLE); } else { @@ -996,7 +999,9 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize /* load service specific parameters */ if (conn) { - if (!set_current_service(conn,SVAL(inbuf,smb_flg),(flags & (AS_USER|DO_CHDIR)?True:False))) { + if (!set_current_service(conn,SVAL(inbuf,smb_flg), + (flags & (AS_USER|DO_CHDIR) + ?True:False))) { return(ERROR_DOS(ERRSRV,ERRaccess)); } conn->num_smb_operations++; @@ -1004,17 +1009,19 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize /* does this protocol need to be run as guest? */ if ((flags & AS_GUEST) - && (!change_to_guest() || + && (!change_to_guest() || !check_access(smbd_server_fd(), lp_hostsallow(-1), lp_hostsdeny(-1)))) { return(ERROR_DOS(ERRSRV,ERRaccess)); } - current_inbuf = inbuf; /* In case we need to defer this message in open... */ + current_inbuf = inbuf; /* In case we need to defer this message in + * open... */ outsize = smb_messages[type].fn(conn, inbuf,outbuf,size,bufsize); done: smb_dump(smb_fn_name(type), 0, outbuf, outsize); + return(outsize); } |