Bug 14808 - smbc_getxattr() return value is incorrect
Summary: smbc_getxattr() return value is incorrect
Status: NEW
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: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-23 07:39 UTC by Dmitry Degtyarev
Modified: 2021-08-23 07:48 UTC (History)
0 users

See Also:


Attachments

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)