configure configure.in: Added tests for fseek64 and ftell64.
authorJeremy Allison <jra@samba.org>
Thu, 17 Sep 1998 19:16:12 +0000 (19:16 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 17 Sep 1998 19:16:12 +0000 (19:16 +0000)
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.

21 files changed:
source/configure.in
source/include/config.h.in
source/include/includes.h
source/include/proto.h
source/include/smb.h
source/lib/access.c
source/lib/system.c
source/nmbd/asyncdns.c
source/param/loadparm.c
source/passdb/ldap.c
source/passdb/nispass.c
source/passdb/smbpass.c
source/passdb/smbpassfile.c
source/smbd/chgpasswd.c
source/smbd/dosmode.c
source/smbd/ipc.c
source/smbd/nttrans.c
source/smbd/open.c
source/smbd/pipes.c
source/smbd/reply.c
source/smbd/trans2.c

index 8656eed90d9396fec9a1527cd1a7e54dd293069a..543450f0f6422b557844249a6873e18bd6ead92a 100644 (file)
@@ -36,7 +36,7 @@ AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h)
 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
 AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
 AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
-AC_CHECK_HEADERS(stropts.h poll.h)
+AC_CHECK_HEADERS(stropts.h poll.h )
 
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
@@ -163,7 +163,7 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
 AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
 AC_CHECK_FUNCS(setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64)
 AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64)
-AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
+AC_CHECK_FUNCS(fseek64 ftell64 bigcrypt getprpwnam setluid yp_get_default_domain getpwanam)
 
 echo $ac_n "checking for long long ... $ac_c"
 AC_TRY_RUN([#include <stdio.h>
index 615666b7ff2e31011fddbbe4923072f82ff58269..2934d438dcb54989647c9e23367b856549f04c1c 100644 (file)
 /* Define if you have the execl function.  */
 #undef HAVE_EXECL
 
+/* Define if you have the fseek64 function.  */
+#undef HAVE_FSEEK64
+
 /* Define if you have the fstat function.  */
 #undef HAVE_FSTAT
 
 /* Define if you have the fsync function.  */
 #undef HAVE_FSYNC
 
+/* Define if you have the ftell64 function.  */
+#undef HAVE_FTELL64
+
 /* Define if you have the ftruncate function.  */
 #undef HAVE_FTRUNCATE
 
index f0271906a5aeb3f1a08ab7792c37c198b5317e25..d8da84bd4e566df100dd4538cc548953766a7645 100644 (file)
 #  endif
 #endif
 
+#if defined(HAVE_LONGLONG)
+#define SMB_BIG_INTEGER unsigned long long
+#else
+#define SMB_BIG_INTEGER unsigned long
+#endif
+
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
index f2b74b40763db174aeb43eb5809ba59da0d60673..6ddc92824d6b568c743e22bda528218b364f49cf 100644 (file)
@@ -160,18 +160,20 @@ int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
 int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
 int sys_ftruncate(int fd, SMB_OFF_T offset);
 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
+int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
+SMB_OFF_T sys_ftell(FILE *fp);
 int dos_unlink(char *fname);
-int dos_open(char *fname,int flags,int mode);
+int dos_open(char *fname,int flags,mode_t mode);
 DIR *dos_opendir(char *dname);
 int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf);
 int sys_waitpid(pid_t pid,int *status,int options);
 int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
-int dos_mkdir(char *dname,int mode);
+int dos_mkdir(char *dname,mode_t mode);
 int dos_rmdir(char *dname);
 int dos_chdir(char *dname);
 int dos_utime(char *fname,struct utimbuf *times);
 int dos_rename(char *from, char *to);
-int dos_chmod(char *fname,int mode);
+int dos_chmod(char *fname,mode_t mode);
 char *dos_getwd(char *s);
 int sys_chown(char *fname,int uid,int gid);
 int sys_chroot(char *dname);
@@ -1792,7 +1794,7 @@ int reply_nttrans(connection_struct *conn,
 void fd_add_to_uid_cache(file_fd_struct *fd_ptr, uid_t u);
 uint16 fd_attempt_close(file_fd_struct *fd_ptr);
 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 open_directory(files_struct *fsp,connection_struct *conn,
                   char *fname, int smb_ofun, int unixmode, int *action);
 BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);
index 412b1f338349084f2b57ee1742f669a5f8b6a123..aa963f916320edec64705c4c51cb8030b9de6b0a 100644 (file)
@@ -708,8 +708,8 @@ struct passdb_ops {
    */
   void *(*startsmbpwent)(BOOL);
   void (*endsmbpwent)(void *);
-  unsigned long (*getsmbpwpos)(void *);
-  BOOL (*setsmbpwpos)(void *, unsigned long);
+  SMB_BIG_INTEGER (*getsmbpwpos)(void *);
+  BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER);
 
   /*
    * smb password database query functions.
index 2e1eb8df556a86ba9af7ef20269e3f07fd64027f..31f9db4e554899a7d005285bc9e45159682bdd5c 100644 (file)
@@ -31,7 +31,7 @@ static int masked_match(char *tok, char *slash, char *s)
        *slash = '/';
        if (net == INADDR_NONE || 
            (mask = interpret_addr(slash + 1)) == INADDR_NONE) {
-               DEBUG(0,("access: bad net/mask access control: %s", tok));
+               DEBUG(0,("access: bad net/mask access control: %s\n", tok));
                return (False);
        }
        return ((addr & mask) == net);
index 215bfd0c1df7d8e5b4f3ab5c8f137541e5455d22..c3d97e0350f397dd630df055a71970a8de57f6ee 100644 (file)
@@ -204,6 +204,32 @@ SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
 #endif
 }
 
+/*******************************************************************
+ An fseek() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
+{
+#if defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
+  return fseek64(fp, offset, whence);
+#else
+  return fseek(fp, offset, whence);
+#endif
+}
+
+/*******************************************************************
+ An ftell() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+SMB_OFF_T sys_ftell(FILE *fp)
+{
+#if defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
+  return (SMB_OFF_T)ftell64(fp);
+#else
+  return (SMB_OFF_T)ftell(fp);
+#endif
+}
+
 /*******************************************************************
 just a unlink wrapper that calls dos_to_unix.
 ********************************************************************/
@@ -216,7 +242,7 @@ int dos_unlink(char *fname)
 /*******************************************************************
 a simple open() wrapper that calls dos_to_unix.
 ********************************************************************/
-int dos_open(char *fname,int flags,int mode)
+int dos_open(char *fname,int flags,mode_t mode)
 {
   return(open(dos_to_unix(fname,False),flags,mode));
 }
@@ -261,7 +287,7 @@ int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
 /*******************************************************************
 mkdir() gets a wrapper that calls dos_to_unix.
 ********************************************************************/
-int dos_mkdir(char *dname,int mode)
+int dos_mkdir(char *dname,mode_t mode)
 {
   return(mkdir(dos_to_unix(dname,False),mode));
 }
@@ -413,7 +439,7 @@ int dos_rename(char *from, char *to)
 /*******************************************************************
 for chmod - call dos_to_unix.
 ********************************************************************/
-int dos_chmod(char *fname,int mode)
+int dos_chmod(char *fname,mode_t mode)
 {
   return(chmod(dos_to_unix(fname,False),mode));
 }
index 8f28f515eab146d07f760f3999a06110f9f4f381..3054ad7353bdd3d8775694f8bde7a78af6920274 100644 (file)
@@ -313,7 +313,7 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
 
 
 /***************************************************************************
-  we use this then we can't do async DNS lookups
+  we use this when we can't do async DNS lookups
   ****************************************************************************/
 BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
                     struct name_record **n)
index c8ab2d411bfc320ff50c9c280b6e35dc7fcfebb0..276cb13c8ee283640c360a068c0d40121a2ee13e 100644 (file)
@@ -2542,7 +2542,7 @@ char *volume_label(int snum)
 /*******************************************************************
  Set the server type we will announce as via nmbd.
 ********************************************************************/
-static void set_default_server_announce_type()
+static void set_default_server_announce_type(void)
 {
   default_server_announce = (SV_TYPE_WORKSTATION | SV_TYPE_SERVER |
                               SV_TYPE_SERVER_UNIX | SV_TYPE_PRINTQ_SERVER);
index ea25f48605a55d1d89d1a03f51aba0badbf86ae1..e58e339df6e3886a3b6c98741134a19b6183f401 100644 (file)
@@ -893,25 +893,25 @@ static void endldappwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the ldap passwd list as an unsigned long.
+ Return the current position in the ldap passwd list as an SMB_BIG_INTEGER.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static unsigned long getldappwpos(void *vp)
+static SMB_BIG_INTEGER getldappwpos(void *vp)
 {
        return 0;
 }
 
 /*************************************************************************
- Set the current position in the ldap passwd list from unsigned long.
+ Set the current position in the ldap passwd list from SMB_BIG_INTEGER.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static BOOL setldappwpos(void *vp, unsigned long tok)
+static BOOL setldappwpos(void *vp, SMB_BIG_INTEGER tok)
 {
        return False;
 }
index d397f1bf40a345899073211027e74741e5d9e783..50b7dd2a2e053555db9323f7570b64ca0d435a4d 100644 (file)
@@ -223,25 +223,25 @@ static struct sam_passwd *getnisp21pwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the nisplus passwd list as an unsigned long.
+ Return the current position in the nisplus passwd list as an SMB_BIG_INTEGER.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static unsigned long getnisppwpos(void *vp)
+static SMB_BIG_INTEGER getnisppwpos(void *vp)
 {
        return 0;
 }
 
 /*************************************************************************
- Set the current position in the nisplus passwd list from unsigned long.
+ Set the current position in the nisplus passwd list from SMB_BIG_INTEGER.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static BOOL setnisppwpos(void *vp, unsigned long tok)
+static BOOL setnisppwpos(void *vp, SMB_BIG_INTEGER tok)
 {
        return False;
 }
index f758b7bbc46153eae9f9c860c66ab88243f7a026..34de513476b0f6e0a7665a800dc777430ad302d2 100644 (file)
@@ -399,23 +399,23 @@ static struct sam_passwd *getsmbfile21pwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the smbpasswd list as an unsigned long.
+ Return the current position in the smbpasswd list as an SMB_BIG_INTEGER
  This must be treated as an opaque token.
 *************************************************************************/
 
-static unsigned long getsmbfilepwpos(void *vp)
+static SMB_BIG_INTEGER getsmbfilepwpos(void *vp)
 {
-  return (unsigned long)ftell((FILE *)vp);
+  return (SMB_BIG_INTEGER)sys_ftell((FILE *)vp);
 }
 
 /*************************************************************************
- Set the current position in the smbpasswd list from unsigned long.
+ Set the current position in the smbpasswd list from an SMB_BIG_INTEGER.
  This must be treated as an opaque token.
 *************************************************************************/
 
-static BOOL setsmbfilepwpos(void *vp, unsigned long tok)
+static BOOL setsmbfilepwpos(void *vp, SMB_BIG_INTEGER tok)
 {
-  return !fseek((FILE *)vp, tok, SEEK_SET);
+  return !sys_fseek((FILE *)vp, (SMB_OFF_T)tok, SEEK_SET);
 }
 
 /************************************************************************
@@ -609,7 +609,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
    * Scan the file, a line at a time and check if the name matches.
    */
   while (!feof(fp)) {
-    pwd_seekpos = (SMB_OFF_T)ftell(fp);
+    pwd_seekpos = sys_ftell(fp);
 
     linebuf[0] = '\0';
 
index dcb69eb43aaf2521f1ff1c61f5a4655f6710a8da..8542ad081d20a470796bdaf2c82fe3388dfa33e5 100644 (file)
@@ -219,7 +219,7 @@ BOOL get_trust_account_password( unsigned char *ret_pwd, time_t *pass_last_set_t
   *pass_last_set_time = (time_t)0;
   memset(ret_pwd, '\0', 16);
 
-  if(fseek( mach_passwd_fp, 0L, SEEK_SET) == -1) {
+  if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
     DEBUG(0,("get_trust_account_password: Failed to seek to start of file. Error was %s.\n",
               strerror(errno) ));
     return False;
@@ -298,7 +298,7 @@ BOOL set_trust_account_password( unsigned char *md4_new_pwd)
   char linebuf[64];
   int i;
 
-  if(fseek( mach_passwd_fp, 0L, SEEK_SET) == -1) {
+  if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
     DEBUG(0,("set_trust_account_password: Failed to seek to start of file. Error was %s.\n",
               strerror(errno) ));
     return False;
index 68cbe9b35bcb3f193124a1790afb279a940b507a..4dc6d29e3cbed6bc7b1a961411fd330928b5c9b4 100644 (file)
@@ -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);
   }
index 1336e27281ba5d849d540b3fc39fb7f4b97db1b1..c2c9cc2373d1dad50eb9cb986eba6b78aae429aa 100644 (file)
@@ -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;
index 61d9aa8bddec8221d8b6592a2dc76bc087313423..ce300dc810597e3c4c3e950eb62afdee01e58c23 100644 (file)
@@ -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));
 
index 95adc5ccb761d7e8ce87f257a8521a29cf543b0c..d6d60c45cd0c647d239f95a6d4bc6bb5a890b637 100644 (file)
@@ -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;
index 42b0fba425bc43653e406ac71c6581f136714525..ad4dd9f52f18deb3c08024e0be4e99b974e53a7e 100644 (file)
@@ -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) 
index 97df3abfc359732e7ea008153dfe60f2a3735341..15d395b29a34a1c3c87679dec1325009bba0f01c 100644 (file)
@@ -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));
   
index 38c39efad6b7b5fd82edaec6e8ecaad60a65eefb..d7f29b60c6ff4fbe3de6ca5322ab5f02f4998d4b 100644 (file)
@@ -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;
index 87d1ea27d0b199d65a2f08b7a6ee3305b0385b7b..fb93fd9e109a72d6559b125505014c5f61a88977 100644 (file)
@@ -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))