netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
uam.h
Go to the documentation of this file.
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/* just a label for exported bits */
12#ifndef UAM_MODULE_EXPORT
13#define UAM_MODULE_EXPORT
14#endif
15
16/* type of uam */
17#define UAM_MODULE_SERVER 1
18#define UAM_MODULE_CLIENT 2
19
20/* in case something drastic has to change */
21#define UAM_MODULE_VERSION 1
22
23/* define if minimum version of libgcrypt is required */
24#define UAM_NEED_LIBGCRYPT_VERSION NULL
25
26/* things for which we can have uams */
27#define UAM_SERVER_LOGIN (1 << 0)
28#define UAM_SERVER_CHANGEPW (1 << 1)
29#define UAM_SERVER_PRINTAUTH (1 << 2)
30#define UAM_SERVER_LOGIN_EXT (1 << 3)
31
32/* options */
33#define UAM_OPTION_USERNAME (1 << 0)
34#define UAM_OPTION_GUEST (1 << 1)
35#define UAM_OPTION_PASSWDOPT (1 << 2)
36#define UAM_OPTION_SIGNATURE (1 << 3)
37#define UAM_OPTION_RANDNUM (1 << 4)
38#define UAM_OPTION_HOSTNAME (1 << 5)
39#define UAM_OPTION_COOKIE (1 << 6)
40#define UAM_OPTION_PROTOCOL (1 << 7)
41#define UAM_OPTION_CLIENTNAME (1 << 8)
42#define UAM_OPTION_KRB5SERVICE (1 << 9)
43#define UAM_OPTION_MACCHARSET (1 << 10)
44#define UAM_OPTION_UNIXCHARSET (1 << 11)
45#define UAM_OPTION_SESSIONINFO (1 << 12)
46#define UAM_OPTION_KRB5REALM (1 << 13)
47#define UAM_OPTION_FQDN (1 << 14)
48
49/* some password options. you pass these in the length parameter and
50 * get back the corresponding option. not all of these are implemented. */
51#define UAM_PASSWD_FILENAME (1 << 0)
52#define UAM_PASSWD_MINLENGTH (1 << 1)
53#define UAM_PASSWD_SRP_FILENAME (1 << 2)
54#define UAM_PASSWD_EXPIRETIME (1 << 3)
55
56/* max lenght of username */
57#define UAM_USERNAMELEN 255
58
59/* i'm doing things this way because os x server's dynamic linker
60 * support is braindead. it also allows me to do a little versioning. */
61 struct uam_export {
62 int uam_type, uam_version;
63 int (*uam_setup)(void *, const char *);
64 void (*uam_cleanup)(void);
65};
66
67#define SESSIONKEY_LEN 64
68#define SESSIONTOKEN_LEN 8
69
70 struct session_info {
71 void *sessionkey;
72 size_t sessionkey_len;
73 void *cryptedkey;
74 size_t cryptedkey_len;
75 void *sessiontoken;
76 size_t sessiontoken_len;
77 void *clientid;
78 size_t clientid_len;
79};
80
81/* register and unregister uams with these functions */
82 extern UAM_MODULE_EXPORT int uam_register(const int, const char *, const char *,
83 ...);
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(void *, 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 *,
94 size_t *);
95
96#endif
UAM_MODULE_EXPORT
#define UAM_MODULE_EXPORT
Definition logger.h:14
session_info
Definition uam.h:70
session_info::sessionkey_len
size_t sessionkey_len
Definition uam.h:72
session_info::sessiontoken_len
size_t sessiontoken_len
Definition uam.h:76
session_info::clientid_len
size_t clientid_len
Definition uam.h:78
session_info::clientid
void * clientid
Definition uam.h:77
session_info::sessiontoken
void * sessiontoken
Definition uam.h:75
session_info::cryptedkey
void * cryptedkey
Definition uam.h:73
session_info::sessionkey
void * sessionkey
Definition uam.h:71
session_info::cryptedkey_len
size_t cryptedkey_len
Definition uam.h:74
uam_export
Definition uam.h:61
uam_export::uam_setup
int(* uam_setup)(void *, const char *)
Definition uam.h:63
uam_export::uam_cleanup
void(* uam_cleanup)(void)
Definition uam.h:64
uam_export::uam_version
int uam_version
Definition uam.h:62
uam_export::uam_type
int uam_type
Definition uam.h:62
uam_afp_read
UAM_MODULE_EXPORT int uam_afp_read(void *, char *, size_t *, int(*)(void *, void *, const int))
uam_checkuser
UAM_MODULE_EXPORT int uam_checkuser(void *, const struct passwd *)
Definition afpd/uam.c:316
uam_afpserver_option
UAM_MODULE_EXPORT int uam_afpserver_option(void *, const int, void *, size_t *)
Definition afpd/uam.c:402
uam_register
UAM_MODULE_EXPORT int uam_register(const int, const char *, const char *,...)
Definition afpd/uam.c:114
uam_getname
UAM_MODULE_EXPORT struct passwd * uam_getname(void *, char *, const int)
helper functions for plugin uams
Definition afpd/uam.c:219
uam_unregister
UAM_MODULE_EXPORT void uam_unregister(const int, const char *)
Definition afpd/uam.c:194