Need help: How to get share permissions

Dhivya Sundhari sdhivya at novell.com
Mon Oct 15 07:20:38 MDT 2012


Hi,

I am using smbc_getxattr (public interface defined in libsmbclient.h) to get share's NTFS permissions. Following that I was looking for apis to get share permissions and figured out its possible using NetrShareGetInfo RPC. 

Using rpcclient I am able to get the information:
=================================================
$ rpcclient  serverip -Uusername%password -c "netsharegetinfo sh 502" 
    remark:    
    path:    C:\Documents and Settings\Administrator\Desktop\sh
    password:    (null)
    type:    0x0
    perms:    0
    max_uses:    -1
    num_uses:    1
revision: 1
type: 0x8004: SEC_DESC_DACL_PRESENT SEC_DESC_SELF_RELATIVE 
DACL
    ACL    Num ACEs:    2    revision:    2
    ---
    ACE
        type: ACCESS ALLOWED (0) flags: 0x00 
        Specific bits: 0x1ff
        Permissions: 0x1f01ff: SYNCHRONIZE_ACCESS WRITE_OWNER_ACCESS WRITE_DAC_ACCESS READ_CONTROL_ACCESS DELETE_ACCESS 
        SID: S-1-1-0

===============================================================

This is the information I am interested in 
"Permissions: 0x1f01ff: SYNCHRONIZE_ACCESS WRITE_OWNER_ACCESS WRITE_DAC_ACCESS READ_CONTROL_ACCESS DELETE_ACCESS
SID: S-1-1-0"

I am using libnetapi's function "NetShareGetInfo" in the test program to get similar result as that of rpcclient. 
But the rpc call with level 502 is failing with error 50 (not_supported).  Other levels of this rpc dosen't return sec_desc_buf. 

Can anybody help me in identifying other ways to get share permissions?


Thanks,
Dhivya 




More information about the samba-technical mailing list