[imp] IMP and virus checking
Michael Redinger
Michael.Redinger@uibk.ac.at
Sun, 6 Jan 2002 20:36:45 +0100 (CET)
---------------------- multipart/mixed attachment
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, 6 Jan 2002, Jan Schneider wrote:
> This one is a bug in the pear library then, not in IMP. You can try a newer
> version to find out if it's already fixed or fix the code yourself (in
> Mail/smtp.php) and send the patch to us or the pear mailing list. Chuck
> also works on the Mail modules in PEAR.
I'll have a look into this.
However, for all of those that don't have an SMTP server that checks for
viruses, here's a small patch (against compose.php) that checks uploaded files
before attaching them.
The function expects an array - the first item is the return message from
the scanner, the second the exit code of the virus scanner.
Attached you also find an example how to use this hook for
McAfee VirusScan for UNIX.
For other languages the error message needs to be translated.
Michael
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
iQA/AwUBPDinUg/XqdllwsEdEQL7jQCdHrkWHwBtP4j/NIevb1Bq80bcPK8An1Yo
TSTkvhHU1gSHqmU7UMQN1Kx6
=hang
-----END PGP SIGNATURE-----
---------------------- multipart/mixed attachment
LS0tIGNvbXBvc2UucGhwLm9yaWcJU3VuIEphbiAgNiAyMDoxODozMiAyMDAy
DQorKysgY29tcG9zZS5waHAJU3VuIEphbiAgNiAyMDoyMDoxNyAyMDAyDQpA
QCAtMjg5LDYgKzI4OSwzMyBAQA0KICAgICB9DQogfQ0KIA0KKw0KKy8qKg0K
KyAqIFNjYW4gYXR0YWNobWVudCBmb3IgdmlydXMNCisgKg0KKyAqIEBwYXJh
bSBzdHJpbmcgJGZpbGUgICAgICB0aGUgZmlsZSB0byBzY2FuDQorICoNCisg
Ki8NCitmdW5jdGlvbiB2aXJ1c19zY2FuKCRmaWxlKQ0KK3sNCisgICAgZ2xv
YmFsICRjb25mOw0KKw0KKyAgICBpZiAoIWVtcHR5KCRjb25mWydob29rcydd
Wyd2aXJ1c2NoZWNrJ10pKSB7DQorICAgICRmZD1mb3BlbignL3RtcC92cycs
ICd3Jyk7ZndyaXRlKC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pbXBfdmlydXNfc2Nh
bic7DQoNCmlmICghZnVuY3Rpb25fZXhpc3RzKCdpbXBfdmlydXNfc2Nhbicp
KSB7DQogICAgICAgIGZ1bmN0aW9uIGltcF92aXJ1c19zY2FuICgkZmlsZSkg
ew0KICAgICAgICAgICAgICAgIEBleGVjKCIvdXNyL2xvY2FsL2Jpbi91dnNj
YW4gIi4kZmlsZSwgJG91dHB1dCwgJGV4aXRjb2RlKTsNCiAgICAgICAgICAg
ICAgICBpZiAoICRleGl0Y29kZSA9PSAwICkgew0KICAgICAgICAgICAgICAg
ICAgICAgICAgcmV0dXJuIHRydWU7DQogICAgICAgICAgICAgICAgfSBlbHNl
IHsNCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheShpbXBs
b2RlKCIuICIsICRvdXRwdXQpLCAkZXhpdGNvZGUpOw0KICAgICAgICAgICAg
ICAgIH0NCiAgICAgICAgfQ0KfQ0KDQo=
---------------------- multipart/mixed attachment--