BIND 10 #183: UNIX domain socket for msgq
BIND 10 Development
do-not-reply at isc.org
Wed May 26 19:27:57 UTC 2010
#183: UNIX domain socket for msgq
-----------------------------+----------------------------------------------
Reporter: larissas | Owner: jinmei
Type: defect | Status: reviewing
Priority: major | Milestone: 04. 2nd Incremental Release
Component: message-library | Resolution:
Keywords: | Sensitive: 0
-----------------------------+----------------------------------------------
Comment(by jinmei):
Replying to [comment:11 jinmei]:
> Replying to [comment:10 jelte]:
> > Ok i have addressed almost all of your issues, except two, which I'm
not sure about, see below. But first some comments about what i did in
r1933;
> >
> > - Those pass statements shouldn't have been there, nor should the
commented-out lines, so i removed them.
> > - I have added a session_unittest file, which right now *only* tests
for that big filename exception (which is now thrown instead of cutting
the file), i think we should make a seperate task for writing tests for
this (since there didn't appear to be any, and most of the other tests are
imho out of scope for this ticket).
> > - Re-add the environment variable again (and added a try-catch block
to the tests, if prefix/install dirs aren't available the test would have
failed
>
> So far, Looks okay (modulo r1940).
Actually, it wasn't okay:-)
This code is not exception safe:
{{{
if (strlen(socket_file) >= sizeof(sun.sun_path)) {
isc_throw(SessionError, "Unable to connect to message queue;
socket file path too long");
}
}}}
We could close it, but I think it's better to validate the input even
before opening the socket. And if we do so, I'd also move to the other
initialization part of sockaddr_sun to the top, so that the reader can
understand the set of validation-then-initialization more easily.
And for that matter,
- I'd fold the isc_throw line (I know it's a personal preference, but I
believe it's a widely adopted style to keep lines short for readability)
- I'd include the offending file name in the exception message (although
it may not be a good idea in this case because it might be absurdly long -
I'd leave the decision to you)
Applying all of these, it would be the attached patch.
--
Ticket URL: <https://bind10.isc.org/ticket/183#comment:12>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list