Bug 4599 - smbc_setxattr can't be called twice with same context
smbc_setxattr can't be called twice with same context
Status: RESOLVED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient
3.0.25
x86 Linux
: P3 normal
: none
Assigned To: Derrell Lipman
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-08 03:40 UTC by Henrik
Modified: 2007-05-15 14:19 UTC (History)
0 users

See Also:


Attachments
Testcase based on testacl.c (2.52 KB, application/zip)
2007-05-08 03:41 UTC, Henrik
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik 2007-05-08 03:40:11 UTC
Hello Derrell,

We've noticed that smbc_setxattr can't be called twice with the same context. 
Attached is a test program based on testacl.c. It tries to set a whole system.nt_sec_desc.*.
We've made some changes to the attached Makefile so you might want to change some paths.
We also hardcoded a complete ACL with our SIDs so those won't probably not work. =)

Set ACL is hard coded to the following:
the_acl = "system.nt_sec_desc.*";
p = "REVISION:1,OWNER:S-1-5-21-517669159-3449754103-2304587396-1005,GROUP:S-1-5-21-517669159-3449754103-2304587396-513,ACL:S-1-5-21-517669159-3449754103-2304587396-1005:0/16/0x001f01ff,ACL:S-1-5-21-517669159-3449754103-2304587396-1018:0/3/0x001200a9,ACL:S-1-3-0:0/27/0x001f01ff,ACL:S-1-5-18:0/19/0x001f01ff,ACL:S-1-5-32-545:0/18/0x00100004,ACL:S-1-5-32-545:0/18/0x00100002,ACL:S-1-5-32-545:0/19/0x001200a9,ACL:S-1-5-32-544:0/19/0x001f01ff";

Setting an acl twice fails on second try with errno = 0
-------------------------------------------------------
$ ./testacl -S smb://10.168.1.133/C$/acl/moo/test.txt
counter: 0
Workgroup: [KIC]
Username: [jonas] admin
Password: admin
counter: 1
Workgroup: [KIC]
Username: [jonas] admin
Password: admin
Could not set attributes for [smb://10.168.1.133/C$/acl/moo] 0: Success


We also noticed that the remove_xattr tries to free a pointer twice. We don't which one tough...
Trying to remove owner acl gets an error
----------------------------------------
$ ./testacl -D system.nt_sec_desc.owner smb://10.168.1.133/C$/acl/moo
Workgroup: [KIC]
Username: [jonas] admin
Password: admin
Could not remove attribute system.nt_sec_desc.owner for [smb://10.168.1.133/C$/acl/moo] 22:Invalid argument


Trying to remove all acls crash the program
-------------------------------------------
$ ./testacl -D system.nt_sec_desc.* smb://10.168.1.133/C$/acl/moo
Workgroup: [KIC]
Username: [jonas] admin
Password: admin
*** glibc detected *** free(): invalid pointer: 0x080e5698 ***
Aborted

Cheers,
Henrik
Comment 1 Henrik 2007-05-08 03:41:09 UTC
Created attachment 2687 [details]
Testcase based on testacl.c
Comment 2 Derrell Lipman 2007-05-15 14:19:36 UTC
Fixed by checkins 22914-22917.  Thanks for the report!

Also see new test program examples/libsmbclient/testacl2.c

Derrell