2010/3/1 Török Edwin <[email protected]>:
> On 03/01/2010 03:39 AM, Phil Varner wrote:
>>
>>             dos.writeInt(0);
>>             dos.write('\0');
>
> The write('\0') is not needed, and even wrong in IDSESSION mode, clamd
> doesn't read it. A zero length chunk is just the chunk length as 4 bytes
> of 0, which you already sent with writeInt.
>

The spec in clamd man says the stream must be closed by a nul byte,
which I thought was the reason for the z prefix?

--Phil


>>             dos.flush();
>>
>>             reader = new BufferedReader(new
>> InputStreamReader(socket.getInputStream(), "ASCII"));
>>
>>             response = reader.readLine();
>>         } finally {
>>             if (reader != null) try { reader.close(); } catch
>> (IOException e) { }
>>             if (dos != null) try { dos.close(); } catch (IOException e) { }
>>             if (socket != null) try { socket.close(); } catch
>> (IOException e) { }
>
> This is not nice, your method declares that it throws IOException (which
> it probably does for creation of socket), but then eats the other
> IOExceptions. I think it should rethrow them instead.
>
>>        if (log.isDebugEnabled()) log.debug( "Response: " + response);
>>        return response.trim();
>
> And this will throw a nullpointer exception if anything goes wrong prior
> to reading the response.
>
> Best regards,
> --Edwin
> _______________________________________________
> Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
> http://www.clamav.net/support/ml
>



-- 

Machines might be interesting, but people are fascinating. -- K.P.
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml

Reply via email to