summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-17 23:06:57 +0000
committerJeremy Allison <jra@samba.org>1998-09-17 23:06:57 +0000
commitb8b67f4fab4a6fd686c5796c2701882197a7bd9d (patch)
tree3f465f69a283a44e5c8414a3326f53caea4664d0 /source3
parentac9b687cc2496409e1c8d86393812faf94ec7550 (diff)
downloadsamba-b8b67f4fab4a6fd686c5796c2701882197a7bd9d.tar.gz
samba-b8b67f4fab4a6fd686c5796c2701882197a7bd9d.tar.bz2
samba-b8b67f4fab4a6fd686c5796c2701882197a7bd9d.zip
configure configure.in: Added checks for statvfs64. Last bit of 64 bit widening (I hope :-).
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. (This used to be commit c512b1b91fb7f2a7a93b9033a33e06d966daadb4)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/configure87
-rw-r--r--source3/configure.in20
-rw-r--r--source3/include/config.h.in1
-rw-r--r--source3/include/includes.h18
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/include/smb.h18
-rw-r--r--source3/lib/debug.c4
-rw-r--r--source3/lib/system.c13
-rw-r--r--source3/lib/util.c6
-rw-r--r--source3/param/loadparm.c10
-rw-r--r--source3/passdb/ldap.c10
-rw-r--r--source3/passdb/nispass.c10
-rw-r--r--source3/passdb/smbpass.c10
-rw-r--r--source3/smbd/dfree.c40
-rw-r--r--source3/smbd/dosmode.c2
-rw-r--r--source3/smbd/negprot.c10
-rw-r--r--source3/smbd/nttrans.c3
-rw-r--r--source3/smbd/open.c7
-rw-r--r--source3/smbd/process.c4
-rw-r--r--source3/smbd/reply.c2
-rw-r--r--source3/smbd/trans2.c23
-rw-r--r--source3/tests/summary.c2
22 files changed, 206 insertions, 98 deletions
diff --git a/source3/configure b/source3/configure
index 7093b8923c..511c44864e 100755
--- a/source3/configure
+++ b/source3/configure
@@ -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
diff --git a/source3/configure.in b/source3/configure.in
index 543450f0f6..0006380416 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -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
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index 2934d438dc..4e4127e448 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -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
diff --git a/source3/include/includes.h b/source3/include/includes.h
index d8da84bd4e..788e4485ab 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -375,6 +375,18 @@
#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.
*/
@@ -411,9 +423,11 @@
#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
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6ddc92824d..8b063bcfd9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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 */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index aa963f9163..de482de6d6 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -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.
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 5f6ad5273a..0418098fb2 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -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" );
diff --git a/source3/lib/system.c b/source3/lib/system.c
index c3d97e0350..18e84d66f0 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -179,6 +179,19 @@ int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
}
/*******************************************************************
+ 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.
********************************************************************/
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 002b31d027..886b6e4ac9 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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)
{
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 276cb13c8e..23f7155444 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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},
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c
index e58e339df6..e27b4fbea7 100644
--- a/source3/passdb/ldap.c
+++ b/source3/passdb/ldap.c
@@ -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;
}
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index 50b7dd2a2e..04c1c23b2e 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -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;
}
diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c
index 34de513476..a2b648b2fd 100644
--- a/source3/passdb/smbpass.c
+++ b/source3/passdb/smbpass.c
@@ -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);
}
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 799ff6a24c..499d089260 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -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));
}
-
-
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index c2c9cc2373..b74e11e643 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -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) {
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index e9dd4614c4..e79743cfd4 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -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);
}
-
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index d6d60c45cd..ca977c39dc 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -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);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index ad4dd9f52f..108ef814ee 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -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;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index b72178013d..1d6de37df0 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -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));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index d7f29b60c6..93beb12af3 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index fb93fd9e10..49687d4cca 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -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);
diff --git a/source3/tests/summary.c b/source3/tests/summary.c
index 8c0d3005af..b89bac86ac 100644
--- a/source3/tests/summary.c
+++ b/source3/tests/summary.c
@@ -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