From 2ef13cd37e25cab3febdf0e77ea8a71da3f5fd6a Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 26 Oct 2010 07:29:14 -0400
Subject: [PATCH] Fixed: FS#1358 - AWStats tools no in tools directory
---
server/plugins-available/shelluser_base_plugin.inc.php | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index c3e112c..69348f5 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -89,9 +89,15 @@
$app->log("Executed command: ".$command,LOGLEVEL_DEBUG);
$app->log("Added shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
+ //* Create .bash_history file
+ touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
+ chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
+ chown(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['username']));
+ chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['pgroup']));
+
//* Disable shell user temporarily if we use jailkit
if($data['new']['chroot'] == 'jailkit') {
- $command = 'usermod -L '.escapeshellcmd($data['new']['username']);
+ $command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']);
exec($command);
$app->log("Disabling shelluser temporarily: ".$command,LOGLEVEL_DEBUG);
}
@@ -100,7 +106,7 @@
$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
}
} else {
- $app->log("Skippung insert of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+ $app->log("Skipping insertion of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
}
}
@@ -128,6 +134,16 @@
exec($command);
$app->log("Executed command: $command ",LOGLEVEL_DEBUG);
$app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
+
+
+ //* Create .bash_history file
+ if(!is_file($data['new']['dir']).'/.bash_history') {
+ touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
+ chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
+ chown(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['username']));
+ chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['pgroup']));
+ }
+
} else {
// The user does not exist, so we insert it now
$this->insert($event_name,$data);
@@ -136,7 +152,7 @@
$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
}
} else {
- $app->log("Skippung update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+ $app->log("Skipping update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
}
}
@@ -172,4 +188,4 @@
} // end class
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1