Bug in authprogs/domain and doc/external-auth

Jeffrey M.Vinocur jeff at litech.org
Wed Mar 9 01:27:57 UTC 2005


On Mar 8, 2005, at 5:42 PM, Todd Olson wrote:

> authprogs/domain  does not work in INN 2.4.1

Hi Todd -- thanks for the reports.  (Glad to see you're finally taking 
the plunge.)


> The problem can be fixed by changing
>        printf("User:%s", host);
> to read
>        printf("User:%s\n", host);

I agree.  This is a result of nnrpd/perm.c:HandleProgInput calling "f" 
on each line but not on the trailing bit in the buffer if there is no 
terminal newline.  Given that doc/external-auth indicates the newline 
is expected, I'll fix domain.c in CVS.

We do have test cases for domain.c; unfortunately /bin/sh is removing 
the whitespace before comparing for correct output.  Russ, do you think 
this is worth fiddling some workaround into domain.t for?


> On a related note, doc/external-auth  states
>    "If the program succeeds, it may return a username string ..."
> which suggests that the return is optional
> but testing shows that the return is *required*
> so
>     'may'  should be changed to   'must'

Hmm.  I agree with your analysis of the current behavior.  However, I 
wonder if the documentation is correct, and the code should be modified 
so that, if no username is returned, the default: in readers.conf is 
used.  (I haven't looked at the code, but I imagine that would be 
straightforward.)

Thoughts on what the correct behavior should be?


> Further, it goes on to say that the line should be exactly
>
>      user:username\r
>
> but testing shows that the line only works if the last char is \n
> so this should either read
>
>      user:username\r\n
> or
>      user:username\n

Yeah, my reading of the code backs up your observation; looks like 
nnrpd generates \r\n but will accept \n alone as valid.

Throughout what became doc/external-auth, Aidan's original 
documentation used \r, and while it looked odd, I never got around to 
investigating convincingly enough to change it.  Russ, I'm not 
completely crazy about this, am I?


-- 
Jeffrey M. Vinocur
jeff at litech.org



More information about the inn-workers mailing list