/*

gcc -shared dnewsauth2.c -o dnewsauth.so
cp dnewsauth.so /usr/local/dnews

In dnews.conf
auth_extern true
auth_lib /usr/local/dnews/dnewsauth.so

*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif

__declspec( dllexport ) int dnewsauth(char *user, char *pass, char *usergrps, int bfsz, char *msg)
{
	if (strcmp(user,"chrisp")!=0) {
		strcpy(msg,"No such user"); 
		return FALSE;
	}
	if (strcmp(pass,"fred")!=0) {
		strcpy(msg,"Wrong password"); 
		return FALSE;
	}
	strncpy(usergrps,"adults,gold",bfsz); usergrps[bfsz] = 0;
	strcpy(msg,"User logged in ok");  /* Optional */	
	return TRUE;
}
