configure configure.in: Added checks for statvfs64. Last bit of 64 bit widening ...
authorJeremy Allison <jra@samba.org>
Thu, 17 Sep 1998 23:06:57 +0000 (23:06 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 17 Sep 1998 23:06:57 +0000 (23:06 +0000)
include/config.h.in: Added #undef STAT_STATVFS64.
include/includes.h: Added SMB_STRUCT_STATVFS type, Changed SMB_BIG_INTEGER to
                    SMB_BIG_UINT and SMB_BIG_INT types.
include/smb.h: Added flag defines from CIFS spec.
lib/debug.c: Fixed one more mode_t issue.
lib/system.c: Added sys_statvfs wrapper.
lib/util.c: Changed trim_string to use size_t.
param/loadparm.c: Moved "blocking locks" into locking section. Alphabetised
                  locking options. Question - shuld we do this for all options ?
passdb/ldap.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
passdb/nispass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
passdb/smbpass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
smbd/dfree.c: Changed to use 64 bit types if available. Moved to use unsigned
              types.
smbd/dosmode.c: Fixed one more mode_t issue.
smbd/negprot.c: Changed literals to be FLAG_ #defines.
smbd/nttrans.c: Removed dead code.
smbd/open.c: Changed disk_free call.
smbd/process.c: Changed literals to be FLAG_ #defines.
smbd/reply.c: Changed disk_free call.
smbd/trans2.c: Fixed but in SMB_QUERY_FS_VOLUME_INFO call. Was using
               UNICODE - should use ascii.
tests/summary.c: Added STAT_STATVFS64 check.
Jeremy.

22 files changed:
source/configure
source/configure.in
source/include/config.h.in
source/include/includes.h
source/include/proto.h
source/include/smb.h
source/lib/debug.c
source/lib/system.c
source/lib/util.c
source/param/loadparm.c
source/passdb/ldap.c
source/passdb/nispass.c
source/passdb/smbpass.c
source/smbd/dfree.c
source/smbd/dosmode.c
source/smbd/negprot.c
source/smbd/nttrans.c
source/smbd/open.c
source/smbd/process.c
source/smbd/reply.c
source/smbd/trans2.c
source/tests/summary.c

index 7093b8923c8fef7138a18c3d85cf584fd795c1bf..511c44864ede97689bfeb7061938d275475ff09a 100755 (executable)
@@ -4628,6 +4628,53 @@ echo "checking how to get filesystem space usage" 1>&6
 echo "configure:4629: checking how to get filesystem space usage" >&5
 space=no
 
+# Test for statvfs64.
+if test $space = no; then
+  # SVR4
+  echo $ac_n "checking statvfs64 function (SVR4)""... $ac_c" 1>&6
+echo "configure:4636: checking statvfs64 function (SVR4)" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs64'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4644 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/statvfs.h>
+  main ()
+  {
+    struct statvfs64 fsd;
+    exit (statfs64 (".", &fsd));
+  }
+EOF
+if { (eval echo configure:4655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  fu_cv_sys_stat_statvfs64=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  fu_cv_sys_stat_statvfs64=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$fu_cv_sys_stat_statvfs64" 1>&6
+  if test $fu_cv_sys_stat_statvfs64 = yes; then
+    space=yes
+    cat >> confdefs.h <<\EOF
+#define STAT_STATVFS64 1
+EOF
+
+  fi
+fi
+
 # Perform only the link test since it seems there are no variants of the
 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
 # because that got a false positive on SCO OSR5.  Adding the declaration
@@ -4637,12 +4684,12 @@ space=no
 if test $space = no; then
   # SVR4
   echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:4641: checking statvfs function (SVR4)" >&5
+echo "configure:4688: checking statvfs function (SVR4)" >&5
 if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4646 "configure"
+#line 4693 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/statvfs.h>
@@ -4650,7 +4697,7 @@ int main() {
 struct statvfs fsd; statvfs (0, &fsd);
 ; return 0; }
 EOF
-if { (eval echo configure:4654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   fu_cv_sys_stat_statvfs=yes
 else
@@ -4675,7 +4722,7 @@ fi
 if test $space = no; then
   # DEC Alpha running OSF/1
   echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6
-echo "configure:4679: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:4726: checking for 3-argument statfs function (DEC OSF/1)" >&5
   if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4683,7 +4730,7 @@ else
   fu_cv_sys_stat_statfs3_osf1=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4687 "configure"
+#line 4734 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -4696,7 +4743,7 @@ else
     exit (statfs (".", &fsd, sizeof (struct statfs)));
   }
 EOF
-if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   fu_cv_sys_stat_statfs3_osf1=yes
 else
@@ -4723,7 +4770,7 @@ fi
 if test $space = no; then
 # AIX
   echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6
-echo "configure:4727: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:4774: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
   if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4731,7 +4778,7 @@ else
   fu_cv_sys_stat_statfs2_bsize=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4735 "configure"
+#line 4782 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_PARAM_H
@@ -4750,7 +4797,7 @@ else
   exit (statfs (".", &fsd));
   }
 EOF
-if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   fu_cv_sys_stat_statfs2_bsize=yes
 else
@@ -4777,7 +4824,7 @@ fi
 if test $space = no; then
 # SVR3
   echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6
-echo "configure:4781: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:4828: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
   if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4785,7 +4832,7 @@ else
   fu_cv_sys_stat_statfs4=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 4836 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/statfs.h>
@@ -4795,7 +4842,7 @@ else
   exit (statfs (".", &fsd, sizeof fsd, 0));
   }
 EOF
-if { (eval echo configure:4799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   fu_cv_sys_stat_statfs4=yes
 else
@@ -4822,7 +4869,7 @@ fi
 if test $space = no; then
 # 4.4BSD and NetBSD
   echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6
-echo "configure:4826: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:4873: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
   if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4830,7 +4877,7 @@ else
   fu_cv_sys_stat_statfs2_fsize=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4834 "configure"
+#line 4881 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -4846,7 +4893,7 @@ else
   exit (statfs (".", &fsd));
   }
 EOF
-if { (eval echo configure:4850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   fu_cv_sys_stat_statfs2_fsize=yes
 else
@@ -4873,7 +4920,7 @@ fi
 if test $space = no; then
   # Ultrix
   echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
-echo "configure:4877: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:4924: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
   if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4881,7 +4928,7 @@ else
   fu_cv_sys_stat_fs_data=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4885 "configure"
+#line 4932 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -4901,7 +4948,7 @@ else
   exit (statfs (".", &fsd) != 1);
   }
 EOF
-if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   fu_cv_sys_stat_fs_data=yes
 else
@@ -4930,11 +4977,11 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4934 "configure"
+#line 4981 "configure"
 #include "confdefs.h"
 #include "tests/summary.c"
 EOF
-if { (eval echo configure:4938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo "configure OK";
 else
index 543450f0f6422b557844249a6873e18bd6ead92a..00063804166a1f176426f1633cfa91696febb05b 100644 (file)
@@ -550,6 +550,26 @@ AC_ARG_WITH(netatalk,
 AC_CHECKING(how to get filesystem space usage)
 space=no
 
+# Test for statvfs64.
+if test $space = no; then
+  # SVR4
+  AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
+  [AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/statvfs.h>
+  main ()
+  {
+    struct statvfs64 fsd;
+    exit (statfs64 (".", &fsd));
+  }],
+  fu_cv_sys_stat_statvfs64=yes,
+  fu_cv_sys_stat_statvfs64=no)])
+  if test $fu_cv_sys_stat_statvfs64 = yes; then
+    space=yes
+    AC_DEFINE(STAT_STATVFS64)
+  fi
+fi
+
 # Perform only the link test since it seems there are no variants of the
 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
 # because that got a false positive on SCO OSR5.  Adding the declaration
index 2934d438dcb54989647c9e23367b856549f04c1c..4e4127e44855a1908a6cc840b61d773cf23e7402 100644 (file)
@@ -95,6 +95,7 @@
 #undef STAT_STATFS3_OSF1
 #undef STAT_STATFS4
 #undef STAT_STATVFS
+#undef STAT_STATVFS64
 #undef HAVE_NETMASK_IFREQ
 #undef HAVE_NETMASK_AIX
 #undef HAVE_CRYPT
index d8da84bd4e566df100dd4538cc548953766a7645..788e4485ab4b5c5cdb12e2f5ba5af79277c07513 100644 (file)
 #  endif
 #endif
 
+/*
+ * Type for statvfs structure.
+ */
+
+#ifndef SMB_STRUCT_STATVFS
+#  if defined(STAT_STATVFS64)
+#    define SMB_STRUCT_STATVFS struct statvfs64
+#  else
+#    define SMB_STRUCT_STATVFS struct statvfs
+#  endif
+#endif
+
 /*
  * Defines for 64 bit fcntl locks.
  */
 #endif
 
 #if defined(HAVE_LONGLONG)
-#define SMB_BIG_INTEGER unsigned long long
+#define SMB_BIG_UINT unsigned long long
+#define SMB_BIG_INT long long
 #else
-#define SMB_BIG_INTEGER unsigned long
+#define SMB_BIG_UINT unsigned long
+#define SMB_BIG_INT long
 #endif
 
 #ifndef MIN
index 6ddc92824d6b568c743e22bda528218b364f49cf..8b063bcfd969d636bc8b7a6a3cc79b09a1f04d1f 100644 (file)
@@ -158,6 +158,7 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
 int sys_stat(char *fname,SMB_STRUCT_STAT *sbuf);
 int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
 int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_statvfs( const char *path, SMB_STRUCT_STATVFS *fsd);
 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);
@@ -1669,7 +1670,6 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
 
 /*The following definitions come from  smbd/dfree.c  */
 
-int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
 
 /*The following definitions come from  smbd/dir.c  */
 
@@ -1796,7 +1796,7 @@ 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,
                      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);
+                  char *fname, int smb_ofun, mode_t unixmode, int *action);
 BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op);
 
 /*The following definitions come from  smbd/oplock.c  */
index aa963f916320edec64705c4c51cb8030b9de6b0a..de482de6d60675ea244918d3e6510764bf46fc25 100644 (file)
@@ -708,8 +708,8 @@ struct passdb_ops {
    */
   void *(*startsmbpwent)(BOOL);
   void (*endsmbpwent)(void *);
-  SMB_BIG_INTEGER (*getsmbpwpos)(void *);
-  BOOL (*setsmbpwpos)(void *, SMB_BIG_INTEGER);
+  SMB_BIG_UINT (*getsmbpwpos)(void *);
+  BOOL (*setsmbpwpos)(void *, SMB_BIG_UINT);
 
   /*
    * smb password database query functions.
@@ -925,6 +925,15 @@ struct bitmap {
 #define smb_vwv16 69
 #define smb_vwv17 71
 
+/* flag defines. CIFS spec 3.1.1 */
+#define FLAG_SUPPORT_LOCKREAD       0x01
+#define FLAG_CLIENT_BUF_AVAIL       0x02
+#define FLAG_RESERVED               0x04
+#define FLAG_CASELESS_PATHNAMES     0x08
+#define FLAG_CANONICAL_PATHNAMES    0x10
+#define FLAG_REQUEST_OPLOCK         0x20
+#define FLAG_REQUEST_BATCH_OPLOCK   0x40
+#define FLAG_REPLY                  0x80
 
 /* the complete */
 #define SMBmkdir      0x00   /* create directory */
@@ -1115,7 +1124,7 @@ struct bitmap {
 /* these are for the NT create_and_X */
 #define smb_ntcreate_NameLength (smb_vwv0 + 5)
 #define smb_ntcreate_Flags (smb_vwv0 + 7)
-#define smb_ntcreate_RootDirectoryFid (smb_wvw0 + 11)
+#define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11)
 #define smb_ntcreate_DesiredAccess (smb_vwv0 + 15)
 #define smb_ntcreate_AllocationSize (smb_vwv0 + 19)
 #define smb_ntcreate_FileAttributes (smb_vwv0 + 27)
@@ -1494,7 +1503,8 @@ extern int unix_ERR_code;
 /*
  * Core protocol.
  */
-#define CORE_OPLOCK_REQUEST(inbuf) ((CVAL(inbuf,smb_flg)&((1<<5)|(1<<6)))>>5)
+#define CORE_OPLOCK_REQUEST(inbuf) \
+    ((CVAL(inbuf,smb_flg)&(FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK))>>5)
 
 /*
  * Extended protocol.
index 5f6ad5273ad99b4e745d7dec8991f1682b8a74e1..0418098fb21cf1e93972f82b631d340fff654a9a 100644 (file)
@@ -204,7 +204,7 @@ void reopen_logs( void )
 
     if( !strcsequal( fname, debugf ) || !dbf || !file_exist( debugf, NULL ) )
       {
-      int oldumask = umask( 022 );
+      mode_t oldumask = umask( 022 );
 
       pstrcpy( debugf, fname );
       if( dbf )
@@ -314,7 +314,7 @@ va_dcl
     {
     if( !dbf )
       {
-      int oldumask = umask( 022 );
+      mode_t oldumask = umask( 022 );
 
       if( append_log )
         dbf = fopen( debugf, "a" );
index c3d97e0350f397dd630df055a71970a8de57f6ee..18e84d66f05746d24bbe7bf215fbb50bf4c1b6d7 100644 (file)
@@ -178,6 +178,19 @@ int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
 #endif
 }
 
+/*******************************************************************
+ An statvfs() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_statvfs( const char *path, SMB_STRUCT_STATVFS *fsd)
+{
+#if defined(STAT_STATVFS64)
+  return statvfs64(path, fsd);
+#else
+  return statvfs(path, fsd);
+#endif
+}
+
 /*******************************************************************
  An ftruncate() wrapper that will deal with 64 bit filesizes.
 ********************************************************************/
index 002b31d027dfed4963b1d0b67c648900e6aeb370..886b6e4ac917e739f4fb46d73a651ba65f751549 100644 (file)
@@ -1089,9 +1089,9 @@ trim the specified elements off the front and back of a string
 BOOL trim_string(char *s,char *front,char *back)
 {
   BOOL ret = False;
-  int front_len = (front && *front) ? strlen(front) : 0;
-  int back_len = (back && *back) ? strlen(back) : 0;
-  int s_len;
+  size_t front_len = (front && *front) ? strlen(front) : 0;
+  size_t back_len = (back && *back) ? strlen(back) : 0;
+  size_t s_len;
 
   while (front_len && strncmp(s, front, front_len) == 0)
   {
index 276cb13c8ee283640c360a068c0d40121a2ee13e..23f71554440d55d3c532d3434e05cb4383cf846c 100644 (file)
@@ -586,7 +586,6 @@ static struct parm_struct parm_table[] =
   {"time server",      P_BOOL,    P_GLOBAL, &Globals.bTimeServer,      NULL,   NULL,  0},
 
   {"Tuning Options", P_SEP, P_SEPARATOR},
-  {"blocking locks",   P_BOOL,    P_LOCAL,  &sDefault.bBlockingLocks,    NULL,   NULL,  0},
   {"change notify timeout", P_INTEGER, P_GLOBAL, &Globals.change_notify_timeout, NULL,   NULL,  0},
   {"deadtime",         P_INTEGER, P_GLOBAL, &Globals.deadtime,          NULL,   NULL,  0},
   {"getwd cache",      P_BOOL,    P_GLOBAL, &use_getwd_cache,           NULL,   NULL,  0},
@@ -685,17 +684,18 @@ static struct parm_struct parm_table[] =
 
   {"WINS Options", P_SEP, P_SEPARATOR},
   {"dns proxy",        P_BOOL,    P_GLOBAL, &Globals.bDNSproxy,         NULL,   NULL,  0},
-  {"wins support",     P_BOOL,    P_GLOBAL, &Globals.bWINSsupport,      NULL,   NULL,  FLAG_BASIC},
   {"wins proxy",       P_BOOL,    P_GLOBAL, &Globals.bWINSproxy,        NULL,   NULL,  0},
   {"wins server",      P_STRING,  P_GLOBAL, &Globals.szWINSserver,      NULL,   NULL,  FLAG_BASIC},
+  {"wins support",     P_BOOL,    P_GLOBAL, &Globals.bWINSsupport,      NULL,   NULL,  FLAG_BASIC},
 
   {"Locking Options", P_SEP, P_SEPARATOR},
+  {"blocking locks",   P_BOOL,    P_LOCAL,  &sDefault.bBlockingLocks,    NULL,   NULL,  0},
+  {"fake oplocks",     P_BOOL,    P_LOCAL,  &sDefault.bFakeOplocks,     NULL,   NULL,  0},
   {"locking",          P_BOOL,    P_LOCAL,  &sDefault.bLocking,         NULL,   NULL,  FLAG_GLOBAL},
+  {"ole locking compatibility",   P_BOOL,    P_GLOBAL,  &Globals.bOleLockingCompat,   NULL,   NULL,  FLAG_GLOBAL},
+  {"oplocks",          P_BOOL,    P_LOCAL,  &sDefault.bOpLocks,         NULL,   NULL,  FLAG_GLOBAL},
   {"strict locking",   P_BOOL,    P_LOCAL,  &sDefault.bStrictLocking,   NULL,   NULL,  FLAG_GLOBAL},
   {"share modes",      P_BOOL,    P_LOCAL,  &sDefault.bShareModes,      NULL,   NULL,  FLAG_GLOBAL},
-  {"oplocks",          P_BOOL,    P_LOCAL,  &sDefault.bOpLocks,         NULL,   NULL,  FLAG_GLOBAL},
-  {"fake oplocks",     P_BOOL,    P_LOCAL,  &sDefault.bFakeOplocks,     NULL,   NULL,  0},
-  {"ole locking compatibility",   P_BOOL,    P_GLOBAL,  &Globals.bOleLockingCompat,   NULL,   NULL,  FLAG_GLOBAL},
 
 #ifdef WITH_LDAP
   {"Ldap Options", P_SEP, P_SEPARATOR},
index e58e339df6e3886a3b6c98741134a19b6183f401..e27b4fbea7be35061b7dfdcb3916473245c6d26e 100644 (file)
@@ -893,25 +893,25 @@ static void endldappwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the ldap passwd list as an SMB_BIG_INTEGER.
+ Return the current position in the ldap passwd list as an SMB_BIG_UINT.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static SMB_BIG_INTEGER getldappwpos(void *vp)
+static SMB_BIG_UINT getldappwpos(void *vp)
 {
-       return 0;
+       return (SMB_BIG_UINT)0;
 }
 
 /*************************************************************************
- Set the current position in the ldap passwd list from SMB_BIG_INTEGER.
+ Set the current position in the ldap passwd list from SMB_BIG_UINT.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static BOOL setldappwpos(void *vp, SMB_BIG_INTEGER tok)
+static BOOL setldappwpos(void *vp, SMB_BIG_UINT tok)
 {
        return False;
 }
index 50b7dd2a2e053555db9323f7570b64ca0d435a4d..04c1c23b2e6a62263179d49525841b666592bbde 100644 (file)
@@ -223,25 +223,25 @@ static struct sam_passwd *getnisp21pwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the nisplus passwd list as an SMB_BIG_INTEGER.
+ Return the current position in the nisplus passwd list as an SMB_BIG_UINT.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static SMB_BIG_INTEGER getnisppwpos(void *vp)
+static SMB_BIG_UINT getnisppwpos(void *vp)
 {
-       return 0;
+       return (SMB_BIG_UINT)0;
 }
 
 /*************************************************************************
- Set the current position in the nisplus passwd list from SMB_BIG_INTEGER.
+ Set the current position in the nisplus passwd list from SMB_BIG_UINT.
  This must be treated as an opaque token.
 
  do not call this function directly.  use passdb.c instead.
 
 *************************************************************************/
-static BOOL setnisppwpos(void *vp, SMB_BIG_INTEGER tok)
+static BOOL setnisppwpos(void *vp, SMB_BIG_UINT tok)
 {
        return False;
 }
index 34de513476b0f6e0a7665a800dc777430ad302d2..a2b648b2fd239d47eabc1fdbaef7e6c8e2aed486 100644 (file)
@@ -399,21 +399,21 @@ static struct sam_passwd *getsmbfile21pwent(void *vp)
 }
 
 /*************************************************************************
- Return the current position in the smbpasswd list as an SMB_BIG_INTEGER
+ Return the current position in the smbpasswd list as an SMB_BIG_UINT.
  This must be treated as an opaque token.
 *************************************************************************/
 
-static SMB_BIG_INTEGER getsmbfilepwpos(void *vp)
+static SMB_BIG_UINT getsmbfilepwpos(void *vp)
 {
-  return (SMB_BIG_INTEGER)sys_ftell((FILE *)vp);
+  return (SMB_BIG_UINT)sys_ftell((FILE *)vp);
 }
 
 /*************************************************************************
- Set the current position in the smbpasswd list from an SMB_BIG_INTEGER.
+ Set the current position in the smbpasswd list from an SMB_BIG_UINT.
  This must be treated as an opaque token.
 *************************************************************************/
 
-static BOOL setsmbfilepwpos(void *vp, SMB_BIG_INTEGER tok)
+static BOOL setsmbfilepwpos(void *vp, SMB_BIG_UINT tok)
 {
   return !sys_fseek((FILE *)vp, (SMB_OFF_T)tok, SEEK_SET);
 }
index 799ff6a24cda1f3d969d4b96fa0f0e93429ffa35..499d0892604991c80b5ff162d901818bba3826c2 100644 (file)
@@ -27,10 +27,10 @@ extern int DEBUGLEVEL;
 /****************************************************************************
 normalise for DOS usage 
 ****************************************************************************/
-static void disk_norm(int *bsize,int *dfree,int *dsize)
+static void disk_norm(SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
 {
        /* check if the disk is beyond the max disk size */
-       int maxdisksize = lp_maxdisksize();
+       SMB_BIG_UINT maxdisksize = lp_maxdisksize();
        if (maxdisksize) {
                /* convert to blocks - and don't overflow */
                maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
@@ -58,19 +58,15 @@ static void disk_norm(int *bsize,int *dfree,int *dsize)
 
 /* Return the number of TOSIZE-byte blocks used by
    BLOCKS FROMSIZE-byte blocks, rounding away from zero.
-   TOSIZE must be positive.  Return -1 if FROMSIZE is not positive.  */
-static int adjust_blocks(int blocks, int fromsize, int tosize)
+*/
+static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SMB_BIG_UINT tosize)
 {
-       if (tosize <= 0 || fromsize <= 0) {
-               return -1;
-       }
-
        if (fromsize == tosize) /* e.g., from 512 to 512 */
                return blocks;
        else if (fromsize > tosize)     /* e.g., from 2048 to 512 */
                return blocks * (fromsize / tosize);
        else                            /* e.g., from 256 to 512 */
-               return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
+               return (blocks + 1) / (tosize / fromsize);
 }
 
 /* this does all of the system specific guff to get the free disk space.
@@ -79,10 +75,10 @@ static int adjust_blocks(int blocks, int fromsize, int tosize)
 
    results are returned in *dfree and *dsize, in 512 byte units
 */
-static int fsusage(const char *path, int *dfree, int *dsize)
+static int fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
 {
 #ifdef STAT_STATFS3_OSF1
-#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
        struct statfs fsd;
 
        if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
@@ -90,7 +86,7 @@ static int fsusage(const char *path, int *dfree, int *dsize)
 #endif /* STAT_STATFS3_OSF1 */
        
 #ifdef STAT_STATFS2_FS_DATA    /* Ultrix */
-#define CONVERT_BLOCKS(B) adjust_blocks ((B), 1024, 512)       
+#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)1024, (SMB_BIG_UINT)512)     
        struct fs_data fsd;
        
        if (statfs (path, &fsd) != 1)
@@ -101,7 +97,7 @@ static int fsusage(const char *path, int *dfree, int *dsize)
 #endif /* STAT_STATFS2_FS_DATA */
        
 #ifdef STAT_STATFS2_BSIZE      /* 4.3BSD, SunOS 4, HP-UX, AIX */
-#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
        struct statfs fsd;
        
        if (statfs (path, &fsd) < 0)
@@ -123,7 +119,7 @@ static int fsusage(const char *path, int *dfree, int *dsize)
        
 
 #ifdef STAT_STATFS2_FSIZE      /* 4.4BSD */
-#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
        
        struct statfs fsd;
        
@@ -133,12 +129,12 @@ static int fsusage(const char *path, int *dfree, int *dsize)
        
 #ifdef STAT_STATFS4            /* SVR3, Dynix, Irix, AIX */
 # if _AIX || defined(_CRAY)
-#  define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
+#  define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
 #  ifdef _CRAY
 #   define f_bavail f_bfree
 #  endif
 # else
-#  define CONVERT_BLOCKS(B) (B)
+#  define CONVERT_BLOCKS(B) ((SMB_BIG_UINT)B)
 #  ifndef _SEQUENT_            /* _SEQUENT_ is DYNIX/ptx */
 #   ifndef DOLPHIN             /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
 #    define f_bavail f_bfree
@@ -158,11 +154,11 @@ static int fsusage(const char *path, int *dfree, int *dsize)
 
 #ifdef STAT_STATVFS            /* SVR4 */
 # define CONVERT_BLOCKS(B) \
-       adjust_blocks ((B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
+       adjust_blocks ((SMB_BIG_UINT)(B), fsd.f_frsize ? (SMB_BIG_UINT)fsd.f_frsize : (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
 
-       struct statvfs fsd;
+       SMB_STRUCT_STATVFS fsd;
 
-       if (statvfs (path, &fsd) < 0)
+       if (sys_statvfs (path, &fsd) < 0)
                return -1;
        /* f_frsize isn't guaranteed to be supported.  */
 
@@ -185,7 +181,7 @@ static int fsusage(const char *path, int *dfree, int *dsize)
 /****************************************************************************
   return number of 1K blocks available on a path and total number 
 ****************************************************************************/
-static int disk_free(char *path,int *bsize,int *dfree,int *dsize)
+static SMB_BIG_UINT disk_free(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
 {
        int dfree_retval;
 
@@ -223,9 +219,7 @@ static int disk_free(char *path,int *bsize,int *dfree,int *dsize)
 /****************************************************************************
 wrap it to get filenames right
 ****************************************************************************/
-int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize)
+SMB_BIG_UINT sys_disk_free(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
 {
        return(disk_free(dos_to_unix(path,False),bsize,dfree,dsize));
 }
-
-
index c2c9cc2373d1dad50eb9cb986eba6b78aae429aa..b74e11e643d9ab5c88e9d239143e04abca5948bb 100644 (file)
@@ -143,7 +143,7 @@ int file_chmod(connection_struct *conn,char *fname,int dosmode,SMB_STRUCT_STAT *
 {
   SMB_STRUCT_STAT st1;
   int mask=0;
-  int tmp;
+  mode_t tmp;
   mode_t unixmode;
 
   if (!st) {
index e9dd4614c42c6a332a9072143aa8716ab48263c8..e79743cfd4b66e29b5ad1c686b9bc0e50a323535 100644 (file)
@@ -50,7 +50,8 @@ static int reply_coreplus(char *outbuf)
   int outsize = set_message(outbuf,13,0,True);
   SSVAL(outbuf,smb_vwv5,raw); /* tell redirector we support
                                 readbraw and writebraw (possibly) */
-  CVAL(outbuf,smb_flg) = 0x81; /* Reply, SMBlockread, SMBwritelock supported */
+  /* Reply, SMBlockread, SMBwritelock supported. */
+  SCVAL(outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
   SSVAL(outbuf,smb_vwv1,0x1); /* user level security, don't encrypt */ 
 
   Protocol = PROTOCOL_COREPLUS;
@@ -80,7 +81,8 @@ static int reply_lanman1(char *outbuf)
 
   Protocol = PROTOCOL_LANMAN1;
 
-  CVAL(outbuf,smb_flg) = 0x81; /* Reply, SMBlockread, SMBwritelock supported */
+  /* Reply, SMBlockread, SMBwritelock supported. */
+  SCVAL(outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
   SSVAL(outbuf,smb_vwv2,max_recv);
   SSVAL(outbuf,smb_vwv3,lp_maxmux()); /* maxmux */
   SSVAL(outbuf,smb_vwv4,1);
@@ -138,7 +140,8 @@ static int reply_lanman2(char *outbuf)
 
   Protocol = PROTOCOL_LANMAN2;
 
-  CVAL(outbuf,smb_flg) = 0x81; /* Reply, SMBlockread, SMBwritelock supported */
+  /* Reply, SMBlockread, SMBwritelock supported. */
+  SCVAL(outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
   SSVAL(outbuf,smb_vwv2,max_recv);
   SSVAL(outbuf,smb_vwv3,lp_maxmux()); 
   SSVAL(outbuf,smb_vwv4,1);
@@ -417,4 +420,3 @@ int reply_negprot(connection_struct *conn,
 
   return(outsize);
 }
-
index d6d60c45cd0c647d239f95a6d4bc6bb5a890b637..ca977c39dcc9c2030703569c190f5b7211c7aaf3 100644 (file)
@@ -712,7 +712,7 @@ static int call_nt_transact_create(connection_struct *conn,
   int oplock_request = 0;
   mode_t unixmode;
   int pnum = -1;
-  int fmode=0,mtime=0,rmode=0;
+  int fmode=0,rmode=0;
   off_t file_len = 0;
   SMB_STRUCT_STAT sbuf;
   int smb_action = 0;
@@ -834,7 +834,6 @@ static int call_nt_transact_create(connection_struct *conn,
       fmode = dos_mode(conn,fname,&sbuf);
       if(fmode == 0)
         fmode = FILE_ATTRIBUTE_NORMAL;
-      mtime = sbuf.st_mtime;
 
       if (fmode & aDIR) {
         close_file(fsp,False);
index ad4dd9f52f18deb3c08024e0be4e99b974e53a7e..108ef814ee1b02f2eb0ddf0066ab7f3735e57f56 100644 (file)
@@ -444,13 +444,12 @@ static void open_file(files_struct *fsp,connection_struct *conn,
   if ((fd_ptr->fd >=0) && 
       conn->printer && lp_minprintspace(SNUM(conn))) {
     pstring dname;
-    int dum1,dum2,dum3;
+    SMB_BIG_UINT dum1,dum2,dum3;
     char *p;
     pstrcpy(dname,fname);
     p = strrchr(dname,'/');
     if (p) *p = 0;
-    if (sys_disk_free(dname,&dum1,&dum2,&dum3) < 
-       lp_minprintspace(SNUM(conn))) {
+    if (sys_disk_free(dname,&dum1,&dum2,&dum3) < (SMB_BIG_UINT)lp_minprintspace(SNUM(conn))) {
       if(fd_attempt_close(fd_ptr) == 0)
         dos_unlink(fname);
       fsp->fd_ptr = 0;
@@ -957,7 +956,7 @@ dev = %x, inode = %.0f\n", oplock_request, fname, (unsigned int)dev, (double)ino
  Open a directory from an NT SMB call.
 ****************************************************************************/
 int open_directory(files_struct *fsp,connection_struct *conn,
-                  char *fname, int smb_ofun, int unixmode, int *action)
+                  char *fname, int smb_ofun, mode_t unixmode, int *action)
 {
        extern struct current_user current_user;
        SMB_STRUCT_STAT st;
index b72178013db200c61fc11e3b81f9b9353df93edb..1d6de37df07a53470b19ceb04f947fce9c013bf8 100644 (file)
@@ -501,9 +501,9 @@ void construct_reply_common(char *inbuf,char *outbuf)
   memcpy(outbuf+4,inbuf+4,4);
   CVAL(outbuf,smb_rcls) = SMB_SUCCESS;
   CVAL(outbuf,smb_reh) = 0;
-  CVAL(outbuf,smb_flg) = 0x80 | (CVAL(inbuf,smb_flg) & 0x8); /* bit 7 set
+  SCVAL(outbuf,smb_flg, FLAG_REPLY | (CVAL(inbuf,smb_flg) & FLAG_CASELESS_PATHNAMES)); /* bit 7 set
                                  means a reply */
-  SSVAL(outbuf,smb_flg2,1); /* say we support long filenames */
+  SSVAL(outbuf,smb_flg2,FLAGS2_LONG_PATH_COMPONENTS); /* say we support long filenames */
   SSVAL(outbuf,smb_err,SMB_SUCCESS);
   SSVAL(outbuf,smb_tid,SVAL(inbuf,smb_tid));
   SSVAL(outbuf,smb_pid,SVAL(inbuf,smb_pid));
index d7f29b60c6ff4fbe3de6ca5322ab5f02f4998d4b..93beb12af3822a40545f8c9b1e876f382fe5ffa8 100644 (file)
@@ -921,7 +921,7 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
 int reply_dskattr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
 {
   int outsize = 0;
-  int dfree,dsize,bsize;
+  SMB_BIG_UINT dfree,dsize,bsize;
   
   sys_disk_free(".",&bsize,&dfree,&dsize);
   
index fb93fd9e109a72d6559b125505014c5f61a88977..49687d4cca0bfdf4d6810f6c9008a34e927c78f5 100644 (file)
@@ -1094,7 +1094,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
   {
     case 1:
     {
-      int dfree,dsize,bsize;
+      SMB_BIG_UINT dfree,dsize,bsize;
       data_len = 18;
       sys_disk_free(".",&bsize,&dfree,&dsize); 
       SIVAL(pdata,l1_idFileSystem,st.st_dev);
@@ -1102,8 +1102,9 @@ static int call_trans2qfsinfo(connection_struct *conn,
       SIVAL(pdata,l1_cUnit,dsize);
       SIVAL(pdata,l1_cUnitAvail,dfree);
       SSVAL(pdata,l1_cbSector,512);
-      DEBUG(5,("call_trans2qfsinfo : bsize=%d, id=%x, cSectorUnit=%d, cUnit=%d, cUnitAvail=%d, cbSector=%d\n",
-                bsize, (unsigned)st.st_dev, bsize/512, dsize, dfree, 512));
+      DEBUG(5,("call_trans2qfsinfo : bsize=%u, id=%x, cSectorUnit=%u, cUnit=%u, cUnitAvail=%u, cbSector=%d\n",
+                (unsigned int)bsize, (unsigned int)st.st_dev, ((unsigned int)bsize)/512, (unsigned int)dsize,
+         (unsigned int)dfree, 512));
       break;
     }
     case 2:
@@ -1132,6 +1133,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
       SIVAL(pdata,4,128); /* Max filename component length */
       SIVAL(pdata,8,2*strlen(FSTYPE_STRING));
       PutUniCode(pdata+12,FSTYPE_STRING);
+      SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS);
       break;
     case SMB_QUERY_FS_LABEL_INFO:
       data_len = 4 + strlen(vname);
@@ -1139,20 +1141,27 @@ static int call_trans2qfsinfo(connection_struct *conn,
       pstrcpy(pdata+4,vname);      
       break;
     case SMB_QUERY_FS_VOLUME_INFO:      
-      data_len = 18 + 2*strlen(vname);
+
+      /*
+       * NB: The earlier CIFS spec that says this always  
+       * uses UNICODE is incorrect ! JRA.
+       */
+
+      data_len = 18 + strlen(vname);
+
       /* 
        * Add volume serial number - hash of a combination of
        * the called hostname and the service name.
        */
       SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^ (str_checksum(local_machine)<<16) );
-      SIVAL(pdata,12,2*strlen(vname));
-      PutUniCode(pdata+18,vname);      
+      SIVAL(pdata,12,strlen(vname));
+      pstrcpy(pdata+18,vname);      
       DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n", strlen(vname),
               vname));
       break;
     case SMB_QUERY_FS_SIZE_INFO:
     {
-      int dfree,dsize,bsize;
+      SMB_BIG_UINT dfree,dsize,bsize;
       data_len = 24;
       sys_disk_free(".",&bsize,&dfree,&dsize); 
       SIVAL(pdata,0,dsize);
index 8c0d3005afd7b2667fb1d3262cf749a1b3426637..b89bac86ac479068476a269f67fb8fe3aef51bea 100644 (file)
@@ -19,7 +19,7 @@ main()
        printf("WARNING: No automated netmask determination - use an interfaces line\n");
 #endif
 
-#if !(defined(STAT_STATVFS) || defined(STAT_STATFS3_OSF1) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS4) || defined(STAT_STATFS2_FSIZE) || defined(STAT_STATFS2_FS_DATA))
+#if !(defined(STAT_STATVFS) || defined(STAT_STATVFS64) || defined(STAT_STATFS3_OSF1) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS4) || defined(STAT_STATFS2_FSIZE) || defined(STAT_STATFS2_FS_DATA))
        printf("ERROR: No disk free routine!\n");
        exit(1);
 #endif