home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku200.tar / ckuath.h < prev    next >
C/C++ Source or Header  |  2001-12-03  |  8KB  |  233 lines

  1. /*  C K U A T H . H --  "C-Kermit to Authentication" interface  */
  2.  
  3. /*
  4.   Author: Jeffrey Altman <jaltman@columbia.edu>,
  5.   Columbia University Academic Information Systems, New York City.
  6.  
  7.   Copyright (C) 1999, 2000,
  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.  
  59.  
  60. struct kstream_crypt_ctl_block {
  61.   int (*encrypt)(struct kstream_data_block *, /* output */
  62.          struct kstream_data_block *); /* input */
  63.   int (*decrypt)(struct kstream_data_block *, /* output */
  64.          struct kstream_data_block *); /* input */
  65.   int (*init)(kstream);
  66.   void (*destroy)(void);
  67. };
  68.  
  69.  
  70. /* Prototypes */
  71.  
  72. int  kstream_destroy();
  73. void kstream_set_buffer_mode(int);
  74. int  kstream_create_from_fd(int fd,
  75.                    const struct kstream_crypt_ctl_block *,
  76.                    kstream_ptr);
  77. int kstream_write(void *, size_t);
  78. int kstream_read(void *, size_t);
  79.  
  80. #endif /* K5STREAM_H */
  81.  
  82. /*
  83.  * Implements Telnet authentication and encryption
  84.  */
  85.  
  86. #ifndef TELNET_AUTH_H
  87. #define TELNET_AUTH_H
  88.  
  89. int auth_parse(unsigned char *, int);
  90.  
  91. int auth_init(kstream);
  92.  
  93. void auth_destroy(void);
  94.  
  95. int auth_encrypt(struct kstream_data_block *, struct kstream_data_block *);
  96.  
  97. int auth_decrypt(struct kstream_data_block *, struct kstream_data_block *);
  98.  
  99. extern BOOL forward_flag;
  100. extern BOOL forwardable_flag;
  101. extern BOOL forwarded_tickets;
  102. #endif /* TEL_AUTH_H */
  103.  
  104.  
  105. /* C-Kermit specific functions */
  106. _PROTOTYP(int ck_auth_init, (char *, char *, char *, int));
  107. _PROTOTYP(int ck_tn_auth_in_progress,(VOID));
  108. _PROTOTYP(int ck_tn_sb_auth, (char *, int));
  109. _PROTOTYP(int ck_tn_sb_encrypt, (char *, int));
  110. _PROTOTYP(int ck_tn_auth_request, (VOID));
  111. _PROTOTYP(void ck_tn_encrypt, (char *, int));
  112. _PROTOTYP(void ck_tn_decrypt, (char *, int));
  113. _PROTOTYP(void ck_tn_encrypt_start, (VOID));
  114. _PROTOTYP(void ck_tn_encrypt_stop, (VOID));
  115. #ifdef CK_SSL
  116. _PROTOTYP(int  ck_tn_tls_negotiate, (VOID));
  117. #endif /* CK_SSL */
  118.  
  119. #ifdef CK_KERBEROS
  120.     /* Define MIT_CURRENT to compile the code for use with versions of */
  121.     /* Kerberos later than KRB5 1.0.5.  Note.  This will not compile   */
  122.     /* successfully in Kermit 95 due to the segmentation of crypto     */
  123.     /* into a separate DLL.                                            */
  124.  
  125. #define KRB_DEFTIM 600            /* Default lifetime (minutes) */
  126.  
  127. /* Kerberos structure definitions */
  128.  
  129. struct krb_op_data {            /* Operational data for all actions */
  130.     int version;            /* Kerberos version    */
  131.     char * cache;            /* Kerberos cache file */
  132. };
  133.  
  134. struct krb4_init_data {            /* INITIALIZE data structure */
  135.     int lifetime;
  136.     char * principal;            /* Principal string */
  137.     char * instance;
  138.     char * realm;                       /* Realm string */
  139.     char * password;            /* Kerberos password */
  140.     int    preauth;                     /* Use preauth mode? */
  141.     int    verbose;                     /* Verbose output? */
  142. };
  143.  
  144. #define KRB5_NUM_OF_ADDRS 16
  145. struct krb5_init_data {            /* INITIALIZE data structure */
  146.     int forwardable;            /* Switch values */
  147.     int proxiable;            /* Correspond to switch names... */
  148.     int lifetime;
  149.     int renew;
  150.     int renewable;
  151.     int validate;
  152.     char * postdate;
  153.     char * service;
  154.     char * principal;            /* Principal string */
  155.     char * instance;
  156.     char * realm;                       /* Realm string */
  157.     char * password;            /* Kerberos password */
  158.     int    preauth;                     /* Use preauth mode? */
  159.     int    verbose;                     /* Verbose output? */
  160.     int    getk4;                       /* Get K4 TGT? */
  161.     char * addrs[KRB5_NUM_OF_ADDRS+1];  /* List of IP Addresses */
  162.     int  no_addresses;                  /* Do not include IP Addresses */
  163. };
  164.  
  165. struct krb5_list_cred_data {        /* List Credentials data */
  166.     int encryption;
  167.     int flags;
  168.     int addr;
  169. };
  170.  
  171. _PROTOTYP(int ck_krb5_autoget_TGT, (char *));
  172. _PROTOTYP(int ck_krb5_initTGT, (struct krb_op_data *,struct krb5_init_data *,
  173.                                  struct krb4_init_data *));
  174. _PROTOTYP(int ck_krb5_destroy, (struct krb_op_data *));
  175. _PROTOTYP(int ck_krb5_list_creds, (struct krb_op_data *,
  176.                                     struct krb5_list_cred_data *));
  177. _PROTOTYP(char * ck_krb5_getrealm, (char *));
  178. _PROTOTYP(char * ck_krb5_getprincipal, (char *));
  179. _PROTOTYP(char * ck_krb5_get_cc_name, (VOID));
  180.  
  181. _PROTOTYP(int ck_krb4_autoget_TGT, (char *));
  182. _PROTOTYP(int ck_krb4_initTGT, (struct krb_op_data *,struct krb4_init_data *));
  183. _PROTOTYP(int ck_krb4_destroy, (struct krb_op_data *));
  184. _PROTOTYP(int ck_krb4_list_creds, (struct krb_op_data *));
  185. _PROTOTYP(char * ck_krb4_getrealm, (VOID));
  186. _PROTOTYP(char * ck_krb4_getprincipal, (VOID));
  187.  
  188. _PROTOTYP(int ck_krb4_get_tkts, (VOID));
  189. _PROTOTYP(char * ck_krb4_get_next_tkt, (VOID));
  190. _PROTOTYP(int ck_krb4_tkt_isvalid,(char *));
  191. _PROTOTYP(int ck_krb4_is_tgt_valid,(VOID));
  192. _PROTOTYP(int ck_krb4_tkt_time,(char *));
  193.  
  194. _PROTOTYP(int ck_krb5_get_tkts, (char *));
  195. _PROTOTYP(char * ck_krb5_get_next_tkt, (VOID));
  196. _PROTOTYP(int ck_krb5_tkt_isvalid,(char *,char *));
  197. _PROTOTYP(char * ck_krb5_tkt_flags,(char *,char *));
  198. _PROTOTYP(int ck_krb5_is_tgt_valid,(VOID));
  199. _PROTOTYP(int ck_krb5_tkt_time,(char *,char *));
  200.  
  201. _PROTOTYP(int krb4_des_avail,(int));
  202. _PROTOTYP(int krb4_des_write,(int,char *,int));
  203. _PROTOTYP(int krb4_des_read, (int,char *,int));
  204. _PROTOTYP(int krb5_des_avail,(int));
  205. _PROTOTYP(int krb5_des_write,(int,char *,int));
  206. _PROTOTYP(int krb5_des_read, (int,char *,int));
  207. _PROTOTYP(int krb5_u2u_avail,(int));
  208. _PROTOTYP(int krb5_u2u_write,(int,char *,int));
  209. _PROTOTYP(int krb5_u2u_read, (int,char *,int));
  210. _PROTOTYP(int k5_user_to_user_server_auth,(VOID));
  211. _PROTOTYP(int k5_user_to_user_client_auth,(VOID));
  212. #endif /* CK_KERBEROS */
  213.  
  214. _PROTOTYP(int ck_krb5_is_installed,(void));
  215. _PROTOTYP(int ck_krb4_is_installed,(void));
  216. _PROTOTYP(int ck_srp_is_installed,(void));
  217. _PROTOTYP(int ck_ntlm_is_installed,(void));
  218. _PROTOTYP(int ck_crypt_is_installed,(void));
  219. _PROTOTYP(int ck_ssleay_is_installed,(void));
  220.  
  221. _PROTOTYP(VOID ck_encrypt_send_support,(VOID));
  222. _PROTOTYP(int ck_get_crypt_table,(struct keytab **, int *));
  223. _PROTOTYP(char * ck_krb4_realmofhost,(char *));
  224. _PROTOTYP(char * ck_krb5_realmofhost,(char *));
  225.  
  226. #define FORWARD  /* allow forwarding of credential */
  227. #ifdef FORWARD
  228. _PROTOTYP(int kerberos5_forward,(VOID));
  229. #endif /* FORWARD */
  230.  
  231. #define AUTHTYPLSTSZ 8
  232. #endif /*KRB5_KERMIT_H*/
  233.