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