The branch, v3-2-test has been updated via 6ffd6c814fafe4112fe72a96a0893d5be06f4380 (commit) via 2afae94936d4fbd3b1e804111bff1960c2b852bd (commit) via 10d457152e8547646353f0f37f51ac92561505ef (commit) via 2e1df306785296979ea064006402254e318e946b (commit) via 140885d3d87ea2de14b3393a7384dff74a4dd44c (commit) from 96f85a48beb7da9c373fc030474020d05c55a18d (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log ----------------------------------------------------------------- commit 6ffd6c814fafe4112fe72a96a0893d5be06f4380 Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Mar 7 23:50:00 2008 +0100 Remove unused marshalling for SRV_NET_NAME_VALIDATE. Guenther commit 2afae94936d4fbd3b1e804111bff1960c2b852bd Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Mar 7 23:47:40 2008 +0100 Remove unused marshalling for SRV_NET_SHARE_DEL. Guenther commit 10d457152e8547646353f0f37f51ac92561505ef Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Mar 7 23:45:39 2008 +0100 Use rpccli_srvsvc_NetShareDel in net. Guenther commit 2e1df306785296979ea064006402254e318e946b Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Mar 7 23:40:00 2008 +0100 Use pidl for _srvsvc_NetNameValidate. Guenther commit 140885d3d87ea2de14b3393a7384dff74a4dd44c Author: Günther Deschner <[EMAIL PROTECTED]> Date: Fri Mar 7 23:39:34 2008 +0100 Add netnamevalidate command to rpcclient. Guenther ----------------------------------------------------------------------- Summary of changes: source/include/rpc_srvsvc.h | 31 --------- source/rpc_client/cli_srvsvc.c | 32 ---------- source/rpc_parse/parse_srv.c | 122 ------------------------------------- source/rpc_server/srv_srvsvc.c | 25 +------- source/rpc_server/srv_srvsvc_nt.c | 23 +++---- source/rpcclient/cmd_srvsvc.c | 34 ++++++++++ source/utils/net_rpc.c | 17 ++++- 7 files changed, 58 insertions(+), 226 deletions(-) Changeset truncated at 500 lines: diff --git a/source/include/rpc_srvsvc.h b/source/include/rpc_srvsvc.h index d0b25e4..3ea55bd 100644 --- a/source/include/rpc_srvsvc.h +++ b/source/include/rpc_srvsvc.h @@ -75,20 +75,6 @@ typedef struct net_srv_disk_enum { /***************************/ -typedef struct { - UNISTR2 *servername; - UNISTR2 sharename; - uint32 type; - uint32 flags; - WERROR status; -} SRV_Q_NET_NAME_VALIDATE; - -typedef struct { - WERROR status; -} SRV_R_NET_NAME_VALIDATE; - -/***************************/ - /* oops - this is going to take up a *massive* amount of stack. */ /* the UNISTR2s already have 1024 uint16 chars in them... */ @@ -625,23 +611,6 @@ typedef struct r_net_share_add } SRV_R_NET_SHARE_ADD; -/* SRV_Q_NET_SHARE_DEL */ -typedef struct q_net_share_del -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - UNISTR2 uni_share_name; - uint32 reserved; - -} SRV_Q_NET_SHARE_DEL; - -/* SRV_R_NET_SHARE_DEL */ -typedef struct r_net_share_del -{ - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_DEL; - /***************************/ typedef struct { diff --git a/source/rpc_client/cli_srvsvc.c b/source/rpc_client/cli_srvsvc.c index 524678c..c043120 100644 --- a/source/rpc_client/cli_srvsvc.c +++ b/source/rpc_client/cli_srvsvc.c @@ -362,38 +362,6 @@ WERROR rpccli_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, return result; } -WERROR rpccli_srvsvc_net_share_del(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *sharename) -{ - prs_struct qbuf, rbuf; - SRV_Q_NET_SHARE_DEL q; - SRV_R_NET_SHARE_DEL r; - WERROR result = W_ERROR(ERRgeneral); - fstring server; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - strupper_m(server); - - init_srv_q_net_share_del(&q, server, sharename); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_SRVSVC, SRV_NET_SHARE_DEL, - q, r, - qbuf, rbuf, - srv_io_q_net_share_del, - srv_io_r_net_share_del, - WERR_GENERAL_FAILURE); - - result = r.status; - return result; -} - WERROR rpccli_srvsvc_net_share_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *netname, uint32 type, const char *remark, uint32 perms, diff --git a/source/rpc_parse/parse_srv.c b/source/rpc_parse/parse_srv.c index a09e704..b4cc087 100644 --- a/source/rpc_parse/parse_srv.c +++ b/source/rpc_parse/parse_srv.c @@ -1522,70 +1522,6 @@ bool srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_stru } /******************************************************************* - initialises a structure. -********************************************************************/ - -void init_srv_q_net_share_del(SRV_Q_NET_SHARE_DEL *del, const char *srvname, - const char *sharename) -{ - del->ptr_srv_name = 1; - init_unistr2(&del->uni_srv_name, srvname, UNI_STR_TERMINATE); - init_unistr2(&del->uni_share_name, sharename, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_del(const char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("reserved", ps, depth, &q_n->reserved)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_n->status)) - return False; - - return True; -} - -/******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ @@ -2759,64 +2695,6 @@ bool srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru /******************************************************************* Reads or writes a structure. - ********************************************************************/ - -bool srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, - sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) - return False; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("type", ps, depth, &q_n->type)) - return False; - - if(!prs_uint32("flags", ps, depth, &q_n->flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. - ********************************************************************/ - -bool srv_io_r_net_name_validate(const char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_name_validate"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. ********************************************************************/ bool srv_io_q_net_file_query_secdesc(const char *desc, SRV_Q_NET_FILE_QUERY_SECDESC *q_n, prs_struct *ps, int depth) diff --git a/source/rpc_server/srv_srvsvc.c b/source/rpc_server/srv_srvsvc.c index 875cda5..8853295 100644 --- a/source/rpc_server/srv_srvsvc.c +++ b/source/rpc_server/srv_srvsvc.c @@ -301,30 +301,9 @@ static bool api_srv_net_disk_enum(pipes_struct *p) NetValidateName (opnum 0x21) *******************************************************************/ -static bool api_srv_net_name_validate(pipes_struct *p) +static bool api_srv_net_name_validate(pipes_struct *p) { - SRV_Q_NET_NAME_VALIDATE q_u; - SRV_R_NET_NAME_VALIDATE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* Unmarshall the net server disk enum. */ - if(!srv_io_q_net_name_validate("", &q_u, data, 0)) { - DEBUG(0,("api_srv_net_name_validate: Failed to unmarshall SRV_Q_NET_NAME_VALIDATE.\n")); - return False; - } - - r_u.status = _srv_net_name_validate(p, &q_u, &r_u); - - if(!srv_io_r_net_name_validate("", &r_u, rdata, 0)) { - DEBUG(0,("api_srv_net_name_validate: Failed to marshall SRV_R_NET_NAME_VALIDATE.\n")); - return False; - } - - return True; + return proxy_srvsvc_call(p, NDR_SRVSVC_NETNAMEVALIDATE); } /******************************************************************* diff --git a/source/rpc_server/srv_srvsvc_nt.c b/source/rpc_server/srv_srvsvc_nt.c index a6cf06c..a64691c 100644 --- a/source/rpc_server/srv_srvsvc_nt.c +++ b/source/rpc_server/srv_srvsvc_nt.c @@ -2380,17 +2380,19 @@ WERROR _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_D } /******************************************************************** + _srvsvc_NetNameValidate ********************************************************************/ -WERROR _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV_R_NET_NAME_VALIDATE *r_u) +WERROR _srvsvc_NetNameValidate(pipes_struct *p, + struct srvsvc_NetNameValidate *r) { - fstring sharename; - - switch ( q_u->type ) { + switch (r->in.name_type) { case 0x9: - rpcstr_pull(sharename, q_u->sharename.buffer, sizeof(sharename), q_u->sharename.uni_str_len*2, 0); - if ( !validate_net_name( sharename, INVALID_SHARENAME_CHARS, sizeof(sharename) ) ) { - DEBUG(5,("_srv_net_name_validate: Bad sharename \"%s\"\n", sharename)); + if (!validate_net_name(r->in.name, INVALID_SHARENAME_CHARS, + strlen_m(r->in.name))) + { + DEBUG(5,("_srvsvc_NetNameValidate: Bad sharename \"%s\"\n", + r->in.name)); return WERR_INVALID_NAME; } break; @@ -2402,7 +2404,6 @@ WERROR _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV return WERR_OK; } - /******************************************************************** ********************************************************************/ @@ -2559,12 +2560,6 @@ WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r) return WERR_NOT_SUPPORTED; } -WERROR _srvsvc_NetNameValidate(pipes_struct *p, struct srvsvc_NetNameValidate *r) -{ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; -} - WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r) { p->rng_fault_state = True; diff --git a/source/rpcclient/cmd_srvsvc.c b/source/rpcclient/cmd_srvsvc.c index e480b71..8c85372 100644 --- a/source/rpcclient/cmd_srvsvc.c +++ b/source/rpcclient/cmd_srvsvc.c @@ -572,6 +572,39 @@ static WERROR cmd_srvsvc_net_file_enum(struct rpc_pipe_client *cli, return result; } +static WERROR cmd_srvsvc_net_name_validate(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + WERROR result; + NTSTATUS status; + uint32_t name_type = 9; + uint32_t flags = 0; + + if (argc < 2 || argc > 3) { + printf("Usage: %s [sharename] [type]\n", argv[0]); + return WERR_OK; + } + + if (argc == 3) { + name_type = atoi(argv[2]); + } + + status = rpccli_srvsvc_NetNameValidate(cli, mem_ctx, + cli->cli->desthost, + argv[1], + name_type, + flags, + &result); + + if (!W_ERROR_IS_OK(result)) + goto done; + + done: + return result; +} + + /* List of commands exported by this module */ struct cmd_set srvsvc_commands[] = { @@ -585,6 +618,7 @@ struct cmd_set srvsvc_commands[] = { { "netsharesetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_info, PI_SRVSVC, NULL, "Set Share Info", "" }, { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, PI_SRVSVC, NULL, "Enumerate open files", "" }, { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, PI_SRVSVC, NULL, "Fetch remote time of day", "" }, + { "netnamevalidate", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_name_validate, PI_SRVSVC, NULL, "Validate sharename", "" }, { NULL } }; diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c index f7fadb9..399ace8 100644 --- a/source/utils/net_rpc.c +++ b/source/utils/net_rpc.c @@ -3314,8 +3314,11 @@ static NTSTATUS rpc_share_del_internals(const DOM_SID *domain_sid, { WERROR result; - result = rpccli_srvsvc_net_share_del(pipe_hnd, mem_ctx, argv[0]); - return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + return rpccli_srvsvc_NetShareDel(pipe_hnd, mem_ctx, + pipe_hnd->cli->desthost, + argv[0], + 0, + &result); } /** @@ -5064,14 +5067,20 @@ static NTSTATUS rpc_sh_share_delete(TALLOC_CTX *mem_ctx, int argc, const char **argv) { WERROR result; + NTSTATUS status; if (argc != 1) { d_fprintf(stderr, "usage: %s <share>\n", ctx->whoami); return NT_STATUS_INVALID_PARAMETER; } - result = rpccli_srvsvc_net_share_del(pipe_hnd, mem_ctx, argv[0]); - return werror_to_ntstatus(result); + status = rpccli_srvsvc_NetShareDel(pipe_hnd, mem_ctx, + pipe_hnd->cli->desthost, + argv[0], + 0, + &result); + + return status; } static NTSTATUS rpc_sh_share_info(TALLOC_CTX *mem_ctx, -- Samba Shared Repository