Bug 14808 - smbc_getxattr() return value is incorrect
Summary: smbc_getxattr() return value is incorrect
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.14.6
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-23 07:39 UTC by Dmitry Degtyarev
Modified: 2023-01-26 17:49 UTC (History)
2 users (show)

See Also:


Attachments
git-am fix for 4.17.next, 4.16.next. (5.51 KB, patch)
2022-11-01 19:26 UTC, Jeremy Allison
jra: review? (dmulder)
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Degtyarev 2021-08-23 07:39:36 UTC
Expected behaviour: "@return 0 on success, < 0 on error" (from function comment).
Actual behaviour: returns positive value on success, < 0 on error.

In the code you can see that getxattr() uses cacl_get():
https://github.com/samba-team/samba/blob/f753e2f7acf8f3394a5f1107344d0323acc05694/source3/libsmb/libsmb_xattr.c#L2169
And then forwards the return value from cacl_get():
https://github.com/samba-team/samba/blob/f753e2f7acf8f3394a5f1107344d0323acc05694/source3/libsmb/libsmb_xattr.c#L2179
Meanwhile, cacl_get() returns a non-zero value called "n_used":
https://github.com/samba-team/samba/blob/f753e2f7acf8f3394a5f1107344d0323acc05694/source3/libsmb/libsmb_xattr.c#L1488

(@Nable80 suggested the bugreport)
Comment 1 Samba QA Contact 2022-11-01 18:32:04 UTC
This bug was referenced in samba master:

74636dfe24c15677261fc40c0a4ec62404898cf4
bdbb38d16c8eaff33484bb747efa639c4d8e7f35
Comment 2 Jeremy Allison 2022-11-01 19:26:34 UTC
Created attachment 17610 [details]
git-am fix for 4.17.next, 4.16.next.

Cherry-picked cleanly from master.
Comment 3 Jeremy Allison 2023-01-13 17:59:25 UTC
Comment on attachment 17610 [details]
git-am fix for 4.17.next, 4.16.next.

Ping David - can we get this into the next release please ?
Comment 4 Ralph Böhme 2023-01-13 18:27:23 UTC
Reassigning to Jule for inclusion in 4.16 and 4.17.
Comment 5 Jule Anger 2023-01-16 09:05:09 UTC
Pushed to autobuild-v4-{17,16}-test.
Comment 6 Samba QA Contact 2023-01-16 10:48:27 UTC
This bug was referenced in samba v4-16-test:

628a1c338277f3fc4250fd54809bf326ec15c0ef
113536e0d735a5235f8be29d4fd1cfc8177930b1
Comment 7 Samba QA Contact 2023-01-16 10:50:03 UTC
This bug was referenced in samba v4-17-test:

a92a0043493f678338ecdefa49810e91f6bb2a1a
50330f69a073915c604070a1889e92af0f0a2006
Comment 8 Jule Anger 2023-01-16 11:54:42 UTC
Closing out bug report.

Thanks!
Comment 9 Samba QA Contact 2023-01-26 17:49:49 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.5):

a92a0043493f678338ecdefa49810e91f6bb2a1a
50330f69a073915c604070a1889e92af0f0a2006