1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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);
}
|