PATCH: radius: bad_hook program caught signal 15

Toon van der Pas toon at hout.vanvergehaald.nl
Sat Feb 28 13:29:49 UTC 2004


On Wed, Feb 25, 2004 at 04:37:36PM -0800, Russ Allbery wrote:
> Katsuhiro Kondou <Katsuhiro_Kondou at isc.org> writes:
> > Toon van der Pas <toon at hout.vanvergehaald.nl> wrote;
> 
> > } But I don't know what your policy is regarding the adding and changing
> > } of log messages, so...
> 
> > I think warn() should be used for this case.  Russ, is that
> > right?
> 
> Yes, that's exactly right.

Well, I tried it. It doesn't work as expected.
I looked into the warn() function and concluded that it should
log the messages to stderr (as required) by default.
So I changed the code into the following:

/* got username and password, check that they're valid */

retval = rad_auth(&radconfig, authinfo->username, authinfo->password);
if (retval == 0)
    /* radius password matches! */
    printf("User:%s\n", authinfo->username);
else if (retval == -1)
    warn("user %s password doesn't match", authinfo->username);
else if (retval == -2)
    warn("Couldn't talk to the radius server");
else
    warn("Unexpected return code from authentication function: %d", retval);
exit(0);

But this doesn't give the same desired result as the previous patch,
which made use of fprintf(stderr,"...") function calls.
With the previous patch I get a nice error message in news.notice:

Feb 28 14:14:35 news nnrpd[17335]: starttls: SSLv3 with cipher RC4-MD5 (128/128 bits) no authentication
Feb 28 14:14:35 news nnrpd[17335]: bbned23-32-100.dsl.hccnet.nl (80.100.32.23) connect
Feb 28 14:14:50 news nnrpd[17335]: bbned23-32-100.dsl.hccnet.nl auth_err user vdpas password doesn't match
Feb 28 14:14:50 news nnrpd[17335]: bbned23-32-100.dsl.hccnet.nl bad_auth

With the warn-patch I get the same old crashes that where the reason
why I started to look into this originally:

Feb 28 14:10:26 news nnrpd[14413]: starttls: SSLv3 with cipher RC4-MD5 (128/128 bits) no authentication
Feb 28 14:10:26 news nnrpd[14413]: bbned23-32-100.dsl.hccnet.nl (80.100.32.23) connect
Feb 28 14:10:39 news nnrpd[14413]: bbned23-32-100.dsl.hccnet.nl bad_hook program caught signal 15
Feb 28 14:10:39 news nnrpd[14413]: bbned23-32-100.dsl.hccnet.nl bad_auth
Feb 28 14:10:39 news nnrpd[14413]: bbned23-32-100.dsl.hccnet.nl times user 0.892 system 0.102 idle 0.013 elapsed 14.167
Feb 28 14:10:39 news nnrpd[14413]: bbned23-32-100.dsl.hccnet.nl time 14378 idle 13096(3) nntpwrite 0(7)

Question: what am I doing wrong here? I'm lost here.

Regards,
Toon.
-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan


More information about the inn-workers mailing list