Question on SMBC_setxattr() in libsmbclient library

Har Gagan Sahai HarGagan.Sahai at microfocus.com
Thu Sep 3 08:22:07 UTC 2015


Hi Samba Team, 


I have a question regarding the SMBC_setxattr() used to set the nt-security-descriptor. During the process of creating the request it is setting the 'ret = -1' which is causing the failure of the API. Here is the code snippet in cacl_set() [notice the statement in bold ] that I found to be causing the problem  : 


case SMBC_XATTR_MODE_ADD: 
                for (i=0;sd->dacl && i<sd->dacl->num_aces;i++) { 
                        bool found = False; 


                        for (j=0;old->dacl && j<old->dacl->num_aces;j++) { 
                                if (dom_sid_equal(&sd->dacl->aces[i].trustee, 
                                              &old->dacl->aces[j].trustee)) { 
                                        if (!(flags & SMBC_XATTR_FLAG_CREATE)) { 
                                                err = EEXIST; 
                                                ret = -1; 
                                                goto failed; 
                                        } 
                                        old->dacl->aces[j] = sd->dacl->aces[i]; 
                                        ret = -1; 
                                        found = True; 
                                } 
                        } 


                        if (!found && (flags & SMBC_XATTR_FLAG_REPLACE)) { 
                                err = ENOATTR; 
                                ret = -1; 
                                goto failed; 
                        } 


                        for (i=0;sd->dacl && i<sd->dacl->num_aces;i++) { 
                                add_ace(&old->dacl, &sd->dacl->aces[i], ctx); 
                        } 
                } 
                dacl = old->dacl; 
                break; 


Kindly let me know the reason behind this condition as this causing the failure of the usage. Incase this is not as intended let me know I can file a bug for this.  


Thanks, 
Har Gagan Sahai 


More information about the samba-technical mailing list