aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/asn1.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-07-12 20:33:32 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-12 20:33:32 -0400
commit50c2f75388727018c3c357454a247072915a9e3f (patch)
treee7c7cd30f1adee51be7af8bda5e937df5c899bc6 /fs/cifs/asn1.c
parent7521a3c566dda7bb09576975324fc0a08a79ad14 (diff)
[CIFS] whitespace/formatting fixes
This should be the last big batch of whitespace/formatting fixes. checkpatch warnings for the cifs directory are down about 90% and many of the remaining ones are harder to remove or make the code harder to read. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/asn1.c')
-rw-r--r--fs/cifs/asn1.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index 2e75883b7f54..f50a88d58f78 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * The ASB.1/BER parsing code is derived from ip_nat_snmp_basic.c which was in 2 * The ASB.1/BER parsing code is derived from ip_nat_snmp_basic.c which was in
3 * turn derived from the gxsnmp package by Gregory McLean & Jochen Friedrich 3 * turn derived from the gxsnmp package by Gregory McLean & Jochen Friedrich
4 * 4 *
5 * Copyright (c) 2000 RP Internet (www.rpi.net.au). 5 * Copyright (c) 2000 RP Internet (www.rpi.net.au).
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -80,7 +80,7 @@
80static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 }; 80static unsigned long SPNEGO_OID[7] = { 1, 3, 6, 1, 5, 5, 2 };
81static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 }; 81static unsigned long NTLMSSP_OID[10] = { 1, 3, 6, 1, 4, 1, 311, 2, 2, 10 };
82 82
83/* 83/*
84 * ASN.1 context. 84 * ASN.1 context.
85 */ 85 */
86struct asn1_ctx { 86struct asn1_ctx {
@@ -190,7 +190,7 @@ asn1_header_decode(struct asn1_ctx *ctx,
190 unsigned char **eoc, 190 unsigned char **eoc,
191 unsigned int *cls, unsigned int *con, unsigned int *tag) 191 unsigned int *cls, unsigned int *con, unsigned int *tag)
192{ 192{
193 unsigned int def = 0; 193 unsigned int def = 0;
194 unsigned int len = 0; 194 unsigned int len = 0;
195 195
196 if (!asn1_id_decode(ctx, cls, con, tag)) 196 if (!asn1_id_decode(ctx, cls, con, tag))
@@ -331,7 +331,7 @@ static unsigned char asn1_ulong_decode(struct asn1_ctx *ctx,
331 *integer |= ch; 331 *integer |= ch;
332 } 332 }
333 return 1; 333 return 1;
334} 334}
335 335
336static unsigned char 336static unsigned char
337asn1_octets_decode(struct asn1_ctx *ctx, 337asn1_octets_decode(struct asn1_ctx *ctx,
@@ -376,7 +376,7 @@ asn1_subid_decode(struct asn1_ctx *ctx, unsigned long *subid)
376 return 1; 376 return 1;
377} 377}
378 378
379static int 379static int
380asn1_oid_decode(struct asn1_ctx *ctx, 380asn1_oid_decode(struct asn1_ctx *ctx,
381 unsigned char *eoc, unsigned long **oid, unsigned int *len) 381 unsigned char *eoc, unsigned long **oid, unsigned int *len)
382{ 382{
@@ -459,7 +459,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
459 unsigned int cls, con, tag, oidlen, rc; 459 unsigned int cls, con, tag, oidlen, rc;
460 int use_ntlmssp = FALSE; 460 int use_ntlmssp = FALSE;
461 461
462 *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default */ 462 *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/
463 463
464 /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */ 464 /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
465 465
@@ -498,7 +498,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
498 return 0; 498 return 0;
499 } else if ((cls != ASN1_CTX) || (con != ASN1_CON) 499 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)
500 || (tag != ASN1_EOC)) { 500 || (tag != ASN1_EOC)) {
501 cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0", 501 cFYI(1,
502 ("cls = %d con = %d tag = %d end = %p (%d) exit 0",
502 cls, con, tag, end, *end)); 503 cls, con, tag, end, *end));
503 return 0; 504 return 0;
504 } 505 }
@@ -508,7 +509,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
508 return 0; 509 return 0;
509 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 510 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
510 || (tag != ASN1_SEQ)) { 511 || (tag != ASN1_SEQ)) {
511 cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1", 512 cFYI(1,
513 ("cls = %d con = %d tag = %d end = %p (%d) exit 1",
512 cls, con, tag, end, *end)); 514 cls, con, tag, end, *end));
513 return 0; 515 return 0;
514 } 516 }
@@ -540,32 +542,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
540 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); 542 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
541 if (!rc) { 543 if (!rc) {
542 cFYI(1, 544 cFYI(1,
543 ("Error 1 decoding negTokenInit header exit 2")); 545 ("Error decoding negTokenInit hdr exit2"));
544 return 0; 546 return 0;
545 } 547 }
546 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { 548 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
547 rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); 549 rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
548 if(rc) { 550 if (rc) {
549 cFYI(1, 551 cFYI(1,
550 ("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx", 552 ("OID len = %d oid = 0x%lx 0x%lx "
551 oidlen, *oid, *(oid + 1), *(oid + 2), 553 "0x%lx 0x%lx",
552 *(oid + 3))); 554 oidlen, *oid, *(oid + 1),
553 rc = compare_oid(oid, oidlen, NTLMSSP_OID, 555 *(oid + 2), *(oid + 3)));
554 NTLMSSP_OID_LEN); 556 rc = compare_oid(oid, oidlen,
557 NTLMSSP_OID, NTLMSSP_OID_LEN);
555 kfree(oid); 558 kfree(oid);
556 if (rc) 559 if (rc)
557 use_ntlmssp = TRUE; 560 use_ntlmssp = TRUE;
558 } 561 }
559 } else { 562 } else {
560 cFYI(1,("This should be an oid what is going on? ")); 563 cFYI(1, ("Should be an oid what is going on?"));
561 } 564 }
562 } 565 }
563 566
564 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 567 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
565 cFYI(1, 568 cFYI(1,
566 ("Error decoding last part of negTokenInit exit 3")); 569 ("Error decoding last part negTokenInit exit3"));
567 return 0; 570 return 0;
568 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { /* tag = 3 indicating mechListMIC */ 571 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
572 /* tag = 3 indicating mechListMIC */
569 cFYI(1, 573 cFYI(1,
570 ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)", 574 ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
571 cls, con, tag, end, *end)); 575 cls, con, tag, end, *end));
@@ -573,7 +577,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
573 } 577 }
574 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 578 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
575 cFYI(1, 579 cFYI(1,
576 ("Error decoding last part of negTokenInit exit 5")); 580 ("Error decoding last part negTokenInit exit5"));
577 return 0; 581 return 0;
578 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 582 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
579 || (tag != ASN1_SEQ)) { 583 || (tag != ASN1_SEQ)) {
@@ -584,7 +588,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
584 588
585 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 589 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
586 cFYI(1, 590 cFYI(1,
587 ("Error decoding last part of negTokenInit exit 7")); 591 ("Error decoding last part negTokenInit exit 7"));
588 return 0; 592 return 0;
589 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { 593 } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
590 cFYI(1, 594 cFYI(1,
@@ -594,20 +598,21 @@ decode_negTokenInit(unsigned char *security_blob, int length,
594 } 598 }
595 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 599 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
596 cFYI(1, 600 cFYI(1,
597 ("Error decoding last part of negTokenInit exit 9")); 601 ("Error decoding last part negTokenInit exit9"));
598 return 0; 602 return 0;
599 } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) 603 } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
600 || (tag != ASN1_GENSTR)) { 604 || (tag != ASN1_GENSTR)) {
601 cFYI(1, 605 cFYI(1,
602 ("Exit 10 cls = %d con = %d tag = %d end = %p (%d)", 606 ("Exit10 cls = %d con = %d tag = %d end = %p (%d)",
603 cls, con, tag, end, *end)); 607 cls, con, tag, end, *end));
604 return 0; 608 return 0;
605 } 609 }
606 cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer)); /* is this UTF-8 or ASCII? */ 610 cFYI(1, ("Need to call asn1_octets_decode() function for %s",
611 ctx.pointer)); /* is this UTF-8 or ASCII? */
607 } 612 }
608 613
609 /* if (use_kerberos) 614 /* if (use_kerberos)
610 *secType = Kerberos 615 *secType = Kerberos
611 else */ 616 else */
612 if (use_ntlmssp) { 617 if (use_ntlmssp) {
613 *secType = NTLMSSP; 618 *secType = NTLMSSP;