The branch, master has been updated
       via  f8994bc2890 smbd: Fix an error resource leak in 
OpenDir_from_pathref()
       via  01f15d0e5e6 libsmb: Use SMB2_0_INFO_FILE instead of a simple "1"
       via  48464c66f8f smbd: Simplify smbd_smb2_query_directory_send()
       via  774005be766 smbd: reopen_from_fsp also works for full fsps
       via  3b386393304 smbd: Make reopen_from_fsp() public
       via  45f50eee06d vfs: Fix streams_xattr_openat
       via  ea597019aad vfs: Simplify streams_xattr_openat()
       via  bea01e845c8 vfs: Convert streams_xattr_get_name() to return 0/errno
       via  7430831f883 smbd: Convert get_ea_value_fsp() to return 0/errno
       via  eecdd0fb598 smbd: Convert refuse_symlink_fsp() to bool
       via  4b3b283b1f3 smbd: Simplify make_connection_snum()
       via  47c8d9b62af pylibsmb: Add NFS reparse tag types
       via  3dc89edf9ca libsmb: Fix a "cast increases required alignment" 
warning
       via  6c8d817f006 libsmb: Fix trailing whitespace
       via  4f727b919ad lsasrv: Simplify dcesrv_lsa_AddRemoveAccountRights()
       via  7c4d1f9de14 lib: Simplify nybble_to_hex_*
       via  542cf01bfe5 ldb: User hexchars_upper from replace.h
       via  fd5562bee7d libreplace: Introduce hexchars_{upper|lower}
       via  72ff0312d11 libcli: Convert an int to a size_t
       via  83582d417c5 lib: Modernize a DEBUG
       via  83bb0c4ae6d idl: Fix trailing whitespace
       via  804568a1d79 lib: simplify smbpasswd_sethexpwd() with 
hex_encode_buf()
       via  282a5778fb6 lib: simplify smbpasswd_gethexpwd() with strhex_to_str()
       via  3a5068f2946 libcli: Try to fix CID 1609583 Overflowed constant
       via  8a64775334b vfs_fruit: Align a few integer types
       via  63f0b59cbed vfs_fruit: Simplify filter_empty_rsrc_stream()
       via  ccb6e6634af libndr: Early overflow detection
       via  5d19591e756 libndr: Simplify data flow in ndr_push_relative_ptr2
      from  b80afa1ca0c libgpo:admx:: s/the the/the/

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f8994bc2890fa83ffffb4bbd89214d78968e7e04
Author: Volker Lendecke <[email protected]>
Date:   Thu Oct 10 17:14:10 2024 +0200

    smbd: Fix an error resource leak in OpenDir_from_pathref()
    
    We have to undo the fsp allocation and open we've done. Not noticed,
    it's probably highly unlikely OpenDir_fsp() fails.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Ralph Böhme <[email protected]>
    Autobuild-Date(master): Tue Nov 12 13:26:10 UTC 2024 on atb-devel-224

commit 01f15d0e5e6701cb6ede3fe85ab7311bd0aa6534
Author: Volker Lendecke <[email protected]>
Date:   Tue Oct 1 15:28:51 2024 +0200

    libsmb: Use SMB2_0_INFO_FILE instead of a simple "1"
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 48464c66f8f1259b21082ba9d0d63b3f034332b7
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 07:35:26 2024 +0200

    smbd: Simplify smbd_smb2_query_directory_send()
    
    Use reopen_from_fsp(), this will use the /proc/self/fd/<fd> trick if
    available, no need to go through non_widelink_open
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 774005be76617771ee87d973bf012cc29d89d514
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 09:30:12 2024 +0200

    smbd: reopen_from_fsp also works for full fsps
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3b386393304417d10a4ebb71c0c46d70ebde2aa4
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 07:32:55 2024 +0200

    smbd: Make reopen_from_fsp() public
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 45f50eee06d36830bd10adc959ddb47b3ccb56ed
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 12:00:28 2024 +0200

    vfs: Fix streams_xattr_openat
    
    This emulates openat, and trying to open a non-existing file should
    result in ENOENT and not ENOATTR
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit ea597019aad2fb8d34f3766741a4c2aee3388801
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 11:59:58 2024 +0200

    vfs: Simplify streams_xattr_openat()
    
    Don't go via NTSTATUS in error handling
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit bea01e845c8df277b7fa8225a4079d43835d7e1c
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 11:17:20 2024 +0200

    vfs: Convert streams_xattr_get_name() to return 0/errno
    
    This function is pretty simple, this avoids a few calls to
    map_errno_from_nt_status in the callers
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 7430831f8831a9a6eee83376c10027ca7cb449d6
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 11:07:11 2024 +0200

    smbd: Convert get_ea_value_fsp() to return 0/errno
    
    Avoid a map_errno_from_nt_status()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit eecdd0fb59828f50d32496f6f8bc06c3fefb80b1
Author: Volker Lendecke <[email protected]>
Date:   Wed Oct 9 10:50:15 2024 +0200

    smbd: Convert refuse_symlink_fsp() to bool
    
    I want to simplify get_ea_value_fsp next
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 4b3b283b1f3bf7192e9a9c849ed2d6006f96350a
Author: Volker Lendecke <[email protected]>
Date:   Fri Oct 11 13:29:33 2024 +0200

    smbd: Simplify make_connection_snum()
    
    Avoid nested if's, don't check for ISDIR twice
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 47c8d9b62af9443b2f4e062820ad46fe5c2ff7df
Author: Volker Lendecke <[email protected]>
Date:   Mon Jun 17 17:02:09 2024 +0200

    pylibsmb: Add NFS reparse tag types
    
    To be used in tests later
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3dc89edf9ca3eae80edea32b86c078fb660dbae6
Author: Volker Lendecke <[email protected]>
Date:   Tue Oct 1 15:35:25 2024 +0200

    libsmb: Fix a "cast increases required alignment" warning
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 6c8d817f0064e33fb3b2b265f32a7cc7eed10bac
Author: Volker Lendecke <[email protected]>
Date:   Wed Sep 25 16:54:11 2024 +0200

    libsmb: Fix trailing whitespace
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 4f727b919adcc05640d941fdbf623dc2b9fbb464
Author: Volker Lendecke <[email protected]>
Date:   Fri Sep 20 15:46:01 2024 +0200

    lsasrv: Simplify dcesrv_lsa_AddRemoveAccountRights()
    
    Use dom_sid_string_buf, no need to talloc.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 7c4d1f9de146c3e4fa97a2200ab98d0df9d8fdfd
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 10 08:46:30 2024 +0200

    lib: Simplify nybble_to_hex_*
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 542cf01bfe530a83dfbc8a606d182c0a5a622059
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 10 10:02:04 2024 +0200

    ldb: User hexchars_upper from replace.h
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit fd5562bee7d1bf503f0adc9347a9f7c16cf3cc22
Author: Volker Lendecke <[email protected]>
Date:   Tue Sep 10 08:45:31 2024 +0200

    libreplace: Introduce hexchars_{upper|lower}
    
    We use that in quite a few places in our code.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 72ff0312d11a99bec8e8879074b46140ba58299a
Author: Volker Lendecke <[email protected]>
Date:   Tue Oct 15 13:46:05 2024 +0200

    libcli: Convert an int to a size_t
    
    More appropriate for an array length
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 83582d417c5879a3c2e5b4bb274d339c315e2d2b
Author: Volker Lendecke <[email protected]>
Date:   Thu Oct 3 11:04:15 2024 +0200

    lib: Modernize a DEBUG
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 83bb0c4ae6d14cbf1b21ab7bf7820cdbbd2a44c3
Author: Volker Lendecke <[email protected]>
Date:   Mon Sep 30 12:55:25 2024 +0200

    idl: Fix trailing whitespace
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 804568a1d7910e989a3630d43efd670c254d32ff
Author: Volker Lendecke <[email protected]>
Date:   Fri Sep 20 15:17:33 2024 +0200

    lib: simplify smbpasswd_sethexpwd() with hex_encode_buf()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 282a5778fb60f3b0879959a9a6a0176a10a94ab0
Author: Volker Lendecke <[email protected]>
Date:   Fri Sep 20 15:14:48 2024 +0200

    lib: simplify smbpasswd_gethexpwd() with strhex_to_str()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3a5068f2946be08f600fe7dfc1921298096fbb35
Author: Volker Lendecke <[email protected]>
Date:   Mon Nov 4 18:26:43 2024 +0100

    libcli: Try to fix CID 1609583 Overflowed constant
    
    Coverity does not like the --i
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 8a64775334be0e8599ee7bc41b072d34d19d693f
Author: Volker Lendecke <[email protected]>
Date:   Mon Nov 4 18:19:48 2024 +0100

    vfs_fruit: Align a few integer types
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 63f0b59cbed814af61d5230343394c565a3895b0
Author: Volker Lendecke <[email protected]>
Date:   Mon Nov 4 18:17:16 2024 +0100

    vfs_fruit: Simplify filter_empty_rsrc_stream()
    
    Inspired by Coverity finding CID 1609584 Overflowed constant -- not
    sure it fixes it.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit ccb6e6634afc31ef3e06d50fa4ef791b12a40206
Author: Volker Lendecke <[email protected]>
Date:   Mon Sep 30 15:45:16 2024 +0200

    libndr: Early overflow detection
    
    This is an addition without an overflow check. Do it right there.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 5d19591e756beac70d022cecc6bb5d791ba67655
Author: Volker Lendecke <[email protected]>
Date:   Mon Sep 30 12:07:30 2024 +0200

    libndr: Simplify data flow in ndr_push_relative_ptr2
    
    Consolidate saving/replacing ndr->offset right around the push_uint32
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

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

Summary of changes:
 lib/ldb/common/ldb_dn.c               |   5 +-
 lib/replace/inet_pton.c               |   6 +-
 lib/replace/replace.c                 |   3 +
 lib/replace/replace.h                 |   3 +
 lib/replace/snprintf.c                |  13 ++-
 lib/util/samba_util.h                 |  46 +--------
 libcli/security/secacl.c              |   2 +-
 libcli/security/secacl.h              |   2 +-
 libcli/security/security_descriptor.c |   8 +-
 librpc/ndr/ndr.c                      |  24 +++--
 source3/lib/tdb_validate.c            |  17 ++--
 source3/libsmb/cli_smb2_fnum.c        |   2 +-
 source3/libsmb/clifile.c              |   2 +-
 source3/libsmb/libsmb_dir.c           |   6 +-
 source3/libsmb/pylibsmb.c             |   6 ++
 source3/modules/vfs_fruit.c           |  55 +++--------
 source3/modules/vfs_streams_xattr.c   | 173 +++++++++++++++++-----------------
 source3/smbd/dir.c                    |   2 +
 source3/smbd/open.c                   |  12 +--
 source3/smbd/proto.h                  |  15 ++-
 source3/smbd/smb1_trans2.c            |  13 ++-
 source3/smbd/smb2_nttrans.c           |  14 +--
 source3/smbd/smb2_query_directory.c   |  18 ++--
 source3/smbd/smb2_service.c           |  30 +++---
 source3/smbd/smb2_trans2.c            |  55 ++++++-----
 source4/lib/samba3/smbpasswd.c        |  49 +++++-----
 source4/librpc/idl/ntp_signd.idl      |   1 -
 source4/rpc_server/lsa/dcesrv_lsa.c   |  11 +--
 28 files changed, 276 insertions(+), 317 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index e785a6d9e3d..19350cc610c 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -232,11 +232,10 @@ static int ldb_dn_escape_internal(char *dst, const char 
*src, int len)
                case '\0': {
                        /* any others get \XX form */
                        unsigned char v;
-                       const char *hexbytes = "0123456789ABCDEF";
                        v = (const unsigned char)c;
                        *d++ = '\\';
-                       *d++ = hexbytes[v>>4];
-                       *d++ = hexbytes[v&0xF];
+                       *d++ = hexchars_upper[v>>4];
+                       *d++ = hexchars_upper[v&0xF];
                        break;
                }
                default:
diff --git a/lib/replace/inet_pton.c b/lib/replace/inet_pton.c
index 80e4865ef49..9e461d770ab 100644
--- a/lib/replace/inet_pton.c
+++ b/lib/replace/inet_pton.c
@@ -131,8 +131,6 @@ inet_pton6(src, dst)
        const char *src;
        unsigned char *dst;
 {
-       static const char xdigits_l[] = "0123456789abcdef",
-                         xdigits_u[] = "0123456789ABCDEF";
        unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
        const char *xdigits, *curtok;
        int ch, saw_xdigit;
@@ -151,8 +149,8 @@ inet_pton6(src, dst)
        while ((ch = *src++) != '\0') {
                const char *pch;
 
-               if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
-                       pch = strchr((xdigits = xdigits_u), ch);
+               if ((pch = strchr((xdigits = hexchars_lower), ch)) == NULL)
+                       pch = strchr((xdigits = hexchars_upper), ch);
                if (pch != NULL) {
                        val <<= 4;
                        val |= (pch - xdigits);
diff --git a/lib/replace/replace.c b/lib/replace/replace.c
index 68e0a38bca6..f7f26712614 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -1231,3 +1231,6 @@ int rep_renameat2(int __oldfd, const char *__old, int 
__newfd,
        return renameat(__oldfd, __old, __newfd, __new);
 }
 #endif /* ! HAVE_RENAMEAT2 */
+
+const char hexchars_lower[] = "0123456789abcdef";
+const char hexchars_upper[] = "0123456789ABCDEF";
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 586f4e0a575..b4bc1327824 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -1101,6 +1101,9 @@ static inline bool hex_byte(const char *in, uint8_t *out)
        return ok;
 }
 
+extern const char hexchars_lower[];
+extern const char hexchars_upper[];
+
 /* Needed for Solaris atomic_add_XX functions. */
 #if defined(HAVE_SYS_ATOMIC_H)
 #include <sys/atomic.h>
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index dd878fca113..63b0882e33f 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -832,9 +832,8 @@ static void fmtint(char *buffer, size_t *currlen, size_t 
maxlen,
        if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
 
        do {
-               convert[place++] =
-                       (caps? "0123456789ABCDEF":"0123456789abcdef")
-                       [uvalue % (unsigned)base  ];
+               convert[place++] = (caps ? hex_upper
+                                        : hex_lower)[uvalue % (unsigned)base];
                uvalue = (uvalue / (unsigned)base );
        } while(uvalue && (place < sizeof(convert)));
        if (place == sizeof(convert)) place--;
@@ -1028,8 +1027,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t 
maxlen,
                idx = (int) ((temp -intpart +0.05)* 10.0);
                /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
                /* printf ("%llf, %f, %x\n", temp, intpart, idx); */
-               iconvert[iplace++] =
-                       (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+               iconvert[iplace++] = (caps ? hexchars_upper
+                                          : hexchars_lower)[idx];
        } while (intpart && (iplace < 311));
        if (iplace == 311) iplace--;
        iconvert[iplace] = 0;
@@ -1043,8 +1042,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t 
maxlen,
                        idx = (int) ((temp -fracpart +0.05)* 10.0);
                        /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */
                        /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */
-                       fconvert[fplace++] =
-                       (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+                       fconvert[fplace++] = (caps ? hexchars_upper
+                                                  : hexchars_lower)[idx];
                } while(fracpart && (fplace < 311));
                if (fplace == 311) fplace--;
        }
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index a38cc8a92f2..3994f8373c5 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -652,54 +652,12 @@ void samba_tevent_set_debug(struct tevent_context *ev, 
const char *name);
 
 static inline char nybble_to_hex_lower(uint8_t val)
 {
-       uint8_t nybble = val & 0xf;
-
-       switch (nybble) {
-       case 0x0: case 0x1: case 0x2: case 0x3: case 0x4:
-       case 0x5: case 0x6: case 0x7: case 0x8: case 0x9:
-               return '0' + nybble;
-       case 0xa:
-               return 'a';
-       case 0xb:
-               return 'b';
-       case 0xc:
-               return 'c';
-       case 0xd:
-               return 'd';
-       case 0xe:
-               return 'e';
-       case 0xf:
-               return 'f';
-       }
-
-       /* unreachable */
-       return '\0';
+       return hexchars_lower[val & 0xf];
 }
 
 static inline char nybble_to_hex_upper(uint8_t val)
 {
-       uint8_t nybble = val & 0xf;
-
-       switch (nybble) {
-       case 0x0: case 0x1: case 0x2: case 0x3: case 0x4:
-       case 0x5: case 0x6: case 0x7: case 0x8: case 0x9:
-               return '0' + nybble;
-       case 0xa:
-               return 'A';
-       case 0xb:
-               return 'B';
-       case 0xc:
-               return 'C';
-       case 0xd:
-               return 'D';
-       case 0xe:
-               return 'E';
-       case 0xf:
-               return 'F';
-       }
-
-       /* unreachable */
-       return '\0';
+       return hexchars_upper[val & 0xf];
 }
 
 #endif /* _SAMBA_UTIL_H_ */
diff --git a/libcli/security/secacl.c b/libcli/security/secacl.c
index 6c92a2eda76..388d97ca3be 100644
--- a/libcli/security/secacl.c
+++ b/libcli/security/secacl.c
@@ -34,7 +34,7 @@
 struct security_acl *make_sec_acl(
        TALLOC_CTX *ctx,
        enum security_acl_revision revision,
-       int num_aces,
+       size_t num_aces,
        const struct security_ace *ace_list)
 {
        struct security_acl *dst;
diff --git a/libcli/security/secacl.h b/libcli/security/secacl.h
index 961e2b4d891..6772a167661 100644
--- a/libcli/security/secacl.h
+++ b/libcli/security/secacl.h
@@ -26,7 +26,7 @@
 struct security_acl *make_sec_acl(
        TALLOC_CTX *ctx,
        enum security_acl_revision revision,
-       int num_aces,
+       size_t num_aces,
        const struct security_ace *ace_list);
 
 #endif /*_SECACL_H_*/
diff --git a/libcli/security/security_descriptor.c 
b/libcli/security/security_descriptor.c
index 9b9f16c6d2e..c550d6ed751 100644
--- a/libcli/security/security_descriptor.c
+++ b/libcli/security/security_descriptor.c
@@ -399,7 +399,10 @@ static NTSTATUS security_descriptor_acl_del(struct 
security_descriptor *sd,
        }
 
        /* there can be multiple ace's for one trustee */
-       for (i=0;i<acl->num_aces;i++) {
+
+       i = 0;
+
+       while (i<acl->num_aces) {
                if (dom_sid_equal(trustee, &acl->aces[i].trustee)) {
                        ARRAY_DEL_ELEMENT(acl->aces, i, acl->num_aces);
                        acl->num_aces--;
@@ -407,7 +410,8 @@ static NTSTATUS security_descriptor_acl_del(struct 
security_descriptor *sd,
                                acl->aces = NULL;
                        }
                        found = true;
-                       --i;
+               } else {
+                       i += 1;
                }
        }
 
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index e552ccba20f..24db73d5001 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1726,19 +1726,23 @@ static enum ndr_err_code ndr_push_relative_ptr2(struct 
ndr_push *ndr, const void
        if (p == NULL) {
                return NDR_ERR_SUCCESS;
        }
-       save_offset = ndr->offset;
+       if (ndr->offset < ndr->relative_base_offset) {
+               return ndr_push_error(
+                       ndr,
+                       NDR_ERR_BUFSIZE,
+                       "ndr_push_relative_ptr2 ndr->offset(%" PRIu32 ") "
+                       "< ndr->relative_base_offset(%" PRIu32 ")",
+                       ndr->offset,
+                       ndr->relative_base_offset);
+       }
        NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
        if (ptr_offset > ndr->offset) {
                return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
                                      "ndr_push_relative_ptr2 
ptr_offset(%"PRIu32") > ndr->offset(%"PRIu32")",
                                      ptr_offset, ndr->offset);
        }
+       save_offset = ndr->offset;
        ndr->offset = ptr_offset;
-       if (save_offset < ndr->relative_base_offset) {
-               return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
-                                     "ndr_push_relative_ptr2 
save_offset(%"PRIu32") < ndr->relative_base_offset(%"PRIu32")",
-                                     save_offset, ndr->relative_base_offset);
-       }
        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save_offset - 
ndr->relative_base_offset));
        ndr->offset = save_offset;
        return NDR_ERR_SUCCESS;
@@ -2014,6 +2018,14 @@ _PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct 
ndr_pull *ndr, const vo
 {
        enum ndr_err_code ret;
        rel_offset += ndr->relative_base_offset;
+       if (rel_offset < ndr->relative_base_offset) {
+               return ndr_pull_error(ndr,
+                                     NDR_ERR_INVALID_POINTER,
+                                     "Overflow rel_offset=%" PRIu32 " + "
+                                     "relative_base_offset=%" PRIu32,
+                                     rel_offset,
+                                     ndr->relative_base_offset);
+       }
        if (rel_offset > ndr->data_size) {
                return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
                                      "ndr_pull_relative_ptr1 
rel_offset(%"PRIu32") > ndr->data_size(%"PRIu32")",
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index 78bd824c09d..5b821a9731b 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -83,12 +83,17 @@ static int tdb_validate_child(struct tdb_context *tdb,
        ret = 0; /* Cache is good. */
 
 out:
-       DEBUG(10,   ("tdb_validate_child: summary of validation status:\n"));
-       DEBUGADD(10,(" * tdb error: %s\n", v_status.tdb_error ? "yes" : "no"));
-       DEBUGADD(10,(" * bad freelist: %s\n",v_status.bad_freelist?"yes":"no"));
-       DEBUGADD(10,(" * bad entry: %s\n", v_status.bad_entry ? "yes" : "no"));
-       DEBUGADD(10,(" * unknown key: %s\n", v_status.unknown_key?"yes":"no"));
-       DEBUGADD(10,(" => overall success: %s\n", v_status.success?"yes":"no"));
+       DBG_DEBUG("summary of validation status:\n"
+                 " * tdb error: %s\n"
+                 " * bad freelist: %s\n"
+                 " * bad entry: %s\n"
+                 " * unknown key: %s\n"
+                 " => overall success: %s\n",
+                 v_status.tdb_error ? "yes" : "no",
+                 v_status.bad_freelist ? "yes" : "no",
+                 v_status.bad_entry ? "yes" : "no",
+                 v_status.unknown_key ? "yes" : "no",
+                 v_status.success ? "yes" : "no");
 
        return ret;
 }
diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 91933c6efe9..95b4385bc9f 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -2251,7 +2251,7 @@ static void cli_smb2_qpathinfo_opened(struct tevent_req 
*subreq)
                                               state->ev,
                                               state->cli,
                                               state->fnum,
-                                              1, /* in_info_type */
+                                              SMB2_0_INFO_FILE,
                                               state->level,
                                               state->max_rdata,
                                               NULL, /* in_input_buffer */
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 812050d7e64..c7da7a1b14c 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -6648,7 +6648,7 @@ NTSTATUS cli_posix_rmdir(struct cli_state *cli, const 
char *fname)
 
 struct cli_notify_state {
        struct tevent_req *subreq;
-       uint8_t setup[8];
+       uint16_t setup[4];
        uint32_t num_changes;
        struct notify_change *changes;
 };
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 59bee575673..1bcf5f1b475 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -2024,7 +2024,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
                TALLOC_FREE(frame);
                return -1;  /* errno set by SMBC_server */
        }
-       
+
        creds = context->internal->creds;
 
        /*d_printf(">>>unlink: resolving %s\n", path);*/
@@ -2415,13 +2415,13 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                TALLOC_FREE(frame);
                return -1;
        }
-       
+
        /* set the credentials to make DFS work */
        smbc_set_credentials_with_fallback(ncontext,
                                           workgroup,
                                           user2,
                                           password2);
-       
+
        /*d_printf(">>>rename: resolved path as %s\n", targetpath1);*/
        /*d_printf(">>>rename: resolving %s\n", path2);*/
        ncreds = ncontext->internal->creds;
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 7ce481e9f3f..b002d0edb0e 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -3169,6 +3169,12 @@ MODULE_INIT_FUNC(libsmb_samba_cwrapper)
        ADD_FLAGS(IO_REPARSE_TAG_DFS);
        ADD_FLAGS(IO_REPARSE_TAG_NFS);
 
+       ADD_FLAGS(NFS_SPECFILE_LNK);
+       ADD_FLAGS(NFS_SPECFILE_CHR);
+       ADD_FLAGS(NFS_SPECFILE_BLK);
+       ADD_FLAGS(NFS_SPECFILE_FIFO);
+       ADD_FLAGS(NFS_SPECFILE_SOCK);
+
        ADD_FLAGS(FSCC_FILE_DIRECTORY_INFORMATION);
        ADD_FLAGS(FSCC_FILE_FULL_DIRECTORY_INFORMATION);
        ADD_FLAGS(FSCC_FILE_BOTH_DIRECTORY_INFORMATION);
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index d8ad4d37a4f..9d1e8badd61 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -413,34 +413,22 @@ static bool add_fruit_stream(TALLOC_CTX *mem_ctx, 
unsigned int *num_streams,
        return true;
 }
 
-static bool filter_empty_rsrc_stream(unsigned int *num_streams,
+static void filter_empty_rsrc_stream(unsigned int *num_streams,
                                     struct stream_struct **streams)
 {
-       struct stream_struct *tmp = *streams;
        unsigned int i;
 
-       if (*num_streams == 0) {
-               return true;
-       }
-
        for (i = 0; i < *num_streams; i++) {
-               if (strequal_m(tmp[i].name, AFPRESOURCE_STREAM)) {
-                       break;
-               }
-       }
+               struct stream_struct *s = &(*streams)[i];
 
-       if (i == *num_streams) {
-               return true;
-       }
-
-       if (tmp[i].size > 0) {
-               return true;
+               if (strequal_m(s->name, AFPRESOURCE_STREAM) &&
+                   (s->size == 0)) {
+                       TALLOC_FREE(s->name);
+                       ARRAY_DEL_ELEMENT(streams, i, *num_streams);
+                       *num_streams -= 1;
+                       return;
+               }
        }
-
-       TALLOC_FREE(tmp[i].name);
-       ARRAY_DEL_ELEMENT(tmp, i, *num_streams);
-       *num_streams -= 1;
-       return true;
 }
 
 static bool del_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
@@ -3745,8 +3733,7 @@ static NTSTATUS fruit_streaminfo_meta_stream(
        struct stream_struct **pstreams)
 {
        struct stream_struct *stream = *pstreams;
-       unsigned int num_streams = *pnum_streams;
-       int i;
+       unsigned int i, num_streams = *pnum_streams;
 
        for (i = 0; i < num_streams; i++) {
                if (strequal_m(stream[i].name, AFPINFO_STREAM)) {
@@ -3783,10 +3770,9 @@ static NTSTATUS fruit_streaminfo_meta_netatalk(
        struct stream_struct **pstreams)
 {
        struct stream_struct *stream = *pstreams;
-       unsigned int num_streams = *pnum_streams;
+       unsigned int i, num_streams = *pnum_streams;
        struct adouble *ad = NULL;
        bool is_fi_empty;
-       int i;
        bool ok;
 
        /* Remove the Netatalk xattr from the list */
@@ -3880,13 +3866,7 @@ static NTSTATUS fruit_streaminfo_rsrc_stream(
        unsigned int *pnum_streams,
        struct stream_struct **pstreams)
 {
-       bool ok;
-
-       ok = filter_empty_rsrc_stream(pnum_streams, pstreams);
-       if (!ok) {
-               DBG_ERR("Filtering resource stream failed\n");
-               return NT_STATUS_INTERNAL_ERROR;
-       }
+       filter_empty_rsrc_stream(pnum_streams, pstreams);
        return NT_STATUS_OK;
 }
 
@@ -3898,13 +3878,7 @@ static NTSTATUS fruit_streaminfo_rsrc_xattr(
        unsigned int *pnum_streams,
        struct stream_struct **pstreams)
 {
-       bool ok;
-
-       ok = filter_empty_rsrc_stream(pnum_streams, pstreams);
-       if (!ok) {
-               DBG_ERR("Filtering resource stream failed\n");
-               return NT_STATUS_INTERNAL_ERROR;
-       }
+       filter_empty_rsrc_stream(pnum_streams, pstreams);
        return NT_STATUS_OK;
 }
 
@@ -3917,11 +3891,10 @@ static NTSTATUS fruit_streaminfo_rsrc_adouble(
        struct stream_struct **pstreams)
 {
        struct stream_struct *stream = *pstreams;
-       unsigned int num_streams = *pnum_streams;
+       unsigned int i, num_streams = *pnum_streams;
        struct adouble *ad = NULL;
        bool ok;
        size_t rlen;
-       int i;
 
        /*
         * Check if there's a AFPRESOURCE_STREAM from the VFS streams backend
diff --git a/source3/modules/vfs_streams_xattr.c 
b/source3/modules/vfs_streams_xattr.c
index 4cc69b42a8a..48c1e05da0f 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -48,15 +48,12 @@ struct stream_io {
 static ssize_t get_xattr_size_fsp(struct files_struct *fsp,
                                  const char *xattr_name)
 {
-       NTSTATUS status;
+       int ret;
        struct ea_struct ea;
        ssize_t result;
 
-       status = get_ea_value_fsp(talloc_tos(),
-                                 fsp,
-                                 xattr_name,
-                                 &ea);
-       if (!NT_STATUS_IS_OK(status)) {
+       ret = get_ea_value_fsp(talloc_tos(), fsp, xattr_name, &ea);
+       if (ret != 0) {


-- 
Samba Shared Repository

Reply via email to