ckuath.h 8.2 KB

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