diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/files.c | 8 | ||||
-rw-r--r-- | source3/smbd/open.c | 61 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 123 | ||||
-rw-r--r-- | source3/smbd/reply.c | 10 |
4 files changed, 170 insertions, 32 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 341d9946ec..163e4f0cf2 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -128,9 +128,15 @@ file_fd_struct *fd_get_already_open(SMB_STRUCT_STAT *sbuf) (sbuf->st_dev == fd_ptr->dev) && (sbuf->st_ino == fd_ptr->inode)) { fd_ptr->ref_count++; +#ifdef LARGE_SMB_INO_T + DEBUG(3,("Re-used file_fd_struct dev = %x, inode = %.0f, ref_count = %d\n", + (unsigned int)fd_ptr->dev, (double)fd_ptr->inode, + fd_ptr->ref_count)); +#else /* LARGE_SMB_INO_T */ DEBUG(3,("Re-used file_fd_struct dev = %x, inode = %x, ref_count = %d\n", - fd_ptr->dev, fd_ptr->inode, + (unsigned int)fd_ptr->dev, fd_ptr->inode, fd_ptr->ref_count)); +#endif /* LARGE_SMB_INO_T */ return fd_ptr; } } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f24d4ac962..45d919187f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -149,10 +149,18 @@ int fd_attempt_close(file_fd_struct *fd_ptr) { extern struct current_user current_user; - DEBUG(3,("fd_attempt_close fd = %d, dev = %x, inode = %x, open_flags = %d, ref_count = %d.\n", - fd_ptr->fd, fd_ptr->dev, fd_ptr->inode, +#ifdef LARGE_SMB_INO_T + DEBUG(3,("fd_attempt_close fd = %d, dev = %x, inode = %.0f, open_flags = %d, ref_count = %d.\n", + fd_ptr->fd, (unsigned int)fd_ptr->dev, (double)fd_ptr->inode, fd_ptr->real_open_flags, fd_ptr->ref_count)); +#else /* LARGE_SMB_INO_T */ + DEBUG(3,("fd_attempt_close fd = %d, dev = %x, inode = %lx, open_flags = %d, ref_count = %d.\n", + fd_ptr->fd, (unsigned int)fd_ptr->dev, (unsigned long)fd_ptr->inode, + fd_ptr->real_open_flags, + fd_ptr->ref_count)); +#endif /* LARGE_SMB_INO_T */ + if(fd_ptr->ref_count > 0) { fd_ptr->ref_count--; if(fd_ptr->ref_count == 0) { @@ -718,16 +726,28 @@ void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int if(share_entry->op_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) { +#ifdef LARGE_SMB_INO_T + DEBUG(5,("open_file_shared: breaking oplock (%x) on file %s, \ +dev = %x, inode = %.0f\n", share_entry->op_type, fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(5,("open_file_shared: breaking oplock (%x) on file %s, \ -dev = %x, inode = %x\n", share_entry->op_type, fname, dev, inode)); +dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ /* Oplock break.... */ unlock_share_entry(conn, dev, inode, token); if(request_oplock_break(share_entry, dev, inode) == False) { free((char *)old_shares); + +#ifdef LARGE_SMB_INO_T + DEBUG(0,("open_file_shared: FAILED when breaking oplock (%x) on file %s, \ +dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(0,("open_file_shared: FAILED when breaking oplock (%x) on file %s, \ -dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode)); +dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ + errno = EACCES; unix_ERR_class = ERRDOS; unix_ERR_code = ERRbadshare; @@ -831,8 +851,13 @@ dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode)); global_oplocks_open++; port = oplock_port; +#ifdef LARGE_SMB_INO_T + DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \ +dev = %x, inode = %.0f\n", oplock_request, fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \ -dev = %x, inode = %x\n", oplock_request, fname, dev, inode)); +dev = %x, inode = %lx\n", oplock_request, fname, (unsigned int)dev, (double)inode)); +#endif /* LARGE_SMB_INO_T */ } else @@ -1051,8 +1076,15 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op) */ if(rename_op && (share_entry->pid == pid)) { + +#ifdef LARGE_SMB_INO_T + DEBUG(0,("check_file_sharing: NT redirector workaround - rename attempted on \ +batch oplocked file %s, dev = %x, inode = %.0f\n", fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(0,("check_file_sharing: NT redirector workaround - rename attempted on \ -batch oplocked file %s, dev = %x, inode = %x\n", fname, dev, inode)); +batch oplocked file %s, dev = %x, inode = %lx\n", fname, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ + /* * This next line is a test that allows the deny-mode * processing to be skipped. This seems to be needed as @@ -1065,16 +1097,29 @@ batch oplocked file %s, dev = %x, inode = %x\n", fname, dev, inode)); } else { + +#ifdef LARGE_SMB_INO_T DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \ -dev = %x, inode = %x\n", share_entry->op_type, fname, dev, inode)); +dev = %x, inode = %.0f\n", share_entry->op_type, fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ + DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \ +dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ /* Oplock break.... */ unlock_share_entry(conn, dev, inode, token); if(request_oplock_break(share_entry, dev, inode) == False) { free((char *)old_shares); + +#ifdef LARGE_SMB_INO_T DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \ -dev = %x, inode = %x\n", old_shares[i].op_type, fname, dev, inode)); +dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ + DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \ +dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ + return False; } lock_share_entry(conn, dev, inode, &token); diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index ab88b82953..52a574663c 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -105,19 +105,30 @@ should be %d).\n", msg_len, OPLOCK_BREAK_MSG_LEN)); } { uint32 remotepid = IVAL(msg_start,OPLOCK_BREAK_PID_OFFSET); + SMB_DEV_T dev = IVAL(msg_start,OPLOCK_BREAK_DEV_OFFSET); /* - * Warning - this will need to be changed if SMB_DEV_T/SMB_INO_T <> 4 bytes. !! + * Warning - beware of SMB_INO_T <> 4 bytes. !! */ - SMB_DEV_T dev = IVAL(msg_start,OPLOCK_BREAK_DEV_OFFSET); +#ifdef LARGE_SMB_INO_T + SMB_INO_T inode_low = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET); + SMB_INO_T inode_high = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET + 4); + SMB_INO_T inode = inode_low | (inode_high << 32); +#else /* LARGE_SMB_INO_T */ SMB_INO_T inode = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET); +#endif /* LARGE_SMB_INO_T */ struct timeval tval; struct sockaddr_in toaddr; tval.tv_sec = IVAL(msg_start, OPLOCK_BREAK_SEC_OFFSET); tval.tv_usec = IVAL(msg_start, OPLOCK_BREAK_USEC_OFFSET); +#ifdef LARGE_SMB_INO_T DEBUG(5,("process_local_message: oplock break request from \ -pid %d, port %d, dev = %x, inode = %x\n", remotepid, from_port, dev, inode)); +pid %d, port %d, dev = %x, inode = %.0f\n", remotepid, from_port, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ + DEBUG(5,("process_local_message: oplock break request from \ +pid %d, port %d, dev = %x, inode = %lx\n", remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ /* * If we have no record of any currently open oplocks, @@ -157,9 +168,15 @@ oplocks. Returning success.\n")); return False; } +#ifdef LARGE_SMB_INO_T + DEBUG(5,("process_local_message: oplock break reply sent to \ +pid %d, port %d, for file dev = %x, inode = %.0f\n", + remotepid, from_port, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(5,("process_local_message: oplock break reply sent to \ -pid %d, port %d, for file dev = %x, inode = %x\n", remotepid, - from_port, dev, inode)); +pid %d, port %d, for file dev = %x, inode = %lx\n", + remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ } break; @@ -179,14 +196,25 @@ reply - dumping info.\n")); { uint32 remotepid = IVAL(msg_start,OPLOCK_BREAK_PID_OFFSET); + SMB_DEV_T dev = IVAL(msg_start,OPLOCK_BREAK_DEV_OFFSET); /* - * Warning - this will need to be changed if SMB_DEV_T/SMB_INO_T <> 4 bytes. !! + * Warning - beware of SMB_INO_T <> 4 bytes. !! */ - SMB_DEV_T dev = IVAL(msg_start,OPLOCK_BREAK_DEV_OFFSET); +#ifdef LARGE_SMB_INO_T + SMB_INO_T inode_low = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET); + SMB_INO_T inode_high = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET + 4); + SMB_INO_T inode = inode_low | (inode_high << 32); +#else /* LARGE_SMB_INO_T */ SMB_INO_T inode = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET); +#endif /* LARGE_SMB_INO_T */ +#ifdef LARGE_SMB_INO_T + DEBUG(0,("process_local_message: unsolicited oplock break reply from \ +pid %d, port %d, dev = %x, inode = %.0f\n", remotepid, from_port, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(0,("process_local_message: unsolicited oplock break reply from \ -pid %d, port %d, dev = %x, inode = %x\n", remotepid, from_port, dev, inode)); +pid %d, port %d, dev = %x, inode = %lx\n", remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ } return False; @@ -217,7 +245,11 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 3 ) ) { - dbgtext( "oplock_break: called for dev = %x, inode = %x.\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "oplock_break: called for dev = %x, inode = %.0f.\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "oplock_break: called for dev = %x, inode = %lx.\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open ); } @@ -232,7 +264,11 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 0 ) ) { dbgtext( "oplock_break: cannot find open file with " ); - dbgtext( "dev = %x, inode = %x ", dev, inode); +#ifdef LARGE_SMB_INO_T + dbgtext( "dev = %x, inode = %.0f ", (unsigned int)dev, (double)inode); +#else /* LARGE_SMB_INO_T */ + dbgtext( "dev = %x, inode = %x ", (unsigned int)dev, (unsigned long)inode); +#endif /* LARGE_SMB_INO_T */ dbgtext( "allowing break to succeed.\n" ); } return True; @@ -252,7 +288,11 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 0 ) ) { dbgtext( "oplock_break: file %s ", fsp->fsp_name ); - dbgtext( "(dev = %x, inode = %x) has no oplock.\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "(dev = %x, inode = %.0f) has no oplock.\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "(dev = %x, inode = %lx) has no oplock.\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ dbgtext( "Allowing break to succeed regardless.\n" ); } return True; @@ -265,7 +305,11 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) { dbgtext( "oplock_break: ERROR: oplock_break already sent for " ); dbgtext( "file %s ", fsp->fsp_name); - dbgtext( "(dev = %x, inode = %x)\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "(dev = %x, inode = %.0f)\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "(dev = %x, inode = %lx)\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ } /* We have to fail the open here as we cannot send another oplock break on @@ -357,7 +401,12 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) OPLOCK_BREAK_TIMEOUT ) ); DEBUGADD( 0, ( "oplock_break failed for file %s ", fsp->fsp_name ) ); - DEBUGADD( 0, ( "(dev = %x, inode = %x).\n", dev, inode)); +#ifdef LARGE_SMB_INO_T + DEBUGADD( 0, ( "(dev = %x, inode = %.0f).\n", (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ + DEBUGADD( 0, ( "(dev = %x, inode = %lx).\n", (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ + shutdown_server = True; break; } @@ -384,7 +433,12 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) dbgtext( "oplock_break: no break received from client " ); dbgtext( "within %d seconds.\n", OPLOCK_BREAK_TIMEOUT ); dbgtext( "oplock_break failed for file %s ", fsp->fsp_name ); - dbgtext( "(dev = %x, inode = %x).\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "(dev = %x, inode = %.0f).\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "(dev = %x, inode = %lx).\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ + } shutdown_server = True; break; @@ -451,7 +505,11 @@ BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 3 ) ) { dbgtext( "oplock_break: returning success for " ); - dbgtext( "dev = %x, inode = %x.\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open ); } @@ -495,11 +553,16 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); SIVAL(op_break_msg,OPLOCK_BREAK_PID_OFFSET,pid); SIVAL(op_break_msg,OPLOCK_BREAK_SEC_OFFSET,(uint32)share_entry->time.tv_sec); SIVAL(op_break_msg,OPLOCK_BREAK_USEC_OFFSET,(uint32)share_entry->time.tv_usec); + SIVAL(op_break_msg,OPLOCK_BREAK_DEV_OFFSET,dev); /* - * WARNING - this will need to be changed if SMB_DEV_T/SMB_INO_T <> 4 bytes. + * WARNING - beware of SMB_INO_T <> 4 bytes. */ - SIVAL(op_break_msg,OPLOCK_BREAK_DEV_OFFSET,dev); +#ifdef LARGE_SMB_INO_T + SIVAL(op_break_msg,OPLOCK_BREAK_INODE_OFFSET,(inode & 0xFFFFFFFFL)); + SIVAL(op_break_msg,OPLOCK_BREAK_INODE_OFFSET+4,((inode >> 32) & 0xFFFFFFFFL)); +#else /* LARGE_SMB_INO_T */ SIVAL(op_break_msg,OPLOCK_BREAK_INODE_OFFSET,inode); +#endif /* LARGE_SMB_INO_T */ /* set the address and port */ bzero((char *)&addr_out,sizeof(addr_out)); @@ -511,7 +574,12 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); { dbgtext( "request_oplock_break: sending a oplock break message to " ); dbgtext( "pid %d on port %d ", share_entry->pid, share_entry->op_port ); - dbgtext( "for dev = %x, inode = %x\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ + } if(sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0, @@ -522,7 +590,11 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: failed when sending a oplock " ); dbgtext( "break message to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); - dbgtext( "for dev = %x, inode = %x.\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ dbgtext( "Error was %s\n", strerror(errno) ); } return False; @@ -555,7 +627,12 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: no response received to oplock " ); dbgtext( "break request to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); - dbgtext( "for dev = %x, inode = %x\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ + } /* * This is a hack to make handling of failing clients more robust. @@ -572,7 +649,11 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: error in response received " ); dbgtext( "to oplock break request to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); - dbgtext( "for dev = %x, inode = %x.\n", dev, inode ); +#ifdef LARGE_SMB_INO_T + dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); +#else /* LARGE_SMB_INO_T */ + dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); +#endif /* LARGE_SMB_INO_T */ dbgtext( "Error was (%s).\n", strerror(errno) ); } return False; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 3665518ae6..d7ab997010 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3564,9 +3564,15 @@ no oplock granted on this file.\n", fsp->fnum)); /* Remove the oplock flag from the sharemode. */ lock_share_entry(fsp->conn, dev, inode, &token); if(remove_share_oplock(fsp, token)==False) { + +#ifdef LARGE_SMB_INO_T + DEBUG(0,("reply_lockingX: failed to remove share oplock for fnum %d, \ +dev = %x, inode = %.0f\n", fsp->fnum, (unsigned int)dev, (double)inode)); +#else /* LARGE_SMB_INO_T */ DEBUG(0,("reply_lockingX: failed to remove share oplock for fnum %d, \ -dev = %x, inode = %x\n", - fsp->fnum, dev, inode)); +dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); +#endif /* LARGE_SMB_INO_T */ + unlock_share_entry(fsp->conn, dev, inode, token); } else { unlock_share_entry(fsp->conn, dev, inode, token); |