From 27c6232be8ac58420a31409f751963f334f21b64 Mon Sep 17 00:00:00 2001 From: laking Date: Tue, 5 Apr 2011 15:59:00 +0000 Subject: [PATCH] Update on certificte ssh-rsa shell plugins. dbmaster changed to db --- server/plugins-available/shelluser_base_plugin.inc.php | 8 ++++---- server/plugins-available/shelluser_jailkit_plugin.inc.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 558a6bf42b..58858a3bcc 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -197,11 +197,11 @@ class shelluser_base_plugin { private function _setup_ssh_rsa() { $this->app->log("ssh-rsa setup shelluser_base",LOGLEVEL_DEBUG); // Get the client ID, username, and the key - $domain_data = $this->app->dbmaster->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id'])); - $sys_group_data = $this->app->dbmaster->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid'])); + $domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id'])); + $sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid'])); $id = intval($sys_group_data['client_id']); $username= $sys_group_data['name']; - $client_data = $this->app->dbmaster->queryOneRecord('SELECT * FROM client WHERE client.client_id = '.$id); + $client_data = $this->app->db->queryOneRecord('SELECT * FROM client WHERE client.client_id = '.$id); $userkey = $client_data['ssh_rsa']; unset($domain_data); unset($client_data); @@ -218,7 +218,7 @@ class shelluser_base_plugin { //Generate ssh-rsa-keys exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""'); // save keypair in client table - $this->app->dbmaster->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$id); + $this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$id); // and use the public key that has been generated $userkey = file_get_contents('/tmp/id_rsa.pub') ; diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 050ec00617..c43ef86d52 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -366,11 +366,11 @@ class shelluser_jailkit_plugin { private function _setup_ssh_rsa() { $this->app->log("ssh-rsa setup shelluser_jailkit",LOGLEVEL_DEBUG); // Get the client ID, username, and the key - $domain_data = $this->app->dbmaster->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id'])); - $sys_group_data = $this->app->dbmaster->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid'])); + $domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id'])); + $sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid'])); $id = intval($sys_group_data['client_id']); $username= $sys_group_data['name']; - $client_data = $this->app->dbmaster->queryOneRecord('SELECT * FROM client WHERE client.client_id = '.$id); + $client_data = $this->app->db->queryOneRecord('SELECT * FROM client WHERE client.client_id = '.$id); $userkey = $client_data['ssh_rsa']; unset($domain_data); unset($client_data); @@ -387,7 +387,7 @@ class shelluser_jailkit_plugin { //Generate ssh-rsa-keys exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""'); // save keypair in client table - $this->app->dbmaster->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$id); + $this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$id); // and use the public key that has been generated $userkey = file_get_contents('/tmp/id_rsa.pub') ; -- GitLab