1 /*
2 ** Copyright 2000-2004 Double Precision, Inc. See COPYING for
3 ** distribution information.
4 */
5
6 #include "auth.h"
7 #include "courierauthstaticlist.h"
8 #include "courierauthsasl.h"
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <string.h>
12
13
14 extern int authdaemondo_meta(struct auth_meta *meta,
15 const char *authreq,
16 int (*func)(struct authinfo *, void *),
17 void *arg);
18
auth_getuserinfo(const char * service,const char * uid,int (* callback)(struct authinfo *,void *),void * arg)19 int auth_getuserinfo(const char *service, const char *uid,
20 int (*callback)(struct authinfo *, void *),
21 void *arg)
22 {
23 struct auth_meta dummy;
24
25 memset(&dummy, 0, sizeof(dummy));
26
27 return auth_getuserinfo_meta(&dummy, service, uid, callback, arg);
28 }
29
auth_getuserinfo_meta(struct auth_meta * meta,const char * service,const char * uid,int (* callback)(struct authinfo *,void *),void * arg)30 int auth_getuserinfo_meta(struct auth_meta *meta,
31 const char *service, const char *uid,
32 int (*callback)(struct authinfo *, void *),
33 void *arg)
34 {
35 char *buf=malloc(strlen(service)+strlen(uid)+20);
36 int rc;
37
38 if (!buf)
39 {
40 perror("malloc");
41 return (1);
42 }
43 strcat(strcat(strcat(strcat(strcpy(buf, "PRE . "), service), " "),
44 uid), "\n");
45
46 rc=authdaemondo_meta(meta, buf, callback, arg);
47 free(buf);
48 return (rc);
49 }
50