summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_srvsvc.c29
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c43
2 files changed, 72 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 9d85088e56..0b4eac5cc7 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -166,6 +166,34 @@ static BOOL api_srv_net_sess_enum(pipes_struct *p)
}
/*******************************************************************
+ Delete session.
+********************************************************************/
+
+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;
+}
+
+/*******************************************************************
RPC to enumerate shares.
********************************************************************/
@@ -530,6 +558,7 @@ static struct api_struct api_srv_cmds[] =
{
{ "SRV_NET_CONN_ENUM" , SRV_NET_CONN_ENUM , api_srv_net_conn_enum },
{ "SRV_NET_SESS_ENUM" , SRV_NET_SESS_ENUM , api_srv_net_sess_enum },
+ { "SRV_NET_SESS_DEL" , SRV_NET_SESS_DEL , api_srv_net_sess_del },
{ "SRV_NET_SHARE_ENUM_ALL" , SRV_NET_SHARE_ENUM_ALL , api_srv_net_share_enum_all },
{ "SRV_NET_SHARE_ENUM" , SRV_NET_SHARE_ENUM , api_srv_net_share_enum },
{ "SRV_NET_SHARE_ADD" , SRV_NET_SHARE_ADD , api_srv_net_share_add },
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 13e1971925..8bcb5c82ac 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -1349,6 +1349,49 @@ WERROR _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET_S
}
/*******************************************************************
+net sess del
+********************************************************************/
+
+WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SESS_DEL *r_u)
+{
+ struct sessionid *session_list;
+ int num_sessions, snum, ret;
+ fstring username;
+ fstring machine;
+
+ rpcstr_pull_unistr2_fstring(username, &q_u->uni_user_name);
+ rpcstr_pull_unistr2_fstring(machine, &q_u->uni_cli_name);
+
+ /* strip leading backslashes if any */
+ while (machine[0] == '\\') {
+ memmove(machine, &machine[1], strlen(machine));
+ }
+
+ num_sessions = list_sessions(&session_list);
+
+ DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__));
+
+ r_u->status = WERR_ACCESS_DENIED;
+
+ for (snum = 0; snum < num_sessions; snum++) {
+
+ if ((StrCaseCmp(session_list[snum].username, username) == 0 || username[0] == '\0' ) &&
+ StrCaseCmp(session_list[snum].remote_machine, machine) == 0) {
+
+ if ((ret = message_send_pid(session_list[snum].pid, MSG_SHUTDOWN, NULL, 0, False))) {
+ r_u->status = WERR_OK;
+ } else {
+ r_u->status = WERR_ACCESS_DENIED;
+ }
+ }
+ }
+
+ DEBUG(5,("_srv_net_sess_del: %d\n", __LINE__));
+
+ return r_u->status;
+}
+
+/*******************************************************************
Net share enum all.
********************************************************************/