From eb0645bb0d5079d12b84213d95d3e21fcce66e4c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 15 Dec 2008 05:33:05 -0500
Subject: [PATCH] - Global settings are configurable trough a form under admin > system > Interface Config - Formatted error messages for better visibility.

---
 server/plugins-available/shelluser_base_plugin.inc.php |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index 7e6b485..91f9f25 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -32,6 +32,20 @@
 	
 	var $plugin_name = 'shelluser_base_plugin';
 	var $class_name = 'shelluser_base_plugin';
+	var $min_uid = 499;
+	
+	//* This function is called during ispconfig installation to determine
+	//  if a symlink shall be created for this plugin.
+	function onInstall() {
+		global $conf;
+		
+		if($conf['services']['web'] == true) {
+			return true;
+		} else {
+			return false;
+		}
+		
+	}
 	
 		
 	/*
@@ -60,7 +74,7 @@
 		
 		// Get the UID of the parent user
 		$uid = intval($app->system->getuid($data['new']['puser']));
-		if($uid > 999) {
+		if($uid > $this->min_uid) {
 			$command = 'useradd';
 			$command .= ' --home '.escapeshellcmd($data['new']['dir']);
 			$command .= ' --gid '.escapeshellcmd($data['new']['pgroup']);
@@ -85,19 +99,20 @@
 		
 		// Get the UID of the parent user
 		$uid = intval($app->system->getuid($data['new']['puser']));
-		if($uid > 999) {
+		if($uid > $this->min_uid) {
 			$command = 'usermod';
 			$command .= ' --home '.escapeshellcmd($data['new']['dir']);
 			$command .= ' --gid '.escapeshellcmd($data['new']['pgroup']);
-			$command .= ' --non-unique ';
+			// $command .= ' --non-unique ';
 			$command .= ' --password '.escapeshellcmd($data['new']['password']);
-			$command .= ' --shell '.escapeshellcmd($data['new']['shell']);
-			$command .= ' --uid '.escapeshellcmd($uid);
+			if($data['new']['chroot'] != 'jailkit') $command .= ' --shell '.escapeshellcmd($data['new']['shell']);
+			// $command .= ' --uid '.escapeshellcmd($uid);
 			$command .= ' --login '.escapeshellcmd($data['new']['username']);
 			$command .= ' '.escapeshellcmd($data['old']['username']);
 			
 			exec($command);
-			$app->log("Updated shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
+			// $app->log("Updated shelluser: $command ",LOGLEVEL_DEBUG);
+			$app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
 			
 		} else {
 			$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
@@ -111,7 +126,7 @@
 		
 		// Get the UID of the user
 		$userid = intval($app->system->getuid($data['old']['username']));
-		if($userid > 999) {
+		if($userid > $this->min_uid) {
 			$command = 'userdel';
 			$command .= ' '.escapeshellcmd($data['old']['username']);
 			

--
Gitblit v1.9.1