]> arthur.barton.de Git - netatalk.git/blob - etc/papd/uam_auth.h
CVS id tags, define fixes, code beautification
[netatalk.git] / etc / papd / uam_auth.h
1 /*
2  * $Id: uam_auth.h,v 1.3 2001-06-25 20:13:45 rufustfirefly Exp $
3  *
4  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
5  * All Rights Reserved.  See COPYRIGHT.
6  *
7  * interface between uam.c and auth.c
8  */
9
10 #ifndef PAPD_UAM_AUTH_H
11 #define PAPD_UAM_AUTH_H 1
12
13 #include <sys/cdefs.h>
14 #include <pwd.h>
15
16 #include <atalk/uam.h>
17
18 #include "file.h"
19
20 struct uam_mod {
21   void *uam_module;
22   struct uam_export *uam_fcn;
23   struct uam_mod *uam_prev, *uam_next;
24 };
25
26 struct uam_obj {
27   const char *uam_name; /* authentication method */
28   char *uam_path; /* where it's located */
29   int uam_count;
30   union {
31     struct {
32       int (*login) __P((void *, struct passwd **, 
33                         char *, int, char *, int *));
34       int (*logincont) __P((void *, struct passwd **, char *,
35                             int, char *, int *));
36       void (*logout) __P((void));
37     } uam_login;
38     int (*uam_changepw) __P((void *, char *, struct passwd *, char *,
39                              int, char *, int *));
40     int (*uam_printer) __P((char *, char *, char *, struct papfile *));
41   } u;
42   struct uam_obj *uam_prev, *uam_next;
43 };
44
45 #define uam_attach(a, b) do { \
46     (a)->uam_prev->uam_next = (b); \
47     (b)->uam_prev = (a)->uam_prev; \
48     (b)->uam_next = (a); \
49     (a)->uam_prev = (b); \
50 } while (0)                                  
51
52 #define uam_detach(a) do { \
53     (a)->uam_prev->uam_next = (a)->uam_next; \
54     (a)->uam_next->uam_prev = (a)->uam_prev; \
55 } while (0)
56
57 #define UAM_LIST(type) (((type) == UAM_SERVER_LOGIN) ? &uam_login : \
58                 (((type) == UAM_SERVER_CHANGEPW) ? &uam_changepw : \
59                 (((type) == UAM_SERVER_PRINTAUTH) ? &uam_printer : NULL)))
60
61
62 extern struct uam_mod *uam_load __P((const char *, const char *));
63 extern void uam_unload __P((struct uam_mod *));
64
65 /* auth.c */
66 int auth_load __P((const char *, const char *));
67 int auth_register __P((const int, struct uam_obj *));
68 #define auth_unregister(a) uam_detach(a)
69 struct uam_obj *auth_uamfind __P((const int, const char *, const int));
70 void auth_unload __P((void));
71 int getuamnames __P((const int, char *));
72
73 #endif /* uam_auth.h */