Import Upstream version 0.69.0
[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"
b0322a85 7#include "courierauthstaticlist.h"
d9898ee8 8#include "courierauthsasl.h"
9#include <stdlib.h>
10#include <stdio.h>
11#include <string.h>
12
d9898ee8 13
14extern int authdaemondo(const char *authreq,
15 int (*func)(struct authinfo *, void *), void *arg);
16
17int auth_getuserinfo(const char *service, const char *uid,
18 int (*callback)(struct authinfo *, void *),
19 void *arg)
20{
21char *buf=malloc(strlen(service)+strlen(uid)+20);
22int rc;
23
24 if (!buf)
25 {
26 perror("malloc");
27 return (1);
28 }
29 strcat(strcat(strcat(strcat(strcpy(buf, "PRE . "), service), " "),
30 uid), "\n");
31
32 rc=authdaemondo(buf, callback, arg);
33 free(buf);
34 return (rc);
35}