decrypt_login(); $serverNameParts = explode(",", $server); if (sizeof($serverNameParts) > 1) { $handle = new Net_SSH2($serverNameParts[0], $serverNameParts[1]); } else { $handle = new Net_SSH2($server); } if ($handle) { $sr = @ldap_read($_SESSION['ldap']->server(), $credentials[0], "objectClass=posixAccount", array('uid'), 0, 0, 0, LDAP_DEREF_NEVER); if (!$sr) { $return = array("ERROR," . _("Your LAM admin user must be a valid Unix account to work with lamdaemon!") . ","); return $return; } $entry = @ldap_get_entries($_SESSION['ldap']->server(), $sr); if (!isset($entry[0]['uid'][0])) { $return = array("ERROR," . _("Your LAM admin user must be a valid Unix account to work with lamdaemon!") . ","); return $return; } $userName = $entry[0]['uid'][0]; if ($handle->login($userName, $credentials[1])) { $output = $handle->exec("sudo " . $_SESSION['config']->get_scriptPath() . ' ' . escapeshellarg($command)); $return = array($output); return $return; } else { $return = array("ERROR," . _('Unable to connect to remote server!') . "," . $server); return $return; } } else { $return = array("ERROR," . _('Unable to connect to remote server!') . "," . $server); return $return; } } ?>