/code/classes/Daemon/SSHd_Auto/Client.class.php
https://github.com/blekkzor/pinetd2 · PHP · 35 lines · 29 code · 6 blank · 0 comment · 3 complexity · 8c451fe3c3c920709755f31376db56c4 MD5 · raw file
- <?php
- namespace Daemon\SSHd_Auto;
- class Client extends \Daemon\SSHd\Client {
- protected function login($login, $pass, $service) {
- $data = $this->serverCall('getLogin', array('login' => $login, 'ip' => $this->peer[0]));
- if (is_null($data)) return false;
- if (crypt($pass, $data['Password']) != $data['Password']) return false;
- $info = array(
- 'root' => $data['Path'],
- 'suid_user' => 'nobody', // force suid on login
- 'suid_group' => 'nobody', // force suid on login
- 'write_level' => $data['Access'],
- );
- return $this->doLogin($info);
- }
- protected function serverCall($method, array $params) {
- $params['server'] = $this->IPC->getName();
- $headers = array(
- 'X-IPC: STATIC',
- 'X-Path: Service/Hosting::'.$method,
- );
- $ch = curl_init('http://www.uid.st/');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, '', '&'));
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- return unserialize(curl_exec($ch));
- }
- }