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