mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
net: Rename functable3 to functable, get rid of old functables
This commit is contained in:
@ -313,7 +313,7 @@ static int net_maxrid(struct net_context *c, int argc, const char **argv)
|
||||
}
|
||||
|
||||
/* main function table */
|
||||
static struct functable3 net_func[] = {
|
||||
static struct functable net_func[] = {
|
||||
{
|
||||
"rpc",
|
||||
net_rpc,
|
||||
@ -759,7 +759,7 @@ static struct functable3 net_func[] = {
|
||||
}
|
||||
|
||||
c->private_data = net_func;
|
||||
rc = net_run_function3(c, argc_new-1, argv_new+1, "net", net_func);
|
||||
rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
|
||||
|
||||
DEBUG(2,("return code = %d\n", rc));
|
||||
|
||||
|
@ -74,17 +74,6 @@ struct net_context {
|
||||
struct functable {
|
||||
const char *funcname;
|
||||
int (*fn)(struct net_context *c, int argc, const char **argv);
|
||||
};
|
||||
|
||||
struct functable2 {
|
||||
const char *funcname;
|
||||
int (*fn)(struct net_context *c, int argc, const char **argv);
|
||||
const char *helptext;
|
||||
};
|
||||
|
||||
struct functable3 {
|
||||
const char *funcname;
|
||||
int (*fn)(struct net_context *c, int argc, const char **argv);
|
||||
int valid_transports;
|
||||
const char *description;
|
||||
const char *usage;
|
||||
|
@ -603,7 +603,7 @@ static int ads_user_delete(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_ads_user(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
ads_user_add,
|
||||
@ -663,7 +663,7 @@ int net_ads_user(struct net_context *c, int argc, const char **argv)
|
||||
return ADS_ERR_OK(rc) ? 0 : -1;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads user", func);
|
||||
return net_run_function(c, argc, argv, "net ads user", func);
|
||||
}
|
||||
|
||||
static int net_ads_group_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -762,7 +762,7 @@ static int ads_group_delete(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_ads_group(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
ads_group_add,
|
||||
@ -813,7 +813,7 @@ int net_ads_group(struct net_context *c, int argc, const char **argv)
|
||||
ads_destroy(&ads);
|
||||
return ADS_ERR_OK(rc) ? 0 : -1;
|
||||
}
|
||||
return net_run_function3(c, argc, argv, "net ads group", func);
|
||||
return net_run_function(c, argc, argv, "net ads group", func);
|
||||
}
|
||||
|
||||
static int net_ads_status(struct net_context *c, int argc, const char **argv)
|
||||
@ -1405,7 +1405,7 @@ static int net_ads_dns_gethostbyname(struct net_context *c, int argc, const char
|
||||
|
||||
static int net_ads_dns(struct net_context *c, int argc, const char *argv[])
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"register",
|
||||
net_ads_dns_register,
|
||||
@ -1425,7 +1425,7 @@ static int net_ads_dns(struct net_context *c, int argc, const char *argv[])
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads dns", func);
|
||||
return net_run_function(c, argc, argv, "net ads dns", func);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -1730,7 +1730,7 @@ static int net_ads_printer_remove(struct net_context *c, int argc, const char **
|
||||
|
||||
static int net_ads_printer(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"search",
|
||||
net_ads_printer_search,
|
||||
@ -1766,7 +1766,7 @@ static int net_ads_printer(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads printer", func);
|
||||
return net_run_function(c, argc, argv, "net ads printer", func);
|
||||
}
|
||||
|
||||
|
||||
@ -2178,7 +2178,7 @@ static int net_ads_keytab_list(struct net_context *c, int argc, const char **arg
|
||||
|
||||
int net_ads_keytab(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
net_ads_keytab_add,
|
||||
@ -2219,7 +2219,7 @@ int net_ads_keytab(struct net_context *c, int argc, const char **argv)
|
||||
use keytab functions.\n");
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads keytab", func);
|
||||
return net_run_function(c, argc, argv, "net ads keytab", func);
|
||||
}
|
||||
|
||||
static int net_ads_kerberos_renew(struct net_context *c, int argc, const char **argv)
|
||||
@ -2333,7 +2333,7 @@ static int net_ads_kerberos_kinit(struct net_context *c, int argc, const char **
|
||||
|
||||
int net_ads_kerberos(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"kinit",
|
||||
net_ads_kerberos_kinit,
|
||||
@ -2361,12 +2361,12 @@ int net_ads_kerberos(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads kerberos", func);
|
||||
return net_run_function(c, argc, argv, "net ads kerberos", func);
|
||||
}
|
||||
|
||||
int net_ads(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"info",
|
||||
net_ads_info,
|
||||
@ -2522,7 +2522,7 @@ int net_ads(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads", func);
|
||||
return net_run_function(c, argc, argv, "net ads", func);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -615,7 +615,7 @@ out:
|
||||
|
||||
int net_ads_gpo(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
#if 0
|
||||
{
|
||||
"apply",
|
||||
@ -689,7 +689,7 @@ int net_ads_gpo(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net ads gpo", func);
|
||||
return net_run_function(c, argc, argv, "net ads gpo", func);
|
||||
}
|
||||
|
||||
#endif /* HAVE_ADS */
|
||||
|
@ -90,7 +90,7 @@ int net_afs_impersonate(struct net_context *c, int argc,
|
||||
|
||||
int net_afs(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"key",
|
||||
net_afs_key,
|
||||
@ -109,6 +109,6 @@ int net_afs(struct net_context *c, int argc, const char **argv)
|
||||
},
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
return net_run_function3(c, argc, argv, "net afs", func);
|
||||
return net_run_function(c, argc, argv, "net afs", func);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ static int net_cache_flush(struct net_context *c, int argc, const char **argv)
|
||||
**/
|
||||
int net_cache(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
net_cache_add,
|
||||
@ -369,5 +369,5 @@ int net_cache(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net cache", func);
|
||||
return net_run_function(c, argc, argv, "net cache", func);
|
||||
}
|
||||
|
@ -1024,7 +1024,7 @@ struct conf_functable {
|
||||
};
|
||||
|
||||
/**
|
||||
* This imitates net_run_function3 but calls the main functions
|
||||
* This imitates net_run_function but calls the main functions
|
||||
* through the wrapper net_conf_wrap_function().
|
||||
*/
|
||||
static int net_conf_run_function(struct net_context *c, int argc,
|
||||
|
@ -227,7 +227,7 @@ int net_dom(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
NET_API_STATUS status;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"join",
|
||||
net_dom_join,
|
||||
@ -257,5 +257,5 @@ int net_dom(struct net_context *c, int argc, const char **argv)
|
||||
libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
|
||||
libnetapi_set_password(c->netapi_ctx, c->opt_password);
|
||||
|
||||
return net_run_function3(c, argc, argv, "net dom", func);
|
||||
return net_run_function(c, argc, argv, "net dom", func);
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ static int net_groupmap_memberships(struct net_context *c, int argc, const char
|
||||
**********************************************************/
|
||||
int net_groupmap(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
net_groupmap_add,
|
||||
@ -901,6 +901,6 @@ int net_groupmap(struct net_context *c, int argc, const char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return net_run_function3(c,argc, argv, "net groupmap", func);
|
||||
return net_run_function(c,argc, argv, "net groupmap", func);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ static int net_help_usage(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
static int net_usage(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 *table = (struct functable3*) c->private_data;
|
||||
struct functable *table = (struct functable*) c->private_data;
|
||||
int i;
|
||||
|
||||
d_printf("Usage:\n");
|
||||
@ -54,7 +54,7 @@ static int net_usage(struct net_context *c, int argc, const char **argv)
|
||||
*/
|
||||
int net_help(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 *func = (struct functable3 *)c->private_data;
|
||||
struct functable *func = (struct functable *)c->private_data;
|
||||
|
||||
if (argc == 0) {
|
||||
return net_usage(c, argc, argv);
|
||||
@ -65,5 +65,5 @@ int net_help(struct net_context *c, int argc, const char **argv)
|
||||
}
|
||||
|
||||
c->display_usage = true;
|
||||
return net_run_function3(c, argc, argv, "net help", func);
|
||||
return net_run_function(c, argc, argv, "net help", func);
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ fail:
|
||||
**********************************************************/
|
||||
int net_idmap(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"dump",
|
||||
net_idmap_dump,
|
||||
@ -435,7 +435,7 @@ int net_idmap(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net idmap", func);
|
||||
return net_run_function(c, argc, argv, "net idmap", func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -449,14 +449,8 @@ NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
|
||||
unsigned flags, struct cli_state **pcli);
|
||||
const char *net_prompt_pass(struct net_context *c, const char *user);
|
||||
int net_run_function(struct net_context *c, int argc, const char **argv,
|
||||
struct functable *table,
|
||||
int (*usage_fn)(struct net_context *c,
|
||||
int argc, const char **argv));
|
||||
int net_run_function2(struct net_context *c, int argc, const char **argv,
|
||||
const char *whoami, struct functable2 *table);
|
||||
int net_run_function3(struct net_context *c, int argc, const char **argv,
|
||||
const char *whoami, struct functable3 *table);
|
||||
void net_display_usage_from_functable(struct functable3 *table);
|
||||
const char *whoami, struct functable *table);
|
||||
void net_display_usage_from_functable(struct functable *table);
|
||||
|
||||
/* The following definitions come from utils/netlookup.c */
|
||||
|
||||
|
@ -132,7 +132,7 @@ static int rap_file_user(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rap_file(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"close",
|
||||
rap_file_close,
|
||||
@ -189,7 +189,7 @@ int net_rap_file(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap file", func);
|
||||
return net_run_function(c, argc, argv, "net rap file", func);
|
||||
}
|
||||
|
||||
int net_rap_share_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -271,7 +271,7 @@ static int rap_share_add(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rap_share(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"delete",
|
||||
rap_share_delete,
|
||||
@ -328,7 +328,7 @@ int net_rap_share(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap share", func);
|
||||
return net_run_function(c, argc, argv, "net rap share", func);
|
||||
}
|
||||
|
||||
int net_rap_session_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -436,7 +436,7 @@ static int rap_session_delete(struct net_context *c, int argc, const char **argv
|
||||
|
||||
int net_rap_session(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"info",
|
||||
rap_session_info,
|
||||
@ -490,7 +490,7 @@ int net_rap_session(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap session", func);
|
||||
return net_run_function(c, argc, argv, "net rap session", func);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -558,7 +558,7 @@ static int net_rap_server_domain(struct net_context *c, int argc,
|
||||
|
||||
int net_rap_server(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"name",
|
||||
net_rap_server_name,
|
||||
@ -580,7 +580,7 @@ int net_rap_server(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
/* smb4k uses 'net [rap|rpc] server domain' to query servers in a domain */
|
||||
/* Fall through for 'domain', any other forms will cause to show usage message */
|
||||
return net_run_function3(c, argc, argv, "net rap server", func);
|
||||
return net_run_function(c, argc, argv, "net rap server", func);
|
||||
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv)
|
||||
struct cli_state *cli;
|
||||
int ret;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"info",
|
||||
rap_printq_info,
|
||||
@ -766,7 +766,7 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap printq", func);
|
||||
return net_run_function(c, argc, argv, "net rap printq", func);
|
||||
}
|
||||
|
||||
static int net_rap_user_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -858,7 +858,7 @@ static int rap_user_info(struct net_context *c, int argc, const char **argv)
|
||||
int net_rap_user(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
int ret = -1;
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rap_user_add,
|
||||
@ -911,7 +911,7 @@ int net_rap_user(struct net_context *c, int argc, const char **argv)
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = net_run_function3(c, argc, argv, "net rap user", func);
|
||||
ret = net_run_function(c, argc, argv, "net rap user", func);
|
||||
done:
|
||||
if (ret != 0) {
|
||||
DEBUG(1, ("Net user returned: %d\n", ret));
|
||||
@ -977,7 +977,7 @@ static int rap_group_add(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rap_group(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rap_group_add,
|
||||
@ -1022,7 +1022,7 @@ int net_rap_group(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap group", func);
|
||||
return net_run_function(c, argc, argv, "net rap group", func);
|
||||
}
|
||||
|
||||
int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -1090,7 +1090,7 @@ static int rap_groupmember_list(struct net_context *c, int argc, const char **ar
|
||||
|
||||
int net_rap_groupmember(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rap_groupmember_add,
|
||||
@ -1118,7 +1118,7 @@ int net_rap_groupmember(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap groupmember", func);
|
||||
return net_run_function(c, argc, argv, "net rap groupmember", func);
|
||||
}
|
||||
|
||||
int net_rap_validate_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -1168,7 +1168,7 @@ static void service_fn(const char *service_name, const char *dummy,
|
||||
|
||||
int net_rap_service(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"start",
|
||||
rap_service_start,
|
||||
@ -1212,7 +1212,7 @@ int net_rap_service(struct net_context *c, int argc, const char **argv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap service", func);
|
||||
return net_run_function(c, argc, argv, "net rap service", func);
|
||||
}
|
||||
|
||||
int net_rap_password_usage(struct net_context *c, int argc, const char **argv)
|
||||
@ -1261,7 +1261,7 @@ int net_rap_admin(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rap(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"file",
|
||||
net_rap_file,
|
||||
@ -1369,6 +1369,6 @@ int net_rap(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rap", func);
|
||||
return net_run_function(c, argc, argv, "net rap", func);
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ int net_registry(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"enumerate",
|
||||
net_registry_enumerate,
|
||||
@ -525,7 +525,7 @@ int net_registry(struct net_context *c, int argc, const char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = net_run_function3(c, argc, argv, "net registry", func);
|
||||
ret = net_run_function(c, argc, argv, "net registry", func);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
NET_API_STATUS status;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rpc_user_add,
|
||||
@ -1243,7 +1243,7 @@ int net_rpc_user(struct net_context *c, int argc, const char **argv)
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc user", func);
|
||||
return net_run_function(c, argc, argv, "net rpc user", func);
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_sh_user_list(struct net_context *c,
|
||||
@ -3020,7 +3020,7 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
NET_API_STATUS status;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rpc_group_add,
|
||||
@ -3102,7 +3102,7 @@ int net_rpc_group(struct net_context *c, int argc, const char **argv)
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc group", func);
|
||||
return net_run_function(c, argc, argv, "net rpc group", func);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -4084,7 +4084,7 @@ static int rpc_share_migrate_all(struct net_context *c, int argc,
|
||||
static int rpc_share_migrate(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"all",
|
||||
rpc_share_migrate_all,
|
||||
@ -4122,7 +4122,7 @@ static int rpc_share_migrate(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
net_mode_share = NET_MODE_SHARE_MIGRATE;
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc share migrate", func);
|
||||
return net_run_function(c, argc, argv, "net rpc share migrate", func);
|
||||
}
|
||||
|
||||
struct full_alias {
|
||||
@ -4926,7 +4926,7 @@ int net_usersidlist_usage(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rpc_share(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rpc_share_add,
|
||||
@ -4986,7 +4986,7 @@ int net_rpc_share(struct net_context *c, int argc, const char **argv)
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc share", func);
|
||||
return net_run_function(c, argc, argv, "net rpc share", func);
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_sh_share_list(struct net_context *c,
|
||||
@ -5288,7 +5288,7 @@ static int rpc_file_user(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rpc_file(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"close",
|
||||
rpc_file_close,
|
||||
@ -5332,7 +5332,7 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv)
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc file", func);
|
||||
return net_run_function(c, argc, argv, "net rpc file", func);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6699,7 +6699,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
static int rpc_trustdom(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
rpc_trustdom_add,
|
||||
@ -6751,7 +6751,7 @@ static int rpc_trustdom(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc trustdom", func);
|
||||
return net_run_function(c, argc, argv, "net rpc trustdom", func);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7046,7 +7046,7 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv)
|
||||
rpc_printer_migrate_drivers_internals, the printer-queue already
|
||||
*has* to exist */
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"all",
|
||||
rpc_printer_migrate_all,
|
||||
@ -7098,7 +7098,7 @@ int rpc_printer_migrate(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc printer migrate",func);
|
||||
return net_run_function(c, argc, argv, "net rpc printer migrate",func);
|
||||
}
|
||||
|
||||
|
||||
@ -7265,7 +7265,7 @@ static int rpc_printer_publish(struct net_context *c, int argc,
|
||||
const char **argv)
|
||||
{
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"publish",
|
||||
rpc_printer_publish_publish,
|
||||
@ -7315,7 +7315,7 @@ static int rpc_printer_publish(struct net_context *c, int argc,
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc printer publish",func);
|
||||
return net_run_function(c, argc, argv, "net rpc printer publish",func);
|
||||
|
||||
}
|
||||
|
||||
@ -7369,7 +7369,7 @@ int rpc_printer_usage(struct net_context *c, int argc, const char **argv)
|
||||
**/
|
||||
int net_rpc_printer(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"list",
|
||||
rpc_printer_list,
|
||||
@ -7418,7 +7418,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv)
|
||||
argc, argv);
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc printer", func);
|
||||
return net_run_function(c, argc, argv, "net rpc printer", func);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7432,7 +7432,7 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rpc(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"audit",
|
||||
net_rpc_audit,
|
||||
@ -7612,5 +7612,5 @@ int net_rpc(struct net_context *c, int argc, const char **argv)
|
||||
},
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
return net_run_function3(c, argc, argv, "net rpc", func);
|
||||
return net_run_function(c, argc, argv, "net rpc", func);
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ static int rpc_audit_list(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rpc_audit(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"get",
|
||||
rpc_audit_get,
|
||||
@ -490,5 +490,5 @@ int net_rpc_audit(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc audit", func);
|
||||
return net_run_function(c, argc, argv, "net rpc audit", func);
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ static int rpc_registry_getsd(struct net_context *c, int argc, const char **argv
|
||||
|
||||
int net_rpc_registry(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"enumerate",
|
||||
rpc_registry_enumerate,
|
||||
@ -1307,5 +1307,5 @@ int net_rpc_registry(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc registry", func);
|
||||
return net_run_function(c, argc, argv, "net rpc registry", func);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ static int rpc_rights_revoke(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_rpc_rights(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"list",
|
||||
rpc_rights_list,
|
||||
@ -651,7 +651,7 @@ int net_rpc_rights(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc rights", func);
|
||||
return net_run_function(c, argc, argv, "net rpc rights", func);
|
||||
}
|
||||
|
||||
static NTSTATUS rpc_sh_rights_list(struct net_context *c,
|
||||
|
@ -669,7 +669,7 @@ static int rpc_service_status(struct net_context *c, int argc, const char **argv
|
||||
|
||||
int net_rpc_service(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"list",
|
||||
rpc_service_list,
|
||||
@ -721,5 +721,5 @@ int net_rpc_service(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net rpc service",func);
|
||||
return net_run_function(c, argc, argv, "net rpc service",func);
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ static int net_sam_set_comment(struct net_context *c, int argc,
|
||||
|
||||
static int net_sam_set(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"homedir",
|
||||
net_sam_set_homedir,
|
||||
@ -440,7 +440,7 @@ static int net_sam_set(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net sam set", func);
|
||||
return net_run_function(c, argc, argv, "net sam set", func);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -587,7 +587,7 @@ static int net_sam_policy_list(struct net_context *c, int argc, const char **arg
|
||||
|
||||
static int net_sam_policy(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"list",
|
||||
net_sam_policy_list,
|
||||
@ -615,7 +615,7 @@ static int net_sam_policy(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net sam policy", func);
|
||||
return net_run_function(c, argc, argv, "net sam policy", func);
|
||||
}
|
||||
|
||||
extern PRIVS privs[];
|
||||
@ -740,7 +740,7 @@ static int net_sam_rights_revoke(struct net_context *c, int argc, const char **a
|
||||
|
||||
static int net_sam_rights(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"list",
|
||||
net_sam_rights_list,
|
||||
@ -767,7 +767,7 @@ static int net_sam_rights(struct net_context *c, int argc, const char **argv)
|
||||
},
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
return net_run_function3(c, argc, argv, "net sam rights", func);
|
||||
return net_run_function(c, argc, argv, "net sam rights", func);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1316,7 +1316,7 @@ static int net_sam_list_workstations(struct net_context *c, int argc,
|
||||
|
||||
static int net_sam_list(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"users",
|
||||
net_sam_list_users,
|
||||
@ -1360,7 +1360,7 @@ static int net_sam_list(struct net_context *c, int argc, const char **argv)
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
return net_run_function3(c, argc, argv, "net sam list", func);
|
||||
return net_run_function(c, argc, argv, "net sam list", func);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1808,7 +1808,7 @@ failed:
|
||||
**********************************************************/
|
||||
int net_sam(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"createbuiltingroup",
|
||||
net_sam_createbuiltingroup,
|
||||
@ -1933,6 +1933,6 @@ int net_sam(struct net_context *c, int argc, const char **argv)
|
||||
"work\n");
|
||||
}
|
||||
|
||||
return net_run_function3(c, argc, argv, "net sam", func);
|
||||
return net_run_function(c, argc, argv, "net sam", func);
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ static int net_status_shares(struct net_context *c, int argc, const char **argv)
|
||||
|
||||
int net_status(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"sessions",
|
||||
net_status_sessions,
|
||||
@ -265,5 +265,5 @@ int net_status(struct net_context *c, int argc, const char **argv)
|
||||
},
|
||||
{NULL, NULL, 0, NULL, NULL}
|
||||
};
|
||||
return net_run_function3(c, argc, argv, "net status", func);
|
||||
return net_run_function(c, argc, argv, "net status", func);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ static int net_time_zone(struct net_context *c, int argc, const char **argv)
|
||||
int net_time(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
time_t t;
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"system",
|
||||
net_time_system,
|
||||
@ -209,7 +209,7 @@ int net_time(struct net_context *c, int argc, const char **argv)
|
||||
};
|
||||
|
||||
if (argc != 0) {
|
||||
return net_run_function3(c, argc, argv, "net time", func);
|
||||
return net_run_function(c, argc, argv, "net time", func);
|
||||
}
|
||||
|
||||
if (c->display_usage) {
|
||||
|
@ -1012,7 +1012,7 @@ int net_usershare(struct net_context *c, int argc, const char **argv)
|
||||
{
|
||||
SMB_STRUCT_DIR *dp;
|
||||
|
||||
struct functable3 func[] = {
|
||||
struct functable func[] = {
|
||||
{
|
||||
"add",
|
||||
net_usershare_add,
|
||||
@ -1069,5 +1069,5 @@ int net_usershare(struct net_context *c, int argc, const char **argv)
|
||||
}
|
||||
sys_closedir(dp);
|
||||
|
||||
return net_run_function3(c, argc, argv, "net usershare", func);
|
||||
return net_run_function(c, argc, argv, "net usershare", func);
|
||||
}
|
||||
|
@ -546,57 +546,8 @@ const char *net_prompt_pass(struct net_context *c, const char *user)
|
||||
return pass;
|
||||
}
|
||||
|
||||
/*
|
||||
run a function from a function table. If not found then
|
||||
call the specified usage function
|
||||
*/
|
||||
int net_run_function(struct net_context *c, int argc, const char **argv,
|
||||
struct functable *table,
|
||||
int (*usage_fn)(struct net_context *c,
|
||||
int argc, const char **argv))
|
||||
{
|
||||
int i;
|
||||
|
||||
if (argc < 1) {
|
||||
d_printf("\nUsage: \n");
|
||||
return usage_fn(c, argc, argv);
|
||||
}
|
||||
for (i=0; table[i].funcname; i++) {
|
||||
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
|
||||
return table[i].fn(c, argc-1, argv+1);
|
||||
}
|
||||
d_fprintf(stderr, "No command: %s\n", argv[0]);
|
||||
return usage_fn(c, argc, argv);
|
||||
}
|
||||
|
||||
/*
|
||||
* run a function from a function table.
|
||||
*/
|
||||
int net_run_function2(struct net_context *c, int argc, const char **argv,
|
||||
const char *whoami, struct functable2 *table)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (argc != 0) {
|
||||
for (i=0; table[i].funcname; i++) {
|
||||
if (StrCaseCmp(argv[0], table[i].funcname) == 0)
|
||||
return table[i].fn(c, argc-1, argv+1);
|
||||
}
|
||||
}
|
||||
|
||||
d_fprintf(stderr, "Invalid command: %s %s\n", whoami,
|
||||
(argc > 0)?argv[0]:"");
|
||||
d_printf("Usage:\n");
|
||||
for (i=0; table[i].funcname != NULL; i++) {
|
||||
d_printf("%s %-15s %s\n", whoami, table[i].funcname,
|
||||
table[i].helptext);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int net_run_function3(struct net_context *c, int argc, const char **argv,
|
||||
const char *whoami, struct functable3 *table)
|
||||
const char *whoami, struct functable *table)
|
||||
{
|
||||
int i;
|
||||
if (argc != 0) {
|
||||
@ -622,7 +573,7 @@ int net_run_function3(struct net_context *c, int argc, const char **argv,
|
||||
return c->display_usage?0:-1;
|
||||
}
|
||||
|
||||
void net_display_usage_from_functable(struct functable3 *table)
|
||||
void net_display_usage_from_functable(struct functable *table)
|
||||
{
|
||||
int i;
|
||||
for (i=0; table[i].funcname != NULL; i++) {
|
||||
|
Reference in New Issue
Block a user