-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathckoath.c
9627 lines (8808 loc) · 313 KB
/
ckoath.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
C K O A T H . C -- Authentication for Kermit 95
Copyright (C) 1998, 2004, Trustees of Columbia University in the City of New
York.
Author: Jeffrey E Altman (jaltman@secure-endpoints.com)
Secure Endpoints Inc., New York City
*/
#include "ckcdeb.h"
#ifdef CK_AUTHENTICATION
#define CKOATH_C
#include "ckcker.h"
#include "ckuusr.h"
#include "ckucmd.h" /* For struct keytab */
#include "ckcnet.h"
#include "ckctel.h"
#ifdef CK_DES
#ifdef CK_SSL
#ifndef LIBDES
#define LIBDES
#endif /* LIBDES */
#endif /* CK_SSL */
#endif /* CK_DES */
#ifdef CRYPT_DLL
#ifndef LIBDES
#define LIBDES
#endif /* LIBDES */
#ifdef OS2
#ifdef NT
#include <windows.h>
#define SECURITY_WIN32
#include <security.h>
#ifndef NTLMSP_NAME_A
#define NTLMSP_NAME_A "NTLM"
#endif /* NTLMSP_NAME_A */
#else /* NT */
#define INCL_DOSMODULEMGR
#include <os2.h>
#endif /* NT */
#endif /* OS2 */
#endif /* CRYPT_DLL */
#include "ckosyn.h"
#ifdef NT
#define KRB5_AUTOCONF__
#define NTLM
#endif /* NT */
#ifndef CK_KERBEROS
#ifdef KRB4
#undef KRB4
#endif /* KRB4 */
#ifdef KRB5
#undef KRB5
#endif /* KRB5 */
#ifdef KRB524
#undef KRB524
#endif /* KRB524 */
#endif /* CK_KERBEROS */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <io.h>
#ifdef KRB5
#include "krb5.h"
#include "profile.h"
#include "com_err.h"
#ifdef KRB5_GET_INIT_CREDS_OPT_TKT_LIFE
#define KRB5_HAVE_GET_INIT_CREDS
#else
#define krb5_free_unparsed_name(con,val) krb5_xfree((char *)(val))
#endif
#ifndef KRB5_HAVE_GET_INIT_CREDS
#define krb5_free_data_contents(c,v) krb5_xfree((char *)(v)->data)
#endif
#endif /* KRB5 */
#ifdef KRB4
#define des_cblock Block
#define des_key_schedule Schedule
#ifdef NT
#define _WINDOWS
#include "kerberosIV/krb.h"
#else /* NT */
#ifdef KRB524
#include "kerberosIV/krb.h"
_PROTOTYP(const char * krb_get_err_text_entry, (int));
#else /* KRB524 */
#include "krb.h"
#define krb_get_err_text_entry krb_get_err_text
#endif /* KRB524 */
#endif /* NT */
#else /* KRB4 */
#ifdef CK_SSL
#define des_cblock Block
#define des_key_schedule Schedule
#endif /* CK_SSL */
#endif /* KRB4 */
#include "ckuath.h"
#ifdef CK_KERBEROS
#ifndef KRB5
#define NOBLOCKDEF
#endif /* KRB5 */
#ifdef KRB524
#define NOBLOCKDEF
#endif /* KRB524 */
#endif /* CK_KERBEROS */
#include "ckuat2.h"
#ifdef CK_SSL
#ifdef LIBDES
#ifndef HEADER_DES_H
#define HEADER_DES_H
#endif /* HEADER_DES_H */
#endif /* LIBDES */
#include "ck_ssl.h"
#endif /* SSL */
#ifdef CK_SRP
#include <t_pwd.h>
#include <t_client.h>
#include <t_server.h>
#endif /* CK_SRP */
#ifdef OS2
#ifdef CK_ENCRYPTION
#define MAP_DES
#endif /* CK_ENCRYPTION */
#ifdef KRB4
#define MAP_KRB4
#endif /* KRB4 */
#ifdef SRPDLL
#define MAP_SRP
#endif /* SRPDLL */
#ifdef KRB5
#define MAP_KRB5
#endif /* KRB5 */
#ifdef CRYPT_DLL
#define MAP_CRYPT
#endif /* CRYPT_DLL */
#define MAP_NTLM
#include "ckoath.h"
extern char tn_msg[], hexbuf[]; /* from ckcnet.c */
extern int deblog, debses, tn_deb;
extern int authentication_version;
extern int auth_type_user[AUTHTYPLSTSZ];
extern int auth_how;
extern int auth_crypt;
extern int auth_fwd;
extern int accept_complete;
#define AUTHTMPBL 2048
static char strTmp[AUTHTMPBL+1];
extern char szUserNameRequested[UIDBUFLEN+1]; /* for incoming connections */
extern char szUserNameAuthenticated[UIDBUFLEN+1];/* for incoming connections */
extern char szHostName[UIDBUFLEN+1];
#ifdef CK_ENCRYPTION
extern int encrypt_flag;
#endif
#ifdef KRB5
extern krb5_context k5_context;
extern char * krb5_d_principal; /* Default principal */
extern char * krb5_d_instance; /* Default instance */
extern char * krb5_d_realm; /* Default realm */
extern char * krb5_d_cc; /* Default credentials cache */
extern char * krb5_d_srv; /* Default service name */
extern int krb5_d_lifetime; /* Default lifetime */
extern int krb5_d_forwardable;
extern int krb5_d_proxiable;
extern int krb5_d_renewable;
extern int krb5_autoget;
extern int krb5_checkaddrs;
extern int krb5_d_getk4;
extern int krb5_d_no_addresses;
extern char * krb5_d_addrs[];
extern int krb5_errno;
extern char * krb5_errmsg;
#endif /* KRB5 */
#ifdef KRB4
extern char * krb4_d_principal; /* Default principal */
extern char * krb4_d_realm; /* Default realm */
extern char * krb4_d_srv; /* Default service name */
extern int krb4_d_lifetime; /* Default lifetime */
extern int krb4_d_preauth;
extern char * krb4_d_instance;
extern int krb4_autoget;
extern int krb4_checkaddrs;
extern char * k4_keytab;
extern int krb4_errno;
extern char * krb4_errmsg;
#endif /* KRB4 */
#ifdef CK_KERBEROS
#define CHECKADDRS
#endif /* CK_KERBEROS */
#ifdef OS2ONLY
#ifdef KRB5_CALLCONV
#undef KRB5_CALLCONV
#define KRB5_CALLCONV __cdecl
#endif
#ifdef KRB5_CALLCONV_C
#undef KRB5_CALLCONV_C
#endif
#define KRB5_CALLCONV_C __cdecl
#endif
#ifndef KRB5_CALLCONV
#define KRB5_CALLCONV __stdcall
#endif /* KRB5_CALLCONV */
#ifndef KRB5_CALLCONV_C
#define KRB5_CALLCONV_C __cdecl
#endif /* KRB5_CALLCONV_C */
#ifdef OS2ONLY
static char fail[_MAX_PATH];
#endif /* OS2ONLY */
int copy_for_net(unsigned char *to, unsigned char *from, int c);
#ifdef SRPDLL
/* These functions are located in DLLs which we are not linking to at */
/* compile time. Therefore, we have to redirect them to locally */
/* defined functions which will call the real thing only if they are */
/* available via Run-Time Linking. */
/*
From SRP.DLL:
unresolved external symbol _t_clientresponse
unresolved external symbol _t_clientgetkey
unresolved external symbol _t_clientpasswd
unresolved external symbol _t_clientgenexp
unresolved external symbol _t_clientopen
unresolved external symbol _t_clientverify
*/
static unsigned char * (*p_t_clientresponse)(struct t_client *)=NULL;
static unsigned char *
(*p_t_clientgetkey)(struct t_client *, struct t_num *)=NULL;
static void (*p_t_clientpasswd)(struct t_client *, char *)=NULL;
static struct t_num * (*p_t_clientgenexp)(struct t_client *)=NULL;
static struct t_client * (*p_t_clientopen)
(const char *, struct t_num *, struct t_num *, struct t_num *)=NULL;
static int (*p_t_clientverify)(struct t_client *, unsigned char *)=NULL;
unsigned char *
ck_t_clientresponse(struct t_client * client) {
if ( p_t_clientresponse )
return(p_t_clientresponse(client));
else
return(NULL);
}
unsigned char *
ck_t_clientgetkey(struct t_client * client, struct t_num * num) {
if ( p_t_clientgetkey )
return(p_t_clientgetkey(client,num));
return(NULL);
}
void ck_t_clientpasswd(struct t_client * client, char * pwd) {
if ( p_t_clientpasswd )
p_t_clientpasswd(client,pwd);
}
struct t_num *
ck_t_clientgenexp(struct t_client * client) {
if ( p_t_clientgenexp )
return(p_t_clientgenexp(client));
else
return(NULL);
}
struct t_client *
ck_t_clientopen(const char * str, struct t_num * A,
struct t_num * B, struct t_num * C) {
if ( p_t_clientopen )
return(p_t_clientopen(str,A,B,C));
else
return(NULL);
}
int
ck_t_clientverify(struct t_client * client, unsigned char * str) {
if ( p_t_clientverify )
return(p_t_clientverify(client,str));
else
return(0);
}
#endif /* SRPDLL */
#ifdef KRB4
/* These functions are located in DLLs which we are not linking to at */
/* compile time. Therefore, we have to redirect them to locally */
/* defined functions which will call the real thing only if they are */
/* available via Run-Time Linking. */
/*
From KRB4_32.DLL:
unresolved external symbol __imp__krb_get_err_text@4
unresolved external symbol __imp__krb_get_cred@16
unresolved external symbol __imp__krb_mk_req@20
unresolved external symbol __imp__krb_realmofhost@4
unresolved external symbol __imp__krb_get_phost@4
unresolved external symbol _des_ecb_encrypt
unresolved external symbol __imp__des_key_sched@8
unresolved external symbol _des_new_random_key
unresolved external symbol _des_set_random_generator_seed
Note: kerberosiv/krb.h contains a reference to errno which
must be renamed to compile under Windows NT with errno.h
unresolved external symbol __imp__krb_get_pw_in_tkt@28
unresolved external symbol __imp__krb_get_pw_in_tkt_preauth@28
unresolved external symbol __imp__krb_get_lrealm@8
unresolved external symbol __imp__krb_get_err_text@4
unresolved external symbol __imp__kname_parse@16
unresolved external symbol __imp__dest_tkt
unresolved external symbol __imp__krb_get_tf_realm@8
Leash specific (not defined in Kerberos V/KerberosIV
include files
unresolved external symbol _tf_get_cred
unresolved external symbol _tf_get_pinst
unresolved external symbol _tf_get_pname
unresolved external symbol _tf_close
unresolved external symbol _tf_init
unresolved external symbol _tkt_string
C:\kerberos\leash\KRB4\INCLUDE\KRB.H
int tf_get_pname(char*);
int tf_get_pinst(char*);
int tf_get_cred(CREDENTIALS*);
void tf_close(void);
int tf_init(char *,int);
char * tkt_string(void);
int krb_check_serv(char *);
Added when we put in server side support:
unresolved external symbol __imp__kuserok@8
unresolved external symbol _krb_kntoln
unresolved external symbol __imp__krb_rd_req@24
*/
/* these were all KRB5_CALLCONV */
static const char * (KRB5_CALLCONV * p_krb_get_err_text_entry)(int _errno)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_cred)(char *service, char *instance,
char *realm, CREDENTIALS *c)=NULL;
static int (KRB5_CALLCONV * p_krb_mk_req)(KTEXT authent, char *service,
char *instance, char *realm,
KRB4_32 checksum)=NULL;
static char * (KRB5_CALLCONV * p_krb_realmofhost)(char *host)=NULL;
static char * (KRB5_CALLCONV_C * p_krb_get_phost)(char *alias)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_pw_in_tkt)
(char *user, char *instance, char *realm,
char *service, char *sinstance,
int life, char *password)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_pw_in_tkt_preauth)
(char *user, char *instance, char *realm,
char *service, char *sinstance,
int life, char *password)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_lrealm)(char *realm, int index)=NULL;
static const char * (KRB5_CALLCONV * p_krb_get_err_text)(int _errno)=NULL;
static int (KRB5_CALLCONV_C * p_kname_parse)(char *name, char *inst,
char *realm,char *fullname)=NULL;
static int (KRB5_CALLCONV_C * p_dest_tkt)(void)=NULL;
static int (KRB5_CALLCONV_C * p_tf_get_pname)(char*)=NULL;
static int (KRB5_CALLCONV_C * p_tf_get_pinst)(char*)=NULL;
static int (KRB5_CALLCONV_C * p_tf_get_cred)(CREDENTIALS*)=NULL;
static void (KRB5_CALLCONV_C * p_tf_close)(void)=NULL;
static int (KRB5_CALLCONV_C * p_tf_init)(char *,int)=NULL;
static char * (KRB5_CALLCONV_C * p_tkt_string)(void)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_tf_realm)(char *ticket_file,
char *realm)=NULL;
static int (KRB5_CALLCONV_C * p_krb_get_tf_fullname)(char *ticket_file,
char *name, char *inst,
char *realm)=NULL;
static int (KRB5_CALLCONV_C * p_krb_check_serv)(char * service)=NULL;
static int (KRB5_CALLCONV_C * p_kuserok)(AUTH_DAT *kdata, char *luser)=NULL;
static int (KRB5_CALLCONV_C * p_k95_k4_userok)( const char * princ_name,
const char * princ_inst,
const char * princ_realm,
const char * local_realm,
const char *luser)=NULL;
static int (KRB5_CALLCONV_C * p_krb_kntoln)(AUTH_DAT *kdata, char *luser)=NULL;
static int (KRB5_CALLCONV_C * p_k95_k4_princ_to_userid)( const char * princ_name,
const char * princ_inst,
const char * princ_realm,
const char * local_realm,
char *luser, int len)=NULL;
static int (KRB5_CALLCONV_C * p_krb_rd_req)(KTEXT, char *service, char *inst,
unsigned KRB4_32 from_addr, AUTH_DAT *,
char *srvtab)=NULL;
static int (KRB5_CALLCONV * p_krb_sendauth)(long,int,KTEXT,CHAR *,CHAR *,CHAR *,
unsigned long,MSG_DAT *,CREDENTIALS *, Key_schedule *,
struct sockaddr_in *,struct sockaddr_in *, CHAR *)=NULL;
static int (KRB5_CALLCONV_C * p_set_krb_debug)(int)=NULL;
static int (KRB5_CALLCONV_C * p_set_krb_ap_req_debug)(int)=NULL;
static long (KRB5_CALLCONV_C *p_krb_mk_safe)(char * in, char * out,
unsigned long length,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver)=NULL;
static long (KRB5_CALLCONV_C *p_krb_mk_priv)(char * in, char * out,
unsigned long length,
Schedule sched,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver)=NULL;
static long (KRB5_CALLCONV_C *p_krb_rd_priv)(char * in, unsigned long in_length,
Schedule sched,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver,
MSG_DAT * m_data)=NULL;
static long (KRB5_CALLCONV_C *p_krb_rd_safe)(char * in, unsigned long in_length,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver,
MSG_DAT * m_data)=NULL;
static int (KRB5_CALLCONV_C *p_krb_in_tkt)(char *, char *, char *)=NULL;
static int (KRB5_CALLCONV_C *p_krb_save_credentials)(char *, char *, char *, C_Block, int, int, KTEXT, long)=NULL;
int
ck_krb_in_tkt(char *a, char *b, char *c)
{
if ( p_krb_in_tkt )
return(p_krb_in_tkt(a,b,c));
else
return(KFAILURE);
}
int
ck_krb_save_credentials(char *a, char *b, char *c, C_Block block, int n, int m, KTEXT k, long l)
{
if ( p_krb_save_credentials )
return(p_krb_save_credentials(a,b,c,block,n,m,k,l));
else
return(KFAILURE);
}
const char *
ck_krb_get_err_text_entry(int _errno)
{
if (_errno == -1 )
return("Function not supported by Kerberos installation");
if ( p_krb_get_err_text_entry )
return(p_krb_get_err_text_entry(_errno));
if ( p_krb_get_err_text )
return(p_krb_get_err_text(_errno));
else
return("");
}
int
ck_krb_get_cred(char *service, char *instance,
char *realm, LEASH_CREDENTIALS *c)
{
if ( p_krb_get_cred )
return(p_krb_get_cred(service,instance,realm,(CREDENTIALS *)c));
else
return(-1);
}
int
ck_krb_mk_req(KTEXT authent, char *service,
char *instance, char *realm,
KRB4_32 checksum)
{
if ( p_krb_mk_req )
return(p_krb_mk_req(authent,service,
instance,realm,checksum));
else
return(-1);
}
char *
ck_krb_realmofhost(char *host)
{
debug(F110,"ck_krb_realmofhost",host,0);
if ( p_krb_realmofhost )
return(p_krb_realmofhost(host));
else
return("");
}
char *
ck_krb_get_phost(char *alias)
{
if ( p_krb_get_phost )
return(p_krb_get_phost(alias));
else
return("");
}
int
ck_krb_get_pw_in_tkt( char *user, char *instance, char *realm,
char *service, char *sinstance,
int life, char *password)
{
if ( p_krb_get_pw_in_tkt )
return(p_krb_get_pw_in_tkt(user,instance,realm,service,
sinstance,life,password));
else
return(-1);
}
int
ck_krb_get_pw_in_tkt_preauth( char *user, char *instance, char *realm,
char *service, char *sinstance,
int life, char *password)
{
if ( p_krb_get_pw_in_tkt_preauth )
return(p_krb_get_pw_in_tkt_preauth(user,instance,realm,service,
sinstance,life,password));
else
return(-1);
}
int
ck_krb_get_lrealm(char *realm, int index)
{
if ( p_krb_get_lrealm )
return(p_krb_get_lrealm(realm,index));
else
return(-1);
}
const char *
ck_krb_get_err_text(int _errno)
{
if ( p_krb_get_err_text )
return(p_krb_get_err_text(_errno));
if ( p_krb_get_err_text_entry )
return(p_krb_get_err_text_entry(_errno));
else
return("");
}
int
ck_kname_parse(char *name, char *inst,
char *realm,char *fullname)
{
if ( p_kname_parse )
return(p_kname_parse(name,inst,realm,fullname));
return(-1);
}
int
ck_dest_tkt(void)
{
if ( p_dest_tkt )
return(p_dest_tkt());
else
return(-1);
}
int
ck_tf_get_pname(char* pname)
{
if ( p_tf_get_pname )
return(p_tf_get_pname(pname));
else
return(-1);
}
int
ck_tf_get_pinst(char* pinst)
{
if ( p_tf_get_pinst )
return(p_tf_get_pinst(pinst));
else
return(-1);
}
int
ck_tf_get_cred(LEASH_CREDENTIALS* cred)
{
if ( p_tf_get_cred )
return(p_tf_get_cred((CREDENTIALS *)cred));
else
return(-1);
}
void
ck_tf_close(void)
{
if ( p_tf_close )
p_tf_close();
}
int
ck_tf_init(char * p,int n)
{
if ( p_tf_init )
return(p_tf_init(p,n));
else
return(-1);
}
char *
ck_tkt_string(void)
{
if ( p_tkt_string )
return(p_tkt_string());
else
return("");
}
int
ck_krb_get_tf_realm(char *ticket_file, char *realm)
{
if ( p_krb_get_tf_realm )
return(p_krb_get_tf_realm(ticket_file,realm));
else
return(-1);
}
int
ck_krb_get_tf_fullname(char *tf, char * name, char * inst, char *realm)
{
if ( p_krb_get_tf_fullname )
return(p_krb_get_tf_fullname(tf,name,inst,realm));
else
return(-1);
}
int
ck_krb_check_serv(char * service)
{
if ( p_krb_check_serv )
return(p_krb_check_serv(service));
else
return(-1);
}
static char lrealm[REALM_SZ] = "";
int
ck_kuserok(AUTH_DAT *kdata, char *luser)
{
if ( p_k95_k4_userok ) {
ckstrncpy(lrealm,ck_krb4_getrealm(),REALM_SZ);
return(p_k95_k4_userok(kdata->pname, kdata->pinst, kdata->prealm,
lrealm, luser));
}
else if ( p_kuserok )
return(p_kuserok(kdata,luser));
else {
return(stricmp(luser,kdata->pname));
}
}
int
ck_krb_kntoln(AUTH_DAT *kdata, char *luser)
{
if ( p_k95_k4_princ_to_userid ) {
if (krb_get_lrealm(lrealm,1) == KFAILURE)
lrealm[0] = '\0';
return(p_k95_k4_princ_to_userid(kdata->pname, kdata->pinst,
kdata->prealm, lrealm,
luser, ANAME_SZ));
}
else if ( p_krb_kntoln )
return(p_krb_kntoln(kdata,luser));
else {
if (krb_get_lrealm(lrealm,1) == KFAILURE)
return(KFAILURE);
if (strcmp(kdata->pinst,""))
return(KFAILURE);
if (strcmp(kdata->prealm,lrealm))
return(KFAILURE);
(void) ckstrncpy(luser,kdata->pname,ANAME_SZ);
return(KSUCCESS);
}
}
int
ck_krb_rd_req(KTEXT authent, char *service, char *inst,
unsigned int from_addr, AUTH_DAT * adat,
char *srvtab)
{
if ( p_krb_rd_req )
return(p_krb_rd_req(authent, service, inst, from_addr,
adat, srvtab));
else
return(-1);
}
int
ck_krb_sendauth(long opts, int socket, KTEXT ticket, CHAR * service,
CHAR * hostname, CHAR * realm, unsigned long pid,
MSG_DAT * msg_dat, LEASH_CREDENTIALS * cred,
Schedule * sched, struct sockaddr_in * l_addr,
struct sockaddr_in * r_addr, CHAR * str)
{
if ( p_krb_sendauth )
return(p_krb_sendauth(opts,socket,ticket,service,hostname,
realm,pid, msg_dat, (CREDENTIALS *)cred, sched,
l_addr, r_addr, str));
else
return(-1);
}
int
ck_set_krb_debug(int x)
{
if ( p_set_krb_debug )
return(p_set_krb_debug(x));
else
return(0);
}
int
ck_set_krb_ap_req_debug(int x)
{
if ( p_set_krb_ap_req_debug )
return(p_set_krb_ap_req_debug(x));
else
return(0);
}
long
ck_krb_mk_safe(char * in, char * out,
unsigned long length,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver)
{
if ( p_krb_mk_safe )
return(p_krb_mk_safe(in,out,length,block,sender,receiver));
else
return(-1);
}
long
ck_krb_mk_priv(char * in, char * out,
unsigned long length,
Schedule sched,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver)
{
if ( p_krb_mk_priv )
return(p_krb_mk_priv(in,out,length,sched,block,sender,receiver));
else
return(-1);
}
long
ck_krb_rd_priv(char * in, unsigned long in_length,
Schedule sched,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver,
MSG_DAT * m_data)
{
if ( p_krb_rd_priv )
return(p_krb_rd_priv(in, in_length,sched, block, sender, receiver, m_data));
else
return(-1);
}
long
ck_krb_rd_safe(char * in, unsigned long in_length,
C_Block block,
struct sockaddr_in * sender,
struct sockaddr_in * receiver,
MSG_DAT * m_data)
{
if ( p_krb_rd_safe )
return(p_krb_rd_safe(in, in_length, block, sender, receiver,m_data));
else
return(-1);
}
#endif /* KRB4 */
#ifdef KRB5
/* These functions are located in DLLs which we are not linking to at */
/* compile time. Therefore, we have to redirect them to locally */
/* defined functions which will call the real thing only if they are */
/* available via Run-Time Linking. */
/*
From COMERR32.DLL
unresolved external symbol __imp__com_err
unresolved external symbol __imp__error_message@4
From KRB5_32.DLL:
unresolved external symbol __imp__krb5_free_creds@8
unresolved external symbol __imp__krb5_copy_keyblock@12
unresolved external symbol __imp__krb5_free_keyblock@8
unresolved external symbol __imp__krb5_auth_con_getlocalsubkey@12
unresolved external symbol __imp__krb5_mk_req_extended@24
unresolved external symbol __imp__krb5_auth_con_setflags@12
unresolved external symbol __imp__krb5_auth_con_init@8
unresolved external symbol __imp__krb5_auth_con_free@8
unresolved external symbol __imp__krb5_get_credentials@20
unresolved external symbol __imp__krb5_free_cred_contents@8
unresolved external symbol __imp__krb5_sname_to_principal@20
unresolved external symbol __imp__krb5_cc_default@8
unresolved external symbol __imp__krb5_free_ap_rep_enc_part@8
unresolved external symbol __imp__krb5_rd_rep@16
unresolved external symbol __imp__krb5_get_in_tkt_with_keytab@36
unresolved external symbol __imp__krb5_get_in_tkt_with_password@36
unresolved external symbol __imp__krb5_read_password@20
unresolved external symbol __imp__krb5_build_principal_ext
unresolved external symbol __imp__krb5_unparse_name@12
unresolved external symbol __imp__krb5_parse_name@12
unresolved external symbol __imp__krb5_cc_resolve@12
unresolved external symbol __imp__krb5_string_to_timestamp@8
unresolved external symbol __imp__krb5_kt_resolve@12
unresolved external symbol __imp__krb5_string_to_deltat@8
unresolved external symbol __imp__krb5_timeofday@8
unresolved external symbol __imp__krb5_get_credentials_renew@20
unresolved external symbol __imp__krb5_get_credentials_validate@20
unresolved external symbol __imp__krb5_copy_principal@12
unresolved external symbol __imp__krb5_timestamp_to_sfstring@16
unresolved external symbol __imp__krb5_kt_default@8
unresolved external symbol __imp__krb5_free_ticket@8
unresolved external symbol _decode_krb5_ticket
These were added when Server Side functionality was added:
unresolved external symbol __imp__krb5_auth_con_getremotesubkey@12
unresolved external symbol __imp__krb5_mk_rep@12
unresolved external symbol __imp__krb5_free_authenticator@8
unresolved external symbol __imp__krb5_verify_checksum@28
unresolved external symbol __imp__krb5_auth_con_getkey@12
unresolved external symbol __imp__krb5_auth_con_getauthenticator@12
unresolved external symbol __imp__krb5_rd_req@28
unresolved external symbol _krb5_auth_con_setrcache
unresolved external symbol _krb5_get_server_rcache
unresolved external symbol _krb5_auth_con_getrcache
unresolved external symbol __imp__krb5_free_tgt_creds@8
unresolved external symbol __imp__krb5_rd_cred@20
These were added for 7.1.198 so we can support hardware preauth
__imp__krb5_get_init_creds_password@36
__imp__krb5_get_init_creds_opt_set_address_list@8
__imp__krb5_get_renewed_creds@20
__imp__krb5_get_validated_creds@20
__imp__krb5_get_init_creds_opt_set_tkt_life@8
__imp__krb5_get_init_creds_opt_set_forwardable@8
__imp__krb5_get_init_creds_opt_set_proxiable@8
__imp__krb5_get_init_creds_opt_set_renew_life@8
__imp__krb5_get_init_creds_opt_init@4
These were added 7-17-2000
__imp__krb5_cc_get_principal@12
__imp__krb5_cc_store_cred@12
__imp__krb5_cc_initialize@12
__imp__krb5_cc_destroy@8
__imp__krb5_cc_end_seq_get@12
__imp__krb5_cc_next_cred@16
__imp__krb5_cc_start_seq_get@12
__imp__krb5_cc_get_type
__imp__krb5_cc_get_name@8
__imp__krb5_cc_set_flags@12
*/
static void
(KRB5_CALLCONV * p_com_err)(const char *, errcode_t, const char *, ...)=NULL;
static void (KRB5_CALLCONV * p_com_err_va)
(const char *, errcode_t, const char *, va_list)=NULL;
static const char *
(KRB5_CALLCONV *p_error_message)(errcode_t)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_creds)(krb5_context, krb5_creds*)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_data)(krb5_context, krb5_data *)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_data_contents)(krb5_context, krb5_data *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_copy_keyblock)(krb5_context,
krb5_const krb5_keyblock *,
krb5_keyblock * *)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_keyblock) (krb5_context, krb5_keyblock *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_auth_con_getlocalsubkey)(krb5_context,
krb5_auth_context,
krb5_keyblock * *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_mk_req_extended) (krb5_context,
krb5_auth_context *,
krb5_const krb5_flags,
krb5_data *,
krb5_creds *,
krb5_data * )=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_mk_req)
(krb5_context,
krb5_auth_context *,
krb5_const krb5_flags,
char *,
char *,
krb5_data *,
krb5_ccache,
krb5_data * )=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_auth_con_setflags) (krb5_context,
krb5_auth_context,
krb5_int32)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_auth_con_init) (krb5_context,
krb5_auth_context *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_auth_con_free) (krb5_context,
krb5_auth_context)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_get_credentials)(krb5_context,
krb5_const krb5_flags,
krb5_ccache,
krb5_creds *,
krb5_creds * *)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_cred_contents)(krb5_context, krb5_creds *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_sname_to_principal)(krb5_context,
krb5_const char *,
krb5_const char *,
krb5_int32,
krb5_principal *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_cc_default)(krb5_context,
krb5_ccache *)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_ap_rep_enc_part)(krb5_context,
krb5_ap_rep_enc_part *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_rd_rep)(krb5_context,
krb5_auth_context,
krb5_const krb5_data *,
krb5_ap_rep_enc_part * *)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_init_context)(krb5_context *)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_context)(krb5_context)=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_init_ets)(krb5_context)=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_principal) P((krb5_context, krb5_principal ))=NULL;
static void
(KRB5_CALLCONV *p_krb5_free_unparsed_name) P((krb5_context, char *))=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_fwd_tgt_creds)P((krb5_context,
krb5_auth_context,
char *,
krb5_principal,
krb5_principal,
krb5_ccache,
int forwardable,
krb5_data *))=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_auth_con_genaddrs)P((krb5_context,
krb5_auth_context,
int, int))=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_get_host_realm)P((krb5_context,
const char *,
char ***))=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_free_host_realm)P((krb5_context,
char **))=NULL;
static krb5_error_code
(KRB5_CALLCONV *p_krb5_get_in_tkt_with_keytab)P((krb5_context,
krb5_const krb5_flags,
krb5_address * krb5_const *,
krb5_enctype *,