diff options
author | Jeremy Allison <jra@samba.org> | 2004-11-12 23:42:12 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-11-12 23:42:12 +0000 |
commit | 1a606bad60c6501516540f677f73ad98a8b26cb0 (patch) | |
tree | c8de53ef0185b7e934ba9645c9781f95362b6cf1 /source/client | |
parent | cffd3c99cee0547836dbc932a29dae48dc7b8017 (diff) | |
download | samba-1a606bad60c6501516540f677f73ad98a8b26cb0.tar.gz samba-1a606bad60c6501516540f677f73ad98a8b26cb0.tar.xz samba-1a606bad60c6501516540f677f73ad98a8b26cb0.zip |
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.
Diffstat (limited to 'source/client')
-rw-r--r-- | source/client/client.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/client/client.c b/source/client/client.c index 311eaef8f21..5644635de7c 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -1789,6 +1789,52 @@ static char *unix_mode_to_str(char *s, mode_t m) } /**************************************************************************** + 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,"<mask> 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,"<remote name> [local name] get a file",{COMPL_REMOTE,COMPL_LOCAL}}, + {"getfacl",cmd_getfacl,"<file name> get the POSIX ACL on a file (UNIX extensions only)",{COMPL_REMOTE,COMPL_LOCAL}}, {"hardlink",cmd_hardlink,"<src> <dest> 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}}, |