cfoe
2012-07-11 4ce4a33ab38d0eb7a3f3f53d25913cd7d23952bb
server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -71,6 +71,7 @@
      global $app, $conf;
      
      $app->uses('system');
      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
      
      if($app->system->is_user($data['new']['username'])) {
      
@@ -79,6 +80,8 @@
          */
         if ($data['new']['chroot'] == "jailkit")
         {
            $app->system->web_folder_protection($web['document_root'],false);
            // load the server configuration options
            $app->uses("getconf");
            $this->data = $data;
@@ -98,6 +101,7 @@
            exec($command);
            
            $this->_update_website_security_level();
            $app->system->web_folder_protection($web['document_root'],true);
         }
      
         $app->log("Jailkit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG);
@@ -113,6 +117,7 @@
      global $app, $conf;
      
      $app->uses('system');
      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
      
      if($app->system->is_user($data['new']['username'])) {
      
@@ -121,6 +126,8 @@
          */
         if ($data['new']['chroot'] == "jailkit")
         {
            $app->system->web_folder_protection($web['document_root'],false);
            // load the server configuration options
            $app->uses("getconf");
            $this->data = $data;
@@ -136,6 +143,8 @@
            $this->_setup_ssh_rsa();
            
            $this->_update_website_security_level();
            $app->system->web_folder_protection($web['document_root'],true);
         }
      
         $app->log("Jailkit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG);
@@ -155,6 +164,8 @@
      
      $app->uses('system');
      
      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['old']['parent_domain_id']);
      if ($data['old']['chroot'] == "jailkit")
      {
         $app->uses("getconf");
@@ -165,6 +176,8 @@
         //commented out proved to be dangerous on config errors
         //exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
         
         $app->system->web_folder_protection($web['document_root'],false);
         if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
            $command = 'userdel -f';
            $command .= ' '.escapeshellcmd($data['old']['username']);
@@ -172,6 +185,8 @@
            $app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
         }
         
         $app->system->web_folder_protection($web['document_root'],true);
      }
      
      $app->log("Jailkit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG);