Updated ClamD support for compatibility with ClamAV 0.95. (new set of scan functions for new API - old functions are broken in this ClamAV version!
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@96 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
c7c54cd9df
commit
24866c8438
63
clamsend.pas
63
clamsend.pas
@ -1,9 +1,9 @@
|
|||||||
{==============================================================================|
|
{==============================================================================|
|
||||||
| Project : Ararat Synapse | 001.000.000 |
|
| Project : Ararat Synapse | 001.001.000 |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Content: ClamAV-daemon client |
|
| Content: ClamAV-daemon client |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Copyright (c)2005, Lukas Gebauer |
|
| Copyright (c)2005-2009, 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 |
|
||||||
@ -33,7 +33,7 @@
|
|||||||
| DAMAGE. |
|
| DAMAGE. |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
|
||||||
| Portions created by Lukas Gebauer are Copyright (c)2003. |
|
| Portions created by Lukas Gebauer are Copyright (c)2005-2009. |
|
||||||
| All Rights Reserved. |
|
| All Rights Reserved. |
|
||||||
|==============================================================================|
|
|==============================================================================|
|
||||||
| Contributor(s): |
|
| Contributor(s): |
|
||||||
@ -95,6 +95,12 @@ type
|
|||||||
|
|
||||||
{:Scan content of TStream.}
|
{:Scan content of TStream.}
|
||||||
function ScanStream(const Value: TStream): AnsiString; virtual;
|
function ScanStream(const Value: TStream): AnsiString; virtual;
|
||||||
|
|
||||||
|
{:Scan content of TStrings by new 0.95 API.}
|
||||||
|
function ScanStrings2(const Value: TStrings): AnsiString; virtual;
|
||||||
|
|
||||||
|
{:Scan content of TStream by new 0.95 API.}
|
||||||
|
function ScanStream2(const Value: TStream): AnsiString; virtual;
|
||||||
published
|
published
|
||||||
{:Socket object used for TCP/IP operation. Good for seting OnStatus hook, etc.}
|
{:Socket object used for TCP/IP operation. Good for seting OnStatus hook, etc.}
|
||||||
property Sock: TTCPBlockSocket read FSock;
|
property Sock: TTCPBlockSocket read FSock;
|
||||||
@ -170,7 +176,7 @@ end;
|
|||||||
|
|
||||||
function TClamSend.GetVersion: AnsiString;
|
function TClamSend.GetVersion: AnsiString;
|
||||||
begin
|
begin
|
||||||
Result := DoCommand('VERSION');
|
Result := DoCommand('nVERSION');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TClamSend.OpenStream: Boolean;
|
function TClamSend.OpenStream: Boolean;
|
||||||
@ -178,7 +184,7 @@ var
|
|||||||
S: AnsiString;
|
S: AnsiString;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
s := DoCommand('STREAM');
|
s := DoCommand('nSTREAM');
|
||||||
if (s <> '') and (Copy(s, 1, 4) = 'PORT') then
|
if (s <> '') and (Copy(s, 1, 4) = 'PORT') then
|
||||||
begin
|
begin
|
||||||
s := SeparateRight(s, ' ');
|
s := SeparateRight(s, ' ');
|
||||||
@ -215,4 +221,51 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TClamSend.ScanStrings2(const Value: TStrings): AnsiString;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
s: AnsiString;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if not FSession then
|
||||||
|
FSock.CloseSocket
|
||||||
|
else
|
||||||
|
FSock.sendstring('nINSTREAM' + LF);
|
||||||
|
if not FSession or (FSock.LastError <> 0) then
|
||||||
|
begin
|
||||||
|
if Login then
|
||||||
|
FSock.sendstring('nINSTREAM' + LF)
|
||||||
|
else
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
s := Value.text;
|
||||||
|
i := length(s);
|
||||||
|
FSock.SendString(CodeLongint(i) + s + #0#0#0#0);
|
||||||
|
Result := FSock.RecvTerminated(FTimeout, LF);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TClamSend.ScanStream2(const Value: TStream): AnsiString;
|
||||||
|
var
|
||||||
|
i: integer;
|
||||||
|
s: AnsiString;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if not FSession then
|
||||||
|
FSock.CloseSocket
|
||||||
|
else
|
||||||
|
FSock.sendstring('nINSTREAM' + LF);
|
||||||
|
if not FSession or (FSock.LastError <> 0) then
|
||||||
|
begin
|
||||||
|
if Login then
|
||||||
|
FSock.sendstring('nINSTREAM' + LF)
|
||||||
|
else
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
i := value.Size;
|
||||||
|
FSock.SendString(CodeLongint(i));
|
||||||
|
FSock.SendStreamRaw(Value);
|
||||||
|
FSock.SendString(#0#0#0#0);
|
||||||
|
Result := FSock.RecvTerminated(FTimeout, LF);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user