r6034: Check only once
authorSimo Sorce <idra@samba.org>
Thu, 24 Mar 2005 08:36:00 +0000 (08:36 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:56:16 +0000 (10:56 -0500)
source/rpc_server/srv_srvsvc_nt.c

index 5dd2e6e47f3bc77ca1c2c9afebae8f645e106542..ed08f185f70cd6f1e5055302a86e51a972ebf84f 100644 (file)
@@ -1359,6 +1359,7 @@ WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SES
        int num_sessions, snum, ret;
        fstring username;
        fstring machine;
+       BOOL not_root = False;
        /* SE_PRIV se_diskop = SE_DISK_OPERATOR; / * Is disk op appropriate here ? JRA. * /
        BOOL is_disk_op = False;                 / * No. SSS. :) */
 
@@ -1393,6 +1394,7 @@ WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SES
                    strequal(session_list[snum].remote_machine, machine)) {
                
                        if (user.uid != sec_initial_uid()) {
+                               not_root = True;
                                become_root();
                        }
                        if ((ret = message_send_pid(session_list[snum].pid, MSG_SHUTDOWN, NULL, 0, False))) {
@@ -1400,7 +1402,7 @@ WERROR _srv_net_sess_del(pipes_struct *p, SRV_Q_NET_SESS_DEL *q_u, SRV_R_NET_SES
                        } else {
                                r_u->status = WERR_ACCESS_DENIED;
                        }
-                       if (user.uid != sec_initial_uid()) {
+                       if (not_root) {
                                unbecome_root();
                        }
                }