1/*
2 * $Id: uam_auth.h,v 1.4 2009-10-13 22:55:37 didg 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
20struct uam_mod {
21  void *uam_module;
22  struct uam_export *uam_fcn;
23  struct uam_mod *uam_prev, *uam_next;
24};
25
26struct 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) (void *, struct passwd **,
33			char *, int, char *, int *);
34      int (*logincont) (void *, struct passwd **, char *,
35			    int, char *, int *);
36      void (*logout) (void);
37    } uam_login;
38    int (*uam_changepw) (void *, char *, struct passwd *, char *,
39			     int, char *, int *);
40    int (*uam_printer) (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
62extern struct uam_mod *uam_load (const char *, const char *);
63extern void uam_unload (struct uam_mod *);
64
65/* auth.c */
66int auth_load (const char *, const char *);
67int auth_register (const int, struct uam_obj *);
68#define auth_unregister(a) uam_detach(a)
69struct uam_obj *auth_uamfind (const int, const char *, const int);
70void auth_unload (void);
71int getuamnames (const int, char *);
72
73#endif /* uam_auth.h */
74