home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / ckuath.h < prev    next >
C/C++ Source or Header  |  2020-01-01  |  8KB  |  229 lines

  1. /*  C K U A T H . H --  "C-Kermit to Authentication" interface  */
  2.  
  3. /*
  4.   Author: Jeffrey E Altman <jaltman@secure-endpoints.com>,
  5.             Secure Endpoints Inc., New York City.
  6.  
  7.   Copyright (C) 1999, 2004,
  8.     Trustees of Columbia University in the City of New York.
  9.     All rights reserved.  See the C-Kermit COPYING.TXT file or the
  10.     copyright text in the ckcmai.c module for disclaimer and permissions.
  11. */
  12.  
  13. /*
  14.  * Based on a concatenation of all necessary include files distributed with
  15.  * the Kerberos 5 NT Alpha 2 Telnet package from MIT.
  16.  */
  17.  
  18. #ifndef KRB5_KERMIT_H
  19. #define KRB5_KERMIT_H
  20.  
  21. #ifndef BOOL
  22. #define BOOL int
  23. #endif
  24.  
  25. /* Header file for encrypted-stream library.
  26.  * Written by Ken Raeburn (Raeburn@Cygnus.COM).
  27.  * Copyright (C) 1991, 1992, 1994 by Cygnus Support.
  28.  *
  29.  * Permission to use, copy, modify, and
  30.  * distribute this software and its documentation for any purpose and
  31.  * without fee is hereby granted, provided that the above copyright
  32.  * notice appear in all copies and that both that copyright notice and
  33.  * this permission notice appear in supporting documentation.
  34.  * Cygnus Support makes no representations about the suitability of
  35.  * this software for any purpose.  It is provided "as is" without express
  36.  * or implied warranty.
  37.  */
  38.  
  39. #ifndef K5STREAM_H
  40. #define K5STREAM_H
  41.  
  42. typedef void *kstream_ptr;                      /* Data send on the kstream */
  43. struct kstream_data_block {
  44.   kstream_ptr ptr;
  45.   size_t length;
  46. };
  47.  
  48. typedef struct kstream_int {                    /* Object we pass around */
  49.     int fd;                                       /* Open socket descriptor */
  50.     int (*encrypt)(struct kstream_data_block *, /* output */
  51.                    struct kstream_data_block *); /* input */
  52.     int encrypt_type;
  53.     int (*decrypt)(struct kstream_data_block *, /* output */
  54.                    struct kstream_data_block *); /* input */
  55.     int decrypt_type;
  56. } *kstream;
  57.  
  58. /* Prototypes */
  59.  
  60. int  kstream_destroy();
  61. void kstream_set_buffer_mode(int);
  62. int  kstream_create_from_fd(int fd, kstream_ptr);
  63. int kstream_write(void *, size_t);
  64. int kstream_read(void *, size_t);
  65.  
  66. #endif /* K5STREAM_H */
  67.  
  68. /*
  69.  * Implements Telnet authentication and encryption
  70.  */
  71.  
  72. #ifndef TELNET_AUTH_H
  73. #define TELNET_AUTH_H
  74.  
  75. int auth_parse(unsigned char *, int);
  76.  
  77. int auth_init(kstream);
  78.  
  79. void auth_destroy(void);
  80.  
  81. int auth_encrypt(struct kstream_data_block *, struct kstream_data_block *);
  82.  
  83. int auth_decrypt(struct kstream_data_block *, struct kstream_data_block *);
  84.  
  85. extern BOOL forward_flag;
  86. extern BOOL forwardable_flag;
  87. extern BOOL forwarded_tickets;
  88. #endif /* TEL_AUTH_H */
  89.  
  90.  
  91. /* C-Kermit specific functions */
  92. _PROTOTYP(void auth_finished,(int));
  93. _PROTOTYP(int ck_auth_init, (char *, char *, char *, int));
  94. _PROTOTYP(int ck_tn_auth_valid, (VOID));
  95. _PROTOTYP(int ck_tn_auth_in_progress,(VOID));
  96. _PROTOTYP(int ck_tn_sb_auth, (char *, int));
  97. _PROTOTYP(int ck_tn_sb_encrypt, (char *, int));
  98. _PROTOTYP(int ck_tn_auth_request, (VOID));
  99. _PROTOTYP(void ck_tn_encrypt, (char *, int));
  100. _PROTOTYP(void ck_tn_decrypt, (char *, int));
  101. _PROTOTYP(void ck_tn_encrypt_start, (VOID));
  102. _PROTOTYP(void ck_tn_encrypt_stop, (VOID));
  103. _PROTOTYP(int ck_tn_authenticated, (VOID));
  104. #ifdef CK_ENCRYPTION
  105. _PROTOTYP(int ck_tn_encrypting, (VOID));
  106. _PROTOTYP(int ck_tn_decrypting, (VOID));
  107. #endif /* CK_ENCRYPTION */
  108. #ifdef CK_SSL
  109. _PROTOTYP(int ck_tn_tls_negotiate, (VOID));
  110. _PROTOTYP(int SendSSLAuthSB, (int, void *, int));
  111. #endif /* CK_SSL */
  112.  
  113. #ifdef CK_KERBEROS
  114.     /* Define MIT_CURRENT to compile the code for use with versions of */
  115.     /* Kerberos later than KRB5 1.0.5.  Note.  This will not compile   */
  116.     /* successfully in Kermit 95 due to the segmentation of crypto     */
  117.     /* into a separate DLL.                                            */
  118.  
  119. #define KRB_DEFTIM 600                  /* Default lifetime (minutes) */
  120.  
  121. /* Kerberos structure definitions */
  122.  
  123. struct krb_op_data {                    /* Operational data for all actions */
  124.     int version;                        /* Kerberos version    */
  125.     char * cache;                       /* Kerberos cache file */
  126. };
  127.  
  128. struct krb4_init_data {                 /* INITIALIZE data structure */
  129.     int lifetime;
  130.     char * principal;                   /* Principal string */
  131.     char * instance;
  132.     char * realm;                       /* Realm string */
  133.     char * password;                    /* Kerberos password */
  134.     int    preauth;                     /* Use preauth mode? */
  135.     int    verbose;                     /* Verbose output? */
  136. };
  137.  
  138. #define KRB5_NUM_OF_ADDRS 16
  139. struct krb5_init_data {                 /* INITIALIZE data structure */
  140.     int forwardable;                    /* Switch values */
  141.     int proxiable;                      /* Correspond to switch names... */
  142.     int lifetime;
  143.     int renew;
  144.     int renewable;
  145.     int validate;
  146.     char * postdate;
  147.     char * service;
  148.     char * principal;                   /* Principal string */
  149.     char * instance;
  150.     char * realm;                       /* Realm string */
  151.     char * password;                    /* Kerberos password */
  152.     int    preauth;                     /* Use preauth mode? */
  153.     int    verbose;                     /* Verbose output? */
  154.     int    getk4;                       /* Get K4 TGT? */
  155.     char * addrs[KRB5_NUM_OF_ADDRS+1];  /* List of IP Addresses */
  156.     int  no_addresses;                  /* Do not include IP Addresses */
  157. };
  158.  
  159. struct krb5_list_cred_data {            /* List Credentials data */
  160.     int encryption;
  161.     int flags;
  162.     int addr;
  163. };
  164.  
  165. _PROTOTYP(int ck_krb5_autoget_TGT, (char *));
  166. _PROTOTYP(int ck_krb5_initTGT, (struct krb_op_data *,struct krb5_init_data *,
  167.                                  struct krb4_init_data *));
  168. _PROTOTYP(int ck_krb5_destroy, (struct krb_op_data *));
  169. _PROTOTYP(int ck_krb5_list_creds, (struct krb_op_data *,
  170.                                     struct krb5_list_cred_data *));
  171. _PROTOTYP(char * ck_krb5_getrealm, (char *));
  172. _PROTOTYP(char * ck_krb5_getprincipal, (char *));
  173. _PROTOTYP(char * ck_krb5_get_cc_name, (VOID));
  174.  
  175. _PROTOTYP(int ck_krb4_autoget_TGT, (char *));
  176. _PROTOTYP(int ck_krb4_initTGT, (struct krb_op_data *,struct krb4_init_data *));
  177. _PROTOTYP(int ck_krb4_destroy, (struct krb_op_data *));
  178. _PROTOTYP(int ck_krb4_list_creds, (struct krb_op_data *));
  179. _PROTOTYP(char * ck_krb4_getrealm, (VOID));
  180. _PROTOTYP(char * ck_krb4_getprincipal, (VOID));
  181.  
  182. _PROTOTYP(int ck_krb4_get_tkts, (VOID));
  183. _PROTOTYP(char * ck_krb4_get_next_tkt, (VOID));
  184. _PROTOTYP(int ck_krb4_tkt_isvalid,(char *));
  185. _PROTOTYP(int ck_krb4_is_tgt_valid,(VOID));
  186. _PROTOTYP(int ck_krb4_tkt_time,(char *));
  187.  
  188. _PROTOTYP(int ck_krb5_get_tkts, (char *));
  189. _PROTOTYP(char * ck_krb5_get_next_tkt, (VOID));
  190. _PROTOTYP(int ck_krb5_tkt_isvalid,(char *,char *));
  191. _PROTOTYP(char * ck_krb5_tkt_flags,(char *,char *));
  192. _PROTOTYP(int ck_krb5_is_tgt_valid,(VOID));
  193. _PROTOTYP(int ck_krb5_tkt_time,(char *,char *));
  194.  
  195. _PROTOTYP(int krb4_des_avail,(int));
  196. _PROTOTYP(int krb4_des_write,(int,char *,int));
  197. _PROTOTYP(int krb4_des_read, (int,char *,int));
  198. _PROTOTYP(int krb5_des_avail,(int));
  199. _PROTOTYP(int krb5_des_write,(int,char *,int,int));
  200. _PROTOTYP(int krb5_des_read, (int,char *,int,int));
  201. _PROTOTYP(int krb5_u2u_avail,(int));
  202. _PROTOTYP(int krb5_u2u_write,(int,char *,int));
  203. _PROTOTYP(int krb5_u2u_read, (int,char *,int));
  204. _PROTOTYP(int k5_user_to_user_server_auth,(VOID));
  205. _PROTOTYP(int k5_user_to_user_client_auth,(VOID));
  206. #endif /* CK_KERBEROS */
  207.  
  208. _PROTOTYP(int ck_krb5_is_installed,(void));
  209. _PROTOTYP(int ck_krb4_is_installed,(void));
  210. _PROTOTYP(int ck_srp_is_installed,(void));
  211. _PROTOTYP(int ck_ntlm_is_installed,(void));
  212. _PROTOTYP(int ck_crypt_is_installed,(void));
  213. _PROTOTYP(int ck_ssleay_is_installed,(void));
  214. _PROTOTYP(int ck_gssapi_is_installed,(void));
  215. _PROTOTYP(int ck_krypto_is_installed,(void));
  216.  
  217. _PROTOTYP(VOID ck_encrypt_send_support,(VOID));
  218. _PROTOTYP(int ck_get_crypt_table,(struct keytab **, int *));
  219. _PROTOTYP(char * ck_krb4_realmofhost,(char *));
  220. _PROTOTYP(char * ck_krb5_realmofhost,(char *));
  221.  
  222. #define FORWARD  /* allow forwarding of credential */
  223. #ifdef FORWARD
  224. _PROTOTYP(int kerberos5_forward,(VOID));
  225. #endif /* FORWARD */
  226.  
  227. #define AUTHTYPLSTSZ 8
  228. #endif /*KRB5_KERMIT_H*/
  229.