Import Debian package 0.61.0-1+lenny1
[hcoop/debian/courier-authlib.git] / preauthdaemon.c
CommitLineData
d9898ee8 1/*
2** Copyright 2000-2004 Double Precision, Inc. See COPYING for
3** distribution information.
4*/
5
6#include "auth.h"
7#include "authstaticlist.h"
8#include "courierauthsasl.h"
9#include <stdlib.h>
10#include <stdio.h>
11#include <string.h>
12
13static const char rcsid[]="$Id: preauthdaemon.c,v 1.2 2004/10/21 00:10:49 mrsam Exp $";
14
15extern int authdaemondo(const char *authreq,
16 int (*func)(struct authinfo *, void *), void *arg);
17
18int auth_getuserinfo(const char *service, const char *uid,
19 int (*callback)(struct authinfo *, void *),
20 void *arg)
21{
22char *buf=malloc(strlen(service)+strlen(uid)+20);
23int rc;
24
25 if (!buf)
26 {
27 perror("malloc");
28 return (1);
29 }
30 strcat(strcat(strcat(strcat(strcpy(buf, "PRE . "), service), " "),
31 uid), "\n");
32
33 rc=authdaemondo(buf, callback, arg);
34 free(buf);
35 return (rc);
36}