From c6c67005a820fd20afd0674d9b8f529450f0e1ae Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 5 Mar 2008 01:26:39 +0100 Subject: Use pidl for _srvsvc_NetShareSetInfo(). Guenther (This used to be commit 9bfa77edc68a887972b609bfb0aee8bbbc89ce04) --- source3/rpc_server/srv_srvsvc.c | 23 +---------- source3/rpc_server/srv_srvsvc_nt.c | 82 ++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 66 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index a7e7be4a04..0d50bccef0 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -270,28 +270,7 @@ static bool api_srv_net_share_get_info(pipes_struct *p) static bool api_srv_net_share_set_info(pipes_struct *p) { - SRV_Q_NET_SHARE_SET_INFO q_u; - SRV_R_NET_SHARE_SET_INFO 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 set info. */ - if(!srv_io_q_net_share_set_info("", &q_u, data, 0)) { - DEBUG(0,("api_srv_net_share_set_info: Failed to unmarshall SRV_Q_NET_SHARE_SET_INFO.\n")); - return False; - } - - r_u.status = _srv_net_share_set_info(p, &q_u, &r_u); - - if(!srv_io_r_net_share_set_info("", &r_u, rdata, 0)) { - DEBUG(0,("api_srv_net_share_set_info: Failed to marshall SRV_R_NET_SHARE_SET_INFO.\n")); - return False; - } - - return True; + return proxy_srvsvc_call(p, NDR_SRVSVC_NETSHARESETINFO); } /******************************************************************* diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index a3c9248ad2..75c262a7a6 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1564,16 +1564,17 @@ char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname) } /******************************************************************* - Net share set info. Modify share details. + _srvsvc_NetShareSetInfo. Modify share details. ********************************************************************/ -WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, SRV_R_NET_SHARE_SET_INFO *r_u) +WERROR _srvsvc_NetShareSetInfo(pipes_struct *p, + struct srvsvc_NetShareSetInfo *r) { struct current_user user; char *command = NULL; char *share_name = NULL; char *comment = NULL; - char *pathname = NULL; + const char *pathname = NULL; int type; int snum; int ret; @@ -1583,15 +1584,16 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S bool is_disk_op = False; int max_connections = 0; TALLOC_CTX *ctx = p->mem_ctx; + union srvsvc_NetShareInfo *info = r->in.info; - DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__)); + DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__)); - share_name = unistr2_to_ascii_talloc(ctx, &q_u->uni_share_name); + share_name = talloc_strdup(p->mem_ctx, r->in.share_name); if (!share_name) { - return WERR_NET_NAME_NOT_FOUND; + return WERR_NOMEM; } - r_u->parm_error = 0; + *r->out.parm_error = 0; if ( strequal(share_name,"IPC$") || ( lp_enable_asu_support() && strequal(share_name,"ADMIN$") ) @@ -1619,44 +1621,39 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S if ( user.ut.uid != sec_initial_uid() && !is_disk_op ) return WERR_ACCESS_DENIED; - switch (q_u->info_level) { + switch (r->in.level) { case 1: pathname = talloc_strdup(ctx, lp_pathname(snum)); - comment = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info2.info_2_str.uni_remark); - type = q_u->info.share.info2.info_2.type; + comment = talloc_strdup(ctx, info->info2->comment); + type = info->info2->type; psd = NULL; break; case 2: - comment = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info2.info_2_str.uni_remark); - pathname = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info2.info_2_str.uni_path); - type = q_u->info.share.info2.info_2.type; - max_connections = (q_u->info.share.info2.info_2.max_uses == 0xffffffff) ? 0 : q_u->info.share.info2.info_2.max_uses; + comment = talloc_strdup(ctx, info->info2->comment); + pathname = info->info2->path; + type = info->info2->type; + max_connections = (info->info2->max_users == 0xffffffff) ? + 0 : info->info2->max_users; psd = NULL; break; #if 0 /* not supported on set but here for completeness */ case 501: - unistr2_to_ascii(comment, &q_u->info.share.info501.info_501_str.uni_remark, sizeof(comment)); - type = q_u->info.share.info501.info_501.type; + comment = talloc_strdup(ctx, info->info501->comment); + type = info->info501->type; psd = NULL; break; #endif case 502: - comment = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info502.info_502_str.uni_remark); - pathname = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info502.info_502_str.uni_path); - type = q_u->info.share.info502.info_502.type; - psd = q_u->info.share.info502.info_502_str.sd; + comment = talloc_strdup(ctx, info->info502->comment); + pathname = info->info502->path; + type = info->info502->type; + psd = info->info502->sd; map_generic_share_sd_bits(psd); break; case 1004: pathname = talloc_strdup(ctx, lp_pathname(snum)); - comment = unistr2_to_ascii_talloc(ctx, - &q_u->info.share.info1004.info_1004_str.uni_remark); + comment = talloc_strdup(ctx, info->info1004->comment); type = STYPE_DISKTREE; break; case 1005: @@ -1664,12 +1661,12 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S user, so we must compare it to see if it's what is set in smb.conf, so that we can contine other ops like setting ACLs on a share */ - if (((q_u->info.share.info1005.share_info_flags & + if (((info->info1005->dfs_flags & SHARE_1005_CSC_POLICY_MASK) >> SHARE_1005_CSC_POLICY_SHIFT) == lp_csc_policy(snum)) return WERR_OK; else { - DEBUG(3, ("_srv_net_share_set_info: client is trying to change csc policy from the network; must be done with smb.conf\n")); + DEBUG(3, ("_srvsvc_NetShareSetInfo: client is trying to change csc policy from the network; must be done with smb.conf\n")); return WERR_ACCESS_DENIED; } case 1006: @@ -1678,12 +1675,13 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S case 1501: pathname = talloc_strdup(ctx, lp_pathname(snum)); comment = talloc_strdup(ctx, lp_comment(snum)); - psd = q_u->info.share.info1501.sdb->sd; + psd = info->info1501->sd; map_generic_share_sd_bits(psd); type = STYPE_DISKTREE; break; default: - DEBUG(5,("_srv_net_share_set_info: unsupported switch value %d\n", q_u->info_level)); + DEBUG(5,("_srvsvc_NetShareSetInfo: unsupported switch value %d\n", + r->in.level)); return WERR_UNKNOWN_LEVEL; } @@ -1702,7 +1700,7 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S string_replace(comment, '"', ' '); } - DEBUG(10,("_srv_net_share_set_info: change share command = %s\n", + DEBUG(10,("_srvsvc_NetShareSetInfo: change share command = %s\n", lp_change_share_cmd() ? lp_change_share_cmd() : "NULL" )); /* Only call modify function if something changed. */ @@ -1710,7 +1708,7 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S if (strcmp(path, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) || (lp_max_connections(snum) != max_connections)) { if (!lp_change_share_cmd() || !*lp_change_share_cmd()) { - DEBUG(10,("_srv_net_share_set_info: No change share command\n")); + DEBUG(10,("_srvsvc_NetShareSetInfo: No change share command\n")); return WERR_ACCESS_DENIED; } @@ -1726,7 +1724,7 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S return WERR_NOMEM; } - DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command )); + DEBUG(10,("_srvsvc_NetShareSetInfo: Running [%s]\n", command )); /********* BEGIN SeDiskOperatorPrivilege BLOCK *********/ @@ -1745,14 +1743,16 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S /********* END SeDiskOperatorPrivilege BLOCK *********/ - DEBUG(3,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command, ret )); + DEBUG(3,("_srvsvc_NetShareSetInfo: Running [%s] returned (%d)\n", + command, ret )); TALLOC_FREE(command); if ( ret != 0 ) return WERR_ACCESS_DENIED; } else { - DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name )); + DEBUG(10,("_srvsvc_NetShareSetInfo: No change to share name (%s)\n", + share_name )); } /* Replace SD if changed. */ @@ -1764,12 +1764,12 @@ WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S if (old_sd && !sec_desc_equal(old_sd, psd)) { if (!set_share_security(share_name, psd)) - DEBUG(0,("_srv_net_share_set_info: Failed to change security info in share %s.\n", + DEBUG(0,("_srvsvc_NetShareSetInfo: Failed to change security info in share %s.\n", share_name )); } } - DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__)); + DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__)); return WERR_OK; } @@ -2549,12 +2549,6 @@ WERROR _srvsvc_NetShareGetInfo(pipes_struct *p, struct srvsvc_NetShareGetInfo *r return WERR_NOT_SUPPORTED; } -WERROR _srvsvc_NetShareSetInfo(pipes_struct *p, struct srvsvc_NetShareSetInfo *r) -{ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; -} - WERROR _srvsvc_NetShareDel(pipes_struct *p, struct srvsvc_NetShareDel *r) { p->rng_fault_state = True; -- cgit