From 41a96e4787dc41830a0edb0a8e7da00b6d203f21 Mon Sep 17 00:00:00 2001
From: redray <redray@ispconfig3>
Date: Sat, 11 Apr 2009 12:14:19 -0400
Subject: [PATCH] added "sys_perm_other" to billing and domain tables. "sys_perm_all" was wrong and is obsolete - sorry.

---
 server/plugins-available/shelluser_base_plugin.inc.php |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index bf834c7..151dfda 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -87,6 +87,13 @@
 			
 				exec($command);
 				$app->log("Added shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
+				
+				//* Disable shell user temporarily if we use jailkit
+				if($data['new']['chroot'] == 'jailkit') {
+					$command = 'usermod -L '.escapeshellcmd($data['new']['username']);
+					exec($command);
+					$app->log("Disabling shelluser temporarily: ".$command,LOGLEVEL_DEBUG);
+				}
 			
 			} else {
 				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
@@ -141,11 +148,14 @@
 			// Get the UID of the user
 			$userid = intval($app->system->getuid($data['old']['username']));
 			if($userid > $this->min_uid) {
-				$command = 'userdel';
-				$command .= ' '.escapeshellcmd($data['old']['username']);
+				// We delete only non jailkit users, jailkit users will be deleted by the jailkit plugin.
+				if ($data['old']['chroot'] != "jailkit") {
+					$command = 'userdel -f';
+					$command .= ' '.escapeshellcmd($data['old']['username']);
 			
-				exec($command);
-				$app->log("Deleted shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
+					exec($command);
+					$app->log("Deleted shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
+				}
 			
 			} else {
 				$app->log("UID = $userid for shelluser:".$data['old']['username']." not allowed.",LOGLEVEL_ERROR);

--
Gitblit v1.9.1