@@ -483,160 +483,150 @@ decode_negTokenInit(unsigned char *security_blob, int length,
483
483
484
484
asn1_open (& ctx , security_blob , length );
485
485
486
+ /* GSSAPI header */
486
487
if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
487
488
cFYI (1 , ("Error decoding negTokenInit header" ));
488
489
return 0 ;
489
490
} else if ((cls != ASN1_APL ) || (con != ASN1_CON )
490
491
|| (tag != ASN1_EOC )) {
491
492
cFYI (1 , ("cls = %d con = %d tag = %d" , cls , con , tag ));
492
493
return 0 ;
493
- } else {
494
- /* remember to free obj->oid */
495
- rc = asn1_header_decode (& ctx , & end , & cls , & con , & tag );
496
- if (rc ) {
497
- if ((tag == ASN1_OJI ) && (con == ASN1_PRI )) {
498
- rc = asn1_oid_decode (& ctx , end , & oid , & oidlen );
499
- if (rc ) {
500
- rc = compare_oid (oid , oidlen ,
501
- SPNEGO_OID ,
502
- SPNEGO_OID_LEN );
503
- kfree (oid );
504
- }
505
- } else
506
- rc = 0 ;
507
- }
494
+ }
508
495
509
- if (!rc ) {
510
- cFYI (1 , ("Error decoding negTokenInit header" ));
511
- return 0 ;
512
- }
496
+ /* Check for SPNEGO OID -- remember to free obj->oid */
497
+ rc = asn1_header_decode (& ctx , & end , & cls , & con , & tag );
498
+ if (rc ) {
499
+ if ((tag == ASN1_OJI ) && (con == ASN1_PRI ) &&
500
+ (cls == ASN1_UNI )) {
501
+ rc = asn1_oid_decode (& ctx , end , & oid , & oidlen );
502
+ if (rc ) {
503
+ rc = compare_oid (oid , oidlen , SPNEGO_OID ,
504
+ SPNEGO_OID_LEN );
505
+ kfree (oid );
506
+ }
507
+ } else
508
+ rc = 0 ;
509
+ }
513
510
514
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
515
- cFYI (1 , ("Error decoding negTokenInit" ));
516
- return 0 ;
517
- } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )
518
- || (tag != ASN1_EOC )) {
519
- cFYI (1 ,
520
- ("cls = %d con = %d tag = %d end = %p (%d) exit 0" ,
521
- cls , con , tag , end , * end ));
522
- return 0 ;
523
- }
511
+ /* SPNEGO OID not present or garbled -- bail out */
512
+ if (!rc ) {
513
+ cFYI (1 , ("Error decoding negTokenInit header" ));
514
+ return 0 ;
515
+ }
524
516
525
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
526
- cFYI (1 , ("Error decoding negTokenInit" ));
527
- return 0 ;
528
- } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
529
- || (tag != ASN1_SEQ )) {
530
- cFYI (1 ,
531
- ("cls = %d con = %d tag = %d end = %p (%d) exit 1 " ,
532
- cls , con , tag , end , * end ));
533
- return 0 ;
534
- }
517
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
518
+ cFYI (1 , ("Error decoding negTokenInit" ));
519
+ return 0 ;
520
+ } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )
521
+ || (tag != ASN1_EOC )) {
522
+ cFYI (1 ,
523
+ ("cls = %d con = %d tag = %d end = %p (%d) exit 0 " ,
524
+ cls , con , tag , end , * end ));
525
+ return 0 ;
526
+ }
535
527
536
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
537
- cFYI (1 , ("Error decoding 2nd part of negTokenInit" ));
538
- return 0 ;
539
- } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )
540
- || (tag != ASN1_EOC )) {
541
- cFYI (1 ,
542
- ("cls = %d con = %d tag = %d end = %p (%d) exit 0 " ,
543
- cls , con , tag , end , * end ));
544
- return 0 ;
545
- }
528
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
529
+ cFYI (1 , ("Error decoding negTokenInit" ));
530
+ return 0 ;
531
+ } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
532
+ || (tag != ASN1_SEQ )) {
533
+ cFYI (1 ,
534
+ ("cls = %d con = %d tag = %d end = %p (%d) exit 1 " ,
535
+ cls , con , tag , end , * end ));
536
+ return 0 ;
537
+ }
546
538
547
- if (asn1_header_decode
548
- (& ctx , & sequence_end , & cls , & con , & tag ) == 0 ) {
549
- cFYI (1 , ("Error decoding 2nd part of negTokenInit" ));
550
- return 0 ;
551
- } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
552
- || (tag != ASN1_SEQ )) {
553
- cFYI (1 ,
554
- ("cls = %d con = %d tag = %d end = %p (%d) exit 1" ,
555
- cls , con , tag , end , * end ));
556
- return 0 ;
557
- }
539
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
540
+ cFYI (1 , ("Error decoding 2nd part of negTokenInit" ));
541
+ return 0 ;
542
+ } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )
543
+ || (tag != ASN1_EOC )) {
544
+ cFYI (1 ,
545
+ ("cls = %d con = %d tag = %d end = %p (%d) exit 0" ,
546
+ cls , con , tag , end , * end ));
547
+ return 0 ;
548
+ }
558
549
559
- while (!asn1_eoc_decode (& ctx , sequence_end )) {
560
- rc = asn1_header_decode (& ctx , & end , & cls , & con , & tag );
561
- if (!rc ) {
562
- cFYI (1 ,
563
- ("Error decoding negTokenInit hdr exit2" ));
564
- return 0 ;
565
- }
566
- if ((tag == ASN1_OJI ) && (con == ASN1_PRI )) {
567
- if (asn1_oid_decode (& ctx , end , & oid , & oidlen )) {
568
-
569
- cFYI (1 ,
570
- ("OID len = %d oid = 0x%lx 0x%lx "
571
- "0x%lx 0x%lx" ,
572
- oidlen , * oid , * (oid + 1 ),
573
- * (oid + 2 ), * (oid + 3 )));
574
-
575
- if (compare_oid (oid , oidlen ,
576
- MSKRB5_OID ,
577
- MSKRB5_OID_LEN ))
578
- use_kerberos = true;
579
- else if (compare_oid (oid , oidlen ,
580
- KRB5_OID ,
581
- KRB5_OID_LEN ))
582
- use_kerberos = true;
583
- else if (compare_oid (oid , oidlen ,
584
- NTLMSSP_OID ,
585
- NTLMSSP_OID_LEN ))
586
- use_ntlmssp = true;
587
-
588
- kfree (oid );
589
- }
590
- } else {
591
- cFYI (1 , ("Should be an oid what is going on?" ));
592
- }
593
- }
550
+ if (asn1_header_decode
551
+ (& ctx , & sequence_end , & cls , & con , & tag ) == 0 ) {
552
+ cFYI (1 , ("Error decoding 2nd part of negTokenInit" ));
553
+ return 0 ;
554
+ } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
555
+ || (tag != ASN1_SEQ )) {
556
+ cFYI (1 ,
557
+ ("cls = %d con = %d tag = %d end = %p (%d) exit 1" ,
558
+ cls , con , tag , end , * end ));
559
+ return 0 ;
560
+ }
594
561
595
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
596
- cFYI (1 ,
597
- ("Error decoding last part negTokenInit exit3" ));
598
- return 0 ;
599
- } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )) {
600
- /* tag = 3 indicating mechListMIC */
562
+ while (!asn1_eoc_decode (& ctx , sequence_end )) {
563
+ rc = asn1_header_decode (& ctx , & end , & cls , & con , & tag );
564
+ if (!rc ) {
601
565
cFYI (1 ,
602
- ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)" ,
603
- cls , con , tag , end , * end ));
566
+ ("Error decoding negTokenInit hdr exit2" ));
604
567
return 0 ;
605
568
}
606
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
607
- cFYI (1 ,
608
- ("Error decoding last part negTokenInit exit5" ));
609
- return 0 ;
610
- } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
611
- || (tag != ASN1_SEQ )) {
612
- cFYI (1 , ("cls = %d con = %d tag = %d end = %p (%d)" ,
613
- cls , con , tag , end , * end ));
569
+ if ((tag == ASN1_OJI ) && (con == ASN1_PRI )) {
570
+ if (asn1_oid_decode (& ctx , end , & oid , & oidlen )) {
571
+
572
+ cFYI (1 , ("OID len = %d oid = 0x%lx 0x%lx "
573
+ "0x%lx 0x%lx" , oidlen , * oid ,
574
+ * (oid + 1 ), * (oid + 2 ), * (oid + 3 )));
575
+
576
+ if (compare_oid (oid , oidlen , MSKRB5_OID ,
577
+ MSKRB5_OID_LEN ))
578
+ use_kerberos = true;
579
+ else if (compare_oid (oid , oidlen , KRB5_OID ,
580
+ KRB5_OID_LEN ))
581
+ use_kerberos = true;
582
+ else if (compare_oid (oid , oidlen , NTLMSSP_OID ,
583
+ NTLMSSP_OID_LEN ))
584
+ use_ntlmssp = true;
585
+
586
+ kfree (oid );
587
+ }
588
+ } else {
589
+ cFYI (1 , ("Should be an oid what is going on?" ));
614
590
}
591
+ }
615
592
616
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
617
- cFYI (1 ,
618
- ("Error decoding last part negTokenInit exit 7" ));
619
- return 0 ;
620
- } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )) {
621
- cFYI (1 ,
622
- ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)" ,
623
- cls , con , tag , end , * end ));
624
- return 0 ;
625
- }
626
- if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
627
- cFYI (1 ,
628
- ("Error decoding last part negTokenInit exit9" ));
629
- return 0 ;
630
- } else if ((cls != ASN1_UNI ) || (con != ASN1_PRI )
631
- || (tag != ASN1_GENSTR )) {
632
- cFYI (1 ,
633
- ("Exit10 cls = %d con = %d tag = %d end = %p (%d)" ,
634
- cls , con , tag , end , * end ));
635
- return 0 ;
636
- }
637
- cFYI (1 , ("Need to call asn1_octets_decode() function for %s" ,
638
- ctx .pointer )); /* is this UTF-8 or ASCII? */
593
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
594
+ cFYI (1 , ("Error decoding last part negTokenInit exit3" ));
595
+ return 0 ;
596
+ } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )) {
597
+ /* tag = 3 indicating mechListMIC */
598
+ cFYI (1 , ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)" ,
599
+ cls , con , tag , end , * end ));
600
+ return 0 ;
601
+ }
602
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
603
+ cFYI (1 , ("Error decoding last part negTokenInit exit5" ));
604
+ return 0 ;
605
+ } else if ((cls != ASN1_UNI ) || (con != ASN1_CON )
606
+ || (tag != ASN1_SEQ )) {
607
+ cFYI (1 , ("cls = %d con = %d tag = %d end = %p (%d)" ,
608
+ cls , con , tag , end , * end ));
609
+ }
610
+
611
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
612
+ cFYI (1 , ("Error decoding last part negTokenInit exit 7" ));
613
+ return 0 ;
614
+ } else if ((cls != ASN1_CTX ) || (con != ASN1_CON )) {
615
+ cFYI (1 , ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)" ,
616
+ cls , con , tag , end , * end ));
617
+ return 0 ;
618
+ }
619
+ if (asn1_header_decode (& ctx , & end , & cls , & con , & tag ) == 0 ) {
620
+ cFYI (1 , ("Error decoding last part negTokenInit exit9" ));
621
+ return 0 ;
622
+ } else if ((cls != ASN1_UNI ) || (con != ASN1_PRI )
623
+ || (tag != ASN1_GENSTR )) {
624
+ cFYI (1 , ("Exit10 cls = %d con = %d tag = %d end = %p (%d)" ,
625
+ cls , con , tag , end , * end ));
626
+ return 0 ;
639
627
}
628
+ cFYI (1 , ("Need to call asn1_octets_decode() function for %s" ,
629
+ ctx .pointer )); /* is this UTF-8 or ASCII? */
640
630
641
631
if (use_kerberos )
642
632
* secType = Kerberos ;
0 commit comments