Fixes by Reinier Olislagers, Thank you.

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@189 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2014-03-03 16:26:43 +00:00
parent 93c88514ef
commit 4b16db708e
2 changed files with 27 additions and 19 deletions

View File

@ -47,13 +47,14 @@
{:@abstract(SSH plugin for LibSSH2) {:@abstract(SSH plugin for LibSSH2)
Require libssh2.dll or libssh2.so. You can download binaries it as part Requires libssh2.dll or libssh2.so.
of CURL project from http://curl.haxx.se/download.html You can download binaries as part of the CURL project from
http://curl.haxx.se/download.html
You need pascal bindongs for library too! You can found one at: You need Pascal bindings for the library too! You can find one at:
http://www.lazarus.freepascal.org/index.php/topic,15935.msg86465.html#msg86465 http://www.lazarus.freepascal.org/index.php/topic,15935.msg86465.html#msg86465
This plugin implementing client part only. This plugin implements the client part only.
} }
{$IFDEF FPC} {$IFDEF FPC}
@ -170,9 +171,14 @@ begin
end; end;
if not SSHCheck(libssh2_session_startup(FSession, FSocket.Socket)) then if not SSHCheck(libssh2_session_startup(FSession, FSocket.Socket)) then
exit; exit;
// Attempt private key authentication, then fall back to username/password but
// do not forget original private key auth error. This avoids giving spurious errors like
// Authentication failed (username/password)
// instead of e.g.
// Unable to extract public key from private key file: Method unimplemented in libgcrypt backend
if FSocket.SSL.PrivateKeyFile<>'' then if FSocket.SSL.PrivateKeyFile<>'' then
if (not SSHCheck(libssh2_userauth_publickey_fromfile(FSession, PChar(FSocket.SSL.Username), nil, PChar(FSocket.SSL.PrivateKeyFile), PChar(FSocket.SSL.KeyPassword)))) if (not SSHCheck(libssh2_userauth_publickey_fromfile(FSession, PChar(FSocket.SSL.Username), nil, PChar(FSocket.SSL.PrivateKeyFile), PChar(FSocket.SSL.KeyPassword))))
and (not SSHCheck(libssh2_userauth_password(FSession, PChar(FSocket.SSL.Username), PChar(FSocket.SSL.Password)))) then and (libssh2_userauth_password(FSession, PChar(FSocket.SSL.Username), PChar(FSocket.SSL.Password))<0) then
exit; exit;
FChannel := libssh2_channel_open_session(FSession); FChannel := libssh2_channel_open_session(FSession);
if not assigned(FChannel) then if not assigned(FChannel) then

View File

@ -3,7 +3,7 @@
|==============================================================================| |==============================================================================|
| Content: misc. procedures and functions | | Content: misc. procedures and functions |
|==============================================================================| |==============================================================================|
| Copyright (c)1999-2010, Lukas Gebauer | | Copyright (c)1999-2014, Lukas Gebauer |
| All rights reserved. | | All rights reserved. |
| | | |
| Redistribution and use in source and binary forms, with or without | | Redistribution and use in source and binary forms, with or without |
@ -42,7 +42,7 @@
| (Found at URL: http://www.ararat.cz/synapse/) | | (Found at URL: http://www.ararat.cz/synapse/) |
|==============================================================================} |==============================================================================}
{:@abstract(Misc. network based utilities)} {:@abstract(Miscellaneous network based utilities)}
{$IFDEF FPC} {$IFDEF FPC}
{$MODE DELPHI} {$MODE DELPHI}
@ -88,31 +88,33 @@ uses
; ;
Type Type
{:@abstract(This record contains information about proxy setting.)} {:@abstract(This record contains information about proxy settings.)}
TProxySetting = record TProxySetting = record
Host: string; Host: string;
Port: string; Port: string;
Bypass: string; Bypass: string;
end; end;
{:By this function you can turn-on computer on network, if this computer {:With this function you can turn on a computer on the network, if this computer
supporting Wake-on-lan feature. You need MAC number (network card indentifier) supports Wake-on-LAN feature. You need the MAC address
of computer for turn-on. You can also assign target IP addres. If you not (network card identifier) of the computer. You can also assign a target IP
specify it, then is used broadcast for delivery magic wake-on packet. However addres. If you do not specify it, then broadcast is used to deliver magic
broadcasts workinh only on your local network. When you need to wake-up wake-on-LAN packet.
However broadcasts work only on your local network. When you need to wake-up a
computer on another network, you must specify any existing IP addres on same computer on another network, you must specify any existing IP addres on same
network segment as targeting computer.} network segment as targeting computer.}
procedure WakeOnLan(MAC, IP: string); procedure WakeOnLan(MAC, IP: string);
{:Autodetect current DNS servers used by system. If is defined more then one DNS {:Autodetect current DNS servers used by the system. If more than one DNS server
server, then result is comma-delimited.} is defined, then the result is comma-delimited.}
function GetDNS: string; function GetDNS: string;
{:Autodetect InternetExplorer proxy setting for given protocol. This function {:Autodetect InternetExplorer proxy setting for given protocol. This function
working only on windows!} works only on windows!}
function GetIEProxy(protocol: string): TProxySetting; function GetIEProxy(protocol: string): TProxySetting;
{:Return all known IP addresses on local system. Addresses are divided by comma.} {:Return all known IP addresses on the local system. Addresses are divided by
comma/comma-delimited.}
function GetLocalIPs: string; function GetLocalIPs: string;
implementation implementation