Ok - this is the 64 bit widening check in. It changes the configure
authorJeremy Allison <jra@samba.org>
Thu, 3 Sep 1998 18:40:31 +0000 (18:40 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 3 Sep 1998 18:40:31 +0000 (18:40 +0000)
to check for stat64 and friends, and then changes much of Samba
to use the data type SMB_OFF_T for file size information.

stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide
the 64 bit calls if needed.

Note that this still does not expose 64 bit functionality to the
client, as the changes to the reply_xxx smb's are not yet done.

This code change should make these changes possible.

Still to do before full 64 bit-ness to the client:

fcntl lock code.
statfs code
widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T
types being in place).

Let me know if wierd things happen after this check-in and I'll
fix them :-).

Jeremy.
(This used to be commit 14500936c321d15995c963766aac67bf1f4e3824)

33 files changed:
source3/client/client.c
source3/client/clitar.c
source3/client/smbmnt.c
source3/configure
source3/configure.in
source3/include/config.h.in
source3/include/includes.h
source3/include/proto.h
source3/include/smb.h
source3/lib/charset.c
source3/lib/debug.c
source3/lib/netatalk.c
source3/lib/replace.c
source3/lib/smbrun.c
source3/lib/system.c
source3/lib/util.c
source3/locking/locking_slow.c
source3/locking/shmem.c
source3/passdb/passdb.c
source3/passdb/smbpass.c
source3/printing/printing.c
source3/script/mkproto.awk
source3/smbd/connection.c
source3/smbd/dir.c
source3/smbd/fileio.c
source3/smbd/groupname.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/predict.c
source3/smbd/quotas.c
source3/smbd/reply.c
source3/smbd/trans2.c
source3/utils/make_smbcodepage.c

index 0b98d1f670610f4b43f8327a65407560927894dc..d5dece1626efeb06c1cee98fed6e0006ec885b74 100644 (file)
@@ -462,11 +462,19 @@ static void display_finfo(file_info *finfo)
 {
   if (do_this_one(finfo)) {
     time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
+#ifdef LARGE_SMB_OFF_T
+    DEBUG(0,("  %-30s%7.7s%.0f  %s",
+       CNV_LANG(finfo->name),
+          attrib_string(finfo->mode),
+          (double)finfo->size,
+          asctime(LocalTime(&t))));
+#else /* LARGE_SMB_OFF_T */
     DEBUG(0,("  %-30s%7.7s%10d  %s",
           CNV_LANG(finfo->name),
           attrib_string(finfo->mode),
           finfo->size,
           asctime(LocalTime(&t))));
+#endif /* LARGE_SMB_OFF_T */
     dir_total += finfo->size;
   }
 }
@@ -1190,10 +1198,17 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
     }
 
 
+#ifdef LARGE_SMB_OFF_T
+  DEBUG(2,("getting file %s of size %.0f bytes as %s ",
+          CNV_LANG(finfo.name),
+          (double)finfo.size,
+          lname));
+#else /* LARGE_SMB_OFF_T */
   DEBUG(2,("getting file %s of size %d bytes as %s ",
           CNV_LANG(finfo.name),
           finfo.size,
           lname));
+#endif /* LARGE_SMB_OFF_T */
 
   while (nread < finfo.size && !close_done)
     {
@@ -1202,7 +1217,11 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
 
       p=NULL;
       
+#ifdef LARGE_SMB_OFF_T
+      DEBUG(3,("nread=%d max_xmit=%d fsize=%.0f\n",nread,max_xmit,(double)finfo.size));
+#else /* LARGE_SMB_OFF_T */
       DEBUG(3,("nread=%d max_xmit=%d fsize=%d\n",nread,max_xmit,finfo.size));
+#endif /* LARGE_SMB_OFF_T */
 
       /* 3 possible read types. readbraw if a large block is required.
         readX + close if not much left and read if neither is supported */
@@ -1880,7 +1899,11 @@ static void do_put(char *rname,char *lname,file_info *finfo)
   if (finfo->size < 0)
     finfo->size = file_size(lname);
   
+#ifdef LARGE_SMB_OFF_T
+  DEBUG(1,("putting file %s of size %.0f bytes as %s ",lname,(double)finfo->size,CNV_LANG(rname)));
+#else /* LARGE_SMB_OFF_T */
   DEBUG(1,("putting file %s of size %d bytes as %s ",lname,finfo->size,CNV_LANG(rname)));
+#endif /* LARGE_SMB_OFF_T */
   
   if (!maxwrite)
     maxwrite = writebraw_supported?MAX(max_xmit,BUFFER_SIZE):(max_xmit-200);
index 66421546833c2860d3c9215591a96f6f38a2e3f6..502a867f60ade9a5c7a3fc7aaaf78149a163e40a 100644 (file)
@@ -446,7 +446,7 @@ static void dotareof(int f)
   (void) dozerobuf(f, TBLOCK);
   (void) dozerobuf(f, TBLOCK);
 
-  if (fstat(f, &stbuf) == -1)
+  if (sys_fstat(f, &stbuf) == -1)
     {
       DEBUG(0, ("Couldn't stat file handle\n"));
       return;
index 9fb0dba99d81aed9fb0d57013c57f515edff9e1f..f6753090b8ad600556287f331f0b45da35552a23 100644 (file)
@@ -197,7 +197,7 @@ main(int argc, char *argv[])
         argv += 1;
         argc -= 1;
 
-        if (stat(mount_point, &st) == -1) {
+        if (sys_stat(mount_point, &st) == -1) {
                 fprintf(stderr, "could not find mount point %s: %s\n",
                         mount_point, strerror(errno));
                 exit(1);
index b576f02642ff64b07fe96c95217e3b6927222523..827e2984d46abc1c89819dea2812c8661e0eb8f6 100755 (executable)
@@ -3466,7 +3466,7 @@ else
 fi
 done
 
-for ac_func in setuidx setgroups mktime rename ftruncate
+for ac_func in setuidx setgroups mktime rename ftruncate stat64 fstat64 lstat64
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:3473: checking for $ac_func" >&5
@@ -3521,7 +3521,7 @@ else
 fi
 done
 
-for ac_func in set_auth_parameters atexit grantpt getspnam dup2
+for ac_func in set_auth_parameters atexit grantpt getspnam dup2 lseek64 ftruncate64
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:3528: checking for $ac_func" >&5
@@ -3658,7 +3658,7 @@ rm -fr conftest*
 fi
 
 
-echo $ac_n "checking for off64_t ... $ac_c"
+echo $ac_n "checking for 64 bit off_t ... $ac_c"
 if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
@@ -3667,9 +3667,35 @@ else
 #include "confdefs.h"
 #include <stdio.h>
 #include <sys/stat.h>
-main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
+main() { exit((sizeof(off_t) == 8) ? 0 : 1); }
 EOF
 if { (eval echo configure:3673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  echo yes;cat >> confdefs.h <<\EOF
+#define SIZEOF_OFF_T 8
+EOF
+
+echo no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for off64_t ... $ac_c"
+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 3693 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+#include <sys/stat.h>
+main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
+EOF
+if { (eval echo configure:3699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_OFF64_T 1
@@ -3690,7 +3716,7 @@ 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 3694 "configure"
+#line 3720 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -3698,7 +3724,7 @@ else
 #include <sys/sem.h>
 main() { union semun ss; exit(0); }
 EOF
-if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_UNION_SEMUN 1
@@ -3719,12 +3745,12 @@ 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 3723 "configure"
+#line 3749 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main() { char c; c=250; exit((c > 0)?0:1); }
 EOF
-if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_UNSIGNED_CHAR 1
@@ -3742,7 +3768,7 @@ fi
 
 echo $ac_n "checking for sin_len in sock ... $ac_c"
 cat > conftest.$ac_ext <<EOF
-#line 3746 "configure"
+#line 3772 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -3751,7 +3777,7 @@ int main() {
 struct sockaddr_in sock; sock.sin_len = sizeof(sock);
 ; return 0; }
 EOF
-if { (eval echo configure:3755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_SOCK_SIN_LEN 1
@@ -3767,14 +3793,14 @@ rm -f conftest*
 
 echo $ac_n "checking for __FILE__ macro ... $ac_c"
 cat > conftest.$ac_ext <<EOF
-#line 3771 "configure"
+#line 3797 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("%s\n", __FILE__);
 ; return 0; }
 EOF
-if { (eval echo configure:3778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_FILE_MACRO 1
@@ -3790,14 +3816,14 @@ rm -f conftest*
 
 echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
 cat > conftest.$ac_ext <<EOF
-#line 3794 "configure"
+#line 3820 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 int main() {
 printf("%s\n", __FUNCTION__);
 ; return 0; }
 EOF
-if { (eval echo configure:3801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_FUNCTION_MACRO 1
@@ -3816,14 +3842,14 @@ 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 3820 "configure"
+#line 3846 "configure"
 #include "confdefs.h"
 
 #include <sys/time.h>
 #include <unistd.h>
 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}
 EOF
-if { (eval echo configure:3827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_GETTIMEOFDAY_TZ 1
@@ -3845,7 +3871,7 @@ 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 3849 "configure"
+#line 3875 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <dirent.h>
@@ -3853,7 +3879,7 @@ main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
 di->d_name[0] == 0) exit(0); exit(1);} 
 EOF
-if { (eval echo configure:3857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes - you are using the broken /usr/ucb/cc;cat >> confdefs.h <<\EOF
 #define HAVE_BROKEN_READDIR 1
@@ -3871,7 +3897,7 @@ fi
 
 echo $ac_n "checking for utimbuf ... $ac_c"
 cat > conftest.$ac_ext <<EOF
-#line 3875 "configure"
+#line 3901 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <utime.h>
@@ -3879,7 +3905,7 @@ int main() {
 struct utimbuf tbuf;  tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));
 ; return 0; }
 EOF
-if { (eval echo configure:3883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_UTIMBUF 1
@@ -3898,11 +3924,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 3902 "configure"
+#line 3928 "configure"
 #include "confdefs.h"
 #include "tests/ftruncate.c"
 EOF
-if { (eval echo configure:3906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_FTRUNCATE_EXTEND 1
@@ -3923,11 +3949,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 3927 "configure"
+#line 3953 "configure"
 #include "confdefs.h"
 #include "tests/getgroups.c"
 EOF
-if { (eval echo configure:3931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_BROKEN_GETGROUPS 1
@@ -3949,7 +3975,7 @@ 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 3953 "configure"
+#line 3979 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -3961,7 +3987,7 @@ if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
     strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } 
 exit(1);}
 EOF
-if { (eval echo configure:3965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define REPLACE_INET_NTOA 1
@@ -3982,11 +4008,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 3986 "configure"
+#line 4012 "configure"
 #include "confdefs.h"
 main() { exit(getuid() != 0); }
 EOF
-if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_ROOT 1
@@ -4008,14 +4034,14 @@ 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 4012 "configure"
+#line 4038 "configure"
 #include "confdefs.h"
 
 #define HAVE_NETMASK_IFCONF 1
 #define AUTOCONF 1
 #include "lib/netmask.c"
 EOF
-if { (eval echo configure:4019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;netmask=yes;cat >> confdefs.h <<\EOF
 #define HAVE_NETMASK_IFCONF 1
@@ -4037,14 +4063,14 @@ 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 4041 "configure"
+#line 4067 "configure"
 #include "confdefs.h"
 
 #define HAVE_NETMASK_IFREQ 1
 #define AUTOCONF 1
 #include "lib/netmask.c"
 EOF
-if { (eval echo configure:4048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;netmask=yes;cat >> confdefs.h <<\EOF
 #define HAVE_NETMASK_IFREQ 1
@@ -4067,14 +4093,14 @@ 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 4071 "configure"
+#line 4097 "configure"
 #include "confdefs.h"
 
 #define HAVE_NETMASK_AIX 1
 #define AUTOCONF 1
 #include "lib/netmask.c"
 EOF
-if { (eval echo configure:4078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;netmask=yes;cat >> confdefs.h <<\EOF
 #define HAVE_NETMASK_AIX 1
@@ -4096,11 +4122,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 4100 "configure"
+#line 4126 "configure"
 #include "confdefs.h"
 #include "tests/trapdoor.c"
 EOF
-if { (eval echo configure:4104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo no
 else
@@ -4121,11 +4147,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 4125 "configure"
+#line 4151 "configure"
 #include "confdefs.h"
 #include "tests/shared_mmap.c"
 EOF
-if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_SHARED_MMAP 1
@@ -4146,11 +4172,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 4150 "configure"
+#line 4176 "configure"
 #include "confdefs.h"
 #include "tests/fcntl_lock.c"
 EOF
-if { (eval echo configure:4154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_FCNTL_LOCK 1
@@ -4171,11 +4197,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 4175 "configure"
+#line 4201 "configure"
 #include "confdefs.h"
 #include "tests/sysv_ipc.c"
 EOF
-if { (eval echo configure:4179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo yes;cat >> confdefs.h <<\EOF
 #define HAVE_SYSV_IPC 1
@@ -4194,7 +4220,7 @@ fi
 #################################################
 # check for the AFS filesystem
 echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6
-echo "configure:4198: checking whether to use AFS" >&5
+echo "configure:4224: checking whether to use AFS" >&5
 # Check whether --with-afs or --without-afs was given.
 if test "${with_afs+set}" = set; then
   withval="$with_afs"
@@ -4220,7 +4246,7 @@ fi
 #################################################
 # check for the DFS auth system
 echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6
-echo "configure:4224: checking whether to use DFS auth" >&5
+echo "configure:4250: checking whether to use DFS auth" >&5
 # Check whether --with-dfs or --without-dfs was given.
 if test "${with_dfs+set}" = set; then
   withval="$with_dfs"
@@ -4245,7 +4271,7 @@ fi
 #################################################
 # check for automount support
 echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6
-echo "configure:4249: checking whether to use AUTOMOUNT" >&5
+echo "configure:4275: checking whether to use AUTOMOUNT" >&5
 # Check whether --with-automount or --without-automount was given.
 if test "${with_automount+set}" = set; then
   withval="$with_automount"
@@ -4270,7 +4296,7 @@ fi
 #################################################
 # check for a LDAP password database
 echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6
-echo "configure:4274: checking whether to use LDAP password database" >&5
+echo "configure:4300: checking whether to use LDAP password database" >&5
 # Check whether --with-ldap or --without-ldap was given.
 if test "${with_ldap+set}" = set; then
   withval="$with_ldap"
@@ -4295,7 +4321,7 @@ fi
 #################################################
 # check for a NISPLUS password database
 echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6
-echo "configure:4299: checking whether to use NISPLUS password database" >&5
+echo "configure:4325: checking whether to use NISPLUS password database" >&5
 # Check whether --with-nisplus or --without-nisplus was given.
 if test "${with_nisplus+set}" = set; then
   withval="$with_nisplus"
@@ -4320,7 +4346,7 @@ fi
 #################################################
 # check for a NISPLUS_HOME support 
 echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6
-echo "configure:4324: checking whether to use NISPLUS_HOME" >&5
+echo "configure:4350: checking whether to use NISPLUS_HOME" >&5
 # Check whether --with-nisplus-home or --without-nisplus-home was given.
 if test "${with_nisplus_home+set}" = set; then
   withval="$with_nisplus_home"
@@ -4345,7 +4371,7 @@ fi
 #################################################
 # check for the secure socket layer
 echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
-echo "configure:4349: checking whether to use SSL" >&5
+echo "configure:4375: checking whether to use SSL" >&5
 # Check whether --with-ssl or --without-ssl was given.
 if test "${with_ssl+set}" = set; then
   withval="$with_ssl"
@@ -4370,7 +4396,7 @@ fi
 #################################################
 # check for experimental mmap support
 echo $ac_n "checking whether to use MMAP""... $ac_c" 1>&6
-echo "configure:4374: checking whether to use MMAP" >&5
+echo "configure:4400: checking whether to use MMAP" >&5
 # Check whether --with-mmap or --without-mmap was given.
 if test "${with_mmap+set}" = set; then
   withval="$with_mmap"
@@ -4395,7 +4421,7 @@ fi
 #################################################
 # check for syslog logging
 echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
-echo "configure:4399: checking whether to use syslog logging" >&5
+echo "configure:4425: checking whether to use syslog logging" >&5
 # Check whether --with-syslog or --without-syslog was given.
 if test "${with_syslog+set}" = set; then
   withval="$with_syslog"
@@ -4420,7 +4446,7 @@ fi
 #################################################
 # check for experimental netatalk resource fork support
 echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6
-echo "configure:4424: checking whether to support netatalk" >&5
+echo "configure:4450: checking whether to support netatalk" >&5
 # Check whether --with-netatalk or --without-netatalk was given.
 if test "${with_netatalk+set}" = set; then
   withval="$with_netatalk"
@@ -4446,7 +4472,7 @@ fi
 #################################################
 # these tests are taken from the GNU fileutils package
 echo "checking how to get filesystem space usage" 1>&6
-echo "configure:4450: checking how to get filesystem space usage" >&5
+echo "configure:4476: checking how to get filesystem space usage" >&5
 space=no
 
 # Perform only the link test since it seems there are no variants of the
@@ -4458,12 +4484,12 @@ space=no
 if test $space = no; then
   # SVR4
   echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:4462: checking statvfs function (SVR4)" >&5
+echo "configure:4488: 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 4467 "configure"
+#line 4493 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/statvfs.h>
@@ -4471,7 +4497,7 @@ int main() {
 struct statvfs fsd; statvfs (0, &fsd);
 ; return 0; }
 EOF
-if { (eval echo configure:4475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   fu_cv_sys_stat_statvfs=yes
 else
@@ -4496,7 +4522,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:4500: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:4526: 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
@@ -4504,7 +4530,7 @@ else
   fu_cv_sys_stat_statfs3_osf1=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4508 "configure"
+#line 4534 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -4517,7 +4543,7 @@ else
     exit (statfs (".", &fsd, sizeof (struct statfs)));
   }
 EOF
-if { (eval echo configure:4521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4547: \"$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
@@ -4544,7 +4570,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:4548: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:4574: 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
@@ -4552,7 +4578,7 @@ else
   fu_cv_sys_stat_statfs2_bsize=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4556 "configure"
+#line 4582 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_PARAM_H
@@ -4571,7 +4597,7 @@ else
   exit (statfs (".", &fsd));
   }
 EOF
-if { (eval echo configure:4575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4601: \"$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
@@ -4598,7 +4624,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:4602: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:4628: 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
@@ -4606,7 +4632,7 @@ else
   fu_cv_sys_stat_statfs4=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4610 "configure"
+#line 4636 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/statfs.h>
@@ -4616,7 +4642,7 @@ else
   exit (statfs (".", &fsd, sizeof fsd, 0));
   }
 EOF
-if { (eval echo configure:4620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4646: \"$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
@@ -4643,7 +4669,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:4647: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:4673: 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
@@ -4651,7 +4677,7 @@ else
   fu_cv_sys_stat_statfs2_fsize=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4655 "configure"
+#line 4681 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -4667,7 +4693,7 @@ else
   exit (statfs (".", &fsd));
   }
 EOF
-if { (eval echo configure:4671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4697: \"$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
@@ -4694,7 +4720,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:4698: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:4724: 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
@@ -4702,7 +4728,7 @@ else
   fu_cv_sys_stat_fs_data=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 4706 "configure"
+#line 4732 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_PARAM_H
@@ -4722,7 +4748,7 @@ else
   exit (statfs (".", &fsd) != 1);
   }
 EOF
-if { (eval echo configure:4726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4752: \"$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
index e90cd13f4d062e996453ad26c28957f125e9abaa..6904155a9d83024d1f20c279cfd248738e9cf155 100644 (file)
@@ -160,8 +160,8 @@ AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
 AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
 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)
-AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2)
+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)
 
 echo $ac_n "checking for long long ... $ac_c"
@@ -170,6 +170,13 @@ main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }]
 echo yes;AC_DEFINE(HAVE_LONGLONG), 
 echo no)
 
+echo $ac_n "checking for 64 bit off_t ... $ac_c"
+AC_TRY_RUN([#include <stdio.h>
+#include <sys/stat.h>
+main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
+echo yes;AC_DEFINE(SIZEOF_OFF_T,8)
+echo no)
+
 echo $ac_n "checking for off64_t ... $ac_c"
 AC_TRY_RUN([#include <stdio.h>
 #include <sys/stat.h>
index f67061a289ed431e89c26fd49e1e8b29a8f40b29..71304c86b4e22fe19a8bd39c811a99a0e208a566 100644 (file)
@@ -59,6 +59,7 @@
 #undef HAVE_ERRNO_DECL
 #undef HAVE_LONGLONG
 #undef HAVE_OFF64_T
+#undef SIZEOF_OFF_T
 #undef HAVE_REMSH
 #undef HAVE_UNSIGNED_CHAR
 #undef HAVE_UTIMBUF
 /* Define if you have the ftruncate function.  */
 #undef HAVE_FTRUNCATE
 
+/* Define if you have the stat64 function.  */
+#undef HAVE_STAT64
+
+/* Define if you have the fstat64 function.  */
+#undef HAVE_FSTAT64
+
+/* Define if you have the lstat64 function.  */
+#undef HAVE_LSTAT64
+
+/* Define if you have the lseek64 function.  */
+#undef HAVE_LSEEK64
+
+/* Define if you have the ftruncate64 function.  */
+#undef HAVE_FTRUNCATE64
+
 /* Define if you have the getauthuid function.  */
 #undef HAVE_GETAUTHUID
 
index 15112cb1636ad5e45d592cc5755835ce18274f5a..41fccce5feadf1709573c82bbc5fed3a69449715 100644 (file)
 #endif
 
 /*
- * Type for device and inodes.
+ * Types for devices, inodes and offsets.
  */
 
 #ifndef SMB_DEV_T
 #define SMB_INO_T uint32
 #endif
 
+#ifndef SMB_OFF_T
+#ifdef HAVE_OFF64_T
+#define SMB_OFF_T off64_t
+#else
+#define SMB_OFF_T off_t
+#endif
+#endif
+
+/*
+ * Set the define that tells us if we can do 64 bit
+ * NT SMB calls.
+ */
+
+#ifndef LARGE_SMB_OFF_T
+#if defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
+#define LARGE_SMB_OFF_T 1
+#endif
+#endif
+
 /*
- * Type for stat structure. This will
- * soon change to a user defined type
- * once we wrap stat(), fstat() and lstat()
- * for 64 bit file sizes. JRA.
+ * Type for stat structure.
  */
 
 #ifndef SMB_STRUCT_STAT
+#if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
+#define SMB_STRUCT_STAT struct stat64
+#else
 #define SMB_STRUCT_STAT struct stat
 #endif
+#endif
 
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
index 969b8c6a86ef5d53900f25aa9dd4bf2d763da395..0e6dc54d34c4e1b155782b2ef4fc4e88e3af2c08 100644 (file)
@@ -165,6 +165,11 @@ int smbrun(char *cmd,char *outfile,BOOL shared);
 
 int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
 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_ftruncate(int fd, SMB_OFF_T offset);
+int sys_lseek(int fd, SMB_OFF_T offset, int whence);
 int dos_unlink(char *fname);
 int dos_open(char *fname,int flags,int mode);
 DIR *dos_opendir(char *dname);
@@ -177,7 +182,7 @@ 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);
-char *sys_getwd(char *s);
+char *dos_getwd(char *s);
 int sys_chown(char *fname,int uid,int gid);
 int sys_chroot(char *dname);
 struct hostent *sys_gethostbyname(char *name);
@@ -230,7 +235,7 @@ int name_mangle( char *In, char *Out, char name_type );
 BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
 time_t file_modtime(char *fname);
 BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
-uint32 file_size(char *file_name);
+SMB_OFF_T file_size(char *file_name);
 char *attrib_string(int mode);
 int StrCaseCmp(char *s, char *t);
 int StrnCaseCmp(char *s, char *t, int n);
@@ -265,7 +270,7 @@ void expand_mask(char *Mask,BOOL doext);
 BOOL strhasupper(char *s);
 BOOL strhaslower(char *s);
 int count_chars(char *s,char c);
-void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date);
+void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date);
 void close_low_fds(void);
 int set_blocking(int fd, BOOL set);
 int write_socket(int fd,char *buf,int len);
@@ -276,7 +281,7 @@ int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew);
 BOOL send_keepalive(int client);
 int read_data(int fd,char *buffer,int N);
 int write_data(int fd,char *buffer,int N);
-int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align);
+SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align);
 int read_smb_length(int fd,char *inbuf,int timeout);
 BOOL receive_smb(int fd,char *buffer, int timeout);
 BOOL client_receive_smb(int fd,char *buffer, int timeout);
@@ -301,7 +306,7 @@ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2);
 void become_daemon(void);
 BOOL yesno(char *p);
 char *fgets_slash(char *s2,int maxlen,FILE *f);
-int set_filelen(int fd, long len);
+int set_filelen(int fd, SMB_OFF_T len);
 int byte_checksum(char *buf,int len);
 char *dirname_dos(char *path,char *buf);
 void *Realloc(void *p,int size);
@@ -1977,7 +1982,8 @@ BOOL dptr_zero(char *buf);
 void *dptr_fetch(char *buf,int *num);
 void *dptr_fetch_lanman2(int dptr_num);
 BOOL dir_check_ftype(connection_struct *conn,int mode,SMB_STRUCT_STAT *st,int dirtype);
-BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend);
+BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,
+                   SMB_OFF_T *size,int *mode,time_t *date,BOOL check_descend);
 void *OpenDir(connection_struct *conn, char *name, BOOL use_veto);
 void CloseDir(void *p);
 char *ReadDirName(void *p);
@@ -2003,7 +2009,7 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int
 
 /*The following definitions come from  smbd/fileio.c  */
 
-int seek_file(files_struct *fsp,uint32 pos);
+SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos);
 int read_file(files_struct *fsp,char *data,uint32 pos,int n);
 int write_file(files_struct *fsp,char *data,int n);
 void sync_file(connection_struct *conn, files_struct *fsp);
@@ -2144,7 +2150,7 @@ int reply_pipe_close(connection_struct *conn, char *inbuf,char *outbuf);
 
 /*The following definitions come from  smbd/predict.c  */
 
-int read_predict(int fd,int offset,char *buf,char **ptr,int num);
+int read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,int num);
 void do_read_prediction(void);
 void invalidate_read_prediction(int fd);
 
index b27c5319378fe56ae1988504241528c5d8a8c842..8600bcc120b0358837b416a9044090de53784ad8 100644 (file)
@@ -442,10 +442,10 @@ struct cli_state {
 
 typedef struct
 {
-  int size;
+  SMB_OFF_T size;
   int mode;
-  int uid;
-  int gid;
+  uid_t uid;
+  gid_t gid;
   /* these times are normally kept in GMT */
   time_t mtime;
   time_t atime;
@@ -559,12 +559,12 @@ typedef struct files_struct
        int fnum;
        connection_struct *conn;
        file_fd_struct *fd_ptr;
-       int pos;
-       uint32 size;
+       SMB_OFF_T pos;
+       SMB_OFF_T size;
        int mode;
        int vuid;
        char *mmap_ptr;
-       uint32 mmap_size;
+       SMB_OFF_T mmap_size;
        write_bmpx_struct *wbmpx_ptr;
        struct timeval open_time;
        BOOL open;
index 55b76f2667e32093b2191c4ee6b29fb5a92f0e04..08d7726e3bff6e8a5400bb11fc02f7e9bba398ba 100644 (file)
@@ -189,7 +189,7 @@ static codepage_p load_client_codepage( int client_codepage )
   pstring codepage_file_name;
   unsigned char buf[8];
   FILE *fp = NULL;
-  unsigned int size;
+  SMB_OFF_T size;
   codepage_p cp_p = NULL;
   SMB_STRUCT_STAT st;
 
@@ -221,7 +221,7 @@ static codepage_p load_client_codepage( int client_codepage )
      plus zero or more bytes of data. Note that the data cannot be more
      than 4 * MAXCODEPAGELINES bytes.
    */
-  size = (unsigned int)st.st_size;
+  size = st.st_size;
 
   if( size < CODEPAGE_HEADER_SIZE || size > (CODEPAGE_HEADER_SIZE + 4 * MAXCODEPAGELINES))
   {
@@ -270,11 +270,10 @@ Needed %hu, got %hu.\n",
   }
 
   /* Check the length is correct. */
-  if(IVAL(buf,CODEPAGE_LENGTH_OFFSET) != 
-                 (unsigned int)(size - CODEPAGE_HEADER_SIZE))
+  if(IVAL(buf,CODEPAGE_LENGTH_OFFSET) != (size - CODEPAGE_HEADER_SIZE))
   {
     DEBUG(0,("load_client_codepage: filename %s has incorrect size headers. \
-Needed %u, got %u.\n", codepage_file_name, size - CODEPAGE_HEADER_SIZE
+Needed %u, got %u.\n", codepage_file_name, (uint32)(size - CODEPAGE_HEADER_SIZE)
                IVAL(buf,CODEPAGE_LENGTH_OFFSET)));
     goto clean_and_exit;
   }
index f5a0eadb96bd9e3e75de888b5e8cb2240e31bd1c..5f6ad5273ad99b4e745d7dec8991f1682b8a74e1 100644 (file)
@@ -258,7 +258,7 @@ static void check_log_size( void )
   if( !dbf || maxlog <= 0 )
     return;
 
-  if( fstat( fileno( dbf ), &st ) == 0 && st.st_size > maxlog )
+  if( sys_fstat( fileno( dbf ), &st ) == 0 && st.st_size > maxlog )
     {
     (void)fclose( dbf );
     dbf = NULL;
index 421d74f3c5ff75c8659d0a5d9d0e2be3c890954d..ae0a57154e140d6fab8d4312b166775e8896ffa2 100644 (file)
@@ -94,7 +94,7 @@ int ntalk_mkresdir(const char *fname)
   }
   lastslash++;
   fdir[lastslash] = 0;
-  lstat(fdir, &dirstats);
+  sys_lstat(fdir, &dirstats);
 
   /* append .AppleDouble */
   for (i = 0; (appledouble[i] != 0) && (lastslash <= 254); i++) {
index 1421233c1ef9cbc302661a378e1aeef4adb796db..6441efe44c7d02d550b3504012c156bf88a3de3a 100644 (file)
@@ -32,7 +32,7 @@ extern int DEBUGLEVEL;
  /*******************************************************************
 ftruncate for operating systems that don't have it
 ********************************************************************/
- int ftruncate(int f,long l)
+ int ftruncate(int f,SMB_OFF_T l)
 {
       struct  flock   fl;
 
index 56fcd68ec199a64b5112287fd925615c4181ce0b..d2abf0e9529596dc65e5dc63598db7666e034858 100644 (file)
@@ -50,7 +50,7 @@ static BOOL setup_stdout_file(char *outfile,BOOL shared)
 #endif
   }
 
-  if(stat(outfile, &st) == 0) {
+  if(sys_stat(outfile, &st) == 0) {
     /* Check we're not deleting a device file. */ 
     if(st.st_mode & S_IFREG)
       unlink(outfile);
index bc8860cdb9c86833501c9acaccfe3b21939715bd..b6a59e864824631b77d497a3c63614331a99b26c 100644 (file)
@@ -139,6 +139,70 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
 #endif /* USE_POLL */
 #endif /* NO_SELECT */
 
+/*******************************************************************
+A stat() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_stat(char *fname,SMB_STRUCT_STAT *sbuf)
+{
+#if defined(HAVE_OFF64_T) && defined(HAVE_STAT64)
+  return stat64(fname, sbuf);
+#else
+  return stat(fname, sbuf);
+#endif
+}
+
+/*******************************************************************
+ An fstat() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
+{
+#if defined(HAVE_OFF64_T) && defined(HAVE_FSTAT64)
+  return fstat64(fd, sbuf);
+#else
+  return fstat(fd, sbuf);
+#endif
+}
+
+/*******************************************************************
+ An lstat() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
+{
+#if defined(HAVE_OFF64_T) && defined(HAVE_LSTAT64)
+  return lstat64(fname, sbuf);
+#else
+  return lstat(fname, sbuf);
+#endif
+}
+
+/*******************************************************************
+ An ftruncate() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_ftruncate(int fd, SMB_OFF_T offset)
+{
+#if defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
+  return ftruncate64(fd, offset);
+#else
+  return ftruncate(fd, offset);
+#endif
+}
+
+/*******************************************************************
+ An lseek() wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+int sys_lseek(int fd, SMB_OFF_T offset, int whence)
+{
+#if defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64)
+  return lseek64(fd, offset, whence);
+#else
+  return lseek(fd, offset, whence);
+#endif
+}
 
 /*******************************************************************
 just a unlink wrapper that calls dos_to_unix.
@@ -166,13 +230,12 @@ DIR *dos_opendir(char *dname)
        return(opendir(dos_to_unix(dname,False)));
 }
 
-
 /*******************************************************************
 and a stat() wrapper that calls dos_to_unix.
 ********************************************************************/
 int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf)
 {
-  return(stat(dos_to_unix(fname,False),sbuf));
+  return(sys_stat(dos_to_unix(fname,False),sbuf));
 }
 
 /*******************************************************************
@@ -192,10 +255,9 @@ don't forget lstat() that calls dos_to_unix.
 ********************************************************************/
 int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf)
 {
-  return(lstat(dos_to_unix(fname,False),sbuf));
+  return(sys_lstat(dos_to_unix(fname,False),sbuf));
 }
 
-
 /*******************************************************************
 mkdir() gets a wrapper that calls dos_to_unix.
 ********************************************************************/
@@ -204,7 +266,6 @@ int dos_mkdir(char *dname,int mode)
   return(mkdir(dos_to_unix(dname,False),mode));
 }
 
-
 /*******************************************************************
 do does rmdir() - call dos_to_unix
 ********************************************************************/
@@ -213,7 +274,6 @@ int dos_rmdir(char *dname)
   return(rmdir(dos_to_unix(dname,False)));
 }
 
-
 /*******************************************************************
 I almost forgot chdir() - call dos_to_unix.
 ********************************************************************/
@@ -222,7 +282,6 @@ int dos_chdir(char *dname)
   return(chdir(dos_to_unix(dname,False)));
 }
 
-
 /*******************************************************************
 now for utime() - call dos_to_unix.
 ********************************************************************/
@@ -253,64 +312,57 @@ static int copy_reg(char *source, const char *dest)
   char *buf;
   int len;                      /* Number of bytes read into `buf'. */
 
-  lstat (source, &source_stats);
+  sys_lstat (source, &source_stats);
   if (!S_ISREG (source_stats.st_mode))
-    {
-      return 1;
-    }
+    return 1;
 
   if (unlink (dest) && errno != ENOENT)
-    {
-      return 1;
-    }
+    return 1;
 
   if((ifd = open (source, O_RDONLY, 0)) < 0)
-    {
-      return 1;
-    }
+    return 1;
+
   if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0 )
-    {
-      close (ifd);
-      return 1;
-    }
+  {
+    close (ifd);
+    return 1;
+  }
 
   if((buf = malloc( COPYBUF_SIZE )) == NULL)
-    {
-      close (ifd);  
-      close (ofd);  
-      unlink (dest);
-      return 1;
-    }
+  {
+    close (ifd);  
+    close (ofd);  
+    unlink (dest);
+    return 1;
+  }
 
   while ((len = read(ifd, buf, COPYBUF_SIZE)) > 0)
-    {
-      if (write_data(ofd, buf, len) < 0)
-        {
-          close (ifd);
-          close (ofd);
-          unlink (dest);
-          free(buf);
-          return 1;
-        }
-    }
-  free(buf);
-  if (len < 0)
+  {
+    if (write_data(ofd, buf, len) < 0)
     {
       close (ifd);
       close (ofd);
       unlink (dest);
+      free(buf);
       return 1;
     }
+  }
+  free(buf);
+  if (len < 0)
+  {
+    close (ifd);
+    close (ofd);
+    unlink (dest);
+    return 1;
+  }
 
   if (close (ifd) < 0)
-    {
-      close (ofd);
-      return 1;
-    }
+  {
+    close (ofd);
+    return 1;
+  }
   if (close (ofd) < 0)
-    {
-      return 1;
-    }
+    return 1;
 
   /* chown turns off set[ug]id bits for non-root,
      so do the chmod last.  */
@@ -322,23 +374,18 @@ static int copy_reg(char *source, const char *dest)
     tv.actime = source_stats.st_atime;
     tv.modtime = source_stats.st_mtime;
     if (utime (dest, &tv))
-      {
-        return 1;
-      }
+      return 1;
   }
 
   /* Try to preserve ownership.  For non-root it might fail, but that's ok.
      But root probably wants to know, e.g. if NFS disallows it.  */
   if (chown (dest, source_stats.st_uid, source_stats.st_gid)
       && (errno != EPERM))
-    {
-      return 1;
-    }
+    return 1;
 
   if (chmod (dest, source_stats.st_mode & 07777))
-    {
-      return 1;
-    }
+    return 1;
+
   unlink (source);
   return 0;
 }
@@ -356,10 +403,10 @@ int dos_rename(char *from, char *to)
     rcode = rename (zfrom, zto);
 
     if (errno == EXDEV) 
-      {
-        /* Rename across filesystems needed. */
-        rcode = copy_reg (zfrom, zto);        
-      }
+    {
+      /* Rename across filesystems needed. */
+      rcode = copy_reg (zfrom, zto);        
+    }
     return rcode;
 }
 
@@ -372,9 +419,10 @@ int dos_chmod(char *fname,int mode)
 }
 
 /*******************************************************************
-for getwd
+for getwd - takes a UNIX directory name and returns the name
+in dos format.
 ********************************************************************/
-char *sys_getwd(char *s)
+char *dos_getwd(char *s)
 {
        char *wd;
 #ifdef HAVE_GETCWD
@@ -459,4 +507,3 @@ struct hostent *sys_gethostbyname(char *name)
   return(gethostbyname(name));
 #endif /* REDUCE_ROOT_DNS_LOOKUPS */
 }
-
index 8b10939a97957d4338fef2d2b4dd7a4ba671e613..891b11facc079717f27899b5da0af96cc0832d63 100644 (file)
@@ -566,7 +566,7 @@ BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st)
 /*******************************************************************
 returns the size in bytes of the named file
 ********************************************************************/
-uint32 file_size(char *file_name)
+SMB_OFF_T file_size(char *file_name)
 {
   SMB_STRUCT_STAT buf;
   buf.st_size = 0;
@@ -1218,15 +1218,15 @@ struct
 {
   SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */
   SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */
-  char *text;
+  char *text; /* The pathname in DOS format. */
   BOOL valid;
 } ino_list[MAX_GETWDCACHE];
 
 BOOL use_getwd_cache=True;
 
 /*******************************************************************
-  return the absolute current directory path
-  Note that this path is returned in UNIX format, not DOS
+  return the absolute current directory path - given a UNIX pathname.
+  Note that this path is returned in DOS format, not UNIX
   format.
 ********************************************************************/
 char *GetWd(char *str)
@@ -1239,7 +1239,7 @@ char *GetWd(char *str)
   *s = 0;
 
   if (!use_getwd_cache)
-    return(sys_getwd(str));
+    return(dos_getwd(str));
 
   /* init the cache */
   if (!getwd_cache_init)
@@ -1255,10 +1255,10 @@ char *GetWd(char *str)
   /*  Get the inode of the current directory, if this doesn't work we're
       in trouble :-) */
 
-  if (stat(".",&st) == -1) 
+  if (dos_stat(".",&st) == -1) 
   {
     DEBUG(0,("Very strange, couldn't stat \".\"\n"));
-    return(sys_getwd(str));
+    return(dos_getwd(str));
   }
 
 
@@ -1275,7 +1275,7 @@ char *GetWd(char *str)
       if (st.st_ino == ino_list[i].inode &&
           st.st_dev == ino_list[i].dev)
       {
-        if (stat(ino_list[i].text,&st2) == 0)
+        if (dos_stat(ino_list[i].text,&st2) == 0)
         {
           if (st.st_ino == st2.st_ino &&
               st.st_dev == st2.st_dev &&
@@ -1302,7 +1302,7 @@ char *GetWd(char *str)
       The very slow getcwd, which spawns a process on some systems, or the
       not quite so bad getwd. */
 
-  if (!sys_getwd(s))
+  if (!dos_getwd(s))
   {
     DEBUG(0,("Getwd failed, errno %s\n",strerror(errno)));
     return (NULL);
@@ -1692,7 +1692,7 @@ int count_chars(char *s,char c)
 /****************************************************************************
   make a dir struct
 ****************************************************************************/
-void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date)
+void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date)
 {  
   char *p;
   pstring mask2;
@@ -1717,7 +1717,7 @@ void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode
   CVAL(buf,21) = mode;
   put_dos_date(buf,22,date);
   SSVAL(buf,26,size & 0xFFFF);
-  SSVAL(buf,28,size >> 16);
+  SSVAL(buf,28,(size >> 16)&0xFFFF);
   StrnCpy(buf+30,fname,12);
   if (!case_sensitive)
     strupper(buf+30);
@@ -2054,14 +2054,18 @@ int write_data(int fd,char *buffer,int N)
 /****************************************************************************
 transfer some data between two fd's
 ****************************************************************************/
-int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align)
+SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align)
 {
   static char *buf=NULL;  
   static int size=0;
   char *buf1,*abuf;
-  int total = 0;
+  SMB_OFF_T total = 0;
 
-  DEBUG(4,("transfer_file %d  (head=%d) called\n",n,headlen));
+#ifdef LARGE_SMB_OFF_T
+  DEBUG(4,("transfer_file n=%.0f  (head=%d) called\n",(double)n,headlen));
+#else /* LARGE_SMB_OFF_T */
+  DEBUG(4,("transfer_file n=%d  (head=%d) called\n",n,headlen));
+#endif /* LARGE_SMB_OFF_T */
 
   if (size == 0) {
     size = lp_readsize();
@@ -2084,46 +2088,46 @@ int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align)
     n += headlen;
 
   while (n > 0)
-    {
-      int s = MIN(n,size);
-      int ret,ret2=0;
+  {
+    int s = (int)MIN(n,(SMB_OFF_T)size);
+    int ret,ret2=0;
 
-      ret = 0;
+    ret = 0;
 
-      if (header && (headlen >= MIN(s,1024))) {
-       buf1 = header;
-       s = headlen;
-       ret = headlen;
-       headlen = 0;
-       header = NULL;
-      } else {
-       buf1 = abuf;
-      }
+    if (header && (headlen >= MIN(s,1024))) {
+      buf1 = header;
+      s = headlen;
+      ret = headlen;
+      headlen = 0;
+      header = NULL;
+    } else {
+      buf1 = abuf;
+    }
 
-      if (header && headlen > 0)
-       {
-         ret = MIN(headlen,size);
-         memcpy(buf1,header,ret);
-         headlen -= ret;
-         header += ret;
-         if (headlen <= 0) header = NULL;
-       }
+    if (header && headlen > 0)
+    {
+      ret = MIN(headlen,size);
+      memcpy(buf1,header,ret);
+      headlen -= ret;
+      header += ret;
+      if (headlen <= 0) header = NULL;
+    }
 
-      if (s > ret)
-       ret += read(infd,buf1+ret,s-ret);
+    if (s > ret)
+      ret += read(infd,buf1+ret,s-ret);
 
-      if (ret > 0)
-       {
-         ret2 = (outfd>=0?write_data(outfd,buf1,ret):ret);
-         if (ret2 > 0) total += ret2;
-         /* if we can't write then dump excess data */
-         if (ret2 != ret)
-           transfer_file(infd,-1,n-(ret+headlen),NULL,0,0);
-       }
-      if (ret <= 0 || ret2 != ret)
-       return(total);
-      n -= ret;
+    if (ret > 0)
+    {
+      ret2 = (outfd>=0?write_data(outfd,buf1,ret):ret);
+      if (ret2 > 0) total += ret2;
+      /* if we can't write then dump excess data */
+      if (ret2 != ret)
+        transfer_file(infd,-1,n-(ret+headlen),NULL,0,0);
     }
+    if (ret <= 0 || ret2 != ret)
+      return(total);
+    n -= ret;
+  }
   return(total);
 }
 
@@ -3261,18 +3265,18 @@ char *fgets_slash(char *s2,int maxlen,FILE *f)
 set the length of a file from a filedescriptor.
 Returns 0 on success, -1 on failure.
 ****************************************************************************/
-int set_filelen(int fd, long len)
+int set_filelen(int fd, SMB_OFF_T len)
 {
 /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
    extend a file with ftruncate. Provide alternate implementation
    for this */
 
 #ifdef HAVE_FTRUNCATE_EXTEND
-  return ftruncate(fd, len);
+  return sys_ftruncate(fd, len);
 #else
   SMB_STRUCT_STAT st;
   char c = 0;
-  long currpos = lseek(fd, 0L, SEEK_CUR);
+  SMB_OFF_T currpos = sys_lseek(fd, (SMB_OFF_T)0, SEEK_CUR);
 
   if(currpos < 0)
     return -1;
@@ -3280,7 +3284,7 @@ int set_filelen(int fd, long len)
      the requested size (call ftruncate),
      or shorter, in which case seek to len - 1 and write 1
      byte of zero */
-  if(fstat(fd, &st)<0)
+  if(sys_fstat(fd, &st)<0)
     return -1;
 
 #ifdef S_ISFIFO
@@ -3290,14 +3294,14 @@ int set_filelen(int fd, long len)
   if(st.st_size == len)
     return 0;
   if(st.st_size > len)
-    return ftruncate(fd, len);
+    return sys_ftruncate(fd, len);
 
-  if(lseek(fd, len-1, SEEK_SET) != len -1)
+  if(sys_lseek(fd, len-1, SEEK_SET) != len -1)
     return -1;
   if(write(fd, &c, 1)!=1)
     return -1;
   /* Seek to where we were */
-  lseek(fd, currpos, SEEK_SET);
+  sys_lseek(fd, currpos, SEEK_SET);
   return 0;
 #endif
 }
index 4c2ba43cd8e1c9ead95c3f09a7df732f7d565d4b..c242baec4a8307dcc746749b7e671acab6198891 100644 (file)
@@ -188,7 +188,7 @@ static BOOL slow_lock_share_entry(connection_struct *conn,
        * the open and the lock call. Back out and try again.
        */
 
-      if(stat(fname, &dummy_stat)!=0)
+      if(sys_stat(fname, &dummy_stat)!=0)
       {
         DEBUG(2,("lock_share_entry: Re-issuing open on %s to fix race. Error was %s\n",
                 fname, strerror(errno)));
@@ -232,7 +232,7 @@ static BOOL slow_unlock_share_entry(connection_struct *conn,
   share_name(conn, dev, inode, fname);
 
   /* get the share mode file size */
-  if(fstat((int)token, &sb) != 0)
+  if(sys_fstat((int)token, &sb) != 0)
   {
     DEBUG(0,("ERROR: unlock_share_entry: Failed to do stat on share file %s (%s)\n",
               fname, strerror(errno)));
@@ -269,12 +269,12 @@ static int read_share_file(connection_struct *conn, int fd, char *fname, char **
 {
   SMB_STRUCT_STAT sb;
   char *buf;
-  int size;
+  SMB_OFF_T size;
 
   *out = 0;
   *p_new_file = False;
 
-  if(fstat(fd, &sb) != 0)
+  if(sys_fstat(fd, &sb) != 0)
   {
     DEBUG(0,("ERROR: read_share_file: Failed to do stat on share file %s (%s)\n",
                   fname, strerror(errno)));
@@ -288,14 +288,14 @@ static int read_share_file(connection_struct *conn, int fd, char *fname, char **
   }
 
   /* Allocate space for the file */
-  if((buf = (char *)malloc(sb.st_size)) == NULL)
+  if((buf = (char *)malloc((size_t)sb.st_size)) == NULL)
   {
     DEBUG(0,("read_share_file: malloc for file size %d fail !\n", 
             (int)sb.st_size));
     return -1;
   }
   
-  if(lseek(fd, 0, SEEK_SET) != 0)
+  if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
   {
     DEBUG(0,("ERROR: read_share_file: Failed to reset position to 0 \
 for share file %s (%s)\n", fname, strerror(errno)));
@@ -304,7 +304,7 @@ for share file %s (%s)\n", fname, strerror(errno)));
     return -1;
   }
   
-  if (read(fd,buf,sb.st_size) != sb.st_size)
+  if (read(fd,buf,(size_t)sb.st_size) != (size_t)sb.st_size)
   {
     DEBUG(0,("ERROR: read_share_file: Failed to read share file %s (%s)\n",
                fname, strerror(errno)));
@@ -472,7 +472,7 @@ it left a share mode entry with mode 0x%X in share file %s\n",
 
   if(num_entries_copied != num_entries)
   {
-    if(lseek(fd, 0, SEEK_SET) != 0)
+    if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
     {
       DEBUG(0,("ERROR: get_share_modes: lseek failed to reset to \
 position 0 for share mode file %s (%s)\n", fname, strerror(errno)));
@@ -510,7 +510,7 @@ mode file %s (%s)\n", fname, strerror(errno)));
       return 0;
     }
     /* Now truncate the file at this point. */
-    if(ftruncate(fd, newsize)!= 0)
+    if(sys_ftruncate(fd, (SMB_OFF_T)newsize)!= 0)
     {
       DEBUG(0,("ERROR: get_share_modes: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
@@ -642,7 +642,7 @@ for share file %s\n", num_entries, fname));
   }
 
   /* Re-write the file - and truncate it at the correct point. */
-  if(lseek(fd, 0, SEEK_SET) != 0)
+  if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
   {
     DEBUG(0,("ERROR: del_share_mode: lseek failed to reset to \
 position 0 for share mode file %s (%s)\n", fname, strerror(errno)));
@@ -662,7 +662,7 @@ mode file %s (%s)\n", fname, strerror(errno)));
   }
 
   /* Now truncate the file at this point. */
-  if(ftruncate(fd, newsize) != 0)
+  if(sys_ftruncate(fd, (SMB_OFF_T)newsize) != 0)
   {
     DEBUG(0,("ERROR: del_share_mode: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
@@ -689,7 +689,7 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16
   share_name(fsp->conn, fsp->fd_ptr->dev,
                        fsp->fd_ptr->inode, fname);
 
-  if(fstat(fd, &sb) != 0)
+  if(sys_fstat(fd, &sb) != 0)
   {
     DEBUG(0,("ERROR: set_share_mode: Failed to do stat on share file %s\n",
                   fname));
@@ -699,17 +699,17 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16
   /* Sanity check for file contents (if it's not a new share file). */
   if(sb.st_size != 0)
   {
-    int size = sb.st_size;
+    SMB_OFF_T size = sb.st_size;
 
     /* Allocate space for the file plus one extra entry */
-    if((buf = (char *)malloc(sb.st_size + SMF_ENTRY_LENGTH)) == NULL)
+    if((buf = (char *)malloc((size_t)(sb.st_size + SMF_ENTRY_LENGTH))) == NULL)
     {
       DEBUG(0,("set_share_mode: malloc for file size %d fail !\n", 
               (int)(sb.st_size + SMF_ENTRY_LENGTH)));
       return False;
     }
  
-    if(lseek(fd, 0, SEEK_SET) != 0)
+    if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
     {
       DEBUG(0,("ERROR: set_share_mode: Failed to reset position \
 to 0 for share file %s (%s)\n", fname, strerror(errno)));
@@ -718,7 +718,7 @@ to 0 for share file %s (%s)\n", fname, strerror(errno)));
       return False;
     }
 
-    if (read(fd,buf,sb.st_size) != sb.st_size)
+    if (read(fd,buf,(size_t)sb.st_size) != (size_t)sb.st_size)
     {
       DEBUG(0,("ERROR: set_share_mode: Failed to read share file %s (%s)\n",
                   fname, strerror(errno)));
@@ -781,7 +781,7 @@ deleting it.\n", fname));
 
   SIVAL(buf,SMF_NUM_ENTRIES_OFFSET,num_entries);
 
-  if(lseek(fd, 0, SEEK_SET) != 0)
+  if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
   {
     DEBUG(0,("ERROR: set_share_mode: (1) Failed to reset position to \
 0 for share file %s (%s)\n", fname, strerror(errno)));
@@ -803,7 +803,7 @@ deleting it (%s).\n",fname, strerror(errno)));
 
   /* Now truncate the file at this point - just for safety. */
 
-  if(ftruncate(fd, header_size + (SMF_ENTRY_LENGTH*num_entries))!= 0)
+  if(sys_ftruncate(fd, (SMB_OFF_T)(header_size + (SMF_ENTRY_LENGTH*num_entries)))!= 0)
   {
     DEBUG(0,("ERROR: set_share_mode: failed to ftruncate share \
 mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entries), 
@@ -916,7 +916,7 @@ from the share file %s\n", i, num_entries, fname));
   }
 
   /* Re-write the file - and truncate it at the correct point. */
-  if(lseek(fd, 0, SEEK_SET) != 0)
+  if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0)
   {
     DEBUG(0,("ERROR: remove_share_oplock: lseek failed to reset to \
 position 0 for share mode file %s (%s)\n", fname, strerror(errno)));
index 6015085fe4ba140d8dbb7834804f65cbad03ca96..8a81d0efffe2717e599a2ae4ba23ca4298e24d27 100644 (file)
@@ -314,9 +314,9 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth
    int smb_shm_processes_fd = -1;
    int nb_read;
    pid_t other_pid;
-   int seek_back = -((int)sizeof(other_pid));
-   int free_slot = -1;
-   int erased_slot;   
+   SMB_OFF_T seek_back = -((SMB_OFF_T)sizeof(other_pid));
+   SMB_OFF_T free_slot = -1;
+   SMB_OFF_T erased_slot;   
    
    smb_shm_processes_fd = open(processreg_file, 
                               read_only?O_RDONLY:(O_RDWR|O_CREAT), 
@@ -339,10 +339,15 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth
         else
         {
            /* erase old pid */
+#ifdef LARGE_SMB_OFF_T
+            DEBUG(5,("smb_shm_register_process : erasing stale record for pid %d (seek_back = %.0f)\n",
+                      (int)other_pid, (double)seek_back));
+#else
             DEBUG(5,("smb_shm_register_process : erasing stale record for pid %d (seek_back = %d)\n",
                       (int)other_pid, seek_back));
+#endif
            other_pid = (pid_t)0;
-           erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
+           erased_slot = sys_lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
            write(smb_shm_processes_fd, &other_pid, sizeof(other_pid));
            if(free_slot < 0)
               free_slot = erased_slot;
@@ -350,7 +355,7 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth
       }
       else 
         if(free_slot < 0)
-           free_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
+           free_slot = sys_lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
    }
    if (nb_read < 0)
    {
@@ -360,11 +365,17 @@ static BOOL smb_shm_register_process(char *processreg_file, pid_t pid, BOOL *oth
    }
    
    if(free_slot < 0)
-      free_slot = lseek(smb_shm_processes_fd, 0, SEEK_END);
+      free_slot = sys_lseek(smb_shm_processes_fd, 0, SEEK_END);
 
+#ifdef LARGE_SMB_OFF_T
+   DEBUG(5,("smb_shm_register_process : writing record for pid %d at offset %.0f\n",
+         (int)pid, (double)free_slot));
+#else /* LARGE_SMB_OFF_T */
    DEBUG(5,("smb_shm_register_process : writing record for pid %d at offset %d\n",
          (int)pid,free_slot));
-   lseek(smb_shm_processes_fd, free_slot, SEEK_SET);
+#endif /* LARGE_SMB_OFF_T */
+
+   sys_lseek(smb_shm_processes_fd, free_slot, SEEK_SET);
    if(write(smb_shm_processes_fd, &pid, sizeof(pid)) < 0)
    {
       DEBUG(0,("ERROR smb_shm_register_process : processreg_file write failed with code %s\n",strerror(errno)));
@@ -382,8 +393,8 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid)
    int smb_shm_processes_fd = -1;
    int nb_read;
    pid_t other_pid;
-   int seek_back = -((int)sizeof(other_pid));
-   int erased_slot;
+   SMB_OFF_T seek_back = -((SMB_OFF_T)sizeof(other_pid));
+   SMB_OFF_T erased_slot;
    BOOL found = False;
    
    
@@ -399,20 +410,25 @@ static BOOL smb_shm_unregister_process(char *processreg_file, pid_t pid)
       DEBUG(5,("smb_shm_unregister_process : read record for pid %d\n",(int)other_pid));
       if(other_pid == pid)
       {
-        /* erase pid */
-         DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %d)\n",
+        /* erase pid */
+#ifdef LARGE_SMB_OFF_T
+        DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %.0f)\n",
+                     (int)other_pid, (double)seek_back));
+#else /* LARGE_SMB_OFF_T */
+        DEBUG(5,("smb_shm_unregister_process : erasing record for pid %d (seek_val = %d)\n",
                      (int)other_pid, seek_back));
-        other_pid = (pid_t)0;
-        erased_slot = lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
-        if(write(smb_shm_processes_fd, &other_pid, sizeof(other_pid)) < 0)
-        {
-           DEBUG(0,("ERROR smb_shm_unregister_process : processreg_file write failed with code %s\n",strerror(errno)));
-           close(smb_shm_processes_fd);
-           return False;
-        }
+#endif /* LARGE_SMB_OFF_T */
+        other_pid = (pid_t)0;
+        erased_slot = sys_lseek(smb_shm_processes_fd, seek_back, SEEK_CUR);
+        if(write(smb_shm_processes_fd, &other_pid, sizeof(other_pid)) < 0)
+        {
+          DEBUG(0,("ERROR smb_shm_unregister_process : processreg_file write failed with code %s\n",strerror(errno)));
+          close(smb_shm_processes_fd);
+          return False;
+        }
         
-        found = True;
-        break;
+        found = True;
+        break;
       }
    }
    if (nb_read < 0)
@@ -750,10 +766,10 @@ static struct shmem_ops shmops = {
 struct shmem_ops *smb_shm_open(int ronly)
 {
        pstring file_name;
-       int filesize;
+       SMB_OFF_T filesize;
        BOOL created_new = False;
        BOOL other_processes = True;
-       int size = lp_shmem_size();
+       SMB_OFF_T size = (SMB_OFF_T)lp_shmem_size();
 
        read_only = ronly;
 
@@ -766,7 +782,11 @@ struct shmem_ops *smb_shm_open(int ronly)
        if (!*file_name) return(False);
        pstrcat(file_name, "/SHARE_MEM_FILE");
    
+#ifdef LARGE_SMB_OFF_T
+   DEBUG(5,("smb_shm_open : using shmem file %s to be of size %.0f\n",file_name,(double)size));
+#else /* LARGE_SMB_OFF_T */
    DEBUG(5,("smb_shm_open : using shmem file %s to be of size %d\n",file_name,size));
+#endif /* LARGE_SMB_OFF_T */
 
    smb_shm_fd = open(file_name, read_only?O_RDONLY:(O_RDWR|O_CREAT),
                     SHM_FILE_MODE);
@@ -783,7 +803,7 @@ struct shmem_ops *smb_shm_open(int ronly)
       return NULL;
    }
    
-   if( (filesize = lseek(smb_shm_fd, 0, SEEK_END)) < 0)
+   if( (filesize = sys_lseek(smb_shm_fd, 0, SEEK_END)) < 0)
    {
       DEBUG(0,("ERROR smb_shm_open : lseek failed with code %s\n",strerror(errno)));
       smb_shm_global_unlock();
@@ -792,7 +812,7 @@ struct shmem_ops *smb_shm_open(int ronly)
    }
 
    /* return the file offset to 0 to save on later seeks */
-   lseek(smb_shm_fd,0,SEEK_SET);
+   sys_lseek(smb_shm_fd,0,SEEK_SET);
 
    if (filesize == 0)
    {
@@ -819,17 +839,17 @@ struct shmem_ops *smb_shm_open(int ronly)
    if (!read_only && (created_new || !other_processes))
    {
       /* we just created a new one, or are the first opener, lets set it size */
-      if( ftruncate(smb_shm_fd, size) <0)
+      if( sys_ftruncate(smb_shm_fd, size) <0)
       {
-         DEBUG(0,("ERROR smb_shm_open : ftruncate failed with code %s\n",strerror(errno)));
-        smb_shm_unregister_process(smb_shm_processreg_name, getpid());
-        smb_shm_global_unlock();
-        close(smb_shm_fd);
-        return NULL;
+        DEBUG(0,("ERROR smb_shm_open : ftruncate failed with code %s\n",strerror(errno)));
+        smb_shm_unregister_process(smb_shm_processreg_name, getpid());
+        smb_shm_global_unlock();
+        close(smb_shm_fd);
+        return NULL;
       }
 
       /* paranoia */
-      lseek(smb_shm_fd,0,SEEK_SET);
+      sys_lseek(smb_shm_fd,0,SEEK_SET);
 
       filesize = size;
    }
@@ -838,7 +858,14 @@ struct shmem_ops *smb_shm_open(int ronly)
    {
       /* the existing file has a different size and we are not the first opener.
         Since another process is still using it, we will use the file size */
-      DEBUG(0,("WARNING smb_shm_open : filesize (%d) != expected size (%d), using filesize\n",filesize,size));
+#ifdef LARGE_SMB_OFF_T
+      DEBUG(0,("WARNING smb_shm_open : filesize (%.0f) != expected size (%.0f), using filesize\n",
+            (double)filesize, (double)size));
+#else /* LARGE_SMB_OFF_T */
+      DEBUG(0,("WARNING smb_shm_open : filesize (%d) != expected size (%d), using filesize\n",
+            filesize,size));
+#endif /* LARGE_SMB_OFF_T */
+
       size = filesize;
    }
    
index e58d0d5b002cd54a9d091a4707b0dd673b7e13ba..5e476e0227a79bb83e091c4566fc8f58e3309369 100644 (file)
@@ -930,7 +930,7 @@ BOOL pdb_generate_machine_sid(void)
         * Check if the file contains data.
         */
        
-       if(fstat( fd, &st) < 0) {
+       if(sys_fstat( fd, &st) < 0) {
                DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
                         sid_file, strerror(errno) ));
                close(fd);
@@ -1002,7 +1002,7 @@ BOOL pdb_generate_machine_sid(void)
         * use their data.
         */
        
-       if(fstat( fd, &st) < 0) {
+       if(sys_fstat( fd, &st) < 0) {
                DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
                         sid_file, strerror(errno) ));
                close(fd);
index 980c54adf123169f537f00f001553957abe1a735..f758b7bbc46153eae9f9c860c66ab88243f7a026 100644 (file)
@@ -434,7 +434,7 @@ static BOOL add_smbfilepwd_entry(struct smb_passwd *newpwd)
   int fd;
   int new_entry_length;
   char *new_entry;
-  long offpos;
+  SMB_OFF_T offpos;
   char *p;
 
   /* Open the smbpassword file - for update. */
@@ -466,8 +466,8 @@ static BOOL add_smbfilepwd_entry(struct smb_passwd *newpwd)
    */
   fd = fileno(fp);
 
-  if((offpos = lseek(fd, 0, SEEK_END)) == -1) {
-    DEBUG(0, ("add_smbfilepwd_entry(lseek): Failed to add entry for user %s to file %s. \
+  if((offpos = sys_lseek(fd, 0, SEEK_END)) == -1) {
+    DEBUG(0, ("add_smbfilepwd_entry(sys_lseek): Failed to add entry for user %s to file %s. \
 Error was %s\n", newpwd->smb_name, pfile, strerror(errno)));
     endsmbfilepwent(fp);
     return False;
@@ -531,7 +531,7 @@ Error was %s\n", newpwd->smb_name, pfile, strerror(errno)));
 Error was %s\n", wr_len, newpwd->smb_name, pfile, strerror(errno)));
 
     /* Remove the entry we just wrote. */
-    if(ftruncate(fd, offpos) == -1) {
+    if(sys_ftruncate(fd, offpos) == -1) {
       DEBUG(0, ("add_smbfilepwd_entry: ERROR failed to ftruncate file %s. \
 Error was %s. Password file may be corrupt ! Please examine by hand !\n", 
              newpwd->smb_name, strerror(errno)));
@@ -572,7 +572,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
   BOOL found_entry = False;
   BOOL got_pass_last_set_time = False;
 
-  long pwd_seekpos = 0;
+  SMB_OFF_T pwd_seekpos = 0;
 
   int i;
   int wr_len;
@@ -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 = ftell(fp);
+    pwd_seekpos = (SMB_OFF_T)ftell(fp);
 
     linebuf[0] = '\0';
 
@@ -818,7 +818,7 @@ static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
 
   fd = fileno(fp);
 
-  if (lseek(fd, pwd_seekpos - 1, SEEK_SET) != pwd_seekpos - 1) {
+  if (sys_lseek(fd, pwd_seekpos - 1, SEEK_SET) != pwd_seekpos - 1) {
     DEBUG(0, ("mod_smbfilepwd_entry: seek fail on file %s.\n", pfile));
     pw_file_unlock(lockfd,&pw_file_lock_depth);
     fclose(fp);
index 45a9515b51e1ea172768991d8a1a9c802c65d714..a7f832b5934ca4b88e4e51a08d8d8dc2c125c149 100644 (file)
@@ -1058,7 +1058,7 @@ int get_printqueue(int snum,
 
        slprintf(outfile,sizeof(outfile)-1, "%s/lpq.%08x",tmpdir(),str_checksum(syscmd));
   
-       if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf)) {
+       if (!lpq_cache_reset[snum] && cachetime && !sys_stat(outfile,&sbuf)) {
                if (time(NULL) - sbuf.st_mtime < cachetime) {
                        DEBUG(3,("Using cached lpq output\n"));
                        dorun = False;
index 238bd8e0f645795caae579ba6a9fbe4828d37747..2e43e886445b55f614164f15e4921270d5e45907 100644 (file)
@@ -80,7 +80,7 @@ END {
   next;
 }
 
-!/^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|^FILE/ {
+!/^connection_struct|^pipes_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^enum remote_arch_types|^FILE|^SMB_OFF_T/ {
   next;
 }
 
index 342a5f43bc8898cf573fd974d51e8dcb00a9d1cd..c3b6ba0199149cce77b4d3e89610c7dae0979b34 100644 (file)
@@ -88,7 +88,7 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections)
        bzero((void *)&crec,sizeof(crec));
   
        /* remove our mark */
-       if (lseek(fd,i*sizeof(crec),SEEK_SET) != i*sizeof(crec) ||
+       if (sys_lseek(fd,i*sizeof(crec),SEEK_SET) != i*sizeof(crec) ||
            write(fd, &crec,sizeof(crec)) != sizeof(crec)) {
                DEBUG(2,("Couldn't update lock file %s (%s)\n",fname,strerror(errno)));
                if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
@@ -159,14 +159,14 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
        /* find a free spot */
        for (i=0;i<max_connections;i++) {
                if (i>=total_recs || 
-                   lseek(fd,i*sizeof(crec),SEEK_SET) != i*sizeof(crec) ||
+                   sys_lseek(fd,i*sizeof(crec),SEEK_SET) != i*sizeof(crec) ||
                    read(fd,&crec,sizeof(crec)) != sizeof(crec)) {
                        if (foundi < 0) foundi = i;
                        break;
                }
                
                if (Clear && crec.pid && !process_exists(crec.pid)) {
-                       lseek(fd,i*sizeof(crec),SEEK_SET);
+                       sys_lseek(fd,i*sizeof(crec),SEEK_SET);
                        bzero((void *)&crec,sizeof(crec));
                        write(fd, &crec,sizeof(crec));
                        if (foundi < 0) foundi = i;
@@ -206,7 +206,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
        StrnCpy(crec.addr,client_addr(Client),sizeof(crec.addr)-1);
        
        /* make our mark */
-       if (lseek(fd,foundi*sizeof(crec),SEEK_SET) != foundi*sizeof(crec) ||
+       if (sys_lseek(fd,foundi*sizeof(crec),SEEK_SET) != foundi*sizeof(crec) ||
            write(fd, &crec,sizeof(crec)) != sizeof(crec)) {
                if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
                        DEBUG(0,("ERROR: can't release lock on %s\n", fname));
index 7c81b826d1a37ce207e001ccb54dd208e00b77b3..73db295548176c6398fb6088f1ce8c423ff8ca56 100644 (file)
@@ -418,7 +418,8 @@ BOOL dir_check_ftype(connection_struct *conn,int mode,SMB_STRUCT_STAT *st,int di
 /****************************************************************************
   get a directory entry
 ****************************************************************************/
-BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend)
+BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,
+                   SMB_OFF_T *size,int *mode,time_t *date,BOOL check_descend)
 {
   char *dname;
   BOOL found = False;
index 047c84f35fe9a484295d176f328f245a928159ea..6d6edf9d371b3bf4a51305226c9f12b25d3df4c1 100644 (file)
@@ -27,14 +27,14 @@ extern int DEBUGLEVEL;
 /****************************************************************************
 seek a file. Try to avoid the seek if possible
 ****************************************************************************/
-int seek_file(files_struct *fsp,uint32 pos)
+SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos)
 {
-  uint32 offset = 0;
+  SMB_OFF_T offset = 0;
 
   if (fsp->print_file && lp_postscript(fsp->conn->service))
     offset = 3;
 
-  fsp->pos = (int)(lseek(fsp->fd_ptr->fd,pos+offset,SEEK_SET) - offset);
+  fsp->pos = (sys_lseek(fsp->fd_ptr->fd,pos+offset,SEEK_SET) - offset);
   return(fsp->pos);
 }
 
@@ -104,7 +104,7 @@ int write_file(files_struct *fsp,char *data,int n)
   if (!fsp->modified) {
     SMB_STRUCT_STAT st;
     fsp->modified = True;
-    if (fstat(fsp->fd_ptr->fd,&st) == 0) {
+    if (sys_fstat(fsp->fd_ptr->fd,&st) == 0) {
       int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
       if (MAP_ARCHIVE(fsp->conn) && !IS_DOS_ARCHIVE(dosmode)) {        
         file_chmod(fsp->conn,fsp->fsp_name,dosmode | aARCH,&st);
index 6616d0d157fb530502ec5e0d572ecedbb9da1d20..75af12a47afd758211b3b82754bd6446a52bf492 100644 (file)
@@ -82,7 +82,7 @@ void load_groupname_map(void)
   if (!*groupname_map_file)
     return;
 
-  if(stat(groupname_map_file, &st) != 0) {
+  if(sys_stat(groupname_map_file, &st) != 0) {
     DEBUG(0, ("load_groupname_map: Unable to stat file %s. Error was %s\n",
                groupname_map_file, strerror(errno) ));
     return;
index 9e507aa4d2585a95120bf9a5106f25a0d113f2d0..3fdee043dc299ac7b7f34d1e6a9835c08fff41d1 100644 (file)
@@ -415,7 +415,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
        int oplock_request = 0;
        int unixmode, pnum = -1;
        int fmode=0,mtime=0,rmode=0;
-       off_t file_len = 0;
+       SMB_OFF_T file_len = 0;
        SMB_STRUCT_STAT sbuf;
        int smb_action = 0;
        BOOL bad_path = False;
@@ -602,7 +602,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
                        return(ERROR(ERRDOS,ERRnoaccess));
                }
        } else {
-               if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+               if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
                        close_file(fsp,False);
                        restore_case_semantics(file_attributes);
                        return(ERROR(ERRDOS,ERRnoaccess));
@@ -660,12 +660,12 @@ int reply_ntcreate_and_X(connection_struct *conn,
        p += 8;
        SIVAL(p,0,fmode); /* File Attributes. */
        p += 12;
-#if OFF_T_IS_64_BITS
+#ifdef LARGE_SMB_OFF_T
        SIVAL(p,0, file_len & 0xFFFFFFFF);
        SIVAL(p,4, file_len >> 32);
-#else /* OFF_T_IS_64_BITS */
+#else /* LARGE_SMB_OFF_T */
        SIVAL(p,0,file_len);
-#endif /* OFF_T_IS_64_BITS */
+#endif /* LARGE_SMB_OFF_T */
        p += 12;
        SCVAL(p,0,fsp->is_directory ? 1 : 0);
        
@@ -809,7 +809,7 @@ static int call_nt_transact_create(connection_struct *conn,
         return(UNIXERROR(ERRDOS,ERRnoaccess));
       } 
   
-      if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+      if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
         close_file(fsp,False);
 
         restore_case_semantics(file_attributes);
index 76e88c2e85e14a884e23c84135e87d5b8a26a037..395de66a88e585b1c015ce54e45bc673e3f1a3e0 100644 (file)
@@ -472,7 +472,7 @@ static void open_file(files_struct *fsp,connection_struct *conn,
   {
     if(sbuf == 0) {
       /* Do the fstat */
-      if(fstat(fd_ptr->fd, &statbuf) == -1) {
+      if(sys_fstat(fd_ptr->fd, &statbuf) == -1) {
         /* Error - backout !! */
         DEBUG(3,("Error doing fstat on fd %d, file %s (%s)\n",
                  fd_ptr->fd, fname,strerror(errno)));
@@ -576,7 +576,7 @@ static void truncate_unless_locked(files_struct *fsp, connection_struct *conn, i
       unix_ERR_code = ERRlock;
     }
     else
-      ftruncate(fsp->fd_ptr->fd,0); 
+      sys_ftruncate(fsp->fd_ptr->fd,0); 
   }
 }
 
index 6e423c8efff7b8d896b481f215cdb43a48bdc6cf..0deda0c0b6331d2adfe7b53b4a74fc075c09fd35 100644 (file)
@@ -27,11 +27,11 @@ extern int DEBUGLEVEL;
 
 /* variables used by the read prediction module */
 static int rp_fd = -1;
-static int rp_offset = 0;
+static SMB_OFF_T rp_offset = 0;
 static int rp_length = 0;
 static int rp_alloced = 0;
 static int rp_predict_fd = -1;
-static int rp_predict_offset = 0;
+static SMB_OFF_T rp_predict_offset = 0;
 static int rp_predict_length = 0;
 static int rp_timeout = 5;
 static time_t rp_time = 0;
@@ -42,7 +42,7 @@ extern time_t smb_last_time;
 /****************************************************************************
 handle read prediction on a file
 ****************************************************************************/
-int read_predict(int fd,int offset,char *buf,char **ptr,int num)
+int read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,int num)
 {
   int ret = 0;
   int possible = rp_length - (offset - rp_offset);
@@ -70,7 +70,7 @@ int read_predict(int fd,int offset,char *buf,char **ptr,int num)
 
     /* Find the end of the file - ensure we don't
        read predict beyond it. */
-    if(fstat(fd,&rp_stat) < 0)
+    if(sys_fstat(fd,&rp_stat) < 0)
     {
       DEBUG(0,("read-prediction failed on fstat. Error was %s\n", strerror(errno)));
       predict_skip = True;
@@ -134,7 +134,7 @@ void do_read_prediction(void)
        }
     }
 
-  if (lseek(rp_fd,rp_offset,SEEK_SET) != rp_offset) {
+  if (sys_lseek(rp_fd,rp_offset,SEEK_SET) != rp_offset) {
     rp_fd = -1;
     rp_predict_fd = -1;
     return;
index 7f1cd5ce79390a2be8029519f76861522543a8b1..b7a538e189ec513ca5f989fede4cb715baaaccea 100644 (file)
@@ -54,12 +54,12 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   SMB_STRUCT_STAT S;
   FILE *fp;
   struct mntent *mnt;
-  int devno;
+  SMB_DEV_T devno;
   int found;
   
   /* find the block device file */
   
-  if ( stat(path, &S) == -1 ) {
+  if ( sys_stat(path, &S) == -1 ) {
     return(False) ;
   }
 
@@ -69,7 +69,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   found = False ;
   
   while ((mnt = getmntent(fp))) {
-    if ( stat(mnt->mnt_dir,&S) == -1 )
+    if ( sys_stat(mnt->mnt_dir,&S) == -1 )
       continue ;
     if (S.st_dev == devno) {
       found = True ;
@@ -136,15 +136,15 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   struct mntent *mnt;
   FILE *fd;
   SMB_STRUCT_STAT sbuf;
-  dev_t devno ;
-  static dev_t devno_cached = 0 ;
+  SMB_DEV_T devno ;
+  static SMB_DEV_T devno_cached = 0 ;
   static pstring name;
   struct q_request request ;
   struct qf_header header ;
   static int quota_default = 0 ;
   int found ;
   
-  if ( stat(path,&sbuf) == -1 )
+  if ( sys_stat(path,&sbuf) == -1 )
     return(False) ;
   
   devno = sbuf.st_dev ;
@@ -160,7 +160,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
     
     while ((mnt = getmntent(fd)) != NULL) {
       
-      if ( stat(mnt->mnt_dir,&sbuf) == -1 )
+      if ( sys_stat(mnt->mnt_dir,&sbuf) == -1 )
        continue ;
       
       if (sbuf.st_dev == devno) {
@@ -256,11 +256,11 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
 #endif
   FILE *fd;
   SMB_STRUCT_STAT sbuf;
-  dev_t devno ;
-  static dev_t devno_cached = 0 ;
+  SMB_DEV_T devno ;
+  static SMB_DEV_T devno_cached = 0 ;
   int found ;
   
-  if ( stat(path,&sbuf) == -1 )
+  if ( sys_stat(path,&sbuf) == -1 )
     return(False) ;
   
   devno = sbuf.st_dev ;
@@ -273,7 +273,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
     
     found = False ;
     while (getmntent(fd, &mnt) == 0) {
-      if ( stat(mnt.mnt_mountp,&sbuf) == -1 )
+      if ( sys_stat(mnt.mnt_mountp,&sbuf) == -1 )
        continue ;
       DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", 
               mnt.mnt_mountp,sbuf.st_dev));
@@ -292,7 +292,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
     
     found = False ;
     while ((mnt = getmntent(fd)) != NULL) {
-      if ( stat(mnt->mnt_dir,&sbuf) == -1 )
+      if ( sys_stat(mnt->mnt_dir,&sbuf) == -1 )
        continue ;
       DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", 
               mnt->mnt_dir,sbuf.st_dev));
@@ -436,12 +436,12 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   SMB_STRUCT_STAT S;
   FILE *fp;
   struct mntent *mnt;
-  int devno;
+  SMB_DEV_T devno;
   int found;
   
   /* find the block device file */
   
-  if ( stat(path, &S) == -1 ) {
+  if ( sys_stat(path, &S) == -1 ) {
     return(False) ;
   }
 
@@ -451,7 +451,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   found = False ;
   
   while ((mnt = getmntent(fp))) {
-    if ( stat(mnt->mnt_dir,&S) == -1 )
+    if ( sys_stat(mnt->mnt_dir,&S) == -1 )
       continue ;
     if (S.st_dev == devno) {
       found = True ;
@@ -575,7 +575,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
   char dev_disk[256];
   SMB_STRUCT_STAT S;
   /* find the block device file */
-  if ((stat(path, &S)<0) ||
+  if ((sys_stat(path, &S)<0) ||
       (devnm(S_IFBLK, S.st_dev, dev_disk, 256, 0)<0)) return (False);
 #endif
 
index a3164bd67dde9587970c51377021e4aa6e84daae..3665518ae63e222fd8e773ec5a3ad56da925db4e 100644 (file)
@@ -809,7 +809,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
   SMB_STRUCT_STAT sbuf;
   BOOL ok = False;
   int mode=0;
-  uint32 size=0;
+  SMB_OFF_T size=0;
   time_t mtime=0;
   BOOL bad_path = False;
  
@@ -860,7 +860,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
     put_dos_date3(outbuf,smb_vwv1,mtime & ~1);
   else
     put_dos_date3(outbuf,smb_vwv1,mtime);
-  SIVAL(outbuf,smb_vwv3,size);
+  SIVAL(outbuf,smb_vwv3,(uint32)size);
 
   if (Protocol >= PROTOCOL_NT1) {
     char *p = strrchr(fname,'/');
@@ -870,7 +870,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
       SSVAL(outbuf,smb_flg2,flg2 | 0x40); /* IS_LONG_NAME */
   }
   
-  DEBUG( 3, ( "getatr name=%s mode=%d size=%d\n", fname, mode, size ) );
+  DEBUG( 3, ( "getatr name=%s mode=%d size=%d\n", fname, mode, (uint32)size ) );
   
   return(outsize);
 }
@@ -953,7 +953,8 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
   pstring mask;
   pstring directory;
   pstring fname;
-  int size,mode;
+  SMB_OFF_T size;
+  int mode;
   time_t date;
   int dirtype;
   int outsize = 0;
@@ -1244,7 +1245,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
   int outsize = 0;
   int fmode=0;
   int share_mode;
-  int size = 0;
+  SMB_OFF_T size = 0;
   time_t mtime=0;
   int unixmode;
   int rmode=0;
@@ -1289,7 +1290,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
     return(UNIXERROR(ERRDOS,ERRnoaccess));
   }
 
-  if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+  if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
     close_file(fsp,False);
     return(ERROR(ERRDOS,ERRnoaccess));
   }
@@ -1311,7 +1312,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
     put_dos_date3(outbuf,smb_vwv2,mtime & ~1);
   else
     put_dos_date3(outbuf,smb_vwv2,mtime);
-  SIVAL(outbuf,smb_vwv4,size);
+  SIVAL(outbuf,smb_vwv4,(uint32)size);
   SSVAL(outbuf,smb_vwv6,rmode);
 
   if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
@@ -1344,7 +1345,8 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
 #endif
   int smb_ofun = SVAL(inbuf,smb_vwv8);
   int unixmode;
-  int size=0,fmode=0,mtime=0,rmode=0;
+  SMB_OFF_T size=0;
+  int fmode=0,mtime=0,rmode=0;
   SMB_STRUCT_STAT sbuf;
   int smb_action = 0;
   BOOL bad_path = False;
@@ -1390,7 +1392,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
     return(UNIXERROR(ERRDOS,ERRnoaccess));
   }
 
-  if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+  if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
     close_file(fsp,False);
     return(ERROR(ERRDOS,ERRnoaccess));
   }
@@ -1436,7 +1438,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
     put_dos_date3(outbuf,smb_vwv4,mtime & ~1);
   else
     put_dos_date3(outbuf,smb_vwv4,mtime);
-  SIVAL(outbuf,smb_vwv6,size);
+  SIVAL(outbuf,smb_vwv6,(uint32)size);
   SSVAL(outbuf,smb_vwv8,rmode);
   SSVAL(outbuf,smb_vwv11,smb_action);
 
@@ -1767,7 +1769,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
   int nread = 0;
   uint32 startpos;
   char *header = outbuf;
-  int ret=0;
+  SMB_OFF_T ret=0;
   int fd;
   char *fname;
   files_struct *fsp;
@@ -1781,7 +1783,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
   if(global_oplock_break)
   {
     _smb_setlen(header,0);
-    transfer_file(0,Client,0,header,4,0);
+    transfer_file(0,Client,(SMB_OFF_T)0,header,4,0);
     DEBUG(5,("readbraw - oplock break finished\n"));
     return -1;
   }
@@ -1799,7 +1801,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
   if (!FNUM_OK(fsp,conn) || !fsp->can_read) {
          DEBUG(3,("fnum %d not open in readbraw - cache prime?\n",fsp->fnum));
          _smb_setlen(header,0);
-         transfer_file(0,Client,0,header,4,0);
+         transfer_file(0,Client,(SMB_OFF_T)0,header,4,0);
          return(-1);
   } else {
          fd = fsp->fd_ptr->fd;
@@ -1809,12 +1811,12 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
 
   if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK))
   {
-    int size = fsp->size;
+    SMB_OFF_T size = fsp->size;
     int sizeneeded = startpos + maxcount;
            
     if (size < sizeneeded) {
       SMB_STRUCT_STAT st;
-      if (fstat(fsp->fd_ptr->fd,&st) == 0)
+      if (sys_fstat(fsp->fd_ptr->fd,&st) == 0)
         size = st.st_size;
       if (!fsp->can_write) 
         fsp->size = size;
@@ -1843,7 +1845,7 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s
     if ((nread-predict) > 0)
       seek_file(fsp,startpos + predict);
     
-    ret = transfer_file(fd,Client,nread-predict,header,4+predict,
+    ret = transfer_file(fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict,
                        startpos+predict);
   }
 
@@ -2081,7 +2083,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
             tcount,nwritten,numtowrite));
   }
 
-  nwritten = transfer_file(Client,fsp->fd_ptr->fd,numtowrite,NULL,0,
+  nwritten = transfer_file(Client,fsp->fd_ptr->fd,(SMB_OFF_T)numtowrite,NULL,0,
                           startpos+nwritten);
   total_written += nwritten;
   
@@ -2193,7 +2195,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i
      zero then the file size should be extended or
      truncated to the size given in smb_vwv[2-3] */
   if(numtowrite == 0)
-    nwritten = set_filelen(fsp->fd_ptr->fd, startpos);
+    nwritten = set_filelen(fsp->fd_ptr->fd, (SMB_OFF_T)startpos);
   else
     nwritten = write_file(fsp,data,numtowrite);
   
@@ -2280,7 +2282,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
 int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
 {
   uint32 startpos;
-  int32 res= -1;
+  SMB_OFF_T res= -1;
   int mode,umode;
   int outsize = 0;
   files_struct *fsp = file_fsp(inbuf,smb_vwv0);
@@ -2292,19 +2294,19 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
   startpos = IVAL(inbuf,smb_vwv2);
 
   switch (mode & 3) 
-    {
+  {
     case 0: umode = SEEK_SET; break;
     case 1: umode = SEEK_CUR; break;
     case 2: umode = SEEK_END; break;
     default:
       umode = SEEK_SET; break;
-    }
+  }
 
-  res = lseek(fsp->fd_ptr->fd,startpos,umode);
+  res = sys_lseek(fsp->fd_ptr->fd,(SMB_OFF_T)startpos,umode);
   fsp->pos = res;
   
   outsize = set_message(outbuf,2,0,True);
-  SIVALS(outbuf,smb_vwv0,res);
+  SIVALS(outbuf,smb_vwv0,(uint32)res);
   
   DEBUG(3,("lseek fnum=%d ofs=%d mode=%d\n",
           fsp->fnum, startpos, mode));
@@ -3330,7 +3332,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
   }
 
   if ((ofun&3) == 1) {
-    lseek(fsp2->fd_ptr->fd,0,SEEK_END);
+    sys_lseek(fsp2->fd_ptr->fd,0,SEEK_END);
   }
   
   if (st.st_size)
@@ -3951,7 +3953,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
   CHECK_ERROR(fsp);
 
   /* Do an fstat on this file */
-  if(fstat(fsp->fd_ptr->fd, &sbuf))
+  if(sys_fstat(fsp->fd_ptr->fd, &sbuf))
     return(UNIXERROR(ERRDOS,ERRnoaccess));
   
   mode = dos_mode(conn,fsp->fsp_name,&sbuf);
@@ -3969,7 +3971,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int dum_si
     }
   else
     {
-      SIVAL(outbuf,smb_vwv6,sbuf.st_size);
+      SIVAL(outbuf,smb_vwv6,(uint32)sbuf.st_size);
       SIVAL(outbuf,smb_vwv8,ROUNDUP(sbuf.st_size,1024));
     }
   SSVAL(outbuf,smb_vwv10, mode);
index 8871d568ddad58a303638e347aaa397342895f4a..dd1aa8f48b7942aa32fd1328ec17cfd09020c8c8 100644 (file)
@@ -200,7 +200,8 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
 
   pstring fname;
   int unixmode;
-  int size=0,fmode=0,mtime=0,rmode;
+  SMB_OFF_T size=0;
+  int fmode=0,mtime=0,rmode;
   SMB_INO_T inode = 0;
   SMB_STRUCT_STAT sbuf;
   int smb_action = 0;
@@ -247,7 +248,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
     return(UNIXERROR(ERRDOS,ERRnoaccess));
   }
 
-  if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+  if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
     close_file(fsp,False);
     return(ERROR(ERRDOS,ERRnoaccess));
   }
@@ -270,7 +271,7 @@ static int call_trans2open(connection_struct *conn, char *inbuf, char *outbuf,
   SSVAL(params,0,fsp->fnum);
   SSVAL(params,2,fmode);
   put_dos_date2(params,4, mtime);
-  SIVAL(params,8, size);
+  SIVAL(params,8, (uint32)size);
   SSVAL(params,12,rmode);
 
   if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
@@ -311,7 +312,8 @@ static int get_lanman2_dir_entry(connection_struct *conn,
   uint32 reskey=0;
   int prev_dirpos=0;
   int mode=0;
-  uint32 size=0,len;
+  SMB_OFF_T size = 0;
+  uint32 len;
   uint32 mdate=0, adate=0, cdate=0;
   char *nameptr;
   BOOL isrootdir = (strequal(conn->dirpath,"./") ||
@@ -329,78 +331,78 @@ static int get_lanman2_dir_entry(connection_struct *conn,
 
   p = strrchr(path_mask,'/');
   if(p != NULL)
-    {
-      if(p[1] == '\0')
-       pstrcpy(mask,"*.*");
-      else
-       pstrcpy(mask, p+1);
-    }
+  {
+    if(p[1] == '\0')
+      pstrcpy(mask,"*.*");
+    else
+      pstrcpy(mask, p+1);
+  }
   else
     pstrcpy(mask, path_mask);
 
   while (!found)
-    {
-      /* Needed if we run out of space */
-      prev_dirpos = TellDir(conn->dirptr);
-      dname = ReadDirName(conn->dirptr);
+  {
+    /* Needed if we run out of space */
+    prev_dirpos = TellDir(conn->dirptr);
+    dname = ReadDirName(conn->dirptr);
 
-      /*
-       * Due to bugs in NT client redirectors we are not using
-       * resume keys any more - set them to zero.
-       * Check out the related comments in findfirst/findnext.
-       * JRA.
-       */
+    /*
+     * Due to bugs in NT client redirectors we are not using
+     * resume keys any more - set them to zero.
+     * Check out the related comments in findfirst/findnext.
+     * JRA.
+     */
 
-      reskey = 0;
+    reskey = 0;
 
-      DEBUG(8,("get_lanman2_dir_entry:readdir on dirptr 0x%x now at offset %d\n",
-              (unsigned)conn->dirptr,TellDir(conn->dirptr)));
+    DEBUG(8,("get_lanman2_dir_entry:readdir on dirptr 0x%x now at offset %d\n",
+      (unsigned)conn->dirptr,TellDir(conn->dirptr)));
       
-      if (!dname) 
-       return(False);
+    if (!dname) 
+      return(False);
 
-      matched = False;
+    matched = False;
 
-      pstrcpy(fname,dname);      
+    pstrcpy(fname,dname);      
 
-      if(mask_match(fname, mask, case_sensitive, True))
-       {
-         BOOL isdots = (strequal(fname,"..") || strequal(fname,"."));
-         if (dont_descend && !isdots)
-           continue;
+    if(mask_match(fname, mask, case_sensitive, True))
+    {
+      BOOL isdots = (strequal(fname,"..") || strequal(fname,"."));
+      if (dont_descend && !isdots)
+        continue;
          
-         if (isrootdir && isdots)
-           continue;
-
-         pstrcpy(pathreal,conn->dirpath);
-          if(needslash)
-           pstrcat(pathreal,"/");
-         pstrcat(pathreal,dname);
-         if (dos_stat(pathreal,&sbuf) != 0) 
-           {
-             DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
-             continue;
-           }
-
-         mode = dos_mode(conn,pathreal,&sbuf);
-
-         if (!dir_check_ftype(conn,mode,&sbuf,dirtype)) {
-           DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype));
-           continue;
-         }
-
-         size = sbuf.st_size;
-         mdate = sbuf.st_mtime;
-         adate = sbuf.st_atime;
-         cdate = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
-         if(mode & aDIR)
-           size = 0;
-
-         DEBUG(5,("get_lanman2_dir_entry found %s fname=%s\n",pathreal,fname));
+      if (isrootdir && isdots)
+        continue;
+
+      pstrcpy(pathreal,conn->dirpath);
+      if(needslash)
+        pstrcat(pathreal,"/");
+      pstrcat(pathreal,dname);
+      if (dos_stat(pathreal,&sbuf) != 0) 
+      {
+        DEBUG(5,("get_lanman2_dir_entry:Couldn't stat [%s] (%s)\n",pathreal,strerror(errno)));
+        continue;
+      }
+
+      mode = dos_mode(conn,pathreal,&sbuf);
+
+      if (!dir_check_ftype(conn,mode,&sbuf,dirtype)) {
+        DEBUG(5,("[%s] attribs didn't match %x\n",fname,dirtype));
+        continue;
+      }
+
+      size = sbuf.st_size;
+      mdate = sbuf.st_mtime;
+      adate = sbuf.st_atime;
+      cdate = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
+      if(mode & aDIR)
+        size = 0;
+
+      DEBUG(5,("get_lanman2_dir_entry found %s fname=%s\n",pathreal,fname));
          
-         found = True;
-       }
+      found = True;
     }
+  }
 
   name_map_mangle(fname,False,SNUM(conn));
 
@@ -410,7 +412,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
   nt_extmode = mode ? mode : FILE_ATTRIBUTE_NORMAL;
 
   switch (info_level)
-    {
+  {
     case 1:
       if(requires_resume_key) {
        SIVAL(p,0,reskey);
@@ -419,7 +421,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
       put_dos_date2(p,l1_fdateCreation,cdate);
       put_dos_date2(p,l1_fdateLastAccess,adate);
       put_dos_date2(p,l1_fdateLastWrite,mdate);
-      SIVAL(p,l1_cbFile,size);
+      SIVAL(p,l1_cbFile,(uint32)size);
       SIVAL(p,l1_cbFileAlloc,ROUNDUP(size,1024));
       SSVAL(p,l1_attrFile,mode);
       SCVAL(p,l1_cchName,strlen(fname));
@@ -437,7 +439,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
       put_dos_date2(p,l2_fdateCreation,cdate);
       put_dos_date2(p,l2_fdateLastAccess,adate);
       put_dos_date2(p,l2_fdateLastWrite,mdate);
-      SIVAL(p,l2_cbFile,size);
+      SIVAL(p,l2_cbFile,(uint32)size);
       SIVAL(p,l2_cbFileAlloc,ROUNDUP(size,1024));
       SSVAL(p,l2_attrFile,mode);
       SIVAL(p,l2_cbList,0); /* No extended attributes */
@@ -452,7 +454,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
       put_dos_date2(p,4,cdate);
       put_dos_date2(p,8,adate);
       put_dos_date2(p,12,mdate);
-      SIVAL(p,16,size);
+      SIVAL(p,16,(uint32)size);
       SIVAL(p,20,ROUNDUP(size,1024));
       SSVAL(p,24,mode);
       SIVAL(p,26,4);
@@ -471,7 +473,7 @@ static int get_lanman2_dir_entry(connection_struct *conn,
       put_dos_date2(p,4,cdate);
       put_dos_date2(p,8,adate);
       put_dos_date2(p,12,mdate);
-      SIVAL(p,16,size);
+      SIVAL(p,16,(uint32)size);
       SIVAL(p,20,ROUNDUP(size,1024));
       SSVAL(p,24,mode);
       CVAL(p,32) = strlen(fname);
@@ -1076,20 +1078,20 @@ static int call_trans2qfsinfo(connection_struct *conn,
   pdata = *ppdata = Realloc(*ppdata, 1024); bzero(pdata,1024);
 
   switch (info_level) 
-    {
+  {
     case 1:
-      {
-       int dfree,dsize,bsize;
-       data_len = 18;
-       sys_disk_free(".",&bsize,&dfree,&dsize);        
-       SIVAL(pdata,l1_idFileSystem,st.st_dev);
-       SIVAL(pdata,l1_cSectorUnit,bsize/512);
-       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",
+    {
+      int dfree,dsize,bsize;
+      data_len = 18;
+      sys_disk_free(".",&bsize,&dfree,&dsize); 
+      SIVAL(pdata,l1_idFileSystem,st.st_dev);
+      SIVAL(pdata,l1_cSectorUnit,bsize/512);
+      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));
-       break;
+      break;
     }
     case 2:
     { 
@@ -1136,16 +1138,16 @@ static int call_trans2qfsinfo(connection_struct *conn,
               vname));
       break;
     case SMB_QUERY_FS_SIZE_INFO:
-      {
-       int dfree,dsize,bsize;
-       data_len = 24;
-       sys_disk_free(".",&bsize,&dfree,&dsize);        
-       SIVAL(pdata,0,dsize);
-       SIVAL(pdata,8,dfree);
-       SIVAL(pdata,16,bsize/512);
-       SIVAL(pdata,20,512);
-      }
+    {
+      int dfree,dsize,bsize;
+      data_len = 24;
+      sys_disk_free(".",&bsize,&dfree,&dsize); 
+      SIVAL(pdata,0,dsize);
+      SIVAL(pdata,8,dfree);
+      SIVAL(pdata,16,bsize/512);
+      SIVAL(pdata,20,512);
       break;
+    }
     case SMB_QUERY_FS_DEVICE_INFO:
       data_len = 8;
       SIVAL(pdata,0,0); /* dev type */
@@ -1153,7 +1155,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
       break;
     default:
       return(ERROR(ERRDOS,ERRunknownlevel));
-    }
+  }
 
 
   send_trans2_replies( outbuf, bufsize, params, 0, pdata, data_len);
@@ -1201,13 +1203,14 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
   uint16 tran_call = SVAL(inbuf, smb_setup0);
   uint16 info_level;
   int mode=0;
-  int size=0;
+  SMB_OFF_T size=0;
   unsigned int data_size;
   SMB_STRUCT_STAT sbuf;
   pstring fname1;
   char *fname;
   char *p;
-  int l,pos;
+  int l;
+  SMB_OFF_T pos;
   BOOL bad_path = False;
 
   if (tran_call == TRANSACT2_QFILEINFO) {
@@ -1218,11 +1221,11 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
     CHECK_ERROR(fsp);
 
     fname = fsp->fsp_name;
-    if (fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
+    if (sys_fstat(fsp->fd_ptr->fd,&sbuf) != 0) {
       DEBUG(3,("fstat of fnum %d failed (%s)\n",fsp->fnum, strerror(errno)));
       return(UNIXERROR(ERRDOS,ERRbadfid));
     }
-    pos = lseek(fsp->fd_ptr->fd,0,SEEK_CUR);
+    pos = sys_lseek(fsp->fd_ptr->fd,0,SEEK_CUR);
   } else {
     /* qpathinfo */
     info_level = SVAL(params,0);
@@ -1278,7 +1281,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
       put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
       put_dos_date2(pdata,l1_fdateLastAccess,sbuf.st_atime);
       put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */
-      SIVAL(pdata,l1_cbFile,size);
+      SIVAL(pdata,l1_cbFile,(uint32)size);
       SIVAL(pdata,l1_cbFileAlloc,ROUNDUP(size,1024));
       SSVAL(pdata,l1_attrFile,mode);
       SIVAL(pdata,l1_attrFile+2,4); /* this is what OS2 does */
@@ -1289,7 +1292,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
       put_dos_date2(pdata,0,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
       put_dos_date2(pdata,4,sbuf.st_atime);
       put_dos_date2(pdata,8,sbuf.st_mtime);
-      SIVAL(pdata,12,size);
+      SIVAL(pdata,12,(uint32)size);
       SIVAL(pdata,16,ROUNDUP(size,1024));
       SIVAL(pdata,20,mode);
       break;
@@ -1432,7 +1435,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
   uint16 tran_call = SVAL(inbuf, smb_setup0);
   uint16 info_level;
   int mode=0;
-  int size=0;
+  SMB_OFF_T size=0;
   struct utimbuf tvs;
   SMB_STRUCT_STAT st;
   pstring fname1;
@@ -1453,7 +1456,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
     fname = fsp->fsp_name;
     fd = fsp->fd_ptr->fd;
 
-    if(fstat(fd,&st)!=0) {
+    if(sys_fstat(fd,&st)!=0) {
       DEBUG(3,("fstat of %s failed (%s)\n", fname, strerror(errno)));
       return(ERROR(ERRDOS,ERRbadpath));
     }
@@ -1581,7 +1584,11 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
 
   DEBUG(6,("actime: %s " , ctime(&tvs.actime)));
   DEBUG(6,("modtime: %s ", ctime(&tvs.modtime)));
+#ifdef LARGE_SMB_OFF_T
+  DEBUG(6,("size: %.0f ", (double)size));
+#else /* LARGE_SMB_OFF_T */
   DEBUG(6,("size: %x "   , size));
+#endif /* LARGE_SMB_OFF_T */
   DEBUG(6,("mode: %x\n"  , mode));
 
   /* get some defaults (no modifications) if any info is zero. */
index 97dfb715b04c9eacfbe25c0b235061793ba0e4be..67cd3d4f6fe913425b5f3f0c93dd4c33dbeee7fa 100644 (file)
@@ -173,7 +173,7 @@ int do_compile(int codepage, char *input_file, char *output_file)
   SMB_STRUCT_STAT st;
 
   /* Get the size of the input file. Read the entire thing into memory. */
-  if(stat((char *)input_file, &st)!= 0)
+  if(sys_stat((char *)input_file, &st)!= 0)
   {
     fprintf(stderr, "%s: failed to get the file size for file %s. Error was %s\n",
             prog_name, input_file, strerror(errno));
@@ -318,7 +318,7 @@ int do_decompile( int codepage, char *input_file, char *output_file)
   int i = 0;
 
   /* Get the size of the input file. Read the entire thing into memory. */
-  if(stat((char *)input_file, &st)!= 0)
+  if(sys_stat((char *)input_file, &st)!= 0)
   {
     fprintf(stderr, "%s: failed to get the file size for file %s. Error was %s\n",
             prog_name, input_file, strerror(errno));