diff options
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/configure | 337 | ||||
-rw-r--r-- | source3/configure.in | 1 | ||||
-rw-r--r-- | source3/include/config.h.in | 1 | ||||
-rw-r--r-- | source3/include/proto.h | 28 | ||||
-rw-r--r-- | source3/include/smb.h | 6 | ||||
-rw-r--r-- | source3/lib/util.c | 207 | ||||
-rw-r--r-- | source3/locking/locking_shm.c | 71 | ||||
-rw-r--r-- | source3/script/mkproto.awk | 2 | ||||
-rw-r--r-- | source3/smbd/blocking.c | 50 | ||||
-rw-r--r-- | source3/smbd/fileio.c | 60 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 12 | ||||
-rw-r--r-- | source3/smbd/open.c | 30 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 60 | ||||
-rw-r--r-- | source3/smbd/predict.c | 14 | ||||
-rw-r--r-- | source3/smbd/reply.c | 363 |
15 files changed, 608 insertions, 634 deletions
diff --git a/source3/configure b/source3/configure index a57723f209..974eccc07d 100755 --- a/source3/configure +++ b/source3/configure @@ -2435,17 +2435,50 @@ EOF fi +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:2440: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2445 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + echo $ac_n "checking for errno in errno.h... $ac_c" cat > conftest.$ac_ext <<EOF -#line 2442 "configure" +#line 2475 "configure" #include "confdefs.h" #include <errno.h> int main() { int i = errno ; return 0; } EOF -if { (eval echo configure:2449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo yes; cat >> confdefs.h <<\EOF #define HAVE_ERRNO_DECL 1 @@ -2462,14 +2495,14 @@ rm -f conftest* # stupid glibc has the functions but no declaration. grrrr. echo $ac_n "checking for setresuid declaration $ac_c" cat > conftest.$ac_ext <<EOF -#line 2466 "configure" +#line 2499 "configure" #include "confdefs.h" #include <unistd.h> int main() { int i = setresuid ; return 0; } EOF -if { (eval echo configure:2473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo yes; cat >> confdefs.h <<\EOF #define HAVE_SETRESUID_DECL 1 @@ -2490,12 +2523,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 2494 "configure" +#line 2527 "configure" #include "confdefs.h" #include <errno.h> main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);} EOF -if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2532: \"$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_SETRESUID 1 @@ -2513,7 +2546,7 @@ fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2517: checking for 8-bit clean memcmp" >&5 +echo "configure:2550: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2554,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 2525 "configure" +#line 2558 "configure" #include "confdefs.h" main() @@ -2531,7 +2564,7 @@ main() } EOF -if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2553,7 +2586,7 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" # test for where we get crypt() from if test "$ac_cv_lib_crypt_crypt" = "yes"; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:2557: checking for crypt in -lcrypt" >&5 +echo "configure:2590: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2561,7 +2594,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 2565 "configure" +#line 2598 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2572,7 +2605,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:2576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2608,12 +2641,12 @@ if test "$ac_cv_lib_crypt_crypt" = "no" || test "$ac_cv_lib_crypt_crypt" = ""; then # look for crypt echo $ac_n "checking for crypt""... $ac_c" 1>&6 -echo "configure:2612: checking for crypt" >&5 +echo "configure:2645: checking for crypt" >&5 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2617 "configure" +#line 2650 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char crypt(); below. */ @@ -2636,7 +2669,7 @@ crypt(); ; return 0; } EOF -if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_crypt=yes" else @@ -2659,7 +2692,7 @@ else case "$LIBS" in *-lcrypt*) ;; *) echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:2663: checking for crypt in -lcrypt" >&5 +echo "configure:2696: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2667,7 +2700,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 2671 "configure" +#line 2704 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2678,7 +2711,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:2682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2723,21 +2756,21 @@ fi # might need libdl for this to work if test "$ac_cv_header_security_pam_appl_h" = "yes"; then echo $ac_n "checking for -ldl""... $ac_c" 1>&6 -echo "configure:2727: checking for -ldl" >&5 +echo "configure:2760: checking for -ldl" >&5 if eval "test \"`echo '$''{'ac_cv_lib_dl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2734 "configure" +#line 2767 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_lib_dl=yes else @@ -2763,7 +2796,7 @@ fi fi if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then echo $ac_n "checking for pam_authenticate in -lpam""... $ac_c" 1>&6 -echo "configure:2767: checking for pam_authenticate in -lpam" >&5 +echo "configure:2800: checking for pam_authenticate in -lpam" >&5 ac_lib_var=`echo pam'_'pam_authenticate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2771,7 +2804,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpam $LIBS" cat > conftest.$ac_ext <<EOF -#line 2775 "configure" +#line 2808 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2782,7 +2815,7 @@ int main() { pam_authenticate() ; return 0; } EOF -if { (eval echo configure:2786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2818,12 +2851,12 @@ if test "$ac_cv_lib_pam_pam_authenticate" = "no" || test "$ac_cv_lib_pam_pam_authenticate" = ""; then # look for pam_authenticate echo $ac_n "checking for pam_authenticate""... $ac_c" 1>&6 -echo "configure:2822: checking for pam_authenticate" >&5 +echo "configure:2855: checking for pam_authenticate" >&5 if eval "test \"`echo '$''{'ac_cv_func_pam_authenticate'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2827 "configure" +#line 2860 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char pam_authenticate(); below. */ @@ -2846,7 +2879,7 @@ pam_authenticate(); ; return 0; } EOF -if { (eval echo configure:2850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_pam_authenticate=yes" else @@ -2869,7 +2902,7 @@ else case "$LIBS" in *-lpam*) ;; *) echo $ac_n "checking for pam_authenticate in -lpam""... $ac_c" 1>&6 -echo "configure:2873: checking for pam_authenticate in -lpam" >&5 +echo "configure:2906: checking for pam_authenticate in -lpam" >&5 ac_lib_var=`echo pam'_'pam_authenticate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2877,7 +2910,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpam $LIBS" cat > conftest.$ac_ext <<EOF -#line 2881 "configure" +#line 2914 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2888,7 +2921,7 @@ int main() { pam_authenticate() ; return 0; } EOF -if { (eval echo configure:2892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2934,12 +2967,12 @@ fi # only looks in /etc/hosts), so we only look for -lsocket if we need # it. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2938: checking for connect" >&5 +echo "configure:2971: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2943 "configure" +#line 2976 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -2962,7 +2995,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:2966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2982,7 +3015,7 @@ else case "$LIBS" in *-lnsl*) ;; *) echo $ac_n "checking for printf in -lnsl_s""... $ac_c" 1>&6 -echo "configure:2986: checking for printf in -lnsl_s" >&5 +echo "configure:3019: checking for printf in -lnsl_s" >&5 ac_lib_var=`echo nsl_s'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2990,7 +3023,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 2994 "configure" +#line 3027 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3001,7 +3034,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:3005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3032,7 +3065,7 @@ esac case "$LIBS" in *-lnsl*) ;; *) echo $ac_n "checking for printf in -lnsl""... $ac_c" 1>&6 -echo "configure:3036: checking for printf in -lnsl" >&5 +echo "configure:3069: checking for printf in -lnsl" >&5 ac_lib_var=`echo nsl'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3040,7 +3073,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3044 "configure" +#line 3077 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3051,7 +3084,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:3055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3082,7 +3115,7 @@ esac case "$LIBS" in *-lsocket*) ;; *) echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3086: checking for connect in -lsocket" >&5 +echo "configure:3119: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3090,7 +3123,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 3094 "configure" +#line 3127 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3101,7 +3134,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:3105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3132,7 +3165,7 @@ esac case "$LIBS" in *-linet*) ;; *) echo $ac_n "checking for connect in -linet""... $ac_c" 1>&6 -echo "configure:3136: checking for connect in -linet" >&5 +echo "configure:3169: checking for connect in -linet" >&5 ac_lib_var=`echo inet'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3140,7 +3173,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <<EOF -#line 3144 "configure" +#line 3177 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3151,7 +3184,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:3155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3194,12 +3227,12 @@ fi for ac_func in waitpid getcwd strdup strerror chown chmod chroot do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3198: checking for $ac_func" >&5 +echo "configure:3231: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3203 "configure" +#line 3236 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3222,7 +3255,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3249,12 +3282,12 @@ done for ac_func in fstat strchr utime utimes getrlimit fsync execl bzero memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3253: checking for $ac_func" >&5 +echo "configure:3286: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3258 "configure" +#line 3291 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3277,7 +3310,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3304,12 +3337,12 @@ done for ac_func in memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3308: checking for $ac_func" >&5 +echo "configure:3341: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3313 "configure" +#line 3346 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3332,7 +3365,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3359,12 +3392,12 @@ done for ac_func in strftime sigprocmask sigblock sigaction innetgr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3363: checking for $ac_func" >&5 +echo "configure:3396: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3368 "configure" +#line 3401 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3387,7 +3420,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3414,12 +3447,12 @@ done for ac_func in initgroups select rdchk getgrnam pathconf putprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3418: checking for $ac_func" >&5 +echo "configure:3451: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3423 "configure" +#line 3456 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3442,7 +3475,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3469,12 +3502,12 @@ done 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 +echo "configure:3506: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3478 "configure" +#line 3511 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3497,7 +3530,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3524,12 +3557,12 @@ done 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 +echo "configure:3561: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3533 "configure" +#line 3566 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3552,7 +3585,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3579,12 +3612,12 @@ done for ac_func in bigcrypt getprpwnam setluid yp_get_default_domain getpwanam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3583: checking for $ac_func" >&5 +echo "configure:3616: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3588 "configure" +#line 3621 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3607,7 +3640,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3637,12 +3670,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 3641 "configure" +#line 3674 "configure" #include "confdefs.h" #include <stdio.h> main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); } EOF -if { (eval echo configure:3646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3679: \"$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_LONGLONG 1 @@ -3663,13 +3696,13 @@ 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 3667 "configure" +#line 3700 "configure" #include "confdefs.h" #include <stdio.h> #include <sys/stat.h> 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 +if { (eval echo configure:3706: \"$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 @@ -3690,13 +3723,13 @@ 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 3727 "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:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3733: \"$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 @@ -3717,13 +3750,13 @@ 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 3721 "configure" +#line 3754 "configure" #include "confdefs.h" #include <stdio.h> #include <sys/stat.h> main() { exit((sizeof(ino_t) == 8) ? 0 : 1); } EOF -if { (eval echo configure:3727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3760: \"$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_INO_T 8 @@ -3744,13 +3777,13 @@ 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 3748 "configure" +#line 3781 "configure" #include "confdefs.h" #include <stdio.h> #include <sys/stat.h> main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); } EOF -if { (eval echo configure:3754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3787: \"$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_INO64_T 1 @@ -3771,7 +3804,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 3775 "configure" +#line 3808 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3779,7 +3812,7 @@ else #include <sys/sem.h> main() { union semun ss; exit(0); } EOF -if { (eval echo configure:3783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3816: \"$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 @@ -3800,12 +3833,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 3804 "configure" +#line 3837 "configure" #include "confdefs.h" #include <stdio.h> main() { char c; c=250; exit((c > 0)?0:1); } EOF -if { (eval echo configure:3809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3842: \"$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 @@ -3823,7 +3856,7 @@ fi echo $ac_n "checking for sin_len in sock ... $ac_c" cat > conftest.$ac_ext <<EOF -#line 3827 "configure" +#line 3860 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> @@ -3832,7 +3865,7 @@ int main() { struct sockaddr_in sock; sock.sin_len = sizeof(sock); ; return 0; } EOF -if { (eval echo configure:3836: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3869: \"$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 @@ -3848,14 +3881,14 @@ rm -f conftest* echo $ac_n "checking for __FILE__ macro ... $ac_c" cat > conftest.$ac_ext <<EOF -#line 3852 "configure" +#line 3885 "configure" #include "confdefs.h" #include <stdio.h> int main() { printf("%s\n", __FILE__); ; return 0; } EOF -if { (eval echo configure:3859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3892: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo yes;cat >> confdefs.h <<\EOF #define HAVE_FILE_MACRO 1 @@ -3871,14 +3904,14 @@ rm -f conftest* echo $ac_n "checking for __FUNCTION__ macro ... $ac_c" cat > conftest.$ac_ext <<EOF -#line 3875 "configure" +#line 3908 "configure" #include "confdefs.h" #include <stdio.h> int main() { printf("%s\n", __FUNCTION__); ; return 0; } EOF -if { (eval echo configure:3882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo yes;cat >> confdefs.h <<\EOF #define HAVE_FUNCTION_MACRO 1 @@ -3897,14 +3930,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 3901 "configure" +#line 3934 "configure" #include "confdefs.h" #include <sys/time.h> #include <unistd.h> main() { struct timeval tv; exit(gettimeofday(&tv, NULL));} EOF -if { (eval echo configure:3908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3941: \"$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 @@ -3926,7 +3959,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 3930 "configure" +#line 3963 "configure" #include "confdefs.h" #include <sys/types.h> #include <dirent.h> @@ -3934,7 +3967,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:3938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3971: \"$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 @@ -3952,7 +3985,7 @@ fi echo $ac_n "checking for utimbuf ... $ac_c" cat > conftest.$ac_ext <<EOF -#line 3956 "configure" +#line 3989 "configure" #include "confdefs.h" #include <sys/types.h> #include <utime.h> @@ -3960,7 +3993,7 @@ int main() { struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf)); ; return 0; } EOF -if { (eval echo configure:3964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo yes;cat >> confdefs.h <<\EOF #define HAVE_UTIMBUF 1 @@ -3980,11 +4013,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 3984 "configure" +#line 4017 "configure" #include "confdefs.h" #include "tests/trivial.c" EOF -if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then echo yes; else @@ -4002,11 +4035,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 4006 "configure" +#line 4039 "configure" #include "confdefs.h" #include "tests/ftruncate.c" EOF -if { (eval echo configure:4010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4043: \"$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 @@ -4027,11 +4060,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 4031 "configure" +#line 4064 "configure" #include "confdefs.h" #include "tests/getgroups.c" EOF -if { (eval echo configure:4035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4068: \"$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 @@ -4053,7 +4086,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 4057 "configure" +#line 4090 "configure" #include "confdefs.h" #include <stdio.h> @@ -4065,7 +4098,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:4069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4102: \"$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 @@ -4086,11 +4119,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 4090 "configure" +#line 4123 "configure" #include "confdefs.h" main() { exit(getuid() != 0); } EOF -if { (eval echo configure:4094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4127: \"$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 @@ -4112,14 +4145,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 4116 "configure" +#line 4149 "configure" #include "confdefs.h" #define HAVE_NETMASK_IFCONF 1 #define AUTOCONF 1 #include "lib/netmask.c" EOF -if { (eval echo configure:4123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4156: \"$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 @@ -4141,14 +4174,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 4145 "configure" +#line 4178 "configure" #include "confdefs.h" #define HAVE_NETMASK_IFREQ 1 #define AUTOCONF 1 #include "lib/netmask.c" EOF -if { (eval echo configure:4152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4185: \"$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 @@ -4171,14 +4204,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 4175 "configure" +#line 4208 "configure" #include "confdefs.h" #define HAVE_NETMASK_AIX 1 #define AUTOCONF 1 #include "lib/netmask.c" EOF -if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4215: \"$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 @@ -4200,11 +4233,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 4204 "configure" +#line 4237 "configure" #include "confdefs.h" #include "tests/trapdoor.c" EOF -if { (eval echo configure:4208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then echo no else @@ -4225,11 +4258,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 4229 "configure" +#line 4262 "configure" #include "confdefs.h" #include "tests/shared_mmap.c" EOF -if { (eval echo configure:4233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4266: \"$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 @@ -4250,11 +4283,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 4254 "configure" +#line 4287 "configure" #include "confdefs.h" #include "tests/fcntl_lock.c" EOF -if { (eval echo configure:4258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4291: \"$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 @@ -4275,7 +4308,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 4279 "configure" +#line 4312 "configure" #include "confdefs.h" #include <stdio.h> @@ -4296,7 +4329,7 @@ exit(1); #endif } EOF -if { (eval echo configure:4300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4333: \"$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_STRUCT_FLOCK64 1 @@ -4317,11 +4350,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 4321 "configure" +#line 4354 "configure" #include "confdefs.h" #include "tests/sysv_ipc.c" EOF -if { (eval echo configure:4325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4358: \"$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 @@ -4340,7 +4373,7 @@ fi ################################################# # check for the AFS filesystem echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6 -echo "configure:4344: checking whether to use AFS" >&5 +echo "configure:4377: 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" @@ -4366,7 +4399,7 @@ fi ################################################# # check for the DFS auth system echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6 -echo "configure:4370: checking whether to use DFS auth" >&5 +echo "configure:4403: 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" @@ -4391,7 +4424,7 @@ fi ################################################# # check for automount support echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6 -echo "configure:4395: checking whether to use AUTOMOUNT" >&5 +echo "configure:4428: 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" @@ -4416,7 +4449,7 @@ fi ################################################# # check for a LDAP password database echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6 -echo "configure:4420: checking whether to use LDAP password database" >&5 +echo "configure:4453: 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" @@ -4441,7 +4474,7 @@ fi ################################################# # check for a NISPLUS password database echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6 -echo "configure:4445: checking whether to use NISPLUS password database" >&5 +echo "configure:4478: 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" @@ -4466,7 +4499,7 @@ fi ################################################# # check for a NISPLUS_HOME support echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6 -echo "configure:4470: checking whether to use NISPLUS_HOME" >&5 +echo "configure:4503: 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" @@ -4491,7 +4524,7 @@ fi ################################################# # check for the secure socket layer echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6 -echo "configure:4495: checking whether to use SSL" >&5 +echo "configure:4528: 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" @@ -4516,7 +4549,7 @@ fi ################################################# # check for experimental mmap support echo $ac_n "checking whether to use MMAP""... $ac_c" 1>&6 -echo "configure:4520: checking whether to use MMAP" >&5 +echo "configure:4553: 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" @@ -4541,7 +4574,7 @@ fi ################################################# # check for syslog logging echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6 -echo "configure:4545: checking whether to use syslog logging" >&5 +echo "configure:4578: 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" @@ -4566,7 +4599,7 @@ fi ################################################# # check for experimental netatalk resource fork support echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6 -echo "configure:4570: checking whether to support netatalk" >&5 +echo "configure:4603: 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" @@ -4592,7 +4625,7 @@ fi ################################################# # these tests are taken from the GNU fileutils package echo "checking how to get filesystem space usage" 1>&6 -echo "configure:4596: checking how to get filesystem space usage" >&5 +echo "configure:4629: checking how to get filesystem space usage" >&5 space=no # Perform only the link test since it seems there are no variants of the @@ -4604,12 +4637,12 @@ space=no if test $space = no; then # SVR4 echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6 -echo "configure:4608: checking statvfs function (SVR4)" >&5 +echo "configure:4641: 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 4613 "configure" +#line 4646 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/statvfs.h> @@ -4617,7 +4650,7 @@ int main() { struct statvfs fsd; statvfs (0, &fsd); ; return 0; } EOF -if { (eval echo configure:4621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* fu_cv_sys_stat_statvfs=yes else @@ -4642,7 +4675,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:4646: checking for 3-argument statfs function (DEC OSF/1)" >&5 +echo "configure:4679: 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 @@ -4650,7 +4683,7 @@ else fu_cv_sys_stat_statfs3_osf1=no else cat > conftest.$ac_ext <<EOF -#line 4654 "configure" +#line 4687 "configure" #include "confdefs.h" #include <sys/param.h> @@ -4663,7 +4696,7 @@ else exit (statfs (".", &fsd, sizeof (struct statfs))); } EOF -if { (eval echo configure:4667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4700: \"$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 @@ -4690,7 +4723,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:4694: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 +echo "configure:4727: 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 @@ -4698,7 +4731,7 @@ else fu_cv_sys_stat_statfs2_bsize=no else cat > conftest.$ac_ext <<EOF -#line 4702 "configure" +#line 4735 "configure" #include "confdefs.h" #ifdef HAVE_SYS_PARAM_H @@ -4717,7 +4750,7 @@ else exit (statfs (".", &fsd)); } EOF -if { (eval echo configure:4721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4754: \"$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 @@ -4744,7 +4777,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:4748: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 +echo "configure:4781: 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 @@ -4752,7 +4785,7 @@ else fu_cv_sys_stat_statfs4=no else cat > conftest.$ac_ext <<EOF -#line 4756 "configure" +#line 4789 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/statfs.h> @@ -4762,7 +4795,7 @@ else exit (statfs (".", &fsd, sizeof fsd, 0)); } EOF -if { (eval echo configure:4766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4799: \"$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 @@ -4789,7 +4822,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:4793: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 +echo "configure:4826: 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 @@ -4797,7 +4830,7 @@ else fu_cv_sys_stat_statfs2_fsize=no else cat > conftest.$ac_ext <<EOF -#line 4801 "configure" +#line 4834 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_SYS_PARAM_H @@ -4813,7 +4846,7 @@ else exit (statfs (".", &fsd)); } EOF -if { (eval echo configure:4817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4850: \"$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 @@ -4840,7 +4873,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:4844: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 +echo "configure:4877: 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 @@ -4848,7 +4881,7 @@ else fu_cv_sys_stat_fs_data=no else cat > conftest.$ac_ext <<EOF -#line 4852 "configure" +#line 4885 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_SYS_PARAM_H @@ -4868,7 +4901,7 @@ else exit (statfs (".", &fsd) != 1); } EOF -if { (eval echo configure:4872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4905: \"$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 @@ -4897,11 +4930,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 4901 "configure" +#line 4934 "configure" #include "confdefs.h" #include "tests/summary.c" EOF -if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then echo "configure OK"; else diff --git a/source3/configure.in b/source3/configure.in index d0e3448944..8656eed90d 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -55,6 +55,7 @@ AC_TYPE_SIZE_T AC_TYPE_PID_T AC_STRUCT_ST_RDEV AC_CHECK_TYPE(ino_t,unsigned) +AC_CHECK_TYPE(ssize_t, int) echo $ac_n "checking for errno in errno.h... $ac_c" AC_TRY_COMPILE([#include <errno.h>],[int i = errno], diff --git a/source3/include/config.h.in b/source3/include/config.h.in index fc5dcd2c4e..615666b7ff 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -63,6 +63,7 @@ #undef HAVE_UNSIGNED_CHAR #undef HAVE_UTIMBUF #undef ino_t +#undef ssize_t #undef HAVE_CONNECT #undef HAVE_SHORT_INO_T #undef WITH_AFS diff --git a/source3/include/proto.h b/source3/include/proto.h index 862c11f350..4c966b2faa 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -258,18 +258,18 @@ BOOL strhaslower(char *s); int count_chars(char *s,char c); 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 write_socket(int fd,char *buf,int len); -int read_udp_socket(int fd,char *buf,int len); -int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out); +ssize_t write_socket(int fd,char *buf,size_t len); +ssize_t read_udp_socket(int fd,char *buf,size_t len); +ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out); 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); +ssize_t read_data(int fd,char *buffer,size_t N); +ssize_t write_data(int fd,char *buffer,size_t N); 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); -BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout); +ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout); +BOOL receive_smb(int fd,char *buffer, unsigned int timeout); +BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout); +BOOL receive_local_message(int fd, char *buffer, int buffer_len, unsigned int timeout); BOOL push_oplock_pending_smb_message(char *buf, int msg_len); BOOL receive_message_or_smb(int smbfd, int oplock_fd, char *buffer, int buffer_len, @@ -289,7 +289,7 @@ void become_daemon(void); BOOL yesno(char *p); char *fgets_slash(char *s2,int maxlen,FILE *f); int set_filelen(int fd, SMB_OFF_T len); -void *Realloc(void *p,int size); +void *Realloc(void *p,size_t size); BOOL get_myname(char *my_name,struct in_addr *ip); BOOL ip_equal(struct in_addr ip1,struct in_addr ip2); int open_socket_in(int type, int port, int dlevel,uint32 socket_addr); @@ -333,7 +333,7 @@ char *tab_depth(int depth); char *sid_to_string(pstring sidstr_out, DOM_SID *sid); BOOL string_to_sid(DOM_SID *sidout, char *sidstr); int str_checksum(char *s); -void zero_free(void *p, int size); +void zero_free(void *p, size_t size); /*The following definitions come from libsmb/clientgen.c */ @@ -1715,8 +1715,8 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int /*The following definitions come from smbd/fileio.c */ 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); +ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n); +ssize_t write_file(files_struct *fsp,char *data,size_t n); void sync_file(connection_struct *conn, files_struct *fsp); /*The following definitions come from smbd/filename.c */ @@ -1846,7 +1846,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,SMB_OFF_T offset,char *buf,char **ptr,int num); +ssize_t read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,size_t num); void do_read_prediction(void); void invalidate_read_prediction(int fd); diff --git a/source3/include/smb.h b/source3/include/smb.h index dae3e275d5..3e68f1c4ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -458,7 +458,7 @@ typedef struct /* Structure used when SMBwritebmpx is active */ typedef struct { - int wr_total_written; /* So we know when to discard this */ + size_t wr_total_written; /* So we know when to discard this */ int32 wr_timeout; int32 wr_errclass; int32 wr_error; /* Cached errors */ @@ -1413,6 +1413,10 @@ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; #define SMB_LPID_OFFSET(indx) (10 * (indx)) #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) /* Macro to cache an error in a write_bmpx_struct */ #define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \ diff --git a/source3/lib/util.c b/source3/lib/util.c index 56d2aec9cb..668857f004 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1787,9 +1787,9 @@ static int set_blocking(int fd, BOOL set) /**************************************************************************** write to a socket ****************************************************************************/ -int write_socket(int fd,char *buf,int len) +ssize_t write_socket(int fd,char *buf,size_t len) { - int ret=0; + ssize_t ret=0; if (passive) return(len); @@ -1807,16 +1807,16 @@ int write_socket(int fd,char *buf,int len) /**************************************************************************** read from a socket ****************************************************************************/ -int read_udp_socket(int fd,char *buf,int len) +ssize_t read_udp_socket(int fd,char *buf,size_t len) { - int ret; + ssize_t ret; struct sockaddr_in sock; int socklen; socklen = sizeof(sock); bzero((char *)&sock,socklen); bzero((char *)&lastip,sizeof(lastip)); - ret = recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen); + ret = (ssize_t)recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen); if (ret <= 0) { DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno))); return(0); @@ -1835,13 +1835,15 @@ int read_udp_socket(int fd,char *buf,int len) read data from a device with a timout in msec. mincount = if timeout, minimum to read before returning maxcount = number to be read. +time_out = timeout in milliseconds ****************************************************************************/ -int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out) + +ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out) { fd_set fds; int selrtn; - int readret; - int nread = 0; + ssize_t readret; + size_t nread = 0; struct timeval timeout; /* just checking .... */ @@ -1865,48 +1867,48 @@ int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out) #endif /* WITH_SSL */ if (readret == 0) { - smb_read_error = READ_EOF; - return -1; + smb_read_error = READ_EOF; + return -1; } if (readret == -1) { - smb_read_error = READ_ERROR; - return -1; + smb_read_error = READ_ERROR; + return -1; } nread += readret; } - return(nread); + return((ssize_t)nread); } /* Most difficult - timeout read */ /* If this is ever called on a disk file and - mincnt is greater then the filesize then - system performance will suffer severely as - select always return true on disk files */ + mincnt is greater then the filesize then + system performance will suffer severely as + select always returns true on disk files */ /* Set initial timeout */ timeout.tv_sec = time_out / 1000; timeout.tv_usec = 1000 * (time_out % 1000); - for (nread=0; nread<mincnt; ) - { - FD_ZERO(&fds); - FD_SET(fd,&fds); + for (nread=0; nread < mincnt; ) + { + FD_ZERO(&fds); + FD_SET(fd,&fds); - selrtn = sys_select(fd+1,&fds,&timeout); + selrtn = sys_select(fd+1,&fds,&timeout); - /* Check if error */ - if(selrtn == -1) { - /* something is wrong. Maybe the socket is dead? */ - smb_read_error = READ_ERROR; - return -1; - } + /* Check if error */ + if(selrtn == -1) { + /* something is wrong. Maybe the socket is dead? */ + smb_read_error = READ_ERROR; + return -1; + } - /* Did we timeout ? */ - if (selrtn == 0) { - smb_read_error = READ_TIMEOUT; - return -1; - } + /* Did we timeout ? */ + if (selrtn == 0) { + smb_read_error = READ_TIMEOUT; + return -1; + } #ifdef WITH_SSL if(fd == sslFd){ @@ -1918,23 +1920,23 @@ int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out) readret = read(fd, buf+nread, maxcnt-nread); #endif /* WITH_SSL */ - if (readret == 0) { - /* we got EOF on the file descriptor */ - smb_read_error = READ_EOF; - return -1; - } + if (readret == 0) { + /* we got EOF on the file descriptor */ + smb_read_error = READ_EOF; + return -1; + } - if (readret == -1) { - /* the descriptor is probably dead */ - smb_read_error = READ_ERROR; - return -1; - } - - nread += readret; + if (readret == -1) { + /* the descriptor is probably dead */ + smb_read_error = READ_ERROR; + return -1; } + + nread += readret; + } /* Return the number we got */ - return(nread); + return((ssize_t)nread); } /******************************************************************* @@ -1965,10 +1967,10 @@ BOOL send_keepalive(int client) /**************************************************************************** read data from the client, reading exactly N bytes. ****************************************************************************/ -int read_data(int fd,char *buffer,int N) +ssize_t read_data(int fd,char *buffer,size_t N) { - int ret; - int total=0; + ssize_t ret; + size_t total=0; smb_read_error = 0; @@ -1996,17 +1998,17 @@ int read_data(int fd,char *buffer,int N) } total += ret; } - return total; + return (ssize_t)total; } /**************************************************************************** write data to a fd ****************************************************************************/ -int write_data(int fd,char *buffer,int N) +ssize_t write_data(int fd,char *buffer,size_t N) { - int total=0; - int ret; + size_t total=0; + ssize_t ret; while (total < N) { @@ -2025,7 +2027,7 @@ int write_data(int fd,char *buffer,int N) total += ret; } - return total; + return (ssize_t)total; } @@ -2111,28 +2113,30 @@ read 4 bytes of a smb packet and return the smb length of the packet store the result in the buffer This version of the function will return a length of zero on receiving a keepalive packet. +timeout is in milliseconds. ****************************************************************************/ -static int read_smb_length_return_keepalive(int fd,char *inbuf,int timeout) +static ssize_t read_smb_length_return_keepalive(int fd,char *inbuf,unsigned int timeout) { - int len=0, msg_type; - BOOL ok=False; + ssize_t len=0; + int msg_type; + BOOL ok = False; while (!ok) - { - if (timeout > 0) - ok = (read_with_timeout(fd,inbuf,4,4,timeout) == 4); - else - ok = (read_data(fd,inbuf,4) == 4); + { + if (timeout > 0) + ok = (read_with_timeout(fd,inbuf,4,4,timeout) == 4); + else + ok = (read_data(fd,inbuf,4) == 4); - if (!ok) - return(-1); + if (!ok) + return(-1); - len = smb_len(inbuf); - msg_type = CVAL(inbuf,0); + len = smb_len(inbuf); + msg_type = CVAL(inbuf,0); - if (msg_type == 0x85) - DEBUG(5,("Got keepalive packet\n")); - } + if (msg_type == 0x85) + DEBUG(5,("Got keepalive packet\n")); + } DEBUG(10,("got smb length of %d\n",len)); @@ -2143,10 +2147,11 @@ static int read_smb_length_return_keepalive(int fd,char *inbuf,int timeout) read 4 bytes of a smb packet and return the smb length of the packet store the result in the buffer. This version of the function will never return a session keepalive (length of zero). +timeout is in milliseconds. ****************************************************************************/ -int read_smb_length(int fd,char *inbuf,int timeout) +ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout) { - int len; + ssize_t len; for(;;) { @@ -2166,14 +2171,13 @@ int read_smb_length(int fd,char *inbuf,int timeout) /**************************************************************************** read an smb from a fd. Note that the buffer *MUST* be of size BUFFER_SIZE+SAFETY_MARGIN. - The timeout is in milli seconds. - + The timeout is in milliseconds. This function will return on a receipt of a session keepalive packet. ****************************************************************************/ -BOOL receive_smb(int fd,char *buffer, int timeout) +BOOL receive_smb(int fd,char *buffer, unsigned int timeout) { - int len,ret; + ssize_t len,ret; smb_read_error = 0; @@ -2202,7 +2206,7 @@ BOOL receive_smb(int fd,char *buffer, int timeout) /**************************************************************************** read an smb from a fd ignoring all keepalive packets. Note that the buffer *MUST* be of size BUFFER_SIZE+SAFETY_MARGIN. - The timeout is in milli seconds + The timeout is in milliseconds This is exactly the same as receive_smb except that it never returns a session keepalive packet (just as receive_smb used to do). @@ -2210,7 +2214,7 @@ BOOL receive_smb(int fd,char *buffer, int timeout) should never go into a blocking read. ****************************************************************************/ -BOOL client_receive_smb(int fd,char *buffer, int timeout) +BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout) { BOOL ret; @@ -2230,9 +2234,9 @@ BOOL client_receive_smb(int fd,char *buffer, int timeout) /**************************************************************************** read a message from a udp fd. -The timeout is in milli seconds +The timeout is in milliseconds ****************************************************************************/ -BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout) +BOOL receive_local_message(int fd, char *buffer, int buffer_len, unsigned int timeout) { struct sockaddr_in from; int fromlen = sizeof(from); @@ -2451,22 +2455,22 @@ BOOL receive_message_or_smb(int smbfd, int oplock_fd, ****************************************************************************/ BOOL send_smb(int fd,char *buffer) { - int len; - int ret,nwritten=0; + size_t len; + size_t nwritten=0; + ssize_t ret; len = smb_len(buffer) + 4; while (nwritten < len) + { + ret = write_socket(fd,buffer+nwritten,len - nwritten); + if (ret <= 0) { - ret = write_socket(fd,buffer+nwritten,len - nwritten); - if (ret <= 0) - { - DEBUG(0,("Error writing %d bytes to client. %d. Exiting\n",len,ret)); - close_sockets(); - exit(1); - } - nwritten += ret; + DEBUG(0,("Error writing %d bytes to client. %d. Exiting\n",len,ret)); + close_sockets(); + exit(1); } - + nwritten += ret; + } return True; } @@ -2509,7 +2513,7 @@ int name_extract(char *buf,int ofs,char *name) return the total storage length of a mangled name ****************************************************************************/ int name_len( char *s ) - { +{ int len; /* If the two high bits of the byte are set, return 2. */ @@ -2523,7 +2527,7 @@ int name_len( char *s ) } return( len ); - } /* name_len */ +} /* name_len */ /**************************************************************************** send a single packet to a port on another machine @@ -2601,16 +2605,15 @@ BOOL in_list(char *s,char *list,BOOL casesensitive) if (!list) return(False); - while (next_token(&p,tok,LIST_SEP,sizeof(tok))) - { - if (casesensitive) { - if (strcmp(tok,s) == 0) - return(True); - } else { - if (StrCaseCmp(tok,s) == 0) - return(True); - } + while (next_token(&p,tok,LIST_SEP,sizeof(tok))) { + if (casesensitive) { + if (strcmp(tok,s) == 0) + return(True); + } else { + if (StrCaseCmp(tok,s) == 0) + return(True); } + } return(False); } @@ -3312,7 +3315,7 @@ static char *filename_dos(char *path,char *buf) /**************************************************************************** expand a pointer to be a particular size ****************************************************************************/ -void *Realloc(void *p,int size) +void *Realloc(void *p,size_t size) { void *ret=NULL; @@ -4996,7 +4999,7 @@ int str_checksum(char *s) /***************************************************************** zero a memory area then free it. Used to catch bugs faster *****************************************************************/ -void zero_free(void *p, int size) +void zero_free(void *p, size_t size) { memset(p, 0, size); free(p); diff --git a/source3/locking/locking_shm.c b/source3/locking/locking_shm.c index b18b5efb2c..2e7d29f745 100644 --- a/source3/locking/locking_shm.c +++ b/source3/locking/locking_shm.c @@ -139,25 +139,15 @@ static int shm_get_share_modes(connection_struct *conn, if(!found) { -#ifdef LARGE_SMB_INO_T DEBUG(5,("get_share_modes no entry for file dev = %x ino = %.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("get_share_modes no entry for file dev = %x ino = %lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return (0); } if(file_scanner_p->locking_version != LOCKING_VERSION) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: get_share_modes Deleting old share mode v1 %d dev=%x ino=%.0f\n", file_scanner_p->locking_version, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: get_share_modes Deleting old share mode v1 %d dev=%x ino=%lx\n", - file_scanner_p->locking_version, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ if(file_prev_p == file_scanner_p) mode_array[hash_entry] = file_scanner_p->next_offset; @@ -214,13 +204,8 @@ static int shm_get_share_modes(connection_struct *conn, /* PARANOIA TEST */ if(file_scanner_p->num_share_mode_entries < 0) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("PANIC ERROR: get_share_mode: entries=%d dev=%x ino=%.0f\n", file_scanner_p->num_share_mode_entries, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("PANIC ERROR: get_share_mode: entries=%d dev=%x ino=%lx\n", - file_scanner_p->num_share_mode_entries, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return 0; } @@ -251,13 +236,9 @@ static int shm_get_share_modes(connection_struct *conn, /* If no valid share mode entries were found then this record shouldn't exist ! */ if(num_entries_copied == 0) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("get_share_modes: file with dev %x inode %.0f empty\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("get_share_modes: file with dev %x inode %lx empty\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ + if(*old_shares) free((char *)*old_shares); *old_shares = 0; @@ -269,13 +250,8 @@ static int shm_get_share_modes(connection_struct *conn, shmops->shm_free(shmops->addr2offset(file_scanner_p)); } -#ifdef LARGE_SMB_INO_T DEBUG(5,("get_share_modes: file with dev %x inode %.0f -> %d entries\n", (unsigned int)dev, (double)inode, num_entries_copied)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("get_share_modes: file with dev %x inode %lx -> %d entries\n", - (unsigned int)dev, (unsigned long)inode, num_entries_copied)); -#endif /* LARGE_SMB_INO_T */ return(num_entries_copied); } @@ -330,25 +306,15 @@ static void shm_del_share_mode(int token, files_struct *fsp) if(!found) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: del_share_mode no entry for dev %x inode %.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: del_share_mode no entry for dev %x inode %lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return; } if(file_scanner_p->locking_version != LOCKING_VERSION) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: del_share_modes Deleting old share mode v1 %d dev=%x ino=%.0f\n", file_scanner_p->locking_version, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: del_share_modes Deleting old share mode v1 %d dev=%x ino=%lx\n", - file_scanner_p->locking_version, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ if(file_prev_p == file_scanner_p) mode_array[hash_entry] = file_scanner_p->next_offset; @@ -384,13 +350,8 @@ static void shm_del_share_mode(int token, files_struct *fsp) /* Decrement the number of entries in the record. */ file_scanner_p->num_share_mode_entries -= 1; -#ifdef LARGE_SMB_INO_T DEBUG(2,("del_share_modes Deleting share mode entry dev=%x ino=%.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(2,("del_share_modes Deleting share mode entry dev=%x ino=%lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ if(entry_prev_p == entry_scanner_p) /* We are at start of list */ @@ -410,13 +371,8 @@ static void shm_del_share_mode(int token, files_struct *fsp) /* If we deleted the last share mode entry then remove the share mode record. */ if(file_scanner_p->num_share_mode_entries == 0) { -#ifdef LARGE_SMB_INO_T DEBUG(2,("del_share_modes num entries = 0, deleting share_mode dev=%x ino=%.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(2,("del_share_modes num entries = 0, deleting share_mode dev=%x ino=%lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ if(file_prev_p == file_scanner_p) mode_array[hash_entry] = file_scanner_p->next_offset; @@ -427,13 +383,8 @@ static void shm_del_share_mode(int token, files_struct *fsp) } else { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: del_share_modes No share mode dev=%x ino=%.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: del_share_modes No share mode dev=%x ino=%lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ } } @@ -501,13 +452,8 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16 file_scanner_p = new_mode_p; -#ifdef LARGE_SMB_INO_T DEBUG(3,("set_share_mode: Created share record for %s (dev %x inode %.0f)\n", fsp->fsp_name, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(3,("set_share_mode: Created share record for %s (dev %x inode %lx)\n", - fsp->fsp_name, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ } /* Now create the share mode entry */ @@ -601,25 +547,15 @@ static BOOL shm_remove_share_oplock(files_struct *fsp, int token) if(!found) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR:remove_share_oplock: no entry found for dev=%x ino=%.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR:remove_share_oplock: no entry found for dev=%x ino=%lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return False; } if(file_scanner_p->locking_version != LOCKING_VERSION) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: remove_share_oplock: Deleting old share mode v1=%d dev=%x ino=%.0f\n", file_scanner_p->locking_version, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: remove_share_oplock: Deleting old share mode v1=%d dev=%x ino=%lx\n", - file_scanner_p->locking_version, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ if(file_prev_p == file_scanner_p) mode_array[hash_entry] = file_scanner_p->next_offset; @@ -656,13 +592,8 @@ static BOOL shm_remove_share_oplock(files_struct *fsp, int token) if(!found) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("ERROR: remove_share_oplock: No oplock granted. dev=%x ino=%.0f\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("ERROR: remove_share_oplock: No oplock granted. dev=%x ino=%lx\n", - (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return False; } diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk index 2e43e88644..87c23915b0 100644 --- a/source3/script/mkproto.awk +++ b/source3/script/mkproto.awk @@ -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|^SMB_OFF_T/ { +!/^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|^size_t|^ssize_t/ { next; } diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 2241b7aa8d..051e276ca7 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -195,11 +195,13 @@ static void reply_lockingX_error(blocking_lock_record *blr, int eclass, int32 ec files_struct *fsp = blr->fsp; connection_struct *conn = conn_find(SVAL(inbuf,smb_tid)); uint16 num_ulocks = SVAL(inbuf,smb_vwv6); - uint32 count, offset; + SMB_OFF_T count, offset; + unsigned char locktype = CVAL(inbuf,smb_vwv3); + BOOL large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES); char *data; int i; - data = smb_buf(inbuf) + 10*num_ulocks; + data = smb_buf(inbuf) + ((large_file_format ? 20 : 10)*num_ulocks); /* * Data now points at the beginning of the list @@ -209,8 +211,18 @@ static void reply_lockingX_error(blocking_lock_record *blr, int eclass, int32 ec for(i = blr->lock_num; i >= 0; i--) { int dummy1; uint32 dummy2; - count = IVAL(data,SMB_LKLEN_OFFSET(i)); - offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + if(!large_file_format) { + count = IVAL(data,SMB_LKLEN_OFFSET(i)); + offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + } +#ifdef LARGE_SMB_OFF_T + else { + count = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(i))); + offset = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(i))); + } +#endif do_unlock(fsp,conn,count,offset,&dummy1,&dummy2); } @@ -248,10 +260,11 @@ static BOOL process_lockread(blocking_lock_record *blr) { char *outbuf = OutBuffer; char *inbuf = blr->inbuf; - int nread = -1; + ssize_t nread = -1; char *data; int outsize = 0; - uint32 startpos, numtoread; + SMB_OFF_T startpos; + size_t numtoread; int eclass; uint32 ecode; connection_struct *conn = conn_find(SVAL(inbuf,smb_tid)); @@ -316,7 +329,7 @@ static BOOL process_lock(blocking_lock_record *blr) char *outbuf = OutBuffer; char *inbuf = blr->inbuf; int outsize; - uint32 count,offset; + SMB_OFF_T count,offset; int eclass; uint32 ecode; connection_struct *conn = conn_find(SVAL(inbuf,smb_tid)); @@ -352,8 +365,8 @@ static BOOL process_lock(blocking_lock_record *blr) * Success - we got the lock. */ - DEBUG(3,("process_lock : file=%s fnum=%d ofs=%d cnt=%d\n", - fsp->fsp_name, fsp->fnum, (int)offset, (int)count)); + DEBUG(3,("process_lock : file=%s fnum=%d offset=%.0f count=%.0f\n", + fsp->fsp_name, fsp->fnum, (double)offset, (double)count)); construct_reply_common(inbuf, outbuf); outsize = set_message(outbuf,0,0,True); @@ -374,12 +387,13 @@ static BOOL process_lockingX(blocking_lock_record *blr) connection_struct *conn = conn_find(SVAL(inbuf,smb_tid)); uint16 num_ulocks = SVAL(inbuf,smb_vwv6); uint16 num_locks = SVAL(inbuf,smb_vwv7); - uint32 count, offset; + SMB_OFF_T count, offset; + BOOL large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES); char *data; int eclass=0; uint32 ecode=0; - data = smb_buf(inbuf) + 10*num_ulocks; + data = smb_buf(inbuf) + ((large_file_format ? 20 : 10)*num_ulocks); /* * Data now points at the beginning of the list @@ -387,8 +401,18 @@ static BOOL process_lockingX(blocking_lock_record *blr) */ for(; blr->lock_num < num_locks; blr->lock_num++) { - count = IVAL(data,SMB_LKLEN_OFFSET(blr->lock_num)); - offset = IVAL(data,SMB_LKOFF_OFFSET(blr->lock_num)); + if(!large_file_format) { + count = IVAL(data,SMB_LKLEN_OFFSET(blr->lock_num)); + offset = IVAL(data,SMB_LKOFF_OFFSET(blr->lock_num)); + } +#ifdef LARGE_SMB_OFF_T + else { + count = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(blr->lock_num))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(blr->lock_num))); + offset = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(blr->lock_num))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(blr->lock_num))); + } +#endif errno = 0; if(!do_lock(fsp,conn,count,offset, ((locktype & 1) ? F_RDLCK : F_WRLCK), &eclass, &ecode)) diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 6d6edf9d37..f0bb5e45ac 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -27,6 +27,7 @@ extern int DEBUGLEVEL; /**************************************************************************** seek a file. Try to avoid the seek if possible ****************************************************************************/ + SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) { SMB_OFF_T offset = 0; @@ -41,45 +42,43 @@ SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos) /**************************************************************************** read from a file ****************************************************************************/ -int read_file(files_struct *fsp,char *data,uint32 pos,int n) + +ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) { - int ret=0,readret; + ssize_t ret=0,readret; #if USE_READ_PREDICTION - if (!fsp->can_write) - { - ret = read_predict(fsp->fd_ptr->fd,pos,data,NULL,n); + if (!fsp->can_write) { + ret = read_predict(fsp->fd_ptr->fd,pos,data,NULL,n); - data += ret; - n -= ret; - pos += ret; - } + data += ret; + n -= ret; + pos += ret; + } #endif #if WITH_MMAP - if (fsp->mmap_ptr) - { - int num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1; - num = MIN(n,num); - if (num > 0) - { - memcpy(data,fsp->mmap_ptr+pos,num); - data += num; - pos += num; - n -= num; - ret += num; - } + if (fsp->mmap_ptr) { + SMB_OFF_T num = (fsp->mmap_size > pos) ? (fsp->mmap_size - pos) : -1; + num = MIN(n,num); +#ifdef LARGE_SMB_OFF_T + if ((num > 0) && (num < (1<<(sizeof(size_t)*8))) { +#else /* LARGE_SMB_OFF_T */ + if (num > 0) { +#endif /* LARGE_SMB_OFF_T */ + memcpy(data,fsp->mmap_ptr+pos,num); + data += num; + pos += num; + n -= num; + ret += num; } + } #endif - if (n <= 0) + if (seek_file(fsp,pos) != pos) { + DEBUG(3,("Failed to seek to %.0f\n",(double)pos)); return(ret); - - if (seek_file(fsp,pos) != pos) - { - DEBUG(3,("Failed to seek to %d\n",pos)); - return(ret); - } + } if (n > 0) { readret = read(fsp->fd_ptr->fd,data,n); @@ -93,7 +92,8 @@ int read_file(files_struct *fsp,char *data,uint32 pos,int n) /**************************************************************************** write to a file ****************************************************************************/ -int write_file(files_struct *fsp,char *data,int n) + +ssize_t write_file(files_struct *fsp,char *data,size_t n) { if (!fsp->can_write) { @@ -119,6 +119,7 @@ int write_file(files_struct *fsp,char *data,int n) /******************************************************************* sync a file ********************************************************************/ + void sync_file(connection_struct *conn, files_struct *fsp) { #ifdef HAVE_FSYNC @@ -126,4 +127,3 @@ void sync_file(connection_struct *conn, files_struct *fsp) fsync(fsp->fd_ptr->fd); #endif } - diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 0f50145d7f..81b3ff26d5 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -890,12 +890,12 @@ static int call_nt_transact_create(connection_struct *conn, p += 8; SIVAL(p,0,fmode); /* File Attributes. */ p += 12; -#if OFF_T_IS_64_BITS - SIVAL(p,0, file_len & 0xFFFFFFFF); - SIVAL(p,4, (file_len >> 32)); -#else /* OFF_T_IS_64_BITS */ - SIVAL(p,0,file_len); -#endif /* OFF_T_IS_64_BITS */ +#ifdef LARGE_SMB_OFF_T + SIVAL(p,0, file_len & 0xFFFFFFFF); + SIVAL(p,4, (file_len >> 32)); +#else /* LARGE_SMB_OFF_T */ + SIVAL(p,0,file_len); +#endif /* LARGE_SMB_OFF_T */ } /* Send the required number of replies */ diff --git a/source3/smbd/open.c b/source3/smbd/open.c index bd1ead6921..bdd4816aa7 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -815,13 +815,8 @@ void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int if(share_entry->op_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) { -#ifdef LARGE_SMB_INO_T DEBUG(5,("open_file_shared: breaking oplock (%x) on file %s, \ dev = %x, inode = %.0f\n", share_entry->op_type, fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("open_file_shared: breaking oplock (%x) on file %s, \ -dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ /* Oplock break.... */ unlock_share_entry(conn, dev, inode, token); @@ -829,13 +824,8 @@ dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsig { free((char *)old_shares); -#ifdef LARGE_SMB_INO_T DEBUG(0,("open_file_shared: FAILED when breaking oplock (%x) on file %s, \ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("open_file_shared: FAILED when breaking oplock (%x) on file %s, \ -dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ errno = EACCES; unix_ERR_class = ERRDOS; @@ -940,13 +930,8 @@ dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsi global_oplocks_open++; port = oplock_port; -#ifdef LARGE_SMB_INO_T DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \ dev = %x, inode = %.0f\n", oplock_request, fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("open_file_shared: granted oplock (%x) on file %s, \ -dev = %x, inode = %lx\n", oplock_request, fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ } else @@ -1114,13 +1099,8 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op) if(rename_op && (share_entry->pid == pid)) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("check_file_sharing: NT redirector workaround - rename attempted on \ batch oplocked file %s, dev = %x, inode = %.0f\n", fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("check_file_sharing: NT redirector workaround - rename attempted on \ -batch oplocked file %s, dev = %x, inode = %lx\n", fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ /* * This next line is a test that allows the deny-mode @@ -1135,13 +1115,8 @@ batch oplocked file %s, dev = %x, inode = %lx\n", fname, (unsigned int)dev, (uns else { -#ifdef LARGE_SMB_INO_T DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \ dev = %x, inode = %.0f\n", share_entry->op_type, fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("check_file_sharing: breaking oplock (%x) on file %s, \ -dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ /* Oplock break.... */ unlock_share_entry(conn, dev, inode, token); @@ -1149,13 +1124,8 @@ dev = %x, inode = %lx\n", share_entry->op_type, fname, (unsigned int)dev, (unsig { free((char *)old_shares); -#ifdef LARGE_SMB_INO_T DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("check_file_sharing: FAILED when breaking oplock (%x) on file %s, \ -dev = %x, inode = %lx\n", old_shares[i].op_type, fname, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ return False; } diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index dd882d08cc..348e29dbe2 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -124,13 +124,8 @@ should be %d).\n", msg_len, OPLOCK_BREAK_MSG_LEN)); tval.tv_sec = IVAL(msg_start, OPLOCK_BREAK_SEC_OFFSET); tval.tv_usec = IVAL(msg_start, OPLOCK_BREAK_USEC_OFFSET); -#ifdef LARGE_SMB_INO_T DEBUG(5,("process_local_message: oplock break request from \ pid %d, port %d, dev = %x, inode = %.0f\n", remotepid, from_port, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("process_local_message: oplock break request from \ -pid %d, port %d, dev = %x, inode = %lx\n", remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ /* * If we have no record of any currently open oplocks, @@ -170,15 +165,9 @@ oplocks. Returning success.\n")); return False; } -#ifdef LARGE_SMB_INO_T DEBUG(5,("process_local_message: oplock break reply sent to \ pid %d, port %d, for file dev = %x, inode = %.0f\n", remotepid, from_port, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(5,("process_local_message: oplock break reply sent to \ -pid %d, port %d, for file dev = %x, inode = %lx\n", - remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ } break; @@ -210,13 +199,8 @@ reply - dumping info.\n")); SMB_INO_T inode = IVAL(msg_start, OPLOCK_BREAK_INODE_OFFSET); #endif /* LARGE_SMB_INO_T */ -#ifdef LARGE_SMB_INO_T DEBUG(0,("process_local_message: unsolicited oplock break reply from \ pid %d, port %d, dev = %x, inode = %.0f\n", remotepid, from_port, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("process_local_message: unsolicited oplock break reply from \ -pid %d, port %d, dev = %x, inode = %lx\n", remotepid, from_port, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ } return False; @@ -247,11 +231,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 3 ) ) { -#ifdef LARGE_SMB_INO_T dbgtext( "oplock_break: called for dev = %x, inode = %.0f.\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "oplock_break: called for dev = %x, inode = %lx.\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open ); } @@ -266,11 +246,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 0 ) ) { dbgtext( "oplock_break: cannot find open file with " ); -#ifdef LARGE_SMB_INO_T dbgtext( "dev = %x, inode = %.0f ", (unsigned int)dev, (double)inode); -#else /* LARGE_SMB_INO_T */ - dbgtext( "dev = %x, inode = %lx ", (unsigned int)dev, (unsigned long)inode); -#endif /* LARGE_SMB_INO_T */ dbgtext( "allowing break to succeed.\n" ); } return True; @@ -290,11 +266,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 0 ) ) { dbgtext( "oplock_break: file %s ", fsp->fsp_name ); -#ifdef LARGE_SMB_INO_T dbgtext( "(dev = %x, inode = %.0f) has no oplock.\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "(dev = %x, inode = %lx) has no oplock.\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ dbgtext( "Allowing break to succeed regardless.\n" ); } return True; @@ -307,11 +279,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) { dbgtext( "oplock_break: ERROR: oplock_break already sent for " ); dbgtext( "file %s ", fsp->fsp_name); -#ifdef LARGE_SMB_INO_T dbgtext( "(dev = %x, inode = %.0f)\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "(dev = %x, inode = %lx)\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ } /* We have to fail the open here as we cannot send another oplock break on @@ -403,11 +371,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) OPLOCK_BREAK_TIMEOUT ) ); DEBUGADD( 0, ( "oplock_break failed for file %s ", fsp->fsp_name ) ); -#ifdef LARGE_SMB_INO_T DEBUGADD( 0, ( "(dev = %x, inode = %.0f).\n", (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUGADD( 0, ( "(dev = %x, inode = %lx).\n", (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ shutdown_server = True; break; @@ -435,11 +399,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) dbgtext( "oplock_break: no break received from client " ); dbgtext( "within %d seconds.\n", OPLOCK_BREAK_TIMEOUT ); dbgtext( "oplock_break failed for file %s ", fsp->fsp_name ); -#ifdef LARGE_SMB_INO_T dbgtext( "(dev = %x, inode = %.0f).\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "(dev = %x, inode = %lx).\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ } shutdown_server = True; @@ -507,11 +467,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval) if( DEBUGLVL( 3 ) ) { dbgtext( "oplock_break: returning success for " ); -#ifdef LARGE_SMB_INO_T dbgtext( "dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ dbgtext( "Current global_oplocks_open = %d\n", global_oplocks_open ); } @@ -576,11 +532,7 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); { dbgtext( "request_oplock_break: sending a oplock break message to " ); dbgtext( "pid %d on port %d ", share_entry->pid, share_entry->op_port ); -#ifdef LARGE_SMB_INO_T dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ } @@ -592,11 +544,7 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: failed when sending a oplock " ); dbgtext( "break message to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); -#ifdef LARGE_SMB_INO_T dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ dbgtext( "Error was %s\n", strerror(errno) ); } return False; @@ -629,11 +577,7 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: no response received to oplock " ); dbgtext( "break request to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); -#ifdef LARGE_SMB_INO_T dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ } /* @@ -651,11 +595,7 @@ should be %d\n", pid, share_entry->op_port, oplock_port)); dbgtext( "request_oplock_break: error in response received " ); dbgtext( "to oplock break request to pid %d ", share_entry->pid ); dbgtext( "on port %d ", share_entry->op_port ); -#ifdef LARGE_SMB_INO_T dbgtext( "for dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ); -#else /* LARGE_SMB_INO_T */ - dbgtext( "for dev = %x, inode = %lx\n", (unsigned int)dev, (unsigned long)inode ); -#endif /* LARGE_SMB_INO_T */ dbgtext( "Error was (%s).\n", strerror(errno) ); } return False; diff --git a/source3/smbd/predict.c b/source3/smbd/predict.c index 0deda0c0b6..5f015139cf 100644 --- a/source3/smbd/predict.c +++ b/source3/smbd/predict.c @@ -28,11 +28,11 @@ extern int DEBUGLEVEL; /* variables used by the read prediction module */ static int rp_fd = -1; static SMB_OFF_T rp_offset = 0; -static int rp_length = 0; -static int rp_alloced = 0; +static ssize_t rp_length = 0; +static ssize_t rp_alloced = 0; static int rp_predict_fd = -1; static SMB_OFF_T rp_predict_offset = 0; -static int rp_predict_length = 0; +static size_t rp_predict_length = 0; static int rp_timeout = 5; static time_t rp_time = 0; static char *rp_buffer = NULL; @@ -42,10 +42,10 @@ extern time_t smb_last_time; /**************************************************************************** handle read prediction on a file ****************************************************************************/ -int read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,int num) +ssize_t read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,size_t num) { - int ret = 0; - int possible = rp_length - (offset - rp_offset); + ssize_t ret = 0; + ssize_t possible = rp_length - (offset - rp_offset); possible = MIN(possible,num); @@ -97,7 +97,7 @@ pre-read some data ****************************************************************************/ void do_read_prediction(void) { - static int readsize = 0; + static size_t readsize = 0; if (predict_skip) return; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 3d537d8868..8ec2715d0d 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1765,11 +1765,11 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size ****************************************************************************/ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_size, int dum_buffsize) { - int maxcount,mincount; - int nread = 0; - uint32 startpos; + size_t maxcount,mincount; + size_t nread = 0; + SMB_OFF_T startpos; char *header = outbuf; - SMB_OFF_T ret=0; + ssize_t ret=0; int fd; char *fname; files_struct *fsp; @@ -1791,8 +1791,23 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s fsp = file_fsp(inbuf,smb_vwv0); startpos = IVAL(inbuf,smb_vwv1); - maxcount = SVAL(inbuf,smb_vwv3); - mincount = SVAL(inbuf,smb_vwv4); +#ifdef LARGE_SMB_OFF_T + if(SVAL(inbuf,smb_wct) == 10) { + /* + * This is a large offset (64 bit) read. + */ + startpos |= (((SMB_OFF_T)IVAL(inbuf,smb_vwv8)) << 32); + if(startpos < 0) { + DEBUG(0,("readbraw - negative 64 bit readraw offset (%.0f) !\n", + (double)startpos )); + _smb_setlen(header,0); + transfer_file(0,Client,(SMB_OFF_T)0,header,4,0); + return(-1); + } + } +#endif /* LARGE_SMB_OFF_T */ + maxcount = (SVAL(inbuf,smb_vwv3) & 0xFFFF); + mincount = (SVAL(inbuf,smb_vwv4) & 0xFFFF); /* ensure we don't overrun the packet size */ maxcount = MIN(65535,maxcount); @@ -1812,9 +1827,10 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s if (!is_locked(fsp,conn,maxcount,startpos, F_RDLCK)) { SMB_OFF_T size = fsp->size; - int sizeneeded = startpos + maxcount; + SMB_OFF_T sizeneeded = startpos + maxcount; - if (size < sizeneeded) { + if (size < sizeneeded) + { SMB_STRUCT_STAT st; if (sys_fstat(fsp->fd_ptr->fd,&st) == 0) size = st.st_size; @@ -1822,14 +1838,14 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s fsp->size = size; } - nread = MIN(maxcount,(int)(size - startpos)); + nread = MIN(maxcount,(size - startpos)); } if (nread < mincount) nread = 0; - DEBUG( 3, ( "readbraw fnum=%d start=%d max=%d min=%d nread=%d\n", - fsp->fnum, startpos, + DEBUG( 3, ( "readbraw fnum=%d start=%.0f max=%d min=%d nread=%d\n", + fsp->fnum, (double)startpos, maxcount, mincount, nread ) ); #if UNSAFE_READRAW @@ -1840,12 +1856,12 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s #if USE_READ_PREDICTION if (!fsp->can_write) predict = read_predict(fd,startpos,header+4,NULL,nread); -#endif +#endif /* USE_READ_PREDICTION */ if ((nread-predict) > 0) seek_file(fsp,startpos + predict); - ret = transfer_file(fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict, + ret = (ssize_t)transfer_file(fd,Client,(SMB_OFF_T)(nread-predict),header,4+predict, startpos+predict); } @@ -1853,13 +1869,13 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s DEBUG(0,("ERROR: file read failure on %s at %d for %d bytes (%d)\n", fname,startpos,nread,ret)); -#else +#else /* UNSAFE_READRAW */ ret = read_file(fsp,header+4,startpos,nread); if (ret < mincount) ret = 0; _smb_setlen(header,ret); transfer_file(0,Client,0,header,4+ret,0); -#endif +#endif /* UNSAFE_READRAW */ DEBUG(5,("readbraw finished\n")); return -1; @@ -1871,10 +1887,11 @@ int reply_readbraw(connection_struct *conn, char *inbuf, char *outbuf, int dum_s ****************************************************************************/ int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int length, int dum_buffsiz) { - int nread = -1; + ssize_t nread = -1; char *data; int outsize = 0; - uint32 startpos, numtoread; + SMB_OFF_T startpos; + size_t numtoread; int eclass; uint32 ecode; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -1925,10 +1942,10 @@ int reply_lockread(connection_struct *conn, char *inbuf,char *outbuf, int length ****************************************************************************/ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int numtoread; - int nread = 0; + size_t numtoread; + ssize_t nread = 0; char *data; - uint32 startpos; + SMB_OFF_T startpos; int outsize = 0; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -1971,10 +1988,10 @@ int reply_read(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize) { files_struct *fsp = file_fsp(inbuf,smb_vwv2); - uint32 smb_offs = IVAL(inbuf,smb_vwv3); - int smb_maxcnt = SVAL(inbuf,smb_vwv5); - int smb_mincnt = SVAL(inbuf,smb_vwv6); - int nread = -1; + SMB_OFF_T startpos = IVAL(inbuf,smb_vwv3); + size_t smb_maxcnt = SVAL(inbuf,smb_vwv5); + size_t smb_mincnt = SVAL(inbuf,smb_vwv6); + ssize_t nread = -1; char *data; BOOL ok = False; @@ -1989,9 +2006,18 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt set_message(outbuf,12,0,True); data = smb_buf(outbuf); - if (is_locked(fsp,conn,smb_maxcnt,smb_offs, F_RDLCK)) +#ifdef LARGE_SMB_INO_T + if(SVAL(inbuf,smb_wct) == 12) { + /* + * This is a large offset (64 bit) read. + */ + startpos |= (((SMB_OFF_T)IVAL(inbuf,smb_vwv10)) << 32); + } +#endif /* LARGE_SMB_INO_T */ + + if (is_locked(fsp,conn,smb_maxcnt,startpos, F_RDLCK)) return(ERROR(ERRDOS,ERRlock)); - nread = read_file(fsp,data,smb_offs,smb_maxcnt); + nread = read_file(fsp,data,startpos,smb_maxcnt); ok = True; if (nread < 0) @@ -2007,21 +2033,20 @@ int reply_read_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt return chain_reply(inbuf,outbuf,length,bufsize); } - /**************************************************************************** reply to a writebraw (core+ or LANMAN1.0 protocol) ****************************************************************************/ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int nwritten=0; - int total_written=0; - int numtowrite=0; - int outsize = 0; - long startpos; + ssize_t nwritten=0; + ssize_t total_written=0; + size_t numtowrite=0; + size_t tcount; + SMB_OFF_T startpos; char *data=NULL; BOOL write_through; - int tcount; files_struct *fsp = file_fsp(inbuf,smb_vwv0); + int outsize = 0; CHECK_FSP(fsp,conn); CHECK_WRITE(fsp); @@ -2049,13 +2074,13 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s return(ERROR(ERRDOS,ERRlock)); if (seek_file(fsp,startpos) != startpos) - DEBUG(0,("couldn't seek to %ld in writebraw\n",startpos)); + DEBUG(0,("couldn't seek to %.0f in writebraw\n",(double)startpos)); if (numtowrite>0) nwritten = write_file(fsp,data,numtowrite); - DEBUG(3,("writebraw1 fnum=%d start=%ld num=%d wrote=%d sync=%d\n", - fsp->fnum, startpos, numtowrite, nwritten, write_through)); + DEBUG(3,("writebraw1 fnum=%d start=%.0f num=%d wrote=%d sync=%d\n", + fsp->fnum, (double)startpos, numtowrite, nwritten, write_through)); if (nwritten < numtowrite) return(UNIXERROR(ERRHRD,ERRdiskfull)); @@ -2092,7 +2117,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s CVAL(outbuf,smb_com) = SMBwritec; SSVAL(outbuf,smb_vwv0,total_written); - if (nwritten < numtowrite) { + if (nwritten < (ssize_t)numtowrite) { CVAL(outbuf,smb_rcls) = ERRHRD; SSVAL(outbuf,smb_err,ERRdiskfull); } @@ -2100,8 +2125,8 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s if (lp_syncalways(SNUM(conn)) || write_through) sync_file(conn,fsp); - DEBUG(3,("writebraw2 fnum=%d start=%ld num=%d wrote=%d\n", - fsp->fnum, startpos, numtowrite, total_written)); + DEBUG(3,("writebraw2 fnum=%d start=%.0f num=%d wrote=%d\n", + fsp->fnum, (double)startpos, numtowrite, total_written)); /* we won't return a status if write through is not selected - this follows what WfWg does */ @@ -2111,19 +2136,19 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s return(outsize); } - /**************************************************************************** reply to a writeunlock (core+) ****************************************************************************/ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int nwritten = -1; - int outsize = 0; + ssize_t nwritten = -1; + size_t numtowrite; + SMB_OFF_T startpos; char *data; - uint32 numtowrite,startpos; int eclass; uint32 ecode; files_struct *fsp = file_fsp(inbuf,smb_vwv0); + int outsize = 0; CHECK_FSP(fsp,conn); CHECK_WRITE(fsp); @@ -2165,18 +2190,17 @@ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int dum return(outsize); } - /**************************************************************************** reply to a write ****************************************************************************/ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,int dum_buffsize) { - int numtowrite; - int nwritten = -1; - int outsize = 0; - int startpos; + size_t numtowrite; + ssize_t nwritten = -1; + SMB_OFF_T startpos; char *data; files_struct *fsp = file_fsp(inbuf,smb_vwv0); + int outsize = 0; CHECK_FSP(fsp,conn); CHECK_WRITE(fsp); @@ -2209,7 +2233,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i SSVAL(outbuf,smb_vwv0,nwritten); - if (nwritten < numtowrite) { + if (nwritten < (ssize_t)numtowrite) { CVAL(outbuf,smb_rcls) = ERRHRD; SSVAL(outbuf,smb_err,ERRdiskfull); } @@ -2227,11 +2251,11 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize) { files_struct *fsp = file_fsp(inbuf,smb_vwv2); - uint32 smb_offs = IVAL(inbuf,smb_vwv3); - int smb_dsize = SVAL(inbuf,smb_vwv10); - int smb_doff = SVAL(inbuf,smb_vwv11); + SMB_OFF_T startpos = IVAL(inbuf,smb_vwv3); + size_t numtowrite = SVAL(inbuf,smb_vwv10); BOOL write_through = BITSETW(inbuf+smb_vwv7,0); - int nwritten = -1; + ssize_t nwritten = -1; + int smb_doff = SVAL(inbuf,smb_vwv11); char *data; CHECK_FSP(fsp,conn); @@ -2240,34 +2264,43 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng data = smb_base(inbuf) + smb_doff; - if (is_locked(fsp,conn,smb_dsize,smb_offs, F_WRLCK)) +#ifdef LLARGE_SMB_INO_T + if(SVAL(inbuf,smb_wct) == 14) { + /* + * This is a large offset (64 bit) write. + */ + startpos |= (((SMB_OFF_T)IVAL(inbuf,smb_vwv12)) << 32); + } +#endif /* LARGE_SMB_INO_T */ + + if (is_locked(fsp,conn,numtowrite,startpos, F_WRLCK)) return(ERROR(ERRDOS,ERRlock)); - seek_file(fsp,smb_offs); + seek_file(fsp,startpos); /* X/Open SMB protocol says that, unlike SMBwrite if the length is zero then NO truncation is done, just a write of zero. To truncate a file, use SMBwrite. */ - if(smb_dsize == 0) + if(numtowrite == 0) nwritten = 0; else - nwritten = write_file(fsp,data,smb_dsize); + nwritten = write_file(fsp,data,numtowrite); - if(((nwritten == 0) && (smb_dsize != 0))||(nwritten < 0)) + if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) return(UNIXERROR(ERRDOS,ERRnoaccess)); set_message(outbuf,6,0,True); SSVAL(outbuf,smb_vwv2,nwritten); - if (nwritten < smb_dsize) { + if (nwritten < (ssize_t)numtowrite) { CVAL(outbuf,smb_rcls) = ERRHRD; SSVAL(outbuf,smb_err,ERRdiskfull); } DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n", - fsp->fnum, smb_dsize, nwritten)); + fsp->fnum, numtowrite, nwritten)); if (lp_syncalways(SNUM(conn)) || write_through) sync_file(conn,fsp); @@ -2281,7 +2314,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; + SMB_OFF_T startpos; SMB_OFF_T res= -1; int mode,umode; int outsize = 0; @@ -2302,19 +2335,18 @@ int reply_lseek(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, umode = SEEK_SET; break; } - res = sys_lseek(fsp->fd_ptr->fd,(SMB_OFF_T)startpos,umode); + res = sys_lseek(fsp->fd_ptr->fd,startpos,umode); fsp->pos = res; outsize = set_message(outbuf,2,0,True); - SIVALS(outbuf,smb_vwv0,(uint32)res); + SIVALS(outbuf,smb_vwv0,res); - DEBUG(3,("lseek fnum=%d ofs=%d mode=%d\n", - fsp->fnum, startpos, mode)); + DEBUG(3,("lseek fnum=%d ofs=%.0f mode=%d\n", + fsp->fnum, (double)startpos, mode)); return(outsize); } - /**************************************************************************** reply to a flush ****************************************************************************/ @@ -2421,10 +2453,10 @@ int reply_close(connection_struct *conn, int reply_writeclose(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int numtowrite; - int nwritten = -1; + size_t numtowrite; + ssize_t nwritten = -1; int outsize = 0; - int startpos; + SMB_OFF_T startpos; char *data; time_t mtime; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -2470,7 +2502,7 @@ int reply_lock(connection_struct *conn, char *inbuf,char *outbuf, int length, int dum_buffsize) { int outsize = set_message(outbuf,0,0,True); - uint32 count,offset; + SMB_OFF_T count,offset; int eclass; uint32 ecode; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -2481,8 +2513,8 @@ int reply_lock(connection_struct *conn, count = IVAL(inbuf,smb_vwv1); offset = IVAL(inbuf,smb_vwv3); - DEBUG(3,("lock fd=%d fnum=%d ofs=%d cnt=%d\n", - fsp->fd_ptr->fd, fsp->fnum, offset, count)); + DEBUG(3,("lock fd=%d fnum=%d offset=%.0f count=%.0f\n", + fsp->fd_ptr->fd, fsp->fnum, (double)offset, (double)count)); if (!do_lock(fsp, conn, count, offset, F_WRLCK, &eclass, &ecode)) { if((ecode == ERRlock) && lp_blocking_locks(SNUM(conn))) { @@ -2507,7 +2539,7 @@ int reply_lock(connection_struct *conn, int reply_unlock(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { int outsize = set_message(outbuf,0,0,True); - uint32 count,offset; + SMB_OFF_T count,offset; int eclass; uint32 ecode; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -2521,8 +2553,8 @@ int reply_unlock(connection_struct *conn, char *inbuf,char *outbuf, int dum_size if(!do_unlock(fsp, conn, count, offset, &eclass, &ecode)) return (ERROR(eclass,ecode)); - DEBUG( 3, ( "unlock fd=%d fnum=%d ofs=%d cnt=%d\n", - fsp->fd_ptr->fd, fsp->fnum, offset, count ) ); + DEBUG( 3, ( "unlock fd=%d fnum=%d offset=%.0f count=%.0f\n", + fsp->fd_ptr->fd, fsp->fnum, (double)offset, (double)count ) ); return(outsize); } @@ -3476,8 +3508,6 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, return(outsize); } - - /**************************************************************************** reply to a setdir ****************************************************************************/ @@ -3515,7 +3545,6 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size return(outsize); } - /**************************************************************************** reply to a lockingX request ****************************************************************************/ @@ -3528,13 +3557,13 @@ int reply_lockingX(connection_struct *conn, char *inbuf,char *outbuf,int length, #endif uint16 num_ulocks = SVAL(inbuf,smb_vwv6); uint16 num_locks = SVAL(inbuf,smb_vwv7); - uint32 count, offset; + SMB_OFF_T count, offset; int32 lock_timeout = IVAL(inbuf,smb_vwv4); int i; char *data; uint32 ecode=0, dummy2; int eclass=0, dummy1; - + BOOL large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES); CHECK_FSP(fsp,conn); CHECK_ERROR(fsp); @@ -3565,13 +3594,8 @@ no oplock granted on this file.\n", fsp->fnum)); lock_share_entry(fsp->conn, dev, inode, &token); if(remove_share_oplock(fsp, token)==False) { -#ifdef LARGE_SMB_INO_T DEBUG(0,("reply_lockingX: failed to remove share oplock for fnum %d, \ dev = %x, inode = %.0f\n", fsp->fnum, (unsigned int)dev, (double)inode)); -#else /* LARGE_SMB_INO_T */ - DEBUG(0,("reply_lockingX: failed to remove share oplock for fnum %d, \ -dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); -#endif /* LARGE_SMB_INO_T */ unlock_share_entry(fsp->conn, dev, inode, token); } else { @@ -3596,10 +3620,22 @@ dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); /* Data now points at the beginning of the list of smb_unlkrng structs */ for(i = 0; i < (int)num_ulocks; i++) { - count = IVAL(data,SMB_LKLEN_OFFSET(i)); - offset = IVAL(data,SMB_LKOFF_OFFSET(i)); - DEBUG(10,("reply_lockingX: unlock start=%d, len=%d for file %s\n", - (int)offset, (int)count, fsp->fsp_name )); + if(!large_file_format) { + count = IVAL(data,SMB_LKLEN_OFFSET(i)); + offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + } +#ifdef LARGE_SMB_OFF_T + else { + count = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(i))); + offset = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(i))); + } +#endif + + DEBUG(10,("reply_lockingX: unlock start=%.0f, len=%.0f for file %s\n", + (double)offset, (double)count, fsp->fsp_name )); + if(!do_unlock(fsp,conn,count,offset,&eclass, &ecode)) return ERROR(eclass,ecode); } @@ -3608,14 +3644,28 @@ dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); lock_timeout = ((lock_timeout == -1) ? -1 : lock_timeout/1000); /* Now do any requested locks */ - data += 10*num_ulocks; + data += ((large_file_format ? 20 : 10)*num_ulocks); + /* Data now points at the beginning of the list of smb_lkrng structs */ + for(i = 0; i < (int)num_locks; i++) { - count = IVAL(data,SMB_LKLEN_OFFSET(i)); - offset = IVAL(data,SMB_LKOFF_OFFSET(i)); - DEBUG(10,("reply_lockingX: lock start=%d, len=%d for file %s\n", - (int)offset, (int)count, fsp->fsp_name )); + if(!large_file_format) { + count = IVAL(data,SMB_LKLEN_OFFSET(i)); + offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + } +#ifdef LARGE_SMB_OFF_T + else { + count = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(i))); + offset = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(i))); + } +#endif + + DEBUG(10,("reply_lockingX: lock start=%.0f, len=%.0f for file %s\n", + (double)offset, (double)count, fsp->fsp_name )); + if(!do_lock(fsp,conn,count,offset, ((locktype & 1) ? F_RDLCK : F_WRLCK), &eclass, &ecode)) { if((ecode == ERRlock) && (lock_timeout != 0) && lp_blocking_locks(SNUM(conn))) { @@ -3635,8 +3685,19 @@ dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); all of the previous locks (X/Open spec). */ if(i != num_locks && num_locks != 0) { for(; i >= 0; i--) { - count = IVAL(data,SMB_LKLEN_OFFSET(i)); - offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + if(!large_file_format) { + count = IVAL(data,SMB_LKLEN_OFFSET(i)); + offset = IVAL(data,SMB_LKOFF_OFFSET(i)); + } +#ifdef LARGE_SMB_OFF_T + else { + count = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(i))); + offset = (((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(i))) << 32) | + ((SMB_OFF_T) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(i))); + } +#endif + do_unlock(fsp,conn,count,offset,&dummy1,&dummy2); } return ERROR(eclass,ecode); @@ -3656,13 +3717,14 @@ dev = %x, inode = %lx\n", fsp->fnum, (unsigned int)dev, (unsigned long)inode)); ****************************************************************************/ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize) { - int nread = -1; - int total_read; + ssize_t nread = -1; + ssize_t total_read; char *data; - uint32 startpos; - int outsize, mincount, maxcount; + SMB_OFF_T startpos; + int outsize; + size_t mincount, maxcount; int max_per_packet; - int tcount; + size_t tcount; int pad; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -3694,14 +3756,14 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length, do { - int N = MIN(max_per_packet,tcount-total_read); + size_t N = MIN(max_per_packet,tcount-total_read); nread = read_file(fsp,data,startpos,N); if (nread <= 0) nread = 0; - if (nread < N) - tcount = total_read + nread; + if (nread < (ssize_t)N) + tcount = total_read + nread; set_message(outbuf,8,nread,False); SIVAL(outbuf,smb_vwv0,startpos); @@ -3714,22 +3776,23 @@ int reply_readbmpx(connection_struct *conn, char *inbuf,char *outbuf,int length, total_read += nread; startpos += nread; } - while (total_read < tcount); + while (total_read < (ssize_t)tcount); return(-1); } - /**************************************************************************** reply to a SMBwritebmpx (write block multiplex primary) request ****************************************************************************/ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int numtowrite; - int nwritten = -1; + size_t numtowrite; + ssize_t nwritten = -1; int outsize = 0; - uint32 startpos; - int tcount, write_through, smb_doff; + SMB_OFF_T startpos; + size_t tcount; + BOOL write_through; + int smb_doff; char *data; files_struct *fsp = file_fsp(inbuf,smb_vwv0); @@ -3758,32 +3821,32 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_s if(lp_syncalways(SNUM(conn)) || write_through) sync_file(conn,fsp); - if(nwritten < numtowrite) + if(nwritten < (ssize_t)numtowrite) return(UNIXERROR(ERRHRD,ERRdiskfull)); /* If the maximum to be written to this file is greater than what we just wrote then set up a secondary struct to be attached to this fd, we will use this to cache error messages etc. */ - if(tcount > nwritten) + if((ssize_t)tcount > nwritten) + { + write_bmpx_struct *wbms; + if(fsp->wbmpx_ptr != NULL) + wbms = fsp->wbmpx_ptr; /* Use an existing struct */ + else + wbms = (write_bmpx_struct *)malloc(sizeof(write_bmpx_struct)); + if(!wbms) { - write_bmpx_struct *wbms; - if(fsp->wbmpx_ptr != NULL) - wbms = fsp->wbmpx_ptr; /* Use an existing struct */ - else - wbms = (write_bmpx_struct *)malloc(sizeof(write_bmpx_struct)); - if(!wbms) - { - DEBUG(0,("Out of memory in reply_readmpx\n")); - return(ERROR(ERRSRV,ERRnoresource)); - } - wbms->wr_mode = write_through; - wbms->wr_discard = False; /* No errors yet */ - wbms->wr_total_written = nwritten; - wbms->wr_errclass = 0; - wbms->wr_error = 0; - fsp->wbmpx_ptr = wbms; + DEBUG(0,("Out of memory in reply_readmpx\n")); + return(ERROR(ERRSRV,ERRnoresource)); } + wbms->wr_mode = write_through; + wbms->wr_discard = False; /* No errors yet */ + wbms->wr_total_written = nwritten; + wbms->wr_errclass = 0; + wbms->wr_error = 0; + fsp->wbmpx_ptr = wbms; + } /* We are returning successfully, set the message type back to SMBwritebmpx */ @@ -3816,11 +3879,13 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_s ****************************************************************************/ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - int numtowrite; - int nwritten = -1; + size_t numtowrite; + ssize_t nwritten = -1; int outsize = 0; - int32 startpos; - int tcount, write_through, smb_doff; + SMB_OFF_T startpos; + size_t tcount; + BOOL write_through; + int smb_doff; char *data; write_bmpx_struct *wbms; BOOL send_response = False; @@ -3858,32 +3923,34 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz if(lp_syncalways(SNUM(conn)) || write_through) sync_file(conn,fsp); - if (nwritten < numtowrite) + if (nwritten < (ssize_t)numtowrite) + { + if(write_through) { - if(write_through) { - /* We are returning an error - we can delete the aux struct */ - if (wbms) free((char *)wbms); - fsp->wbmpx_ptr = NULL; - return(ERROR(ERRHRD,ERRdiskfull)); - } - return(CACHE_ERROR(wbms,ERRHRD,ERRdiskfull)); + /* We are returning an error - we can delete the aux struct */ + if (wbms) free((char *)wbms); + fsp->wbmpx_ptr = NULL; + return(ERROR(ERRHRD,ERRdiskfull)); } + return(CACHE_ERROR(wbms,ERRHRD,ERRdiskfull)); + } /* Increment the total written, if this matches tcount we can discard the auxiliary struct (hurrah !) and return a writeC */ wbms->wr_total_written += nwritten; if(wbms->wr_total_written >= tcount) + { + if (write_through) { - if (write_through) { - outsize = set_message(outbuf,1,0,True); - SSVAL(outbuf,smb_vwv0,wbms->wr_total_written); - send_response = True; - } - - free((char *)wbms); - fsp->wbmpx_ptr = NULL; + outsize = set_message(outbuf,1,0,True); + SSVAL(outbuf,smb_vwv0,wbms->wr_total_written); + send_response = True; } + free((char *)wbms); + fsp->wbmpx_ptr = NULL; + } + if(send_response) return(outsize); |