]> arthur.barton.de Git - netatalk.git/blob - include/atalk/uam.h
Merge master
[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_MAXFAIL      (1 << 2) /* not implemented yet. */
56 #define UAM_PASSWD_EXPIRETIME   (1 << 3) /* not implemented yet. */
57
58 /* max lenght of username  */
59 #define UAM_USERNAMELEN         255
60
61 /* i'm doing things this way because os x server's dynamic linker
62  * support is braindead. it also allows me to do a little versioning. */
63 struct uam_export {
64   int uam_type, uam_version;
65   int (*uam_setup)(const char *);
66   void (*uam_cleanup)(void);
67 };
68
69 #define SESSIONKEY_LEN  64
70 #define SESSIONTOKEN_LEN 8
71
72 struct session_info {
73   void    *sessionkey;          /* random session key */
74   size_t  sessionkey_len;
75   void    *cryptedkey;          /* kerberos/gssapi crypted key */
76   size_t  cryptedkey_len;
77   void    *sessiontoken;        /* session token sent to the client on FPGetSessionToken*/
78   size_t  sessiontoken_len;
79   void    *clientid;          /* whole buffer cotaining eg idlen, id and boottime */
80   size_t  clientid_len;
81 };
82
83 /* register and unregister uams with these functions */
84 extern UAM_MODULE_EXPORT int uam_register (const int, const char *, const char *, ...);
85 extern UAM_MODULE_EXPORT void uam_unregister (const int, const char *);
86
87 /* helper functions */
88 extern UAM_MODULE_EXPORT struct passwd *uam_getname (void*, char *, const int);
89 extern UAM_MODULE_EXPORT int uam_checkuser (const struct passwd *);
90
91 /* afp helper functions */
92 extern UAM_MODULE_EXPORT int uam_afp_read (void *, char *, size_t *,
93                              int (*)(void *, void *, const int));
94 extern UAM_MODULE_EXPORT int uam_afpserver_option (void *, const int, void *, size_t *);
95
96 #ifdef TRU64
97 extern void uam_afp_getcmdline (int *, char ***);
98 extern int uam_sia_validate_user (sia_collect_func_t *, int, char **,
99                                      char *, char *, char *, int, char *,
100                                      char *);
101 #endif /* TRU64 */
102
103 #endif