#include #include #include #include #include "libsmbclient.h" #include #include #include static void get_auth_data_fn(const char * pServer, const char * pShare, char * pWorkgroup, int maxLenWorkgroup, char * pUsername, int maxLenUsername, char * pPassword, int maxLenPassword) { strcpy(pWorkgroup, "Workgroup"); strcpy(pUsername, "test"); strcpy(pPassword, "test"); return; } int main(int argc, const char *argv[]) { int debug = 10; char smbfile[1024]; static char *the_acl = NULL; int ret; char value[1024]; char name[256]= {} , *ptr; struct stat st; int inode_number; SMBCCTX *context; if (argc != 2) { fprintf(stderr , "%s ",argv[0]); exit(1); } strcpy(smbfile,argv[1]); if (smbc_init(get_auth_data_fn, debug) != 0) { printf("Could not initialize smbc_ library\n"); return 1; } smbc_stat(smbfile, &st); the_acl = strdup("system.nt_sec_desc.owner+"); ret = smbc_getxattr(smbfile, the_acl, value, sizeof(value)); if (ret < 0) { printf("Could not get attributes for [%s] %d: %s\n", smbfile, errno, strerror(errno)); return 1; } printf("OWNER NAME: %s \n\n", value); smbc_stat(smbfile, &st); the_acl = strdup("system.nt_sec_desc.owner+"); ret = smbc_getxattr(smbfile, the_acl, value, sizeof(value)); if (ret < 0) { printf("Could not get attributes for [%s] %d: %s\n", smbfile, errno, strerror(errno)); return 1; } printf("OWNER NAME: %s \n\n", value); smbc_stat(smbfile, &st); smbc_stat(smbfile, &st); smbc_stat(smbfile, &st); memset(value, 0, sizeof(value)); the_acl = strdup("system.nt_sec_desc.owner+"); ret = smbc_getxattr(smbfile, the_acl, value, sizeof(value)); if (ret < 0) { printf("Could not get attributes for [%s] %d: %s\n", smbfile, errno, strerror(errno)); return 1; } printf("OWNER NAME: %s \n\n", value); return 0; }