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_CLIENTNAME (1 << 8) /* get client IP address */ 43#define UAM_OPTION_KRB5SERVICE (1 << 9) /* service name for krb5 principal */ 44#define UAM_OPTION_MACCHARSET (1 << 10) /* mac charset handle */ 45#define UAM_OPTION_UNIXCHARSET (1 << 11) /* unix charset handle */ 46#define UAM_OPTION_SESSIONINFO (1 << 12) /* unix charset handle */ 47#define UAM_OPTION_KRB5REALM (1 << 13) /* krb realm */ 48#define UAM_OPTION_FQDN (1 << 14) /* fully qualified name */ 49 50/* some password options. you pass these in the length parameter and 51 * get back the corresponding option. not all of these are implemented. */ 52#define UAM_PASSWD_FILENAME (1 << 0) 53#define UAM_PASSWD_MINLENGTH (1 << 1) 54#define UAM_PASSWD_EXPIRETIME (1 << 3) /* not implemented yet. */ 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. */ 61struct uam_export { 62 int uam_type, uam_version; 63 int (*uam_setup)(const char *); 64 void (*uam_cleanup)(void); 65}; 66 67#define SESSIONKEY_LEN 64 68#define SESSIONTOKEN_LEN 8 69 70struct session_info { 71 void *sessionkey; /* random session key */ 72 size_t sessionkey_len; 73 void *cryptedkey; /* kerberos/gssapi crypted key */ 74 size_t cryptedkey_len; 75 void *sessiontoken; /* session token sent to the client on FPGetSessionToken*/ 76 size_t sessiontoken_len; 77 void *clientid; /* whole buffer cotaining eg idlen, id and boottime */ 78 size_t clientid_len; 79}; 80 81/* register and unregister uams with these functions */ 82extern UAM_MODULE_EXPORT int uam_register (const int, const char *, const char *, ...); 83extern UAM_MODULE_EXPORT void uam_unregister (const int, const char *); 84 85/* helper functions */ 86extern UAM_MODULE_EXPORT struct passwd *uam_getname (void*, char *, const int); 87extern UAM_MODULE_EXPORT int uam_checkuser (const struct passwd *); 88 89/* afp helper functions */ 90extern UAM_MODULE_EXPORT int uam_afp_read (void *, char *, size_t *, 91 int (*)(void *, void *, const int)); 92extern UAM_MODULE_EXPORT int uam_afpserver_option (void *, const int, void *, size_t *); 93 94#ifdef TRU64 95extern void uam_afp_getcmdline (int *, char ***); 96extern int uam_sia_validate_user (sia_collect_func_t *, int, char **, 97 char *, char *, char *, int, char *, 98 char *); 99#endif /* TRU64 */ 100 101#endif 102