import cyrus-sasl-2.1.23
[cyrus-sasl.git] / mac / kerberos_includes / krb-protos.h
1 /*
2  * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska H\9agskolan
3  * (Royal Institute of Technology, Stockholm, Sweden). 
4  * All rights reserved. 
5  *
6  * Redistribution and use in source and binary forms, with or without 
7  * modification, are permitted provided that the following conditions 
8  * are met: 
9  *
10  * 1. Redistributions of source code must retain the above copyright 
11  *    notice, this list of conditions and the following disclaimer. 
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright 
14  *    notice, this list of conditions and the following disclaimer in the 
15  *    documentation and/or other materials provided with the distribution. 
16  *
17  * 3. Neither the name of the Institute nor the names of its contributors 
18  *    may be used to endorse or promote products derived from this software 
19  *    without specific prior written permission. 
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
31  * SUCH DAMAGE. 
32  */
33
34 /* $Id: krb-protos.h,v 1.2 2001/12/04 02:06:05 rjs3 Exp $ */
35
36 #ifndef __krb_protos_h__
37 #define __krb_protos_h__
38
39 #if defined (__STDC__) || defined (_MSC_VER)
40 #include <stdarg.h>
41 #ifndef __P
42 #define __P(x) x
43 #endif
44 #else
45 #ifndef __P
46 #define __P(x) ()
47 #endif
48 #endif
49
50 #ifdef __STDC__
51 struct in_addr;
52 struct sockaddr_in;
53 struct timeval;
54 #endif
55
56 #ifndef KRB_LIB_FUNCTION
57 #if defined(__BORLANDC__)
58 #define KRB_LIB_FUNCTION /* not-ready-definition-yet */
59 #elif defined(_MSC_VER)
60 #define KRB_LIB_FUNCTION /* not-ready-definition-yet2 */
61 #else
62 #define KRB_LIB_FUNCTION
63 #endif
64 #endif
65
66 void KRB_LIB_FUNCTION
67 afs_string_to_key __P((
68         const char *str,
69         const char *cell,
70         des_cblock *key));
71
72 int KRB_LIB_FUNCTION
73 create_ciph __P((
74         KTEXT c,
75         unsigned char *session,
76         char *service,
77         char *instance,
78         char *realm,
79         u_int32_t life,
80         int kvno,
81         KTEXT tkt,
82         u_int32_t kdc_time,
83         des_cblock *key));
84
85 int KRB_LIB_FUNCTION
86 cr_err_reply __P((
87         KTEXT pkt,
88         char *pname,
89         char *pinst,
90         char *prealm,
91         u_int32_t time_ws,
92         u_int32_t e,
93         char *e_string));
94
95 int KRB_LIB_FUNCTION
96 decomp_ticket __P((
97         KTEXT tkt,
98         unsigned char *flags,
99         char *pname,
100         char *pinstance,
101         char *prealm,
102         u_int32_t *paddress,
103         unsigned char *session,
104         int *life,
105         u_int32_t *time_sec,
106         char *sname,
107         char *sinstance,
108         des_cblock *key,
109         des_key_schedule schedule));
110
111 int KRB_LIB_FUNCTION
112 dest_tkt __P((void));
113
114 int KRB_LIB_FUNCTION
115 get_ad_tkt __P((
116         char *service,
117         char *sinstance,
118         char *realm,
119         int lifetime));
120
121 int KRB_LIB_FUNCTION
122 getst __P((
123         int fd,
124         char *s,
125         int n));
126
127 int KRB_LIB_FUNCTION
128 in_tkt __P((
129         char *pname,
130         char *pinst));
131
132 int KRB_LIB_FUNCTION
133 k_get_all_addrs __P((struct in_addr **l));
134
135 int KRB_LIB_FUNCTION
136 k_gethostname __P((
137         char *name,
138         int namelen));
139
140 int KRB_LIB_FUNCTION
141 k_getportbyname __P((
142         const char *service,
143         const char *proto,
144         int default_port));
145
146 int KRB_LIB_FUNCTION
147 k_getsockinst __P((
148         int fd,
149         char *inst,
150         size_t inst_size));
151
152 int KRB_LIB_FUNCTION
153 k_isinst __P((char *s));
154
155 int KRB_LIB_FUNCTION
156 k_isname __P((char *s));
157
158 int KRB_LIB_FUNCTION
159 k_isrealm __P((char *s));
160
161 struct tm * KRB_LIB_FUNCTION
162 k_localtime __P((u_int32_t *tp));
163
164 int KRB_LIB_FUNCTION
165 kname_parse __P((
166         char *np,
167         char *ip,
168         char *rp,
169         char *fullname));
170
171 int KRB_LIB_FUNCTION
172 krb_atime_to_life __P((char *atime));
173
174 int KRB_LIB_FUNCTION
175 krb_check_auth __P((
176         KTEXT packet,
177         u_int32_t checksum,
178         MSG_DAT *msg_data,
179         des_cblock *session,
180         struct des_ks_struct *schedule,
181         struct sockaddr_in *laddr,
182         struct sockaddr_in *faddr));
183
184 int KRB_LIB_FUNCTION
185 krb_check_tm __P((struct tm tm));
186
187 KTEXT KRB_LIB_FUNCTION
188 krb_create_death_packet __P((char *a_name));
189
190 int KRB_LIB_FUNCTION
191 krb_create_ticket __P((
192         KTEXT tkt,
193         unsigned char flags,
194         char *pname,
195         char *pinstance,
196         char *prealm,
197         int32_t paddress,
198         void *session,
199         int16_t life,
200         int32_t time_sec,
201         char *sname,
202         char *sinstance,
203         des_cblock *key));
204
205 int KRB_LIB_FUNCTION
206 krb_decode_as_rep __P((
207         const char *user,
208         char *instance,         /* INOUT parameter */
209         const char *realm,
210         const char *service,
211         const char *sinstance,
212         key_proc_t key_proc,
213         decrypt_proc_t decrypt_proc,
214         const void *arg,
215         KTEXT as_rep,
216         CREDENTIALS *cred));
217
218 int KRB_LIB_FUNCTION
219 krb_disable_debug __P((void));
220
221 int KRB_LIB_FUNCTION
222 krb_enable_debug __P((void));
223
224 int KRB_LIB_FUNCTION
225 krb_equiv __P((
226         u_int32_t a,
227         u_int32_t b));
228
229 int KRB_LIB_FUNCTION
230 krb_get_address __P((
231         void *from,
232         u_int32_t *to));
233
234 int KRB_LIB_FUNCTION
235 krb_get_admhst __P((
236         char *host,
237         char *realm,
238         int nth));
239
240 int KRB_LIB_FUNCTION
241 krb_get_config_bool __P((const char *variable));
242
243 const char * KRB_LIB_FUNCTION
244 krb_get_config_string __P((const char *variable));
245
246 int KRB_LIB_FUNCTION
247 krb_get_cred __P((
248         char *service,
249         char *instance,
250         char *realm,
251         CREDENTIALS *c));
252
253 int KRB_LIB_FUNCTION
254 krb_get_default_principal __P((
255         char *name,
256         char *instance,
257         char *realm));
258
259 char * KRB_LIB_FUNCTION
260 krb_get_default_realm __P((void));
261
262 const char * KRB_LIB_FUNCTION
263 krb_get_default_tkt_root __P((void));
264
265 const char * KRB_LIB_FUNCTION
266 krb_get_default_keyfile __P((void));
267
268 const char * KRB_LIB_FUNCTION
269 krb_get_err_text __P((int code));
270
271 struct krb_host* KRB_LIB_FUNCTION
272 krb_get_host __P((
273         int nth,
274         const char *realm,
275         int admin));
276
277 int KRB_LIB_FUNCTION
278 krb_get_in_tkt __P((
279         char *user,
280         char *instance,
281         char *realm,
282         char *service,
283         char *sinstance,
284         int life,
285         key_proc_t key_proc,
286         decrypt_proc_t decrypt_proc,
287         void *arg));
288
289 int KRB_LIB_FUNCTION
290 krb_get_int __P((
291         void *f,
292         u_int32_t *to,
293         int size,
294         int lsb));
295
296 int KRB_LIB_FUNCTION
297 krb_get_kdc_time_diff __P((void));
298
299 int KRB_LIB_FUNCTION
300 krb_get_krbconf __P((
301         int num,
302         char *buf,
303         size_t len));
304
305 int KRB_LIB_FUNCTION
306 krb_get_krbextra __P((
307         int num,
308         char *buf,
309         size_t len));
310
311 int KRB_LIB_FUNCTION
312 krb_get_krbhst __P((
313         char *host,
314         char *realm,
315         int nth));
316
317 int KRB_LIB_FUNCTION
318 krb_get_krbrealms __P((
319         int num,
320         char *buf,
321         size_t len));
322
323 int KRB_LIB_FUNCTION
324 krb_get_lrealm __P((
325         char *r,
326         int n));
327
328 int KRB_LIB_FUNCTION
329 krb_get_nir __P((
330         void *from,
331         char *name,
332         char *instance,
333         char *realm));
334
335 char * KRB_LIB_FUNCTION
336 krb_get_phost __P((const char *alias));
337
338 int KRB_LIB_FUNCTION
339 krb_get_pw_in_tkt __P((
340         const char *user,
341         const char *instance,
342         const char *realm,
343         const char *service,
344         const char *sinstance,
345         int life,
346         const char *password));
347
348 int KRB_LIB_FUNCTION
349 krb_get_pw_in_tkt2 __P((
350         const char *user,
351         const char *instance,
352         const char *realm,
353         const char *service,
354         const char *sinstance,
355         int life,
356         const char *password,
357         des_cblock *key));
358
359 int KRB_LIB_FUNCTION
360 krb_get_string __P((
361         void *from,
362         char *to,
363         size_t to_size));
364
365 int KRB_LIB_FUNCTION
366 krb_get_svc_in_tkt __P((
367         char *user,
368         char *instance,
369         char *realm,
370         char *service,
371         char *sinstance,
372         int life,
373         char *srvtab));
374
375 int KRB_LIB_FUNCTION
376 krb_get_tf_fullname __P((
377         char *ticket_file,
378         char *name,
379         char *instance,
380         char *realm));
381
382 int KRB_LIB_FUNCTION
383 krb_get_tf_realm __P((
384         char *ticket_file,
385         char *realm));
386
387 void KRB_LIB_FUNCTION
388 krb_kdctimeofday __P((struct timeval *tv));
389
390 int KRB_LIB_FUNCTION
391 krb_kntoln __P((
392         AUTH_DAT *ad,
393         char *lname));
394
395 int KRB_LIB_FUNCTION
396 krb_kuserok __P((
397         char *name,
398         char *instance,
399         char *realm,
400         char *luser));
401
402 char * KRB_LIB_FUNCTION
403 krb_life_to_atime __P((int life));
404
405 u_int32_t KRB_LIB_FUNCTION
406 krb_life_to_time __P((
407         u_int32_t start,
408         int life_));
409
410 int KRB_LIB_FUNCTION
411 krb_lsb_antinet_ulong_cmp __P((
412         u_int32_t x,
413         u_int32_t y));
414
415 int KRB_LIB_FUNCTION
416 krb_lsb_antinet_ushort_cmp __P((
417         u_int16_t x,
418         u_int16_t y));
419
420 int KRB_LIB_FUNCTION
421 krb_mk_as_req __P((
422         const char *user,
423         const char *instance,
424         const char *realm,
425         const char *service,
426         const char *sinstance,
427         int life,
428         KTEXT cip));
429
430 int KRB_LIB_FUNCTION
431 krb_mk_auth __P((
432         int32_t options,
433         KTEXT ticket,
434         char *service,
435         char *instance,
436         char *realm,
437         u_int32_t checksum,
438         char *version,
439         KTEXT buf));
440
441 int32_t KRB_LIB_FUNCTION
442 krb_mk_err __P((
443         u_char *p,
444         int32_t e,
445         char *e_string));
446
447 int32_t KRB_LIB_FUNCTION
448 krb_mk_priv __P((
449         void *in,
450         void *out,
451         u_int32_t length,
452         struct des_ks_struct *schedule,
453         des_cblock *key,
454         struct sockaddr_in *sender,
455         struct sockaddr_in *receiver));
456
457 int KRB_LIB_FUNCTION
458 krb_mk_req __P((
459         KTEXT authent,
460         char *service,
461         char *instance,
462         char *realm,
463         int32_t checksum));
464
465 int32_t KRB_LIB_FUNCTION
466 krb_mk_safe __P((
467         void *in,
468         void *out,
469         u_int32_t length,
470         des_cblock *key,
471         struct sockaddr_in *sender,
472         struct sockaddr_in *receiver));
473
474 int KRB_LIB_FUNCTION
475 krb_net_read __P((
476         int fd,
477         void *v,
478         size_t len));
479
480 int KRB_LIB_FUNCTION
481 krb_net_write __P((
482         int fd,
483         const void *v,
484         size_t len));
485
486 int KRB_LIB_FUNCTION
487 krb_parse_name __P((
488         const char *fullname,
489         krb_principal *principal));
490
491 int KRB_LIB_FUNCTION
492 krb_put_address __P((
493         u_int32_t addr,
494         void *to,
495         size_t rem));
496
497 int KRB_LIB_FUNCTION
498 krb_put_int __P((
499         u_int32_t from,
500         void *to,
501         size_t rem,
502         int size));
503
504 int KRB_LIB_FUNCTION
505 krb_put_nir __P((
506         const char *name,
507         const char *instance,
508         const char *realm,
509         void *to,
510         size_t rem));
511
512 int KRB_LIB_FUNCTION
513 krb_put_string __P((
514         const char *from,
515         void *to,
516         size_t rem));
517
518 int KRB_LIB_FUNCTION
519 krb_rd_err __P((
520         u_char *in,
521         u_int32_t in_length,
522         int32_t *code,
523         MSG_DAT *m_data));
524
525 int32_t KRB_LIB_FUNCTION
526 krb_rd_priv __P((
527         void *in,
528         u_int32_t in_length,
529         struct des_ks_struct *schedule,
530         des_cblock *key,
531         struct sockaddr_in *sender,
532         struct sockaddr_in *receiver,
533         MSG_DAT *m_data));
534
535 int KRB_LIB_FUNCTION
536 krb_rd_req __P((
537         KTEXT authent,
538         char *service,
539         char *instance,
540         int32_t from_addr,
541         AUTH_DAT *ad,
542         char *fn));
543
544 int32_t KRB_LIB_FUNCTION
545 krb_rd_safe __P((
546         void *in,
547         u_int32_t in_length,
548         des_cblock *key,
549         struct sockaddr_in *sender,
550         struct sockaddr_in *receiver,
551         MSG_DAT *m_data));
552
553 int KRB_LIB_FUNCTION
554 krb_realm_parse __P((
555         char *realm,
556         int length));
557
558 char * KRB_LIB_FUNCTION
559 krb_realmofhost __P((const char *host));
560
561 int KRB_LIB_FUNCTION
562 krb_recvauth __P((
563         int32_t options,
564         int fd,
565         KTEXT ticket,
566         char *service,
567         char *instance,
568         struct sockaddr_in *faddr,
569         struct sockaddr_in *laddr,
570         AUTH_DAT *kdata,
571         char *filename,
572         struct des_ks_struct *schedule,
573         char *version));
574
575 int KRB_LIB_FUNCTION
576 krb_sendauth __P((
577         int32_t options,
578         int fd,
579         KTEXT ticket,
580         char *service,
581         char *instance,
582         char *realm,
583         u_int32_t checksum,
584         MSG_DAT *msg_data,
585         CREDENTIALS *cred,
586         struct des_ks_struct *schedule,
587         struct sockaddr_in *laddr,
588         struct sockaddr_in *faddr,
589         char *version));
590
591 void KRB_LIB_FUNCTION
592 krb_set_kdc_time_diff __P((int diff));
593
594 int KRB_LIB_FUNCTION
595 krb_set_key __P((
596         void *key,
597         int cvt));
598
599 int KRB_LIB_FUNCTION
600 krb_set_lifetime __P((int newval));
601
602 void KRB_LIB_FUNCTION
603 krb_set_tkt_string __P((const char *val));
604
605 const char * KRB_LIB_FUNCTION
606 krb_stime __P((time_t *t));
607
608 int KRB_LIB_FUNCTION
609 krb_time_to_life __P((
610         u_int32_t start,
611         u_int32_t end));
612
613 char * KRB_LIB_FUNCTION
614 krb_unparse_name __P((krb_principal *pr));
615
616 char * KRB_LIB_FUNCTION
617 krb_unparse_name_long __P((
618         char *name,
619         char *instance,
620         char *realm));
621
622 char * KRB_LIB_FUNCTION
623 krb_unparse_name_long_r __P((
624         char *name,
625         char *instance,
626         char *realm,
627         char *fullname));
628
629 char * KRB_LIB_FUNCTION
630 krb_unparse_name_r __P((
631         krb_principal *pr,
632         char *fullname));
633
634 int KRB_LIB_FUNCTION
635 krb_use_admin_server __P((int flag));
636
637 int KRB_LIB_FUNCTION
638 krb_verify_user __P((
639         char *name,
640         char *instance,
641         char *realm,
642         char *password,
643         int secure,
644         char *linstance));
645
646 int KRB_LIB_FUNCTION
647 krb_verify_user_srvtab __P((
648         char *name,
649         char *instance,
650         char *realm,
651         char *password,
652         int secure,
653         char *linstance,
654         char *srvtab));
655
656 int KRB_LIB_FUNCTION
657 kuserok __P((
658         AUTH_DAT *auth,
659         char *luser));
660
661 u_int32_t KRB_LIB_FUNCTION
662 lsb_time __P((
663         time_t t,
664         struct sockaddr_in *src,
665         struct sockaddr_in *dst));
666
667 const char * KRB_LIB_FUNCTION
668 month_sname __P((int n));
669
670 int KRB_LIB_FUNCTION
671 passwd_to_5key __P((
672         const char *user,
673         const char *instance,
674         const char *realm,
675         const void *passwd,
676         des_cblock *key));
677
678 int KRB_LIB_FUNCTION
679 passwd_to_afskey __P((
680         const char *user,
681         const char *instance,
682         const char *realm,
683         const void *passwd,
684         des_cblock *key));
685
686 int KRB_LIB_FUNCTION
687 passwd_to_key __P((
688         const char *user,
689         const char *instance,
690         const char *realm,
691         const void *passwd,
692         des_cblock *key));
693
694 int KRB_LIB_FUNCTION
695 read_service_key __P((
696         const char *service,
697         char *instance,
698         const char *realm,
699         int kvno,
700         const char *file,
701         void *key));
702
703 int KRB_LIB_FUNCTION
704 save_credentials __P((
705         char *service,
706         char *instance,
707         char *realm,
708         unsigned char *session,
709         int lifetime,
710         int kvno,
711         KTEXT ticket,
712         int32_t issue_date));
713
714 int KRB_LIB_FUNCTION
715 send_to_kdc __P((
716         KTEXT pkt,
717         KTEXT rpkt,
718         const char *realm));
719
720 int KRB_LIB_FUNCTION
721 srvtab_to_key __P((
722         const char *user,
723         char *instance,         /* INOUT parameter */
724         const char *realm,
725         const void *srvtab,
726         des_cblock *key));
727
728 void KRB_LIB_FUNCTION
729 tf_close __P((void));
730
731 int KRB_LIB_FUNCTION
732 tf_create __P((char *tf_name));
733
734 int KRB_LIB_FUNCTION
735 tf_get_cred __P((CREDENTIALS *c));
736
737 int KRB_LIB_FUNCTION
738 tf_get_cred_addr __P((char *realm, size_t realm_sz, struct in_addr *addr));
739
740 int KRB_LIB_FUNCTION
741 tf_get_pinst __P((char *inst));
742
743 int KRB_LIB_FUNCTION
744 tf_get_pname __P((char *p));
745
746 int KRB_LIB_FUNCTION
747 tf_init __P((
748         char *tf_name,
749         int rw));
750
751 int KRB_LIB_FUNCTION
752 tf_put_pinst __P((const char *inst));
753
754 int KRB_LIB_FUNCTION
755 tf_put_pname __P((const char *p));
756
757 int KRB_LIB_FUNCTION
758 tf_save_cred __P((
759         char *service,
760         char *instance,
761         char *realm,
762         unsigned char *session,
763         int lifetime,
764         int kvno,
765         KTEXT ticket,
766         u_int32_t issue_date));
767
768 int KRB_LIB_FUNCTION
769 tf_setup __P((
770         CREDENTIALS *cred,
771         const char *pname,
772         const char *pinst));
773
774 int KRB_LIB_FUNCTION
775 tf_get_addr __P((
776         const char *realm,
777         struct in_addr *addr));
778
779 int KRB_LIB_FUNCTION
780 tf_store_addr __P((const char *realm, struct in_addr *addr));
781
782 char * KRB_LIB_FUNCTION
783 tkt_string __P((void));
784
785 int KRB_LIB_FUNCTION
786 krb_add_our_ip_for_realm __P((const char *user, const char *instance,
787                               const char *realm, const char *password));
788
789 #endif /* __krb_protos_h__ */