Mark Constable wrote:
> 
>> case ${TMPIN% *} in
> 
> Doesn't work with more than 2 tokens, ${TMPIN:0:3} works.

You're right... I meant ${TMPIN%% *}

>>>   read A # throwaway
>>>   read B # throwaway
>>>   read ID
>>>   read PW
>> That won't work when there's no newline.
> 
> As it turns out, fortunately, both these examples still work...
> 
>  echo -e "AUTH 1\na\nb\nc\nd" | authProg
>  echo -e "AUTH 1\na\nb\nc\nd\n" | authProg

"echo" does not very closely mimic the auth daemon, as you noticed 
earlier.  First, it'll add a newline even when you don't want one (since 
you're not using -n).  Second, it'll close its stdout when it is done, 
which authdaemon doesn't.  That will cause significantly different 
behavior in authProg.  "read" will not return if there is no newline, 
and the input stream remains open.

>> That sort of problem is easier  
>> to fix when you're not using bash.  Input validation probably is, too.
> 
> I need a very simple procedural working prototype before "porting"
> this to PHP and the provided samplepipe.pl script was useless for
> me. IMVHO it is not a good example to illustrate how the API works.

What would you rather see in an example?

> Thanks Gordon, my little script is simpler and safer now.

NP


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to