From f995b164b98221e224661e370d61ad08dadb2986 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 12 Nov 2004 23:42:12 +0000 Subject: r3713: Implementation of get posix acls in UNIX extensions. Passes valgrind. Need to add printout functions in client and set posix acl in server. SteveF - take a look at this for the cifsfs client ! Once this is working and tested the next step is to write this up for the UNIX extensions spec. documents. Jeremy. (This used to be commit 1bd3f133442a472b4718b94a636f2fec89a2e0dc) --- source3/client/client.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'source3/client/client.c') diff --git a/source3/client/client.c b/source3/client/client.c index 311eaef8f2..5644635de7 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1788,6 +1788,52 @@ static char *unix_mode_to_str(char *s, mode_t m) return s; } +/**************************************************************************** + UNIX getfacl. +****************************************************************************/ + +static int cmd_getfacl(void) +{ + pstring src, name; + uint16 major, minor; + uint32 caplow, caphigh; + char *retbuf = NULL; + + if (!SERVER_HAS_UNIX_CIFS(cli)) { + d_printf("Server doesn't support UNIX CIFS calls.\n"); + return 1; + } + + if (!cli_unix_extensions_version(cli, &major, &minor, &caplow, &caphigh)) { + d_printf("Can't get UNIX CIFS version from server.\n"); + return 1; + } + + if (!(caplow & CIFS_UNIX_POSIX_ACLS_CAP)) { + d_printf("This server supports UNIX extensions but doesn't support POSIX ACLs.\n"); + return 1; + } + + pstrcpy(src,cur_dir); + + if (!next_token_nr(NULL,name,NULL,sizeof(name))) { + d_printf("stat file\n"); + return 1; + } + + pstrcat(src,name); + + if (!cli_unix_getfacl(cli, src, &retbuf)) { + d_printf("%s getfacl file %s\n", + cli_errstr(cli), src); + return 1; + } + + /* ToDo : Print out the ACL values. */ + SAFE_FREE(retbuf); + return 0; +} + /**************************************************************************** UNIX stat. ****************************************************************************/ @@ -2355,6 +2401,7 @@ static struct {"du",cmd_du," computes the total size of the current directory",{COMPL_REMOTE,COMPL_NONE}}, {"exit",cmd_quit,"logoff the server",{COMPL_NONE,COMPL_NONE}}, {"get",cmd_get," [local name] get a file",{COMPL_REMOTE,COMPL_LOCAL}}, + {"getfacl",cmd_getfacl," get the POSIX ACL on a file (UNIX extensions only)",{COMPL_REMOTE,COMPL_LOCAL}}, {"hardlink",cmd_hardlink," create a Windows hard link",{COMPL_REMOTE,COMPL_REMOTE}}, {"help",cmd_help,"[command] give help on a command",{COMPL_NONE,COMPL_NONE}}, {"history",cmd_history,"displays the command history",{COMPL_NONE,COMPL_NONE}}, -- cgit