aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/asn1.c')
-rw-r--r--fs/cifs/asn1.c73
1 files changed, 34 insertions, 39 deletions
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index a20bea598933..6d555c05dba9 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -510,11 +510,11 @@ decode_negTokenInit(unsigned char *security_blob, int length,
510 510
511 /* GSSAPI header */ 511 /* GSSAPI header */
512 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 512 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
513 cFYI(1, ("Error decoding negTokenInit header")); 513 cFYI(1, "Error decoding negTokenInit header");
514 return 0; 514 return 0;
515 } else if ((cls != ASN1_APL) || (con != ASN1_CON) 515 } else if ((cls != ASN1_APL) || (con != ASN1_CON)
516 || (tag != ASN1_EOC)) { 516 || (tag != ASN1_EOC)) {
517 cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag)); 517 cFYI(1, "cls = %d con = %d tag = %d", cls, con, tag);
518 return 0; 518 return 0;
519 } 519 }
520 520
@@ -535,56 +535,52 @@ decode_negTokenInit(unsigned char *security_blob, int length,
535 535
536 /* SPNEGO OID not present or garbled -- bail out */ 536 /* SPNEGO OID not present or garbled -- bail out */
537 if (!rc) { 537 if (!rc) {
538 cFYI(1, ("Error decoding negTokenInit header")); 538 cFYI(1, "Error decoding negTokenInit header");
539 return 0; 539 return 0;
540 } 540 }
541 541
542 /* SPNEGO */ 542 /* SPNEGO */
543 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 543 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
544 cFYI(1, ("Error decoding negTokenInit")); 544 cFYI(1, "Error decoding negTokenInit");
545 return 0; 545 return 0;
546 } else if ((cls != ASN1_CTX) || (con != ASN1_CON) 546 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
547 || (tag != ASN1_EOC)) { 547 || (tag != ASN1_EOC)) {
548 cFYI(1, 548 cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
549 ("cls = %d con = %d tag = %d end = %p (%d) exit 0", 549 cls, con, tag, end, *end);
550 cls, con, tag, end, *end));
551 return 0; 550 return 0;
552 } 551 }
553 552
554 /* negTokenInit */ 553 /* negTokenInit */
555 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 554 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
556 cFYI(1, ("Error decoding negTokenInit")); 555 cFYI(1, "Error decoding negTokenInit");
557 return 0; 556 return 0;
558 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 557 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
559 || (tag != ASN1_SEQ)) { 558 || (tag != ASN1_SEQ)) {
560 cFYI(1, 559 cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
561 ("cls = %d con = %d tag = %d end = %p (%d) exit 1", 560 cls, con, tag, end, *end);
562 cls, con, tag, end, *end));
563 return 0; 561 return 0;
564 } 562 }
565 563
566 /* sequence */ 564 /* sequence */
567 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 565 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
568 cFYI(1, ("Error decoding 2nd part of negTokenInit")); 566 cFYI(1, "Error decoding 2nd part of negTokenInit");
569 return 0; 567 return 0;
570 } else if ((cls != ASN1_CTX) || (con != ASN1_CON) 568 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
571 || (tag != ASN1_EOC)) { 569 || (tag != ASN1_EOC)) {
572 cFYI(1, 570 cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
573 ("cls = %d con = %d tag = %d end = %p (%d) exit 0", 571 cls, con, tag, end, *end);
574 cls, con, tag, end, *end));
575 return 0; 572 return 0;
576 } 573 }
577 574
578 /* sequence of */ 575 /* sequence of */
579 if (asn1_header_decode 576 if (asn1_header_decode
580 (&ctx, &sequence_end, &cls, &con, &tag) == 0) { 577 (&ctx, &sequence_end, &cls, &con, &tag) == 0) {
581 cFYI(1, ("Error decoding 2nd part of negTokenInit")); 578 cFYI(1, "Error decoding 2nd part of negTokenInit");
582 return 0; 579 return 0;
583 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 580 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
584 || (tag != ASN1_SEQ)) { 581 || (tag != ASN1_SEQ)) {
585 cFYI(1, 582 cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
586 ("cls = %d con = %d tag = %d end = %p (%d) exit 1", 583 cls, con, tag, end, *end);
587 cls, con, tag, end, *end));
588 return 0; 584 return 0;
589 } 585 }
590 586
@@ -592,16 +588,15 @@ decode_negTokenInit(unsigned char *security_blob, int length,
592 while (!asn1_eoc_decode(&ctx, sequence_end)) { 588 while (!asn1_eoc_decode(&ctx, sequence_end)) {
593 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); 589 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
594 if (!rc) { 590 if (!rc) {
595 cFYI(1, 591 cFYI(1, "Error decoding negTokenInit hdr exit2");
596 ("Error decoding negTokenInit hdr exit2"));
597 return 0; 592 return 0;
598 } 593 }
599 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { 594 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
600 if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) { 595 if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) {
601 596
602 cFYI(1, ("OID len = %d oid = 0x%lx 0x%lx " 597 cFYI(1, "OID len = %d oid = 0x%lx 0x%lx "
603 "0x%lx 0x%lx", oidlen, *oid, 598 "0x%lx 0x%lx", oidlen, *oid,
604 *(oid + 1), *(oid + 2), *(oid + 3))); 599 *(oid + 1), *(oid + 2), *(oid + 3));
605 600
606 if (compare_oid(oid, oidlen, MSKRB5_OID, 601 if (compare_oid(oid, oidlen, MSKRB5_OID,
607 MSKRB5_OID_LEN) && 602 MSKRB5_OID_LEN) &&
@@ -622,7 +617,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
622 kfree(oid); 617 kfree(oid);
623 } 618 }
624 } else { 619 } else {
625 cFYI(1, ("Should be an oid what is going on?")); 620 cFYI(1, "Should be an oid what is going on?");
626 } 621 }
627 } 622 }
628 623
@@ -632,47 +627,47 @@ decode_negTokenInit(unsigned char *security_blob, int length,
632 no mechListMic (e.g. NTLMSSP instead of KRB5) */ 627 no mechListMic (e.g. NTLMSSP instead of KRB5) */
633 if (ctx.error == ASN1_ERR_DEC_EMPTY) 628 if (ctx.error == ASN1_ERR_DEC_EMPTY)
634 goto decode_negtoken_exit; 629 goto decode_negtoken_exit;
635 cFYI(1, ("Error decoding last part negTokenInit exit3")); 630 cFYI(1, "Error decoding last part negTokenInit exit3");
636 return 0; 631 return 0;
637 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { 632 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
638 /* tag = 3 indicating mechListMIC */ 633 /* tag = 3 indicating mechListMIC */
639 cFYI(1, ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", 634 cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
640 cls, con, tag, end, *end)); 635 cls, con, tag, end, *end);
641 return 0; 636 return 0;
642 } 637 }
643 638
644 /* sequence */ 639 /* sequence */
645 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 640 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
646 cFYI(1, ("Error decoding last part negTokenInit exit5")); 641 cFYI(1, "Error decoding last part negTokenInit exit5");
647 return 0; 642 return 0;
648 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 643 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
649 || (tag != ASN1_SEQ)) { 644 || (tag != ASN1_SEQ)) {
650 cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)", 645 cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)",
651 cls, con, tag, end, *end)); 646 cls, con, tag, end, *end);
652 } 647 }
653 648
654 /* sequence of */ 649 /* sequence of */
655 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 650 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
656 cFYI(1, ("Error decoding last part negTokenInit exit 7")); 651 cFYI(1, "Error decoding last part negTokenInit exit 7");
657 return 0; 652 return 0;
658 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { 653 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
659 cFYI(1, ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)", 654 cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)",
660 cls, con, tag, end, *end)); 655 cls, con, tag, end, *end);
661 return 0; 656 return 0;
662 } 657 }
663 658
664 /* general string */ 659 /* general string */
665 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 660 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
666 cFYI(1, ("Error decoding last part negTokenInit exit9")); 661 cFYI(1, "Error decoding last part negTokenInit exit9");
667 return 0; 662 return 0;
668 } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) 663 } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
669 || (tag != ASN1_GENSTR)) { 664 || (tag != ASN1_GENSTR)) {
670 cFYI(1, ("Exit10 cls = %d con = %d tag = %d end = %p (%d)", 665 cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)",
671 cls, con, tag, end, *end)); 666 cls, con, tag, end, *end);
672 return 0; 667 return 0;
673 } 668 }
674 cFYI(1, ("Need to call asn1_octets_decode() function for %s", 669 cFYI(1, "Need to call asn1_octets_decode() function for %s",
675 ctx.pointer)); /* is this UTF-8 or ASCII? */ 670 ctx.pointer); /* is this UTF-8 or ASCII? */
676decode_negtoken_exit: 671decode_negtoken_exit:
677 if (use_kerberos) 672 if (use_kerberos)
678 *secType = Kerberos; 673 *secType = Kerberos;