DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T t

⟦028f4e98f⟧ TextFile

    Length: 1816 (0x718)
    Types: TextFile
    Names: »tb_checkauth.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/table/tb_checkauth.c« 

TextFile

/* tb_checkauth.c: authentication checks for submission */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/table/RCS/tb_checkauth.c,v 5.0 90/09/20 16:15:00 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/table/RCS/tb_checkauth.c,v 5.0 90/09/20 16:15:00 pp Exp Locker: pp $
 *
 * $Log:	tb_checkauth.c,v $
 * Revision 5.0  90/09/20  16:15:00  pp
 * rcsforce : 5.0 public release
 * 
 */



#include        "util.h"
#include        "chan.h"

#define         MAX_USER_ARGS           5
#define         MAX_USERIDS             50

extern char *crypt ();

/* ---------------------  Begin  Routines  -------------------------------- */

int tb_checkauth (key, channel, username, passwd)
char            *key;
CHAN            *channel;
char            *username;
char            *passwd;
{
	int     argc, argc2;
	char    *argv [MAX_USER_ARGS],
		*argv2[MAX_USERIDS],
		buf [BUFSIZ];
	int     i;

	PP_DBG (("Lib/tb_checkauth (%s, %s)", key, channel -> ch_name));

	if (channel -> ch_auth_tbl == NULL) {
		PP_LOG (LLOG_EXCEPTIONS,
			("Warning: Channel %s (%s) doesn't have a auth table",
			channel -> ch_name, channel -> ch_show));
		return OK;
	}

	if (tb_k2val (channel -> ch_auth_tbl, key, buf) == NOTOK)
		return (NOTOK);

	if ((argc = sstr2arg (buf, MAX_USER_ARGS, argv, "|")) == NOTOK)
		return (NOTOK);

	if (username && argc > 1) {
		if ((argc2 = sstr2arg (argv[1], MAX_USERIDS, argv2, ","))
		    == NOTOK)
			return NOTOK;

		for (i = 0;  i < argc2; i++)
			if (lexequ (argv2[i], username) == 0)
				return OK;
	}

	if (passwd && argc > 2) {
		if (strcmp (passwd, crypt (passwd, argv[2])) == 0)
			return OK;
	}
	PP_LOG(LLOG_EXCEPTIONS, ("Username %s not allowed for %s on chan %s",
				 username, key, channel -> ch_name));
	return (NOTOK);
}