libsmb: fix regression on smbc_getxattr and fix doc
authorRemi Collet <rcollet@redhat.com>
Tue, 4 Apr 2023 08:22:09 +0000 (10:22 +0200)
committerJule Anger <janger@samba.org>
Wed, 6 Sep 2023 08:35:16 +0000 (08:35 +0000)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14808
Signed-off-by: Remi Collet <rcollet@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 4fc166628fda160d1cd38c140a9664defc5844ab)

source3/include/libsmbclient.h
source3/libsmb/libsmb_xattr.c

index ef8b327e374da135a14fe431143eee3bc3115d31..056444d008caec291968b49721ba4e155b4103af 100644 (file)
@@ -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
index 1e8d2718a2299288db9d95c38280f2d5bf386d46..1f82052119304b2e3081d84cbb9ffe1992367ce3 100644 (file)
@@ -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 */