Bug 4601 - smbc_getxattr returns error when buffer size is set to 0
Summary: smbc_getxattr returns error when buffer size is set to 0
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.25
Hardware: Other Other
: P3 minor
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-08 09:45 UTC by Henrik (dead mail address)
Modified: 2007-10-20 09:00 UTC (History)
1 user (show)

See Also:


Attachments
likely fix for described problem (629 bytes, patch)
2007-05-09 14:23 UTC, Derrell Lipman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik (dead mail address) 2007-05-08 09:45:51 UTC
Hi Derrell,

Looking at the comments from libsmbclient.h for function smbc_getxattr we can read:

* @param size      The size of the buffer pointed to by value.  This parameter
*                  may also be zero, in which case the size of the buffer
*                  required to hold the attribute value will be returned,
*                  but nothing will be placed into the value buffer.

however, if we set size parameter to 0, we get -1 returned and errno is set to 34 (Numerical result out of range)

But if we put a buffer with a decent size eg 1024 the function returns the buffer size needed and the ACLs requested in the buffer.

This is a minor bug but wanted to report it.
Comment 1 Derrell Lipman 2007-05-09 14:23:10 UTC
Created attachment 2688 [details]
likely fix for described problem

A quick look reveals one missing test for whether we are just determining the size.  Please try the attached patch and let me know the results.

Thanks,

Derrell
Comment 2 Henrik (dead mail address) 2007-05-14 04:18:41 UTC
Hi Derrell,

Looks like we have a winner! =)

Wouldn't be nice if all bugs were this easy to solve?

Good job /henrik
Comment 3 Derrell Lipman 2007-05-14 09:22:20 UTC
Fixed by check-in 22850, 22851