From ac9b687cc2496409e1c8d86393812faf94ec7550 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Sep 1998 19:16:12 +0000 Subject: configure configure.in: Added tests for fseek64 and ftell64. config.h.in: Added fseek64 and ftell64. includes.h: Added definition of SMB_BIG_INTEGER. smb.h: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. access.c: Tidyup of dbug statement. system.c: Added sys_fseek and sys_ftell. Changed mode calls to use mode_t. asyncdns.c: Tidyup of comment. loadparm.c: Tidyup of set_default_server_announce_type() function definition. ldap.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. nispass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. smbpass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER. smbpassfile.c: Use sys_fseek(). chgpasswd.c: Tidyup of debug statement. dosmode.c: Changed mode calls to use mode_t. ipc.c: Removal of dead code. nttrans.c: Changed mode calls to use mode_t. open.c: Changed mode calls to use mode_t. pipes.c: Removal of dead code. reply.c: Removal of dead code. trans2.c: Removal of dead code. Changed mode calls to use mode_t. Jeremy. (This used to be commit c381d32e3dc23fe887408016cae821aceb30da2c) --- source3/smbd/chgpasswd.c | 4 ++-- source3/smbd/dosmode.c | 2 +- source3/smbd/ipc.c | 24 ++++++++---------------- source3/smbd/nttrans.c | 9 +++++---- source3/smbd/open.c | 10 +++++----- source3/smbd/pipes.c | 3 --- source3/smbd/reply.c | 30 ++++++------------------------ source3/smbd/trans2.c | 7 ++----- 8 files changed, 29 insertions(+), 60 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 68cbe9b35b..4dc6d29e3c 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -302,12 +302,12 @@ static BOOL chat_with_program(char *passwordprogram,char *name,char *chatsequenc /* allocate a pseudo-terminal device */ if ((master = findpty (&slavedev)) < 0) { - DEBUG(3,("Cannot Allocate pty for password change: %s",name)); + DEBUG(3,("Cannot Allocate pty for password change: %s\n",name)); return(False); } if ((pid = fork()) < 0) { - DEBUG(3,("Cannot fork() child for password change: %s",name)); + DEBUG(3,("Cannot fork() child for password change: %s\n",name)); close(master); return(False); } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 1336e27281..c2c9cc2373 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -144,7 +144,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT * SMB_STRUCT_STAT st1; int mask=0; int tmp; - int unixmode; + mode_t unixmode; if (!st) { st = &st1; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 61d9aa8bdd..ce300dc810 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -784,7 +784,7 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); char *QueueName = p; - int uLevel,cbBuf; + int uLevel; int count=0; int snum; char* str3; @@ -797,7 +797,6 @@ static BOOL api_DosPrintQGetInfo(connection_struct *conn, p = skip_string(p,1); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); str3 = p + 4; /* remove any trailing username */ @@ -2670,7 +2669,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para char *str1 = param+2; char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); - int uLevel,cbBuf; + int uLevel; int count; int i; int snum; @@ -2680,7 +2679,6 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para print_status_struct status; uLevel = SVAL(p,2); - cbBuf = SVAL(p,4); bzero(&desc,sizeof(desc)); bzero(&status,sizeof(status)); @@ -2735,7 +2733,7 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn,uint16 vuid, char *pa char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); char* name = p; - int uLevel,cbBuf; + int uLevel; int count; int i, succnt=0; int snum; @@ -2748,7 +2746,6 @@ static BOOL api_WPrintJobEnumerate(connection_struct *conn,uint16 vuid, char *pa p = skip_string(p,1); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintJobEnumerate uLevel=%d name=%s\n",uLevel,name)); @@ -2853,7 +2850,7 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn,uint16 vuid, char *par char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); char* PrinterName = p; - int uLevel,cbBuf; + int uLevel; struct pack_desc desc; int snum; @@ -2861,7 +2858,6 @@ static BOOL api_WPrintDestGetInfo(connection_struct *conn,uint16 vuid, char *par p = skip_string(p,1); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintDestGetInfo uLevel=%d PrinterName=%s\n",uLevel,PrinterName)); @@ -2911,7 +2907,7 @@ static BOOL api_WPrintDestEnum(connection_struct *conn,uint16 vuid, char *param, char *str1 = param+2; char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); - int uLevel,cbBuf; + int uLevel; int queuecnt; int i, n, succnt=0; struct pack_desc desc; @@ -2920,7 +2916,6 @@ static BOOL api_WPrintDestEnum(connection_struct *conn,uint16 vuid, char *param, bzero(&desc,sizeof(desc)); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintDestEnum uLevel=%d\n",uLevel)); @@ -2969,14 +2964,13 @@ static BOOL api_WPrintDriverEnum(connection_struct *conn,uint16 vuid, char *para char *str1 = param+2; char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); - int uLevel,cbBuf; + int uLevel; int succnt; struct pack_desc desc; bzero(&desc,sizeof(desc)); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintDriverEnum uLevel=%d\n",uLevel)); @@ -3014,14 +3008,13 @@ static BOOL api_WPrintQProcEnum(connection_struct *conn,uint16 vuid, char *param char *str1 = param+2; char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); - int uLevel,cbBuf; + int uLevel; int succnt; struct pack_desc desc; bzero(&desc,sizeof(desc)); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintQProcEnum uLevel=%d\n",uLevel)); @@ -3060,14 +3053,13 @@ static BOOL api_WPrintPortEnum(connection_struct *conn,uint16 vuid, char *param, char *str1 = param+2; char *str2 = skip_string(str1,1); char *p = skip_string(str2,1); - int uLevel,cbBuf; + int uLevel; int succnt; struct pack_desc desc; bzero(&desc,sizeof(desc)); uLevel = SVAL(p,0); - cbBuf = SVAL(p,2); DEBUG(3,("WPrintPortEnum uLevel=%d\n",uLevel)); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 95adc5ccb7..d6d60c45cd 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -417,8 +417,9 @@ int reply_ntcreate_and_X(connection_struct *conn, /* Breakout the oplock request bits so we can set the reply bits separately. */ int oplock_request = 0; - int unixmode, pnum = -1; - int fmode=0,mtime=0,rmode=0; + mode_t unixmode; + int pnum = -1; + int fmode=0,rmode=0; SMB_OFF_T file_len = 0; SMB_STRUCT_STAT sbuf; int smb_action = 0; @@ -619,7 +620,6 @@ int reply_ntcreate_and_X(connection_struct *conn, fmode = dos_mode(conn,fname,&sbuf); if(fmode == 0) fmode = FILE_ATTRIBUTE_NORMAL; - mtime = sbuf.st_mtime; if (!fsp->is_directory && (fmode & aDIR)) { close_file(fsp,False); return(ERROR(ERRDOS,ERRnoaccess)); @@ -710,7 +710,8 @@ static int call_nt_transact_create(connection_struct *conn, /* Breakout the oplock request bits so we can set the reply bits separately. */ int oplock_request = 0; - int unixmode, pnum = -1; + mode_t unixmode; + int pnum = -1; int fmode=0,mtime=0,rmode=0; off_t file_len = 0; SMB_STRUCT_STAT sbuf; diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 42b0fba425..ad4dd9f52f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -31,7 +31,7 @@ extern uint16 oplock_port; /**************************************************************************** fd support routines - attempt to do a dos_open ****************************************************************************/ -static int fd_attempt_open(char *fname, int flags, int mode) +static int fd_attempt_open(char *fname, int flags, mode_t mode) { int fd = dos_open(fname,flags,mode); @@ -125,7 +125,7 @@ static BOOL fd_is_in_uid_cache(file_fd_struct *fd_ptr, uid_t u) fd support routines - attempt to re-open an already open fd as O_RDWR. Save the already open fd (we cannot close due to POSIX file locking braindamage. ****************************************************************************/ -static void fd_attempt_reopen(char *fname, int mode, file_fd_struct *fd_ptr) +static void fd_attempt_reopen(char *fname, mode_t mode, file_fd_struct *fd_ptr) { int fd = dos_open( fname, O_RDWR, mode); @@ -268,7 +268,7 @@ static void check_for_pipe(char *fname) open a file ****************************************************************************/ static void open_file(files_struct *fsp,connection_struct *conn, - char *fname1,int flags,int mode, SMB_STRUCT_STAT *sbuf) + char *fname1,int flags,mode_t mode, SMB_STRUCT_STAT *sbuf) { extern struct current_user current_user; pstring fname; @@ -688,7 +688,7 @@ static int check_share_mode( share_mode_entry *share, int deny_mode, open a file with a share mode ****************************************************************************/ void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int share_mode,int ofun, - int mode,int oplock_request, int *Access,int *action) + mode_t mode,int oplock_request, int *Access,int *action) { int flags=0; int flags2=0; @@ -865,7 +865,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou } DEBUG(4,("calling open_file with flags=0x%X flags2=0x%X mode=0%o\n", - flags,flags2,mode)); + flags,flags2,(int)mode)); open_file(fsp,conn,fname,flags|(flags2&~(O_TRUNC)),mode,file_existed ? &sbuf : 0); if (!fsp->open && flags==O_RDWR && errno!=ENOENT && fcbopen) diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 97df3abfc3..15d395b29a 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -119,7 +119,6 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize) int smb_mincnt = SVAL(inbuf,smb_vwv6); int nread = -1; char *data; - BOOL ok = False; if (!p) return(ERROR(ERRDOS,ERRbadfid)); @@ -128,8 +127,6 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize) nread = read_pipe(p, data, smb_offs, smb_maxcnt); - ok = True; - if (nread < 0) return(UNIXERROR(ERRDOS,ERRnoaccess)); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 38c39efad6..d7f29b60c6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -453,9 +453,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int int gid; int uid; int smb_bufsize; - int smb_mpxmax; - int smb_vc_num; - uint32 smb_sesskey; int smb_apasslen = 0; pstring smb_apasswd; int smb_ntpasslen = 0; @@ -472,9 +469,6 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int *smb_ntpasswd = 0; smb_bufsize = SVAL(inbuf,smb_vwv2); - smb_mpxmax = SVAL(inbuf,smb_vwv3); - smb_vc_num = SVAL(inbuf,smb_vwv4); - smb_sesskey = IVAL(inbuf,smb_vwv5); if (Protocol < PROTOCOL_NT1) { smb_apasslen = SVAL(inbuf,smb_vwv7); @@ -1247,7 +1241,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int share_mode; SMB_OFF_T size = 0; time_t mtime=0; - int unixmode; + mode_t unixmode; int rmode=0; SMB_STRUCT_STAT sbuf; BOOL bad_path = False; @@ -1344,7 +1338,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt uint32 smb_time = make_unix_date3(inbuf+smb_vwv6); #endif int smb_ofun = SVAL(inbuf,smb_vwv8); - int unixmode; + mode_t unixmode; SMB_OFF_T size=0; int fmode=0,mtime=0,rmode=0; SMB_STRUCT_STAT sbuf; @@ -1770,8 +1764,6 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s SMB_OFF_T startpos; char *header = outbuf; ssize_t ret=0; - int fd; - char *fname; files_struct *fsp; /* @@ -1818,12 +1810,8 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s _smb_setlen(header,0); transfer_file(0,Client,(SMB_OFF_T)0,header,4,0); return(-1); - } else { - fd = fsp->fd_ptr->fd; - fname = fsp->fsp_name; } - if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK)) { SMB_OFF_T size = fsp->size; @@ -1855,19 +1843,19 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s #if USE_READ_PREDICTION if (!fsp->can_write) - predict = read_predict(fd,startpos,header+4,NULL,nread); + predict = read_predict(fsp->fd_ptr->fd,startpos,header+4,NULL,nread); #endif /* USE_READ_PREDICTION */ if ((nread-predict) > 0) seek_file(fsp,startpos + predict); - ret = (ssize_t)transfer_file(fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict, + ret = (ssize_t)transfer_file(fsp->fd_ptr->fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict, startpos+predict); } if (ret != nread+4) DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n", - fname,startpos,nread,ret)); + fsp->fsp_name,startpos,nread,ret)); #else /* UNSAFE_READRAW */ ret = read_file(fsp,header+4,startpos,nread); @@ -1993,7 +1981,6 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt size_t smb_mincnt = SVAL(inbuf,smb_vwv6); ssize_t nread = -1; char *data; - BOOL ok = False; /* If it's an IPC, pass off the pipe handler. */ if (IS_IPC(conn)) @@ -2018,7 +2005,6 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt if (is_locked(fsp,conn,smb_maxcnt,startpos, F_RDLCK)) return(ERROR(ERRDOS,ERRlock)); nread = read_file(fsp,data,startpos,smb_maxcnt); - ok = True; if (nread < 0) return(UNIXERROR(ERRDOS,ERRnoaccess)); @@ -2718,9 +2704,6 @@ int reply_printqueue(connection_struct *conn, int outsize = set_message(outbuf,2,3,True); int max_count = SVAL(inbuf,smb_vwv0); int start_index = SVAL(inbuf,smb_vwv1); - uint16 vuid; - - vuid = SVAL(inbuf,smb_uid); /* we used to allow the client to get the cnum wrong, but that is really quite gross and only worked when there was only @@ -3722,7 +3705,7 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length, char *data; SMB_OFF_T startpos; int outsize; - size_t mincount, maxcount; + size_t maxcount; int max_per_packet; size_t tcount; int pad; @@ -3740,7 +3723,6 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length, startpos = IVAL(inbuf,smb_vwv1); maxcount = SVAL(inbuf,smb_vwv3); - mincount = SVAL(inbuf,smb_vwv4); data = smb_buf(outbuf); pad = ((long)data)%4; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 87d1ea27d0..fb93fd9e10 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -199,7 +199,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf, int16 namelen = strlen(pname)+1; pstring fname; - int unixmode; + mode_t unixmode; SMB_OFF_T size=0; int fmode=0,mtime=0,rmode; SMB_INO_T inode = 0; @@ -307,14 +307,13 @@ static int get_lanman2_dir_entry(connection_struct *conn, pstring mask; pstring pathreal; pstring fname; - BOOL matched; char *p, *pdata = *ppdata; uint32 reskey=0; int prev_dirpos=0; int mode=0; SMB_OFF_T size = 0; uint32 len; - uint32 mdate=0, adate=0, cdate=0; + time_t mdate=0, adate=0, cdate=0; char *nameptr; BOOL isrootdir = (strequal(conn->dirpath,"./") || strequal(conn->dirpath,".") || @@ -361,8 +360,6 @@ static int get_lanman2_dir_entry(connection_struct *conn, if (!dname) return(False); - matched = False; - pstrcpy(fname,dname); if(mask_match(fname, mask, case_sensitive, True)) -- cgit