diff options
author | Shekhar Amlekar <samlekar@in.ibm.com> | 2013-06-03 13:02:19 +0530 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-09-10 11:32:50 -0700 |
commit | 2d14ab32bfb92d725912c5a2fa0a61d9d723f341 (patch) | |
tree | b85ad8f4b2b0a17882d6c78e9900327549973c66 /source3/rpc_server/srvsvc | |
parent | 69470a2efdf36f306292515c1ed596b576e95120 (diff) | |
download | samba-2d14ab32bfb92d725912c5a2fa0a61d9d723f341.tar.gz samba-2d14ab32bfb92d725912c5a2fa0a61d9d723f341.tar.bz2 samba-2d14ab32bfb92d725912c5a2fa0a61d9d723f341.zip |
s3: rpc_server/srvsvc: use find_sessions() in NetSessDel
instead of using list_sessions(), use find_sessions() that
builds the list of only the sessions of interest.
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/rpc_server/srvsvc')
-rw-r--r-- | source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 8f3a4cf17d..3d4ee22ea1 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -1296,30 +1296,27 @@ WERROR _srvsvc_NetSessDel(struct pipes_struct *p, machine += 2; } - num_sessions = list_sessions(p->mem_ctx, &session_list); + num_sessions = find_sessions(p->mem_ctx, username, machine, + &session_list); for (snum = 0; snum < num_sessions; snum++) { - if ((strequal(session_list[snum].username, username) || username[0] == '\0' ) && - strequal(session_list[snum].remote_machine, machine)) { + NTSTATUS ntstat; - NTSTATUS ntstat; - - if (p->session_info->unix_token->uid != sec_initial_uid()) { - not_root = True; - become_root(); - } + if (p->session_info->unix_token->uid != sec_initial_uid()) { + not_root = True; + become_root(); + } - ntstat = messaging_send(p->msg_ctx, - session_list[snum].pid, - MSG_SHUTDOWN, &data_blob_null); + ntstat = messaging_send(p->msg_ctx, + session_list[snum].pid, + MSG_SHUTDOWN, &data_blob_null); - if (NT_STATUS_IS_OK(ntstat)) - werr = WERR_OK; + if (NT_STATUS_IS_OK(ntstat)) + werr = WERR_OK; - if (not_root) - unbecome_root(); - } + if (not_root) + unbecome_root(); } DEBUG(5,("_srvsvc_NetSessDel: %d\n", __LINE__)); |