diff options
author | Richard Basch <probe@mit.edu> | 1997-02-18 05:37:41 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1997-02-18 05:37:41 +0000 |
commit | 4d51de8797b4444064e76eb86b519c3244974295 (patch) | |
tree | a98db60fd93f288366ff16c47f1eba37aef0364c /src/include/kerberosIV/krb.h | |
parent | dd378c57612bc80c0ea93bb9eb6efc11fc9686c5 (diff) | |
download | krb5-4d51de8797b4444064e76eb86b519c3244974295.tar.gz krb5-4d51de8797b4444064e76eb86b519c3244974295.tar.xz krb5-4d51de8797b4444064e76eb86b519c3244974295.zip |
Added support for building krb4 library (win16/win32)
krb_err.h is a generated file.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9879 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/kerberosIV/krb.h')
-rw-r--r-- | src/include/kerberosIV/krb.h | 328 |
1 files changed, 226 insertions, 102 deletions
diff --git a/src/include/kerberosIV/krb.h b/src/include/kerberosIV/krb.h index da97ed181..0ee380aa5 100644 --- a/src/include/kerberosIV/krb.h +++ b/src/include/kerberosIV/krb.h @@ -27,34 +27,17 @@ #ifndef KRB_DEFS #define KRB_DEFS -#if defined(_WIN32) && !defined(_WINDOWS) -#define _WINDOWS -#endif - -#if defined(_WINDOWS) -#include <win-mac.h> -#endif +/* Need some defs from des.h */ +#include <kerberosIV/des.h> -/* Windows declarations */ -#ifndef KRB5_CALLCONV -#define KRB5_CALLCONV -#define KRB5_CALLCONV_C -#define KRB5_DLLIMP -#define KRB5_EXPORTVAR -#endif -#ifndef FAR -#define FAR -#define NEAR -#endif +#ifdef _WINDOWS +#include <winsock.h> +#include <time.h> +#endif /* _WINDOWS */ -#ifndef INTERFACE -#define INTERFACE KRB5_CALLCONV -#endif +#include <port-sockets.h> -/* Need some defs from des.h */ -#include <kerberosIV/des.h> - /* Text describing error codes */ #define MAX_KRB_ERRORS 256 extern const char *const krb_err_txt[MAX_KRB_ERRORS]; @@ -70,12 +53,6 @@ extern const char *const krb_err_txt[MAX_KRB_ERRORS]; #define KSUCCESS 0 #define KFAILURE 255 -#ifndef __alpha -#define KRB4_32 long -#else -#define KRB4_32 int -#endif - #ifdef NO_UIDGID_T typedef unsigned short uid_t; typedef unsigned short gid_t; @@ -95,14 +72,6 @@ typedef unsigned short gid_t; * the realm. */ -#ifdef notdef -this is server - only, does not belong here; -#define KRBLOG "/kerberos/kerberos.log" -are these used anyplace '?'; -#define VX_KRB_HSTFILE "/etc/krbhst" -#define PC_KRB_HSTFILE "\\kerberos\\krbhst" -#endif - #define KRB_CONF "/etc/krb.conf" #define KRB_RLM_TRANS "/etc/krb.realms" #define KRB_MASTER "kerberos" @@ -124,8 +93,7 @@ are these used anyplace '?'; #define MAX_HSTNM 100 #ifndef DEFAULT_TKT_LIFE /* allow compile-time override */ -#define DEFAULT_TKT_LIFE 96 /* default lifetime for krb_mk_req - & co., 8 hrs */ +#define DEFAULT_TKT_LIFE 255 /* default lifetime for krb_mk_req */ #endif /* Definition of text structure used to pass text around */ @@ -200,19 +168,19 @@ typedef struct credentials CREDENTIALS; /* Structure definition for rd_private_msg and rd_safe_msg */ struct msg_dat { - unsigned char *app_data; /* pointer to appl data */ + unsigned char FAR *app_data; /* pointer to appl data */ unsigned KRB4_32 app_length; /* length of appl data */ - unsigned KRB4_32 hash; /* hash to lookup replay */ - int swap; /* swap bytes? */ - KRB4_32 time_sec; /* msg timestamp seconds */ - unsigned char time_5ms; /* msg timestamp 5ms units */ + unsigned KRB4_32 hash; /* hash to lookup replay */ + int swap; /* swap bytes? */ + KRB4_32 time_sec; /* msg timestamp seconds */ + unsigned char time_5ms; /* msg timestamp 5ms units */ }; typedef struct msg_dat MSG_DAT; /* Location of ticket file for save_cred and get_cred */ -#ifdef PC +#ifdef _WINDOWS #define TKT_FILE "\\kerberos\\ticket.ses" #else #define TKT_FILE tkt_string() @@ -376,10 +344,6 @@ typedef struct msg_dat MSG_DAT; #define K_FLAG_6 /* reserved */ #define K_FLAG_7 /* reserved, bit 7 --> msb */ -#ifndef PC -char *tkt_string(); -#endif /* PC */ - #ifdef OLDNAMES #define krb_mk_req mk_ap_req #define krb_rd_req rd_ap_req @@ -406,11 +370,7 @@ char *tkt_string(); #define KOPT_DONT_MK_REQ 0x00000001 /* don't call krb_mk_req */ #define KOPT_DO_MUTUAL 0x00000002 /* do mutual auth */ - -#define KOPT_DONT_CANON 0x00000004 /* - * don't canonicalize inst as - * a hostname - */ +#define KOPT_DONT_CANON 0x00000004 /* don't canonicalize inst as a host */ #define KRB_SENDAUTH_VLEN 8 /* length for version strings */ @@ -418,6 +378,7 @@ char *tkt_string(); #define KOPT_DO_OLDSTYLE 0x00000008 /* use the old-style protocol */ #endif /* ATHENA_COMPAT */ +#ifdef unix /* until we do V4 compat under DOS, just turn this off */ #define _fmemcpy memcpy #define _fstrncpy strncpy @@ -426,58 +387,24 @@ char *tkt_string(); #define TIME_GMT_UNIXSEC unix_time_gmt_unixsec((unsigned KRB4_32 *)0) #define TIME_GMT_UNIXSEC_US(us) unix_time_gmt_unixsec((us)) #define CONVERT_TIME_EPOCH ((long)0) /* Unix epoch is Krb epoch */ +#endif -#if (defined(__STDC__) || defined(_WINDOWS)) && !defined(KRB5_NO_PROTOTYPES) -#define PROTOTYPE(x) x -#else -#define PROTOTYPE(x) () -#endif /* STDC or PROTOTYPES */ +#ifdef _WINDOWS +#define TIME_GMT_UNIXSEC win_time_gmt_unixsec((unsigned KRB4_32 *)0) +#define TIME_GMT_UNIXSEC_US(us) win_time_gmt_unixsec((us)) +#define CONVERT_TIME_EPOCH win_time_get_epoch() +#endif /* Define u_char, u_short, u_int, and u_long. */ #include <sys/types.h> -/* If this source file requires it, define struct sockaddr_in - (and possibly other things related to network I/O). FIXME. */ -#if defined(DEFINE_SOCKADDR) - #if !defined(_WINDOWS) -#include <netinet/in.h> /* For struct sockaddr_in and in_addr */ -#include <arpa/inet.h> /* For inet_ntoa */ -#include <netdb.h> /* For struct hostent, gethostbyname, etc */ -#include <sys/param.h> /* For MAXHOSTNAMELEN */ -#include <sys/socket.h> /* For SOCK_*, AF_*, etc */ -#include <sys/time.h> /* For struct timeval */ #ifdef NEED_TIME_H #include <time.h> /* For localtime, etc */ +#include <sys/time.h> #endif #endif /* !_WINDOWS */ -#ifndef INVALID_SOCKET -#define INVALID_SOCKET (-1) -#endif - -#endif /* DEFINE_SOCKADDR */ - - -/* - * Compatability with WinSock calls on MS-Windows... - */ -#define SOCKET unsigned int -#define closesocket close -#define ioctlsocket ioctl -#define SOCKET_ERROR (-1) - -/* Some of our own infrastructure where the WinSock stuff was too hairy - to dump into a clean Unix program... */ - -#define SOCKET_INITIALIZE() (0) /* No error (or anything else) */ -#define SOCKET_CLEANUP() /* nothing */ -#define SOCKET_ERRNO errno -#define SOCKET_SET_ERRNO(x) (errno = (x)) -#define SOCKET_NFDS(f) ((f)+1) /* select() arg for a single fd */ -#define SOCKET_READ read -#define SOCKET_WRITE write -#define SOCKET_EINTR EINTR /* ask to disable IP address checking in the library */ extern int krb_ignore_ip_address; @@ -492,22 +419,219 @@ extern int krb_debug; #define DEB(x) /* nothing */ #endif - /* * Some Unixes don't declare errno in <errno.h>... * Move this out to individual c-*.h files if it becomes troublesome. */ -#ifndef errno +#if !defined(errno) && !defined(_WINDOWS) extern int errno; #endif /* Define a couple of function types including parameters. These are needed on MS-Windows to convert arguments of the function pointers to the proper types during calls. */ -typedef int (*key_proc_type) PROTOTYPE ((char *, char *, char *, - char *, C_Block)); + +typedef int (KRB5_CALLCONV *key_proc_type) + PROTOTYPE ((char FAR *, char FAR *, char FAR *, + char FAR *, C_Block)); #define KEY_PROC_TYPE_DEFINED -typedef int (*decrypt_tkt_type) PROTOTYPE ((char *, char *, char *, char *, - key_proc_type, KTEXT *)); + +typedef int (KRB5_CALLCONV *decrypt_tkt_type) + PROTOTYPE ((char FAR *, char FAR *, char FAR *, + char FAR *, key_proc_type, KTEXT FAR *)); #define DECRYPT_TKT_TYPE_DEFINED + +/* + * Function Prototypes for Kerberos V4. + */ + +/* dest_tkt.c */ +KRB5_DLLIMP int KRB5_CALLCONV dest_tkt + PROTOTYPE((void)); +/* err_txt.c */ +KRB5_DLLIMP const char FAR * KRB5_CALLCONV krb_get_err_text + PROTOTYPE((int errno)); +/* g_ad_tkt.c */ +int get_ad_tkt + PROTOTYPE((char *service, char *sinst, char *realm, int lifetime)); +/* g_admhst.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_admhst + PROTOTYPE((char FAR *host, char FAR *realm, int index)); +/* g_cred.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_cred + PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm, + CREDENTIALS FAR *c)); +/* g_in_tkt.c */ +int krb_get_in_tkt + PROTOTYPE((char *user, char *instance, char *realm, + char *service, char *sinst, int life, + key_proc_type, decrypt_tkt_type, char *arg)); +int krb_get_in_tkt_preauth + PROTOTYPE((char *user, char *instance, char *realm, + char *service, char *sinst, int life, + key_proc_type, decrypt_tkt_type, char *arg, + char *preauth_p, int preauth_len)); +/* g_krbhst.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_krbhst + PROTOTYPE((char FAR *host, char FAR *realm, int index)); +/* g_krbrlm.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_lrealm + PROTOTYPE((char FAR *realm, int index)); +/* g_phost.c */ +KRB5_DLLIMP char FAR * KRB5_CALLCONV krb_get_phost + PROTOTYPE((char FAR * alias)); +/* g_pw_in_tkt.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_pw_in_tkt + PROTOTYPE((char FAR *user, char FAR *instance, char FAR *realm, + char FAR *service, char FAR *sinstance, + int life, char FAR *password)); +KRB5_DLLIMP int KRB5_CALLCONV krb_get_pw_in_tkt_preauth + PROTOTYPE((char FAR *user, char FAR *instance, char FAR *realm, + char FAR *service, char FAR *sinstance, + int life, char FAR *password)); +/* g_svc_in_tkt.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_svc_in_tkt + PROTOTYPE((char FAR *user, char FAR *instance, char FAR *realm, + char FAR *service, char FAR *sinstance, + int life, char FAR *srvtab)); +/* g_tf_fname.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_tf_fullname + PROTOTYPE((char *ticket_file, char *name, char *inst, char *realm)); +/* g_tf_realm.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_tf_realm + PROTOTYPE((char *ticket_file, char *realm)); +/* g_tkt_svc.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_get_ticket_for_service + PROTOTYPE((char FAR *serviceName, + char FAR *buf, unsigned KRB4_32 FAR *buflen, + int checksum, des_cblock, Key_schedule, + char FAR *version, int includeVersion)); +/* getst.c */ +int getst + PROTOTYPE((int fd, char *s, int n)); +/* in_tkt.c */ +KRB5_DLLIMP int KRB5_CALLCONV in_tkt + PROTOTYPE((char *name, char *inst)); +/* kname_parse.c */ +KRB5_DLLIMP int KRB5_CALLCONV kname_parse + PROTOTYPE((char FAR *name, char FAR *inst, char FAR *realm, + char FAR *fullname)); +/* kuserok.c */ +KRB5_DLLIMP int KRB5_CALLCONV kuserok + PROTOTYPE((AUTH_DAT FAR *kdata, char FAR *luser)); +/* mk_auth.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_check_auth + PROTOTYPE((KTEXT, unsigned KRB4_32 cksum, MSG_DAT FAR *, + C_Block, Key_schedule, + struct sockaddr_in FAR * local_addr, + struct sockaddr_in FAR * foreign_addr)); +KRB5_DLLIMP int KRB5_CALLCONV krb_mk_auth + PROTOTYPE((long options, KTEXT ticket, + char FAR *service, char FAR *inst, char FAR *realm, + unsigned KRB4_32 checksum, char FAR *version, KTEXT buf)); +/* mk_err.c */ +KRB5_DLLIMP long KRB5_CALLCONV krb_mk_err + PROTOTYPE((u_char FAR *out, KRB4_32 code, char FAR *text)); +/* mk_preauth.c */ +int krb_mk_preauth + PROTOTYPE((char **preauth_p, int *preauth_len, key_proc_type, + char *name, char *inst, char *realm, char *password, + C_Block)); +void krb_free_preauth + PROTOTYPE((char * preauth_p, int len)); +/* mk_priv.c */ +KRB5_DLLIMP long KRB5_CALLCONV krb_mk_priv + PROTOTYPE((u_char FAR *in, u_char FAR *out, + unsigned KRB4_32 length, + Key_schedule, C_Block, + struct sockaddr_in FAR * sender, + struct sockaddr_in FAR * receiver)); +/* mk_req.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_mk_req + PROTOTYPE((KTEXT authent, + char FAR *service, char FAR *instance, char FAR *realm, + KRB4_32 checksum)); +/* mk_safe.c */ +KRB5_DLLIMP long KRB5_CALLCONV krb_mk_safe + PROTOTYPE((u_char FAR *in, u_char FAR *out, unsigned KRB4_32 length, + C_Block, + struct sockaddr_in FAR *sender, + struct sockaddr_in FAR *receiver)); +/* netread.c */ +int krb_net_read + PROTOTYPE((int fd, char *buf, int len)); +/* netwrite.c */ +int krb_net_write + PROTOTYPE((int fd, char *buf, int len)); +/* pkt_clen.c */ +int pkt_clen + PROTOTYPE((KTEXT)); +/* put_svc_key.c */ +KRB5_DLLIMP int KRB5_CALLCONV put_svc_key + PROTOTYPE((char FAR *sfile, + char FAR *name, char FAR *inst, char FAR *realm, + int newvno, char FAR *key)); +/* rd_err.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_rd_err + PROTOTYPE((u_char FAR *in, u_long in_length, + long FAR *code, MSG_DAT FAR *m_data)); +/* rd_priv.c */ +KRB5_DLLIMP long KRB5_CALLCONV krb_rd_priv + PROTOTYPE((u_char FAR *in,unsigned KRB4_32 in_length, + Key_schedule, C_Block, + struct sockaddr_in FAR *sender, + struct sockaddr_in FAR *receiver, + MSG_DAT FAR *m_data)); +/* rd_req.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_rd_req + PROTOTYPE((KTEXT, char FAR *service, char FAR *inst, + unsigned KRB4_32 from_addr, AUTH_DAT FAR *, + char FAR *srvtab)); +/* rd_safe.c */ +KRB5_DLLIMP long KRB5_CALLCONV krb_rd_safe + PROTOTYPE((u_char FAR *in, unsigned KRB4_32 in_length, C_Block, + struct sockaddr_in FAR *sender, + struct sockaddr_in FAR *receiver, + MSG_DAT FAR *m_data)); +/* rd_svc_key.c */ +KRB5_DLLIMP int KRB5_CALLCONV read_service_key + PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm, + int kvno, char FAR *file, char FAR *key)); +KRB5_DLLIMP int KRB5_CALLCONV get_service_key + PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm, + int FAR *kvno, char FAR *file, char FAR *key)); +/* realmofhost.c */ +KRB5_DLLIMP char FAR * KRB5_CALLCONV krb_realmofhost + PROTOTYPE((char FAR *host)); +/* recvauth.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_recvauth + PROTOTYPE((long options, int fd, KTEXT ticket, + char FAR *service, char FAR *instance, + struct sockaddr_in FAR *foreign_addr, + struct sockaddr_in FAR *local_addr, + AUTH_DAT FAR *kdata, char FAR *srvtab, + Key_schedule schedule, char FAR *version)); +/* save_creds.c */ +KRB5_DLLIMP int KRB5_CALLCONV krb_save_credentials + PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm, + C_Block session, int lifetime, int kvno, + KTEXT ticket, long issue_date)); +/* send_to_kdc.c */ +int send_to_kdc + PROTOTYPE((KTEXT pkt, KTEXT rpkt, char *realm)); +/* tkt_string.c */ +char * tkt_string + PROTOTYPE((void)); +void krb_set_tkt_string + PROTOTYPE((char *)); + +#ifdef _WINDOWS +HINSTANCE get_lib_instance(void); +unsigned int krb_get_notification_message(void); +KRB5_DLLIMP char FAR * KRB5_CALLCONV krb_get_default_user(void); +KRB5_DLLIMP int KRB5_CALLCONV krb_set_default_user(char *); +KRB4_32 win_time_gmt_unixsec(unsigned KRB4_32 *); +long win_time_get_epoch(void); +#endif + #endif /* KRB_DEFS */ |