From ca354276ca491a413c8dfc30e9c093e71dc2e9d3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sun, 9 Mar 2008 18:01:52 +0100 Subject: Use pidl for _srvsvc_NetSessDel(). Guenther (This used to be commit 8a10bc13aee7c34f466fa69773694be97f0e7d85) --- source3/rpc_server/srv_srvsvc.c | 21 +-------------------- source3/rpc_server/srv_srvsvc_nt.c | 35 +++++++++++++++-------------------- 2 files changed, 16 insertions(+), 40 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 5351f93346..7579e109d4 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -152,26 +152,7 @@ static bool api_srv_net_sess_enum(pipes_struct *p) static bool api_srv_net_sess_del(pipes_struct *p) { - SRV_Q_NET_SESS_DEL q_u; - SRV_R_NET_SESS_DEL r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - /* grab the net server get enum */ - if (!srv_io_q_net_sess_del("", &q_u, data, 0)) - return False; - - /* construct reply. always indicate success */ - r_u.status = _srv_net_sess_del(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if (!srv_io_r_net_sess_del("", &r_u, rdata, 0)) - return False; - - return True; + return proxy_srvsvc_call(p, NDR_SRVSVC_NETSESSDEL); } /******************************************************************* diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 0d4addde14..7c2efc946d 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1274,31 +1274,33 @@ WERROR _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET_S } /******************************************************************* -net sess del + _srvsvc_NetSessDel ********************************************************************/ -WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SESS_DEL *r_u) +WERROR _srvsvc_NetSessDel(pipes_struct *p, + struct srvsvc_NetSessDel *r) { struct sessionid *session_list; struct current_user user; int num_sessions, snum; - fstring username; - fstring machine; + const char *username; + const char *machine; bool not_root = False; + WERROR werr; - rpcstr_pull_unistr2_fstring(username, &q_u->uni_user_name); - rpcstr_pull_unistr2_fstring(machine, &q_u->uni_cli_name); + username = r->in.user; + machine = r->in.client; /* strip leading backslashes if any */ - while (machine[0] == '\\') { - memmove(machine, &machine[1], strlen(machine)); + if (machine && machine[0] == '\\' && machine[1] == '\\') { + machine += 2; } num_sessions = list_sessions(p->mem_ctx, &session_list); - DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__)); + DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__)); - r_u->status = WERR_ACCESS_DENIED; + werr = WERR_ACCESS_DENIED; get_current_user(&user, p); @@ -1327,19 +1329,18 @@ WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SES MSG_SHUTDOWN, &data_blob_null); if (NT_STATUS_IS_OK(ntstat)) - r_u->status = WERR_OK; + werr = WERR_OK; if (not_root) unbecome_root(); } } - DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__)); - + DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__)); done: - return r_u->status; + return werr; } /******************************************************************* @@ -2508,12 +2509,6 @@ WERROR _srvsvc_NetSessEnum(pipes_struct *p, struct srvsvc_NetSessEnum *r) return WERR_NOT_SUPPORTED; } -WERROR _srvsvc_NetSessDel(pipes_struct *p, struct srvsvc_NetSessDel *r) -{ - p->rng_fault_state = True; - return WERR_NOT_SUPPORTED; -} - WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r) { p->rng_fault_state = True; -- cgit