int net_rpc_rights(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "list", rpc_rights_list, NET_TRANSPORT_RPC, N_("View available/assigned privileges"), N_("net rpc rights list\n" " View available/assigned privileges") }, { "grant", rpc_rights_grant, NET_TRANSPORT_RPC, N_("Assign privilege[s]"), N_("net rpc rights grant\n" " Assign privilege[s]") }, { "revoke", rpc_rights_revoke, NET_TRANSPORT_RPC, N_("Revoke privilege[s]"), N_("net rpc rights revoke\n" " Revoke privilege[s]") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net rpc rights", func); }
int net_printing(struct net_context *c, int argc, const char **argv) { int ret = -1; struct functable func[] = { { "dump", net_printing_dump, NET_TRANSPORT_LOCAL, N_("Dump printer databases"), N_("net printing dump\n" " Dump tdb printing file") }, { "migrate", net_printing_migrate, NET_TRANSPORT_LOCAL | NET_TRANSPORT_RPC, N_("Migrate printer databases"), N_("net printing migrate\n" " Migrate tdb printing files to new storage") }, { NULL, NULL, 0, NULL, NULL } }; ret = net_run_function(c, argc, argv, "net printing", func); return ret; }
int net_rap_share(int argc, const char **argv) { struct functable func[] = { {"DELETE", rap_share_delete}, {"CLOSE", rap_share_delete}, {"ADD", rap_share_add}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; if (opt_long_list_entries) { d_printf( "\nEnumerating shared resources (exports) on remote server:\n\n"\ "\nShare name Type Description\n"\ "---------- ---- -----------\n"); ret = cli_RNetShareEnum(cli, long_share_fn, NULL); } else { ret = cli_RNetShareEnum(cli, share_fn, NULL); } cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_share_usage); }
int net_rap_user(int argc, const char **argv) { int ret = -1; struct functable func[] = { {"ADD", rap_user_add}, {"INFO", rap_user_info}, {"DELETE", rap_user_delete}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; if (!(cli = net_make_ipc_connection(0))) goto done; if (opt_long_list_entries) { d_printf("\nUser name Comment"\ "\n-----------------------------\n"); ret = cli_RNetUserEnum(cli, long_user_fn, NULL); cli_shutdown(cli); goto done; } ret = cli_RNetUserEnum0(cli, user_fn, NULL); cli_shutdown(cli); goto done; } ret = net_run_function(argc, argv, func, net_rap_user_usage); done: if (ret != 0) { DEBUG(1, ("Net user returned: %d\n", ret)); } return ret; }
int net_rap_file(int argc, const char **argv) { struct functable func[] = { {"CLOSE", rap_file_close}, {"USER", rap_file_user}, {"INFO", rap_file_info}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; /* list open files */ d_printf( "\nEnumerating open files on remote server:\n\n"\ "\nFileId Opened by Perms Locks Path \n"\ "------ --------- ----- ----- ---- \n"); ret = cli_NetFileEnum(cli, NULL, NULL, file_fn); cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_file_usage); }
int net_rap_groupmember(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "add", rap_groupmember_add, NET_TRANSPORT_RAP, N_("Add specified user to group"), N_("net rap groupmember add\n" " Add specified user to group") }, { "list", rap_groupmember_list, NET_TRANSPORT_RAP, N_("List users in group"), N_("net rap groupmember list\n" " List users in group") }, { "delete", rap_groupmember_delete, NET_TRANSPORT_RAP, N_("Remove user from group"), N_("net rap groupmember delete\n" " Remove user from group") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net rap groupmember", func); }
int net_rap_group(int argc, const char **argv) { struct functable func[] = { {"ADD", rap_group_add}, {"DELETE", rap_group_delete}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; if (opt_long_list_entries) { d_printf("Group name Comment\n"); d_printf("-----------------------------\n"); ret = cli_RNetGroupEnum(cli, long_group_fn, NULL); cli_shutdown(cli); return ret; } ret = cli_RNetGroupEnum0(cli, group_fn, NULL); cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_group_usage); }
int net_g_lock(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "do", net_g_lock_do, NET_TRANSPORT_LOCAL, N_("Execute a shell command under a lock"), N_("net g_lock do <lock name> <timeout> <command>\n") }, { "locks", net_g_lock_locks, NET_TRANSPORT_LOCAL, N_("List all locknames"), N_("net g_lock locks\n") }, { "dump", net_g_lock_dump, NET_TRANSPORT_LOCAL, N_("Dump a g_lock locking table"), N_("net g_lock dump <lock name>\n") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net g_lock", func); }
int net_ads_group(int argc, const char **argv) { struct functable func[] = { {"ADD", ads_group_add}, {"DELETE", ads_group_delete}, {NULL, NULL} }; ADS_STRUCT *ads; ADS_STATUS rc; const char *shortattrs[] = {"sAMAccountName", NULL}; const char *longattrs[] = {"sAMAccountName", "description", NULL}; char *disp_fields[2] = {NULL, NULL}; if (argc == 0) { if (!(ads = ads_startup())) { return -1; } if (opt_long_list_entries) d_printf("\nGroup name Comment"\ "\n-----------------------------\n"); rc = ads_do_search_all_fn(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE, "(objectclass=group)", opt_long_list_entries ? longattrs : shortattrs, usergrp_display, disp_fields); ads_destroy(&ads); return 0; } return net_run_function(argc, argv, func, net_ads_group_usage); }
/* handle "net help *" subcommands */ int net_help(int argc, const char **argv) { struct functable func[] = { {"ADS", net_ads_help}, {"RAP", net_rap_help}, {"RPC", net_rpc_help}, {"FILE", net_help_file}, {"SHARE", net_help_share}, {"SESSION", net_rap_session_usage}, {"SERVER", net_rap_server_usage}, {"DOMAIN", net_rap_domain_usage}, {"PRINTQ", net_rap_printq_usage}, {"USER", net_help_user}, {"GROUP", net_help_group}, {"GROUPMAP", net_help_groupmap}, {"JOIN", net_help_join}, {"VALIDATE", net_rap_validate_usage}, {"GROUPMEMBER", net_rap_groupmember_usage}, {"ADMIN", net_rap_admin_usage}, {"SERVICE", net_rap_service_usage}, {"PASSWORD", net_rap_password_usage}, {"TIME", net_time_usage}, {"LOOKUP", net_lookup_usage}, {"USERSIDLIST", net_usersidlist_usage}, #ifdef WITH_FAKE_KASERVER {"AFS", net_help_afs}, #endif {"HELP", help_usage}, {NULL, NULL}}; return net_run_function(argc, argv, func, net_usage); }
int net_rap_service(int argc, const char **argv) { struct functable func[] = { {"START", rap_service_start}, {"STOP", rap_service_stop}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; if (opt_long_list_entries) { d_printf("Service name Comment\n"); d_printf("-----------------------------\n"); ret = cli_RNetServiceEnum(cli, long_group_fn, NULL); } ret = cli_RNetServiceEnum(cli, service_fn, NULL); cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_service_usage); }
int net_rap_server(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "name", net_rap_server_name, NET_TRANSPORT_RAP, N_("Get the name of the server"), N_("net rap server name\n" " Get the name of the server") }, { "domain", net_rap_server_domain, NET_TRANSPORT_RAP, N_("Get the servers in this domain/workgroup"), N_("net rap server domain\n" " Get the servers in this domain/workgroup") }, {NULL, NULL, 0, NULL, NULL} }; /* 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_function(c, argc, argv, "net rap server", func); }
int net_rap_session(int argc, const char **argv) { struct functable func[] = { {"INFO", rap_session_info}, {"DELETE", rap_session_delete}, {"CLOSE", rap_session_delete}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; d_printf("Computer User name "\ "Client Type Opens Idle time\n"\ "------------------------------------------"\ "------------------------------------\n"); ret = cli_NetSessionEnum(cli, list_sessions_func); cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_session_usage); }
int net_rap_session(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "info", rap_session_info, NET_TRANSPORT_RAP, N_("Display information about session"), N_("net rap session info\n" " Display information about session") }, { "delete", rap_session_delete, NET_TRANSPORT_RAP, N_("Close specified session"), N_("net rap session delete\n" " Close specified session\n" " Alias for net rap session close") }, { "close", rap_session_delete, NET_TRANSPORT_RAP, N_("Close specified session"), N_("net rap session close\n" " Close specified session") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap session\n" " List all open sessions on remote " "server\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; d_printf(_("Computer User name " "Client Type Opens Idle time\n" "------------------------------------------" "------------------------------------\n")); ret = cli_NetSessionEnum(cli, list_sessions_func); cli_shutdown(cli); return ret; } return net_run_function(c, argc, argv, "net rap session", func); }
/*********************************************************** Look at the current idmap **********************************************************/ int net_idmap(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "dump", net_idmap_dump, NET_TRANSPORT_LOCAL, N_("Dump the current ID mappings"), N_("net idmap dump\n" " Dump the current ID mappings") }, { "restore", net_idmap_restore, NET_TRANSPORT_LOCAL, N_("Restore entries from stdin"), N_("net idmap restore\n" " Restore entries from stdin") }, { "setmap", net_idmap_set, NET_TRANSPORT_LOCAL, N_("Not implemented yet"), N_("net idmap setmap\n" " Not implemented yet") }, { "delete", net_idmap_delete, NET_TRANSPORT_LOCAL, N_("Not implemented yet"), N_("net idmap delete\n" " Not implemented yet") }, { "secret", net_idmap_secret, NET_TRANSPORT_LOCAL, N_("Set secret for specified domain"), N_("net idmap secret {<DOMAIN>|alloc} <secret>\n" " Set secret for specified domain or alloc module") }, { "aclmapset", net_idmap_aclmapset, NET_TRANSPORT_LOCAL, N_("Set acl map"), N_("net idmap aclmapset\n" " Set acl map") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net idmap", func); }
static int net_afs(int argc, const char **argv) { struct functable func[] = { {"key", net_afs_key}, {"impersonate", net_afs_impersonate}, {"help", net_help_afs}, {NULL, NULL} }; return net_run_function(argc, argv, func, net_help_afs); }
int net_rap_groupmember(int argc, const char **argv) { struct functable func[] = { {"ADD", rap_groupmember_add}, {"LIST", rap_groupmember_list}, {"DELETE", rap_groupmember_delete}, {NULL, NULL} }; return net_run_function(argc, argv, func, net_rap_groupmember_usage); }
/*********************************************************** Look at the current idmap **********************************************************/ int net_idmap(int argc, const char **argv) { struct functable func[] = { {"dump", net_idmap_dump}, {"restore", net_idmap_restore}, {"delete", net_idmap_delete}, {"help", net_help_idmap}, {NULL, NULL} }; return net_run_function(argc, argv, func, net_help_idmap); }
static int net_ads_printer(int argc, const char **argv) { struct functable func[] = { {"SEARCH", net_ads_printer_search}, {"INFO", net_ads_printer_info}, {"PUBLISH", net_ads_printer_publish}, {"REMOVE", net_ads_printer_remove}, {NULL, NULL} }; return net_run_function(argc, argv, func, net_ads_printer_usage); }
/** * Entry point to 'net cache' subfunctionality * * @param argv arguments passed to further called functions * @return whatever further functions return **/ int net_cache(int argc, const char **argv) { struct functable func[] = { {"add", net_cache_add}, {"del", net_cache_del}, {"get", net_cache_get}, {"search", net_cache_search}, {"list", net_cache_list}, {"flush", net_cache_flush}, {NULL, NULL} }; return net_run_function(argc, argv, func, net_cache_usage); }
int net_rpc_rights(int argc, const char **argv) { struct functable func[] = { {"list", rpc_rights_list}, {"grant", rpc_rights_grant}, {"revoke", rpc_rights_revoke}, {NULL, NULL} }; if ( argc ) return net_run_function( argc, argv, func, net_help_rights ); return net_help_rights( argc, argv ); }
int net_tdb(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "locking", net_tdb_locking, NET_TRANSPORT_LOCAL, N_("Show information for a record in locking.tdb"), N_("net tdb locking <key>") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net tdb", func); }
int net_rap_group(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "add", rap_group_add, NET_TRANSPORT_RAP, N_("Add specified group"), N_("net rap group add\n" " Add specified group") }, { "delete", rap_group_delete, NET_TRANSPORT_RAP, N_("Delete specified group"), N_("net rap group delete\n" " Delete specified group") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap group\n" " List all groups\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; if (c->opt_long_list_entries) { d_printf(_("Group name Comment\n" "-----------------------------\n")); ret = cli_RNetGroupEnum(cli, long_group_fn, NULL); cli_shutdown(cli); return ret; } ret = cli_RNetGroupEnum0(cli, group_fn, NULL); cli_shutdown(cli); return ret; } return net_run_function(c, argc, argv, "net rap group", func); }
/* handle "net help *" subcommands */ int net_help(struct net_context *c, int argc, const char **argv) { struct functable *func = (struct functable *)c->private_data; if (argc == 0) { return net_usage(c, argc, argv); } if (StrCaseCmp(argv[0], "help") == 0) { return net_help_usage(c, argc, argv); } c->display_usage = true; return net_run_function(c, argc, argv, "net help", func); }
int net_rap_service(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "start", rap_service_start, NET_TRANSPORT_RAP, N_("Start service on remote server"), N_("net rap service start\n" " Start service on remote server") }, { "stop", rap_service_stop, NET_TRANSPORT_RAP, N_("Stop named serve on remote server"), N_("net rap service stop\n" " Stop named serve on remote server") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap service\n" " List services on remote server\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; if (c->opt_long_list_entries) { d_printf(_("Service name Comment\n" "-----------------------------\n")); ret = cli_RNetServiceEnum(cli, long_group_fn, NULL); } ret = cli_RNetServiceEnum(cli, service_fn, NULL); cli_shutdown(cli); return ret; } return net_run_function(c, argc, argv, "net rap service", func); }
int net_rpc_audit(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "get", rpc_audit_get, NET_TRANSPORT_RPC, N_("View configured auditing settings"), N_("net rpc audit get\n" " View configured auditing settings") }, { "set", rpc_audit_set, NET_TRANSPORT_RPC, N_("Set auditing policies"), N_("net rpc audit set\n" " Set auditing policies") }, { "enable", rpc_audit_enable, NET_TRANSPORT_RPC, N_("Enable auditing"), N_("net rpc audit enable\n" " Enable auditing") }, { "disable", rpc_audit_disable, NET_TRANSPORT_RPC, N_("Disable auditing"), N_("net rpc audit disable\n" " Disable auditing") }, { "list", rpc_audit_list, NET_TRANSPORT_RPC, N_("List configured auditing settings"), N_("net rpc audit list\n" " List configured auditing settings") }, {NULL, NULL, 0, NULL, NULL} }; return net_run_function(c, argc, argv, "net rpc audit", func); }
int net_rap_printq(struct net_context *c, int argc, const char **argv) { struct cli_state *cli; int ret; struct functable func[] = { { "info", rap_printq_info, NET_TRANSPORT_RAP, N_("Display info about print queues and jobs"), N_("net rap printq info [queue]\n" " Display info about print jobs in queue.\n" " If queue is not specified, all queues are " "listed") }, { "delete", rap_printq_delete, NET_TRANSPORT_RAP, N_("Delete print job(s)"), N_("net rap printq delete\n" " Delete print job(s)") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap printq\n" " List the print queue\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; d_printf(PRINTQ_ENUM_DISPLAY, smbXcli_conn_remote_name(cli->conn)); /* list header */ ret = cli_NetPrintQEnum(cli, enum_queue, enum_jobs); cli_shutdown(cli); return ret; } return net_run_function(c, argc, argv, "net rap printq", func); }
int net_export(struct net_context *ctx, int argc, const char **argv) { int rc; switch (argc) { case 0: rc = net_export_usage(ctx, argc, argv); return rc; case 1: default: rc = net_run_function(ctx, argc, argv, net_export_functable, net_export_usage); return rc; } return 0; }
int net_rpc_service(int argc, const char **argv) { struct functable func[] = { {"list", rpc_service_list}, {"start", rpc_service_start}, {"stop", rpc_service_stop}, {"pause", rpc_service_pause}, {"resume", rpc_service_resume}, {"status", rpc_service_status}, {NULL, NULL} }; if ( argc ) return net_run_function( argc, argv, func, net_help_service ); return net_help_service( argc, argv ); }
/* handle "net rap help *" subcommands */ int net_rap_help(int argc, const char **argv) { struct functable func[] = { {"FILE", net_rap_file_usage}, {"SHARE", net_rap_share_usage}, {"SESSION", net_rap_session_usage}, {"SERVER", net_rap_server_usage}, {"DOMAIN", net_rap_domain_usage}, {"PRINTQ", net_rap_printq_usage}, {"USER", net_rap_user_usage}, {"GROUP", net_rap_group_usage}, {"VALIDATE", net_rap_validate_usage}, {"GROUPMEMBER", net_rap_groupmember_usage}, {"ADMIN", net_rap_admin_usage}, {"SERVICE", net_rap_service_usage}, {"PASSWORD", net_rap_password_usage}, {NULL, NULL}}; return net_run_function(argc, argv, func, net_rap_usage); }