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_user(struct net_context *c, int argc, const char **argv) { int ret = -1; struct functable func[] = { { "add", rap_user_add, NET_TRANSPORT_RAP, N_("Add specified user"), N_("net rap user add\n" " Add specified user") }, { "info", rap_user_info, NET_TRANSPORT_RAP, N_("List domain groups of specified user"), N_("net rap user info\n" " List domain groups of specified user") }, { "delete", rap_user_delete, NET_TRANSPORT_RAP, N_("Remove specified user"), N_("net rap user delete\n" " Remove specified user") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { struct cli_state *cli; if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap user\n" " List all users\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) goto done; if (c->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(c, argc, argv, "net rap user", func); done: if (ret != 0) { DEBUG(1, (_("Net user returned: %d\n"), ret)); } return ret; }