Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new login api #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions src/PEAR2/Net/RouterOS/Client.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/**
* ~~summary~~
* RouterOS API client implementation.

*
* ~~description~~
* RouterOS is the flag product of the company MikroTik and is a powerful router software. One of its many abilities is to allow control over it via an API. This package provides a client for that API, in turn allowing you to use PHP to control RouterOS hosts.
*
* PHP version 5
*
Expand All @@ -12,7 +13,7 @@
* @author Vasil Rangelov <[email protected]>
* @copyright 2011 Vasil Rangelov
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @version 1.0.0b6
* @link http://pear2.php.net/PEAR2_Net_RouterOS
*/
/**
Expand Down Expand Up @@ -231,7 +232,7 @@ public static function login(
$username,
$password = '',
$timeout = null
) {
) {/*
if (null !== ($remoteCharset = $com->getCharset($com::CHARSET_REMOTE))
&& null !== ($localCharset = $com->getCharset($com::CHARSET_LOCAL))
) {
Expand All @@ -240,7 +241,7 @@ public static function login(
$remoteCharset . '//IGNORE//TRANSLIT',
$password
);
}
}*/
$old = null;
try {
if ($com->getTransmitter()->isPersistent()) {
Expand Down Expand Up @@ -286,16 +287,10 @@ private static function _login(
$timeout = null
) {
$request = new Request('/login');
$request->send($com);
$response = new Response($com, false, $timeout);
//$request->send($com);
//$response = new Response($com, false, $timeout);
$request->setArgument('name', $username);
$request->setArgument(
'response',
'00' . md5(
chr(0) . $password
. pack('H*', $response->getProperty('ret'))
)
);
$request->setArgument('password', $password);
$request->verify($com)->send($com);

$response = new Response($com, false, $timeout);
Expand Down