The branch, v4-18-test has been updated
       via  5cf6870718c libsmb: Fix test for smbc_getxattr
       via  0d8e5ba4f51 libsmb: fix regression on smbc_getxattr and fix doc
      from  69fd70b83df mdssvc: better support for search with mdfind from Macs

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-18-test


- Log -----------------------------------------------------------------
commit 5cf6870718cf4356e627e0159866faf53ee11a08
Author: Remi Collet <rcol...@redhat.com>
Date:   Tue Apr 4 12:16:09 2023 +0200

    libsmb: Fix test for smbc_getxattr
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=14808
    Signed-off-by: Remi Collet <rcol...@redhat.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Sun Apr  9 10:44:38 UTC 2023 on atb-devel-224
    
    (cherry picked from commit 0cd66fe6bd4ac2aa0b302ddf3eb5068fc9c522ec)
    
    Autobuild-User(v4-18-test): Jule Anger <jan...@samba.org>
    Autobuild-Date(v4-18-test): Wed Sep  6 09:28:02 UTC 2023 on atb-devel-224

commit 0d8e5ba4f511d7da2c76b01931190fe1d9bd6a7e
Author: Remi Collet <rcol...@redhat.com>
Date:   Tue Apr 4 10:22:09 2023 +0200

    libsmb: fix regression on smbc_getxattr and fix doc
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=14808
    Signed-off-by: Remi Collet <rcol...@redhat.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    (cherry picked from commit 4fc166628fda160d1cd38c140a9664defc5844ab)

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

Summary of changes:
 source3/include/libsmbclient.h              |  2 +-
 source3/libsmb/libsmb_xattr.c               |  4 ++--
 source4/torture/libsmbclient/libsmbclient.c | 25 +++++++++++++++++++------
 3 files changed, 22 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index ef8b327e374..056444d008c 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -2419,7 +2419,7 @@ int smbc_getxattr(const char *url,
  *                  required to hold the attribute value will be returned,
  *                  but nothing will be placed into the value buffer.
  *
- * @return          0 on success, < 0 on error with errno set:
+ * @return          size on success, < 0 on error with errno set:
  *                  - EINVAL  The client library is not properly initialized
  *                            or one of the parameters is not of a correct
  *                            form
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 1e8d2718a22..1f820521193 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -2182,9 +2182,9 @@ SMBC_getxattr_ctx(SMBCCTX *context,
                TALLOC_FREE(frame);
                /*
                 * static function cacl_get returns a value greater than zero
-                * on success. Map this to zero meaning success.
+                * which is needed buffer size needed when size_t is 0.
                 */
-                return ret < 0 ? -1 : 0;
+                return ret;
         }
 
         /* Unsupported attribute name */
diff --git a/source4/torture/libsmbclient/libsmbclient.c 
b/source4/torture/libsmbclient/libsmbclient.c
index 55ea26f5bc8..72af8fc01c9 100644
--- a/source4/torture/libsmbclient/libsmbclient.c
+++ b/source4/torture/libsmbclient/libsmbclient.c
@@ -1542,17 +1542,30 @@ static bool torture_libsmbclient_getxattr(struct 
torture_context *tctx)
                        ret));
 
        /*
-        * Ensure getting a valid attribute returns 0.
+        * Ensure getting a valid attribute computes its size.
+        */
+       ret = smbc_getxattr(getxattr_name, "system.*", NULL, 0);
+       torture_assert_goto(tctx,
+               ret >= 0,
+               ok,
+               done,
+               talloc_asprintf(tctx,
+                       "smbc_getxattr(foobar, NULL) on '%s' should "
+                       "get >=0, got %d\n",
+                       getxattr_name,
+                       ret));
+
+       /*
+        * Ensure getting a valid attribute returns its size.
         */
        ret = smbc_getxattr(getxattr_name, "system.*", value, sizeof(value));
-       torture_assert_int_equal_goto(tctx,
-               ret,
-               0,
+       torture_assert_goto(tctx,
+               ret >= 0,
                ok,
                done,
                talloc_asprintf(tctx,
-                       "smbc_getxattr(foobar) on '%s' should "
-                       "get -1, got %d\n",
+                       "smbc_getxattr(foobar, value) on '%s' should "
+                       "get >=0, got %d\n",
                        getxattr_name,
                        ret));
 


-- 
Samba Shared Repository

Reply via email to