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)
Require libssh2.dll or libssh2.so. You can download binaries it as part
of CURL project from http://curl.haxx.se/download.html
Requires libssh2.dll or libssh2.so.
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
This plugin implementing client part only.
This plugin implements the client part only.
}
{$IFDEF FPC}
@ -170,10 +171,15 @@ begin
end;
if not SSHCheck(libssh2_session_startup(FSession, FSocket.Socket)) then
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 (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
exit;
and (libssh2_userauth_password(FSession, PChar(FSocket.SSL.Username), PChar(FSocket.SSL.Password))<0) then
exit;
FChannel := libssh2_channel_open_session(FSession);
if not assigned(FChannel) then
begin
@ -237,7 +243,7 @@ end;
initialization
if libssh2_init(0)=0 then
SSLImplementation := TSSLLibSSH2;
SSLImplementation := TSSLLibSSH2;
finalization
libssh2_exit;

View File

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