/*
	Sample dynamic link library for unix authorization.
	Use the procedure libauth.sh to build the shared
	library.

  In dnews.conf you need to define:
	auth_dll true

int auth_user(char *ipname, char *ipnum, char *user, char *pass	     ,char *postgrps, char *readgrps, char *msg, int bfsz);


*/  

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
int auth_user(char *ipname, char *ipnum, char *user, char *pass	     ,char *postgrps, char *readgrps, char *msg, int bfsz);
#ifndef TRUE
#define FALSE 0
#define TRUE (!FALSE)
#endif


int auth_user(char *ipname, char *ipnum, char *user, char *pass
	     ,char *postgrps, char *readgrps, char *msg, int bfsz)
{
	strcpy(msg,"");
	if (strcmp(user,"chrisp")!=0) return FALSE;
	if (strcmp(pass,"test")!=0) return FALSE;
	strncpy(postgrps,"*",bfsz); /* Give full access to all users */
	strncpy(readgrps,"*",bfsz); /* Give full posting access */
	/* The msg paramter is used to return any error information */
	/* postgrps and readgrps are bfsz bytes long (about 1500 bytes)*/
	return TRUE;
}
