[news.software.b] The AUTHORIZED function

forrie@suntau.UUCP (Forrie Aldrich) (02/19/90)

For the longest time, I have been having major problems with getting
the authorized function to work... PERIOD.  I'm at patchlevel 17 (or something)
and don't know if there are any bugs with this here... wondered if someone
might have some better docs and examples of the configuration files, etc., that
would allow me to better understand what is wrong here...

Thanks

Forrie

janick@bnr.CA (Janick Bergeron 1617964) (02/20/90)

In article <52@suntau.UUCP> forrie@suntau.UUCP (Forrie Aldrich) writes:
>For the longest time, I have been having major problems with getting
>the authorized function to work... PERIOD.  I'm at patchlevel 17 (or something)
>and don't know if there are any bugs with this here... wondered if someone
>might have some better docs and examples of the configuration files, etc., that
>would allow me to better understand what is wrong here...
>

I'm running B news 2.11, PL 14 and the authorize function work almost perfectly.

You have to define the preprocessor symbol "FASCIST" (in defs.h) to
a list of newsgroups any restricted user is permitted to post to by default.

For example, I restrict posting by novice users to bnr.* only newsgroups with the
following define:

#define FASCIST "bnr"

You can lift that restriction by inserting a line in LIBDIR/authorized
for each userid to be authorized.

                    *************************
                    ** THERE IS A BUG HERE **
                    *************************

The LAST line of the authorized file is NEVER checked. To get around it,
I always put a comment on the last line of the file...
For example, here is the authorized file on my site to allow me (janick)
and the news admin (cadnews) to post to all newsgroups:

cadnews:all
janick:all
# The last line is always ignored !!


                    ****************************
                    ** B news hackers read-on **
                    ****************************

Note that I'm at patch level 14 and this may have been fixed in
later patches. The bug resides in funcs.c, in function fascist()...
Here is the loop that reads each line of the authorized file:

		while (fscanf(facfd, "%[^:]:%s\n", facuser, factemp) != EOF) {
			if (feof(facfd))
				break;
                        /* Processing stuff deleted here */
		}

See the feof() call ??? If we have just read the last line using the
fscanf() call in the while statement, feof() will return TRUE and we
will abort the checking right away hence never processing the last line...



-- 
Janick Bergeron     Bell-Northern Research, Ltd       Ph.: (613) 763-5457
VHDL Tools            P.O. Box 3511, Station C        Fax: (613) 763-2661
                  Ottawa, Ontario, Canada, K1Y 4H7  Flame: 1-800-DEV-NULL
janick@bnr.ca                     library disclaimer; use disclaimer.all;