]> arthur.barton.de Git - netatalk.git/blob - include/atalk/uam.h
72207f1fcdb1d0aa28dc7ce6ea7958525d1cfe2d
[netatalk.git] / include / atalk / uam.h
1 /* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
2  * All Rights Reserved.  See COPYRIGHT.
3  */
4
5 #ifndef UAM_H
6 #define UAM_H 1
7
8 #include <pwd.h>
9 #include <stdarg.h>
10
11 #ifdef TRU64
12 #include <sia.h>
13 #include <siad.h>
14 #endif /* TRU64 */
15
16 /* just a label for exported bits */
17 #ifndef UAM_MODULE_EXPORT
18 #define UAM_MODULE_EXPORT 
19 #endif
20
21 /* type of uam */
22 #define UAM_MODULE_SERVER        1
23 #define UAM_MODULE_CLIENT        2
24
25 /* in case something drastic has to change */
26 #define UAM_MODULE_VERSION       1
27
28 /* things for which we can have uams */
29 #define UAM_SERVER_LOGIN         (1 << 0)
30 #define UAM_SERVER_CHANGEPW      (1 << 1)
31 #define UAM_SERVER_PRINTAUTH     (1 << 2) 
32 #define UAM_SERVER_LOGIN_EXT     (1 << 3)
33
34 /* options */
35 #define UAM_OPTION_USERNAME     (1 << 0) /* get space for username */
36 #define UAM_OPTION_GUEST        (1 << 1) /* get guest user */
37 #define UAM_OPTION_PASSWDOPT    (1 << 2) /* get the password file */
38 #define UAM_OPTION_SIGNATURE    (1 << 3) /* get server signature */
39 #define UAM_OPTION_RANDNUM      (1 << 4) /* request a random number */
40 #define UAM_OPTION_HOSTNAME     (1 << 5) /* get host name */
41 #define UAM_OPTION_COOKIE       (1 << 6) /* cookie handle */
42 #define UAM_OPTION_PROTOCOL     (1 << 7) /* DSI or ASP */
43 #define UAM_OPTION_CLIENTNAME   (1 << 8) /* get client IP address */
44 #define UAM_OPTION_KRB5SERVICE  (1 << 9) /* service name for krb5 principal */
45 #define UAM_OPTION_MACCHARSET   (1 << 10) /* mac charset handle */
46 #define UAM_OPTION_UNIXCHARSET  (1 << 11) /* unix charset handle */
47 #define UAM_OPTION_SESSIONINFO  (1 << 12) /* unix charset handle */
48 #define UAM_OPTION_KRB5REALM    (1 << 13) /* krb realm */
49 #define UAM_OPTION_FQDN         (1 << 14) /* fully qualified name */
50
51 /* some password options. you pass these in the length parameter and
52  * get back the corresponding option. not all of these are implemented. */
53 #define UAM_PASSWD_FILENAME     (1 << 0)
54 #define UAM_PASSWD_MINLENGTH    (1 << 1)
55 #define UAM_PASSWD_EXPIRETIME   (1 << 3) /* not implemented yet. */
56
57 /* max lenght of username  */
58 #define UAM_USERNAMELEN         255
59
60 /* i'm doing things this way because os x server's dynamic linker
61  * support is braindead. it also allows me to do a little versioning. */
62 struct uam_export {
63   int uam_type, uam_version;
64   int (*uam_setup)(const char *);
65   void (*uam_cleanup)(void);
66 };
67
68 #define SESSIONKEY_LEN  64
69 #define SESSIONTOKEN_LEN 8
70
71 struct session_info {
72   void    *sessionkey;          /* random session key */
73   size_t  sessionkey_len;
74   void    *cryptedkey;          /* kerberos/gssapi crypted key */
75   size_t  cryptedkey_len;
76   void    *sessiontoken;        /* session token sent to the client on FPGetSessionToken*/
77   size_t  sessiontoken_len;
78   void    *clientid;          /* whole buffer cotaining eg idlen, id and boottime */
79   size_t  clientid_len;
80 };
81
82 /* register and unregister uams with these functions */
83 extern UAM_MODULE_EXPORT int uam_register (const int, const char *, const char *, ...);
84 extern UAM_MODULE_EXPORT void uam_unregister (const int, const char *);
85
86 /* helper functions */
87 extern UAM_MODULE_EXPORT struct passwd *uam_getname (void*, char *, const int);
88 extern UAM_MODULE_EXPORT int uam_checkuser (const struct passwd *);
89
90 /* afp helper functions */
91 extern UAM_MODULE_EXPORT int uam_afp_read (void *, char *, size_t *,
92                              int (*)(void *, void *, const int));
93 extern UAM_MODULE_EXPORT int uam_afpserver_option (void *, const int, void *, size_t *);
94
95 #ifdef TRU64
96 extern void uam_afp_getcmdline (int *, char ***);
97 extern int uam_sia_validate_user (sia_collect_func_t *, int, char **,
98                                      char *, char *, char *, int, char *,
99                                      char *);
100 #endif /* TRU64 */
101
102 #endif