PATCH libsmb and net command
Nigel Williams
nigel at veritas.com
Mon Jan 21 17:32:02 GMT 2002
This patch contains the share management client code and addtions to the net
command.
nigel
-------------- next part --------------
Index: libsmb/cli_srvsvc.c
===================================================================
RCS file: /cvsroot/samba/source/libsmb/cli_srvsvc.c,v
retrieving revision 1.4
diff -u -r1.4 cli_srvsvc.c
--- libsmb/cli_srvsvc.c 27 Aug 2001 21:32:54 -0000 1.4
+++ libsmb/cli_srvsvc.c 22 Jan 2002 01:16:47 -0000
@@ -5,6 +5,8 @@
Copyright (C) Andrew Tridgell 1994-2000
Copyright (C) Luke Kenneth Casson Leighton 1996-2000
Copyright (C) Tim Potter 2001
+ Copyright (C) Nigel Williams 2001
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +36,8 @@
NTSTATUS cli_srvsvc_net_srv_get_info(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
- uint32 switch_value, SRV_INFO_CTR *ctr)
+ uint32 switch_value,
+ SRV_INFO_CTR *ctr)
{
prs_struct qbuf, rbuf;
SRV_Q_NET_SRV_GET_INFO q;
@@ -66,6 +69,492 @@
r.ctr = ctr;
if (!srv_io_r_net_srv_get_info("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_srv_disk_enum(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ uint32 preferred_len,
+ ENUM_HND *enum_hnd,
+ uint32 *entries_read,
+ uint32 *total_entries,
+ DISK_INFO **ctr
+ )
+{
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SRV_DISK_ENUM q;
+ SRV_R_NET_SRV_DISK_ENUM r;
+ NTSTATUS result;
+
+ *total_entries = 0;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ init_srv_q_net_srv_disk_enum(&q, server, preferred_len, enum_hnd);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_srv_disk_enum("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SRV_DISK_ENUM, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_srv_disk_enum("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *enum_hnd = r.enum_hnd;
+ *entries_read = r.disk_enum_ctr.entries_read;
+ *total_entries = r.total_entries;
+ *ctr = r.disk_enum_ctr.disk_info; /* this struct is talloced to fit data returned */
+
+ result = r.status;
+
+ done:
+
+ /* N.B. these free memory allocated with malloc/realloc (ie prs_init, prs_grow, ..)
+ memory allocated with talloc i.e. that returned from prs_alloc_mem() is still valid after return
+ */
+
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_name_validate(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *share_name,
+ uint32 type)
+{
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_NAME_VALIDATE q;
+ SRV_R_NET_NAME_VALIDATE r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ init_srv_q_net_name_validate(&q, server, share_name, type);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_name_validate("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_NAME_VALIDATE, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_name_validate("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_enum_sticky(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ uint32 preferred_len,
+ ENUM_HND *enum_hnd,
+ uint32 *total_entries,
+ SRV_SHARE_INFO_CTR *ctr
+ )
+{
+
+ uint32 info_level;
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_ENUM q;
+ SRV_R_NET_SHARE_ENUM r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ info_level = ctr->info_level;
+
+ init_srv_q_net_share_enum(&q, (char *)server, info_level, preferred_len, enum_hnd);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_enum("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NETSHAREENUM_STICKY, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_enum("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *enum_hnd = r.enum_hnd;
+ *total_entries = r.total_entries;
+ *ctr = r.ctr; /*not too expensive as mostly copying pointers to talloced memory */
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_enum(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ uint32 preferred_len,
+ ENUM_HND *enum_hnd,
+ uint32 *total_entries,
+ SRV_SHARE_INFO_CTR *ctr
+ )
+{
+
+ uint32 info_level;
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_ENUM q;
+ SRV_R_NET_SHARE_ENUM r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ info_level = ctr->info_level;
+
+ init_srv_q_net_share_enum(&q, (char *)server, info_level, preferred_len, enum_hnd);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_enum("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NETSHAREENUM, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_enum("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *enum_hnd = r.enum_hnd;
+ *total_entries = r.total_entries;
+ *ctr = r.ctr; /*not too expensive as mostly copying pointers to talloced memory */
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_get_info(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *share_name,
+ SRV_SHARE_INFO *info
+ )
+{
+
+ int info_level;
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_GET_INFO q;
+ SRV_R_NET_SHARE_GET_INFO r;
+
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ info_level = info->switch_value;
+
+ init_srv_q_net_share_get_info(&q, server, share_name, info_level);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_get_info("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SHARE_GET_INFO, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_get_info("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *info = r.info; /* copy the information out. pointers will hopefully be to talloced memory */
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_set_info(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *share_name,
+ const SRV_SHARE_INFO *info,
+ uint32 *parm_error
+ )
+{
+
+ uint32 info_level;
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_SET_INFO q;
+ SRV_R_NET_SHARE_SET_INFO r;
+
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ info_level = info->switch_value;
+
+ init_srv_q_net_share_set_info(&q, server, share_name, info_level, info);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_set_info("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SHARE_SET_INFO, &qbuf, &rbuf)) {
+
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_set_info("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ *parm_error = r.parm_error;
+ goto done;
+ }
+
+ *parm_error = r.parm_error;
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_add(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ SRV_SHARE_INFO *info,
+ uint32 *parm_error
+ )
+{
+
+ uint32 info_level;
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_ADD q;
+ SRV_R_NET_SHARE_ADD r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ info_level = info->switch_value;
+
+ init_srv_q_net_share_add(&q, server, info_level, info);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_add("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SHARE_ADD, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_add("", &r, &rbuf, 0)) {
+ *parm_error = r.parm_error;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *parm_error = r.parm_error;
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_del(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *share_name
+ )
+{
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_DEL q;
+ SRV_R_NET_SHARE_DEL r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ init_srv_q_net_share_del(&q, server, share_name);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_del("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SHARE_DEL, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_del("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ result = r.status;
+
+ done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
+ return result;
+}
+
+NTSTATUS cli_srvsvc_net_share_del_sticky(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ const char *server,
+ const char *share_name
+ )
+{
+
+ prs_struct qbuf, rbuf;
+ SRV_Q_NET_SHARE_DEL q;
+ SRV_R_NET_SHARE_DEL r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+ ZERO_STRUCT(r);
+
+ /* Initialise parse structures */
+
+ prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
+ prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);
+
+ /* Initialise input parameters */
+
+ init_srv_q_net_share_del(&q, server, share_name);
+
+ /* Marshall data and send request */
+
+ if (!srv_io_q_net_share_del("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, SRV_NET_SHARE_DEL_STICKY, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!srv_io_r_net_share_del("", &r, &rbuf, 0)) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
Index: utils/net.c
===================================================================
RCS file: /cvsroot/samba/source/utils/net.c,v
retrieving revision 1.33
diff -u -r1.33 net.c
--- utils/net.c 31 Dec 2001 13:00:59 -0000 1.33
+++ utils/net.c 22 Jan 2002 01:16:47 -0000
@@ -253,6 +253,26 @@
}
+int general_net_usage(int argc, const char **argv)
+{
+
+ d_printf("Valid targets: choose one (none defaults to localhost)\n");
+ d_printf("\t-S or --server=<server>\t\tserver name\n");
+ d_printf("\t-I or --ipaddress=<ipaddr>\taddress of target server\n");
+ d_printf("\t-w or --workgroup=<wg>\t\ttarget workgroup or domain\n");
+
+ d_printf("\n");
+ d_printf("Valid miscellaneous options are:\n"); /* misc options */
+ d_printf("\t-p or --port=<port>\tconnection port on target server\n");
+ d_printf("\t-W or --myworkgroup=<wg>\tclient workgroup\n");
+ d_printf("\t-d or --debug=<level>\t\tdebug level (0-10)\n");
+ d_printf("\t-n or --myname=<name>\t\tclient name\n");
+ d_printf("\t-U or --user=<name>\t\tuser name\n");
+ d_printf("\t-s or --conf=<path>\t\tpathname of smb.conf file\n");
+ d_printf("\t-l or --long\t\t\tdisplay full information\n"); /* */
+ return -1;
+}
+
static int net_usage(int argc, const char **argv)
{
d_printf(" net ads [command]\tto run ADS commands\n"\
@@ -260,6 +280,8 @@
" net rpc [command]\tto run RPC commands\n"\
" net rap help\n"\
"\nType \"net help <option>\" to get more information on that option\n");
+
+ general_net_usage(argc, argv);
return -1;
}
@@ -285,21 +307,21 @@
{"RAP", net_rap_usage},
{"RPC", net_rpc_usage},
- {"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},
+ {"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},
- {"TIME", net_time_usage},
- {"LOOKUP", net_lookup_usage},
+ {"ADMIN", net_rap_admin_usage},
+ {"SERVICE", net_rap_service_usage},
+ {"PASSWORD", net_rap_password_usage},
+ {"TIME", net_time_usage},
+ {"LOOKUP", net_lookup_usage},
{"HELP", help_usage},
{NULL, NULL}};
@@ -314,21 +336,21 @@
{"ADS", net_ads},
/* eventually these should auto-choose the transport ... */
- {"FILE", net_rap_file},
- {"SHARE", net_rap_share},
- {"SESSION", net_rap_session},
- {"SERVER", net_rap_server},
- {"DOMAIN", net_rap_domain},
- {"PRINTQ", net_rap_printq},
- {"USER", net_rap_user},
- {"GROUP", net_rap_group},
- {"VALIDATE", net_rap_validate},
+ {"FILE", net_rap_file},
+ {"SHARE", net_rap_share},
+ {"SESSION", net_rap_session},
+ {"SERVER", net_rap_server},
+ {"DOMAIN", net_rap_domain},
+ {"PRINTQ", net_rap_printq},
+ {"USER", net_rap_user},
+ {"GROUP", net_rap_group},
+ {"VALIDATE", net_rap_validate},
{"GROUPMEMBER", net_rap_groupmember},
- {"ADMIN", net_rap_admin},
- {"SERVICE", net_rap_service},
- {"PASSWORD", net_rap_password},
- {"TIME", net_time},
- {"LOOKUP", net_lookup},
+ {"ADMIN", net_rap_admin},
+ {"SERVICE", net_rap_service},
+ {"PASSWORD", net_rap_password},
+ {"TIME", net_time},
+ {"LOOKUP", net_lookup},
{"HELP", net_help},
{NULL, NULL}
@@ -366,9 +388,9 @@
{"flags", 'F', POPT_ARG_INT, &opt_flags},
{"jobid", 'j', POPT_ARG_INT, &opt_jobid},
{"long", 'l', POPT_ARG_NONE, &opt_long_list_entries},
- {"reboot", 'r', POPT_ARG_NONE, &opt_reboot},
- {"force", 'f', POPT_ARG_NONE, &opt_force},
- {"timeout", 't', POPT_ARG_INT, &opt_timeout},
+ {"reboot", 'r', POPT_ARG_NONE, &opt_reboot},
+ {"force", 'f', POPT_ARG_NONE, &opt_force},
+ {"timeout", 't', POPT_ARG_INT, &opt_timeout},
{ 0, 0, 0, 0}
};
Index: utils/net.h
===================================================================
RCS file: /cvsroot/samba/source/utils/net.h,v
retrieving revision 1.5
diff -u -r1.5 net.h
--- utils/net.h 31 Dec 2001 13:00:59 -0000 1.5
+++ utils/net.h 22 Jan 2002 01:16:47 -0000
@@ -34,6 +34,14 @@
/* We want an anonymous connection */
#define NET_FLAGS_ANONYMOUS 16
+/* A function of this type is passed to the 'run_rpc_command' wrapper */
+typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *, struct cli_state *, TALLOC_CTX *, int, const char **);
+
+typedef int (*run_rpc_command_fn)(const char *pipe_name, int conn_flags,
+ rpc_command_fn fn,
+ int argc, const char **argv);
+
+extern run_rpc_command_fn run_rpc_command_p;
extern int opt_maxusers;
extern char *opt_comment;
Index: utils/net_rpc.c
===================================================================
RCS file: /cvsroot/samba/source/utils/net_rpc.c,v
retrieving revision 1.6
diff -u -r1.6 net_rpc.c
--- utils/net_rpc.c 31 Dec 2001 13:00:59 -0000 1.6
+++ utils/net_rpc.c 22 Jan 2002 01:16:47 -0000
@@ -21,6 +21,14 @@
#include "includes.h"
#include "../utils/net.h"
+/* avoid putting an entry in proto.h */
+
+static int run_rpc_command(const char *pipe_name, int conn_flags,
+ rpc_command_fn fn,
+ int argc, const char **argv);
+
+run_rpc_command_fn run_rpc_command_p = run_rpc_command;
+
/**
* @file net_rpc.c
*
@@ -35,9 +43,11 @@
* of files, as this could get quite big.
**/
-
-/* A function of this type is passed to the 'run_rpc_command' wrapper */
-typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *, struct cli_state *, TALLOC_CTX *, int, const char **);
+int general_rpc_usage(int argc, const char **argv)
+{
+
+ return general_net_usage(argc, argv);
+}
/**
* Many of the RPC functions need the domain sid. This function gets
@@ -159,7 +169,6 @@
return (!NT_STATUS_IS_OK(nt_status));
}
-
/****************************************************************************/
@@ -557,7 +566,6 @@
/****************************************************************************/
-
/**
* Basic usage function for 'net rpc'
* @param argc Standard main() style argc
@@ -572,6 +580,9 @@
d_printf(" net rpc changetrustpw \tto change the trust account password\n");
d_printf(" net rpc abortshutdown \tto to abort the shutdown of a remote server\n");
d_printf(" net rpc shutdown \tto to shutdown a remote server\n");
+ d_printf(" net rpc share \tto manage shares\n");
+ d_printf("\n");
+ general_rpc_usage(argc, argv);
d_printf("\n");
d_printf("'net rpc shutdown' also accepts the following miscellaneous options:\n"); /* misc options */
d_printf("\t-r or --reboot\trequest remote server reboot on shutdown\n");
@@ -591,11 +602,12 @@
int net_rpc(int argc, const char **argv)
{
struct functable func[] = {
- {"join", rpc_join},
- {"user", rpc_user},
+ {"join", rpc_join},
+ {"user", rpc_user},
{"changetrustpw", rpc_changetrustpw},
{"abortshutdown", rpc_shutdown_abort},
- {"shutdown", rpc_shutdown},
+ {"shutdown", rpc_shutdown},
+ {"share", net_rpc_share},
{NULL, NULL}
};
return net_run_function(argc, argv, func, net_rpc_usage);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: net_rpc_share.c
Type: application/octet-stream
Size: 8085 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020121/98c8df56/net_rpc_share.obj
More information about the samba-technical
mailing list