The branch, v3-6-test has been updated
       via  5f21737 s3: Fix Coverity ID 2478, UNINIT
       via  7031fae s3:rpc_client: map fault codes to NTSTATUS with 
dcerpc_fault_to_nt_status()
       via  f8415f5 s3:winbindd: let winbindd_lookup_names() use 
dcerpc_binding_handle functions
       via  8b9bb30 s3:winbindd: let winbindd_lookup_sids() 
dcerpc_binding_handle functions
       via  632e11f docs-xml/smb.conf.5: %i and %I no longer contain IPv4 
mapped IPv6 addresses
       via  c4c49be s3:lib/util_sock: listen on IPv6 addresses with IPV6_ONLY 
(bug #7383)
       via  62b2083 s3:lib/access: normalize IPv4 mapped IPv6 addresses in both 
directions (bug #7383)
       via  79c65e4 lib/util: add RBVAL, RBVALS, RSBVAL and RSRBVALS macros
       via  0ef0fd8 s3:includes: simplify INO_T_VAL macros
       via  90edf53 s3:includes: simplify BIG_UINT macros
       via  3a9f8ec s3:smbd/trans2: make use of BVAL() and remove ugly 
LARGE_SMB_OFF_T ifdef's
       via  b82b990 s3:include/vfs.h: remove very old hints for vfs modules 
with interface version < 8
       via  ae13244 s3:smbd/nttrans: make use of BVAL() and remove ugly 
LARGE_SMB_OFF_T ifdef's
       via  005ec26 s3:lib/sysquota: remove ugly LARGE_SMB_OFF_T ifdef's
       via  9e94404 s3:libsmb: make use of BVAL() and remove ugly 
LARGE_SMB_OFF_T ifdef's
      from  6c08f12 WHATSNEW: Update changes since pre2.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 5f21737a7413750622d87f1f71dbd6eec843e882
Author: Volker Lendecke <[email protected]>
Date:   Sat Apr 23 10:31:14 2011 +0200

    s3: Fix Coverity ID 2478, UNINIT
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Sat Apr 23 14:11:22 CEST 2011 on sn-devel-104
    (cherry picked from commit 123e5c1a75a7e6cfe245af05d2954ab126238acf)

commit 7031faeefc1c9ec5af5fdaee0bcfd3410640ff00
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Apr 24 00:00:40 2011 +0200

    s3:rpc_client: map fault codes to NTSTATUS with dcerpc_fault_to_nt_status()
    
    Most fault codes have a NTSTATUS representation, so use that.
    
    This brings the fault handling in common with the source4/librpc/rpc code,
    which make it possible to share more highlevel code, between source3 and
    source4 as the error checking can be the same now.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Sun Apr 24 10:44:53 CEST 2011 on sn-devel-104
    (cherry picked from commit f7bc84409a7a6736ec2cf1110dd7200a954e3b7e)

commit f8415f5cefa640a4da513335bc2d00a1bdc30bdf
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 23:57:19 2011 +0200

    s3:winbindd: let winbindd_lookup_names() use dcerpc_binding_handle functions
    
    metze
    (cherry picked from commit e7cf7204e60552b45952325f343ea894fda21346)

commit 8b9bb30a6cc21152b642a8382cc2876d189cacde
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 23:56:27 2011 +0200

    s3:winbindd: let winbindd_lookup_sids() dcerpc_binding_handle functions
    
    metze
    (cherry picked from commit 7309daa532c9689d64ce3f33da522f23635213d6)

commit 632e11fa52cc790e962808e67da36ba0155f53b5
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Apr 25 17:40:25 2011 +0200

    docs-xml/smb.conf.5: %i and %I no longer contain IPv4 mapped IPv6 addresses
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Mon Apr 25 18:38:16 CEST 2011 on sn-devel-104
    (cherry picked from commit 7269e455a7d4f659777b4ab7db5d8b68376c8d19)

commit c4c49be416aeac890628c9a9f2fd7975860884d4
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 11:29:51 2011 +0200

    s3:lib/util_sock: listen on IPv6 addresses with IPV6_ONLY (bug #7383)
    
    This avoids getting IPv4 addresses as mapped IPv6 addresses
    (e.g. ::ffff:192.168.0.1).
    
    Before the bahavior was inconsistent between operating system
    and distributions. Some system have IPV6_ONLY as default.
    
    Now we consistently get AF_INET for IPv4 addresses and AF_INET6
    for IPv6 addresses.
    
    It also makes it possible to listen only on IPv6 now
    as "::" doesn't imply "0.0.0.0" anymore. Which also
    avoids confusing log messages that we were not able to
    bind to "0.0.0.0".
    
    metze
    (cherry picked from commit a3a38ee90ab4ab2be68ac71d9c581daa6b9ee189)

commit 62b2083c627abeb8a2fb7e5adc793c630d0d561c
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Apr 24 21:20:19 2011 +0200

    s3:lib/access: normalize IPv4 mapped IPv6 addresses in both directions (bug 
#7383)
    
    metze
    (cherry picked from commit 4bfe2d5655d97fbc7e65744425b5a098e77f5ba1)

commit 79c65e434283f41a1739cdbc132f0e78010b0b47
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 11:01:34 2011 +0200

    lib/util: add RBVAL, RBVALS, RSBVAL and RSRBVALS macros
    
    They pull and push [u]int64_t values in big endian.
    
    metze
    (cherry picked from commit c0441b17e6580de65d87d28bfd9ae72d09a3508f)

commit 0ef0fd81ba863379f28e1bde2808fc48fbe38d4b
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 11:15:30 2011 +0200

    s3:includes: simplify INO_T_VAL macros
    
    metze
    (cherry picked from commit 5b327085775f279976c66cdd5f105132fda0965a)

commit 90edf53dd5d3768ad97748cca90cb177709223dd
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 11:10:05 2011 +0200

    s3:includes: simplify BIG_UINT macros
    
    metze
    (cherry picked from commit d7aa2eb7b664c10551cb45c36d3b564d829e9d44)

commit 3a9f8ec79c8a80430df81d97833f9c2816cfaef6
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 10:30:59 2011 +0200

    s3:smbd/trans2: make use of BVAL() and remove ugly LARGE_SMB_OFF_T ifdef's
    
    We rely on uint64_t for a long time now...
    
    metze
    (cherry picked from commit 9127e555ab043000adc516a9177e43812e52fd4b)

commit b82b990e30fe54d2733c4eb58e6e184c99a1acfe
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 10:17:27 2011 +0200

    s3:include/vfs.h: remove very old hints for vfs modules with interface 
version < 8
    
    The interface version is at 28 now, and this defines cause problem
    on some systems, e.g. Tru64 defines vfs_init in the system headers.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Sat Apr 23 12:07:35 CEST 2011 on sn-devel-104
    (cherry picked from commit 64e7fba1be0d2897c5cee40b41f869bd9e5b272a)

commit ae132446595bf6af167d32c32430e8dceecc94a0
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 10:30:59 2011 +0200

    s3:smbd/nttrans: make use of BVAL() and remove ugly LARGE_SMB_OFF_T ifdef's
    
    We rely on uint64_t for a long time now...
    
    metze
    (cherry picked from commit 4a4a774e61aa5d95fa4c90485c538629ce5d0c92)

commit 005ec263ac515bf76915a3364bd89d9ccf172107
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 10:27:37 2011 +0200

    s3:lib/sysquota: remove ugly LARGE_SMB_OFF_T ifdef's
    
    We rely on uint64_t for a long time now...
    
    metze
    (cherry picked from commit 5186209277e0fec5c9f0c4df2ac57a5e16f74470)

commit 9e944049ea2b1cf6f7aed2e3b6319bb5138a5b65
Author: Stefan Metzmacher <[email protected]>
Date:   Sat Apr 23 10:22:32 2011 +0200

    s3:libsmb: make use of BVAL() and remove ugly LARGE_SMB_OFF_T ifdef's
    
    We rely on uint64_t for a long time now...
    
    metze
    (cherry picked from commit 75ad18037955b1e787e48648a09b0016b1cdce8f)

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages-3/smb.conf.5.xml |    4 ++
 lib/util/byteorder.h               |   17 ++++++---
 source3/include/includes.h         |   15 ++++----
 source3/include/vfs.h              |    8 ----
 source3/lib/access.c               |   31 +++++++++-------
 source3/lib/netapi/user.c          |    2 +-
 source3/lib/sysquotas.c            |   24 -------------
 source3/lib/sysquotas_nfs.c        |    2 +-
 source3/lib/util_sock.c            |   26 ++++++++++++++
 source3/libnet/libnet_join.c       |    2 +-
 source3/libsmb/cliquota.c          |   62 +++------------------------------
 source3/rpc_client/cli_pipe.c      |    6 +---
 source3/smbd/nttrans.c             |   49 +++-----------------------
 source3/smbd/trans2.c              |   30 +---------------
 source3/winbindd/winbindd_cm.c     |    2 +-
 source3/winbindd/winbindd_msrpc.c  |   67 +++++++++++++++++++++++-------------
 source3/winbindd/winbindd_pam.c    |   10 +++---
 17 files changed, 130 insertions(+), 227 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/smb.conf.5.xml 
b/docs-xml/manpages-3/smb.conf.5.xml
index 2b93065..f5f252b 100644
--- a/docs-xml/manpages-3/smb.conf.5.xml
+++ b/docs-xml/manpages-3/smb.conf.5.xml
@@ -503,12 +503,16 @@ chmod 1770 /usr/local/samba/lib/usershares
                <varlistentry>
                <term>%I</term>
                <listitem><para>the IP address of the client machine.</para>
+               <para>Before 3.6.0 it could contain IPv4 mapped IPv6 addresses,
+                       now it only contains IPv4 or IPv6 addresses.</para>
                </listitem>
                </varlistentry>
 
                <varlistentry>
                <term>%i</term>
                <listitem><para>the local IP address to which a client 
connected.</para>
+               <para>Before 3.6.0 it could contain IPv4 mapped IPv6 addresses,
+                       now it only contains IPv4 or IPv6 addresses.</para>
                </listitem>
                </varlistentry>
 
diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h
index 59ad837..6bcf71e 100644
--- a/lib/util/byteorder.h
+++ b/lib/util/byteorder.h
@@ -201,18 +201,29 @@ static __inline__ void st_le32(uint32_t *addr, const 
uint32_t val)
 
 #endif /* not CAREFUL_ALIGNMENT */
 
+/* 64 bit macros */
+#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
+#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
+#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), 
SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
+#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
+
 /* now the reverse routines - these are used in nmb packets (mostly) */
 #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
 #define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
+#define BREV(x) ((IREV(x)<<32) | (IREV((x)>>32)))
 
 #define RSVAL(buf,pos) SREV(SVAL(buf,pos))
 #define RSVALS(buf,pos) SREV(SVALS(buf,pos))
 #define RIVAL(buf,pos) IREV(IVAL(buf,pos))
 #define RIVALS(buf,pos) IREV(IVALS(buf,pos))
+#define RBVAL(buf,pos) BREV(BVAL(buf,pos))
+#define RBVALS(buf,pos) BREV(BVALS(buf,pos))
 #define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
 #define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
 #define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
 #define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
+#define RSBVAL(buf,pos,val) SBVAL(buf,pos,BREV(val))
+#define RSBVALS(buf,pos,val) SBVALS(buf,pos,BREV(val))
 
 /* Alignment macros. */
 #define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3))
@@ -222,10 +233,4 @@ static __inline__ void st_le32(uint32_t *addr, const 
uint32_t val)
 /* macros for accessing SMB protocol elements */
 #define VWV(vwv) ((vwv)*2)
 
-/* 64 bit macros */
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
-#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), 
SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
-#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
-
 #endif /* _BYTEORDER_H */
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 54459a5..6d0b15c 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -308,10 +308,10 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T;
 #endif
 
 #ifdef LARGE_SMB_INO_T
-#define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), 
SIVAL((p),(ofs)+4,(v)>>32))
-#define INO_T_VAL(p, ofs) ((SMB_INO_T)(((uint64_t)(IVAL(p,ofs)))| 
(((uint64_t)(IVAL(p,(ofs)+4))) << 32)))
+#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, v)
+#define INO_T_VAL(p, ofs) ((SMB_INO_T)BVAL(p, ofs))
 #else 
-#define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
+#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, ((uint64_t)(v)) & UINT32_MAX)
 #define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
 #endif
 
@@ -323,11 +323,10 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T;
 #  endif
 #endif
 
-#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), 
SIVAL(p,(ofs)+4,(v)>>32))
-#define BIG_UINT(p, ofs) ((((uint64_t) IVAL(p,(ofs)+4))<<32)|IVAL(p,ofs))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((uint64_t)(IVAL((buf),(off)))) & 
((uint64_t)0xFFFFFFFF)) | \
-               (( ((uint64_t)(IVAL((buf),(off+4)))) & ((uint64_t)0xFFFFFFFF) ) 
<< 32 ) )
-
+/* TODO: remove this macros */
+#define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v)
+#define BIG_UINT(p, ofs) BVAL(p, ofs)
+#define IVAL2_TO_SMB_BIG_UINT(p, ofs) BVAL(p, ofs)
 
 /* this should really be a 64 bit type if possible */
 typedef uint64_t br_off;
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 28d6c38..185bc76 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -136,14 +136,6 @@
 /* Leave at 28 - not yet released. Rename open function to open_fn. - gd */
 #define SMB_VFS_INTERFACE_VERSION 28
 
-
-/* to bug old modules which are trying to compile with the old functions */
-#define vfs_init 
__ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void)
 { 
__ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore
 };
-#define lp_parm_string 
__ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string
 { \
-  
__ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string
 };
-#define lp_vfs_options 
__ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead
 { \
-  
__ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead
 };
-
 /*
     All intercepted VFS operations must be declared as static functions inside 
module source
     in order to keep smbd namespace unpolluted. See source of audit, 
extd_audit, fake_perms and recycle
diff --git a/source3/lib/access.c b/source3/lib/access.c
index a7475a5..f9cd9d5 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -182,29 +182,32 @@ static bool string_match(const char *tok,const char *s)
 bool client_match(const char *tok, const void *item)
 {
        const char **client = (const char **)item;
+       const char *tok_addr = tok;
+       const char *cli_addr = client[ADDR_INDEX];
+
+       /*
+        * tok and client[ADDR_INDEX] can be an IPv4 mapped to IPv6,
+        * we try and match the IPv4 part of address only.
+        * Bug #5311 and #7383.
+        */
+
+       if (strnequal(tok_addr, "::ffff:",7)) {
+               tok_addr += 7;
+       }
+
+       if (strnequal(cli_addr,"::ffff:",7)) {
+               cli_addr += 7;
+       }
 
        /*
         * Try to match the address first. If that fails, try to match the host
         * name if available.
         */
 
-       if (string_match(tok, client[ADDR_INDEX])) {
+       if (string_match(tok_addr, cli_addr)) {
                return true;
        }
 
-       if (strnequal(client[ADDR_INDEX],"::ffff:",7) &&
-                       !strnequal(tok, "::ffff:",7)) {
-               /* client[ADDR_INDEX] is an IPv4 mapped to IPv6, but
-                * the list item is not. Try and match the IPv4 part of
-                * address only. This will happen a lot on IPv6 enabled
-                * systems with IPv4 allow/deny lists in smb.conf.
-                * Bug #5311. JRA.
-                */
-               if (string_match(tok, (client[ADDR_INDEX])+7)) {
-                       return true;
-               }
-       }
-
        if (client[NAME_INDEX][0] != 0) {
                if (string_match(tok, client[NAME_INDEX])) {
                        return true;
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index 63be7ac..653ece1 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -322,7 +322,7 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx,
                                                  25,
                                                  &user_info,
                                                  &result);
-               if (NT_STATUS_EQUAL(status, 
NT_STATUS(DCERPC_FAULT_INVALID_TAG))) {
+               if (NT_STATUS_EQUAL(status, 
NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) {
 
                        user_info.info23.info = info21;
 
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 6abafbd..12c34ed 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -303,7 +303,6 @@ static int command_get_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
 
                        DEBUG (3, ("Parsed output of get_quota, ...\n"));
 
-#ifdef LARGE_SMB_OFF_T
                        DEBUGADD (5,( 
                                "qflags:%u curblocks:%llu softlimit:%llu 
hardlimit:%llu\n"
                                "curinodes:%llu isoftlimit:%llu ihardlimit:%llu 
bsize:%llu\n", 
@@ -312,16 +311,6 @@ static int command_get_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
                                (long long unsigned)dp->curinodes,
                                (long long unsigned)dp->isoftlimit,(long long 
unsigned)dp->ihardlimit,
                                (long long unsigned)dp->bsize));
-#else /* LARGE_SMB_OFF_T */
-                       DEBUGADD (5,( 
-                               "qflags:%u curblocks:%lu softlimit:%lu 
hardlimit:%lu\n"
-                               "curinodes:%lu isoftlimit:%lu ihardlimit:%lu 
bsize:%lu\n", 
-                               dp->qflags,(long unsigned)dp->curblocks,
-                               (long unsigned)dp->softlimit,(long 
unsigned)dp->hardlimit,
-                               (long unsigned)dp->curinodes,
-                               (long unsigned)dp->isoftlimit,(long 
unsigned)dp->ihardlimit,
-                               (long unsigned)dp->bsize));
-#endif /* LARGE_SMB_OFF_T */
                        return 0;
                }
 
@@ -362,7 +351,6 @@ static int command_set_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
                                return -1;
                }
 
-#ifdef LARGE_SMB_OFF_T
                if (asprintf(&syscmd,
                        "%s \"%s\" %d %d "
                        "%u %llu %llu "
@@ -373,18 +361,6 @@ static int command_set_quota(const char *path, enum 
SMB_QUOTA_TYPE qtype, unid_t
                        (long long unsigned)dp->bsize) < 0) {
                        return -1;
                }
-#else /* LARGE_SMB_OFF_T */
-               if (asprintf(&syscmd,
-                       "%s \"%s\" %d %d "
-                       "%u %lu %lu "
-                       "%lu %lu %lu ",
-                       set_quota_command, path, qtype, _id, dp->qflags,
-                       (long unsigned)dp->softlimit,(long 
unsigned)dp->hardlimit,
-                       (long unsigned)dp->isoftlimit,(long 
unsigned)dp->ihardlimit,
-                       (long unsigned)dp->bsize) < 0) {
-                       return -1;
-               }
-#endif /* LARGE_SMB_OFF_T */
 
                DEBUG (3, ("get_quota: Running command %s\n", syscmd));
 
diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c
index eff5874..043ab9f 100644
--- a/source3/lib/sysquotas_nfs.c
+++ b/source3/lib/sysquotas_nfs.c
@@ -91,7 +91,7 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
                      enum SMB_QUOTA_TYPE qtype,
                      unid_t id, SMB_DISK_QUOTA *dp)
 {
-       CLIENT *clnt;
+       CLIENT *clnt = NULL;
        struct getquota_rslt gq_rslt;
        struct getquota_args gq_args;
        const char *mnttype;
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 787ad94..10b335b 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -787,6 +787,32 @@ int open_socket_in(int type,
 #endif /* SO_REUSEPORT */
        }
 
+#ifdef HAVE_IPV6
+       /*
+        * As IPV6_V6ONLY is the default on some systems,
+        * we better try to be consistent and always use it.
+        *
+        * This also avoids using IPv4 via AF_INET6 sockets
+        * and makes sure %I never resolves to a '::ffff:192.168.0.1'
+        * string.
+        */
+       if (sock.ss_family == AF_INET6) {
+               int val = 1;
+               int ret;
+
+               ret = setsockopt(res, IPPROTO_IPV6, IPV6_V6ONLY,
+                                (const void *)&val, sizeof(val));
+               if (ret == -1) {
+                       if(DEBUGLVL(0)) {
+                               dbgtext("open_socket_in(): IPV6_ONLY failed: ");
+                               dbgtext("%s\n", strerror(errno));
+                       }
+                       close(res);
+                       return -1;
+               }
+       }
+#endif
+
        /* now we've got a socket - we need to bind it */
        if (bind(res, (struct sockaddr *)&sock, slen) == -1 ) {
                if( DEBUGLVL(dlevel) && (port == SMB_PORT1 ||
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 1e866c3..c3693a8 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1074,7 +1074,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX 
*mem_ctx,
                                          &user_info,
                                          &result);
 
-       if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) {
+       if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) {
 
                /* retry with level 24 */
 
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index e05b64e..e5c8c83 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -80,43 +80,13 @@ static bool parse_user_quota_record(const uint8_t *rdata,
         */
 
        /* the used space 8 bytes (uint64_t)*/
-       qt.usedspace = (uint64_t)IVAL(rdata,16);
-#ifdef LARGE_SMB_OFF_T
-       qt.usedspace |= (((uint64_t)IVAL(rdata,20)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,20) != 0)&&
-               ((qt.usedspace != 0xFFFFFFFF)||
-                (IVAL(rdata,20)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.usedspace = BVAL(rdata,16);
 
        /* the soft quotas 8 bytes (uint64_t)*/
-       qt.softlim = (uint64_t)IVAL(rdata,24);
-#ifdef LARGE_SMB_OFF_T
-       qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,28) != 0)&&
-               ((qt.softlim != 0xFFFFFFFF)||
-                (IVAL(rdata,28)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.softlim = BVAL(rdata,24);
 
        /* the hard quotas 8 bytes (uint64_t)*/
-       qt.hardlim = (uint64_t)IVAL(rdata,32);
-#ifdef LARGE_SMB_OFF_T
-       qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,36) != 0)&&
-               ((qt.hardlim != 0xFFFFFFFF)||
-                (IVAL(rdata,36)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.hardlim = BVAL(rdata,32);
 
        if (!sid_parse((char *)rdata+40,sid_len,&qt.sid)) {
                return false;
@@ -421,32 +391,10 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int 
quota_fnum,
        /* unknown_1 24 NULL bytes in pdata*/
 
        /* the soft quotas 8 bytes (uint64_t)*/
-       qt.softlim = (uint64_t)IVAL(rdata,24);
-#ifdef LARGE_SMB_OFF_T
-       qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,28) != 0)&&
-               ((qt.softlim != 0xFFFFFFFF)||
-                (IVAL(rdata,28)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               status = NT_STATUS_INVALID_NETWORK_RESPONSE;
-               goto cleanup;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.softlim = BVAL(rdata,24);
 
        /* the hard quotas 8 bytes (uint64_t)*/
-       qt.hardlim = (uint64_t)IVAL(rdata,32);
-#ifdef LARGE_SMB_OFF_T
-       qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,36) != 0)&&
-               ((qt.hardlim != 0xFFFFFFFF)||
-                (IVAL(rdata,36)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               status = NT_STATUS_INVALID_NETWORK_RESPONSE;
-               goto cleanup;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.hardlim = BVAL(rdata,32);
 
        /* quota_flags 2 bytes **/
        qt.qflags = SVAL(rdata,40);
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index d40d999..e7e4e76 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -469,11 +469,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX 
*mem_ctx,
                          pkt->u.fault.status),
                          rpccli_pipe_txt(talloc_tos(), cli)));
 
-               if (NT_STATUS_IS_OK(NT_STATUS(pkt->u.fault.status))) {
-                       return NT_STATUS_UNSUCCESSFUL;
-               } else {
-                       return NT_STATUS(pkt->u.fault.status);
-               }
+               return dcerpc_fault_to_nt_status(pkt->u.fault.status);
 
        default:
                DEBUG(0, (__location__ "Unknown packet type %u received "
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 51abcea..b34ef5f 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -480,10 +480,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
        create_options = IVAL(req->vwv+19, 1);
        root_dir_fid = (uint16)IVAL(req->vwv+5, 1);
 
-       allocation_size = (uint64_t)IVAL(req->vwv+9, 1);
-#ifdef LARGE_SMB_OFF_T
-       allocation_size |= (((uint64_t)IVAL(req->vwv+11, 1)) << 32);
-#endif
+       allocation_size = BVAL(req->vwv+9, 1);
 
        srvstr_get_path_req(ctx, req, &fname, (const char *)req->buf,
                            STR_TERMINATE, &status);
@@ -1032,10 +1029,7 @@ static void call_nt_transact_create(connection_struct 
*conn,
        sd_len = IVAL(params,36);
        ea_len = IVAL(params,40);
        root_dir_fid = (uint16)IVAL(params,4);
-       allocation_size = (uint64_t)IVAL(params,12);
-#ifdef LARGE_SMB_OFF_T
-       allocation_size |= (((uint64_t)IVAL(params,16)) << 32);
-#endif
+       allocation_size = BVAL(params,12);
 
        /*
         * we need to remove ignored bits when they come directly from the 
client
@@ -2834,46 +2828,13 @@ static void 
call_nt_transact_set_user_quota(connection_struct *conn,
         */
 
        /* the used space 8 bytes (uint64_t)*/
-       qt.usedspace = (uint64_t)IVAL(pdata,16);
-#ifdef LARGE_SMB_OFF_T
-       qt.usedspace |= (((uint64_t)IVAL(pdata,20)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(pdata,20) != 0)&&
-               ((qt.usedspace != 0xFFFFFFFF)||
-               (IVAL(pdata,20)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               reply_nterror(req, NT_STATUS_INVALID_LEVEL);
-               return;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.usedspace = BVAL(pdata,16);
 
        /* the soft quotas 8 bytes (uint64_t)*/
-       qt.softlim = (uint64_t)IVAL(pdata,24);
-#ifdef LARGE_SMB_OFF_T
-       qt.softlim |= (((uint64_t)IVAL(pdata,28)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(pdata,28) != 0)&&
-               ((qt.softlim != 0xFFFFFFFF)||
-               (IVAL(pdata,28)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               reply_nterror(req, NT_STATUS_INVALID_LEVEL);
-               return;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.softlim = BVAL(pdata,24);
 
        /* the hard quotas 8 bytes (uint64_t)*/
-       qt.hardlim = (uint64_t)IVAL(pdata,32);
-#ifdef LARGE_SMB_OFF_T
-       qt.hardlim |= (((uint64_t)IVAL(pdata,36)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(pdata,36) != 0)&&
-               ((qt.hardlim != 0xFFFFFFFF)||
-               (IVAL(pdata,36)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               reply_nterror(req, NT_STATUS_INVALID_LEVEL);
-               return;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.hardlim = BVAL(pdata,32);
 
        if (!sid_parse(pdata+40,sid_len,&sid)) {
                reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 507ae9b..830504c 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3733,36 +3733,10 @@ cap_low = 0x%x, cap_high = 0x%x\n",
                                /* unknown_1 24 NULL bytes in pdata*/
 
                                /* the soft quotas 8 bytes (uint64_t)*/
-                               quotas.softlim = (uint64_t)IVAL(pdata,24);
-#ifdef LARGE_SMB_OFF_T
-                               quotas.softlim |= (((uint64_t)IVAL(pdata,28)) 
<< 32);
-#else /* LARGE_SMB_OFF_T */
-                               if ((IVAL(pdata,28) != 0)&&
-                                       ((quotas.softlim != 0xFFFFFFFF)||
-                                       (IVAL(pdata,28)!=0xFFFFFFFF))) {
-                                       /* more than 32 bits? */
-                                       reply_nterror(


-- 
Samba Shared Repository

Reply via email to