diff options
Diffstat (limited to 'source/rpcclient/dfs_cmds.c')
-rw-r--r-- | source/rpcclient/dfs_cmds.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/source/rpcclient/dfs_cmds.c b/source/rpcclient/dfs_cmds.c new file mode 100644 index 00000000000..6c21970333b --- /dev/null +++ b/source/rpcclient/dfs_cmds.c @@ -0,0 +1,64 @@ +#include "includes.h" +#include "ntdomain.h" +#include "rpcclient.h" +#include "rpc_parse.h" + +extern struct client_info cli_info; + +/* DFS command completion function */ +char *complete_dfsenum(char *text, int state) +{ + static uint32 i=0; + DFS_INFO_CTR ctr; + fstring srv_name; + + fstrcpy(srv_name, "\\\\"); + fstrcat(srv_name, cli_info.dest_host); + strupper(srv_name); + + /* first time that the completion is called */ + if(i==0 && state==0) + { + free(ctr.dfs.info1); + if(0 != dfs_enum(srv_name, 1, &ctr)) + { + return NULL; + } + + } + + for(; i<ctr.num_entries;i++) + { + fstring dfspath; + unistr2_to_ascii(dfspath, &(ctr.dfs.info1[i].entrypath), + sizeof(dfspath)-1); + strupper(dfspath); + if(text==NULL || text[0] == 0 || + strnequal(text, dfspath, strlen(text))) + { + char *name = strdup(dfspath); + i++; + return name; + } + } + return NULL; +} + + +/**************************************************************************** + Defines Dfs commands supported by this client + ***************************************************************************/ + +static const struct command_set dfs_commands[] = +{ + { "dfsenum", cmd_dfs_enum, "Enumerate Dfs volumes", {NULL, NULL} }, + { "dfsadd" , cmd_dfs_add, "Add a Dfs volume", {complete_dfsenum, NULL} }, + { "dfsremove", cmd_dfs_remove, "Remove a Dfs volume", + {complete_dfsenum, NULL} }, + { "", NULL, NULL, {NULL, NULL} } +}; + +void add_dfs_commands(void) +{ + add_command_set(dfs_commands); +} |