/*
** Copyright 2000-2004 Double Precision, Inc.  See COPYING for
** distribution information.
*/

#include	"auth.h"
#include	"authstaticlist.h"
#include	"courierauthsasl.h"
#include	<stdlib.h>
#include	<stdio.h>
#include	<string.h>

static const char rcsid[]="$Id: preauthdaemon.c,v 1.2 2004/10/21 00:10:49 mrsam Exp $";

extern int authdaemondo(const char *authreq,
	int (*func)(struct authinfo *, void *), void *arg);

int auth_getuserinfo(const char *service, const char *uid,
		     int (*callback)(struct authinfo *, void *),
		     void *arg)
{
char    *buf=malloc(strlen(service)+strlen(uid)+20);
int     rc;

	if (!buf)
	{
		perror("malloc");
		return (1);
	}
	strcat(strcat(strcat(strcat(strcpy(buf, "PRE . "), service), " "),
		uid), "\n");

	rc=authdaemondo(buf, callback, arg);
	free(buf);
	return (rc);
}


syntax highlighted by Code2HTML, v. 0.9.1