svn rev #23133: trunk/src/lib/krb5/asn.1/
tlyu@MIT.EDU
tlyu at MIT.EDU
Wed Nov 4 23:39:54 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=23133
Commit By: tlyu
Log Message:
make mark-cstyle; make reindent
Changed Files:
U trunk/src/lib/krb5/asn.1/asn1_decode.c
U trunk/src/lib/krb5/asn.1/asn1_encode.c
U trunk/src/lib/krb5/asn.1/asn1_get.c
U trunk/src/lib/krb5/asn.1/asn1_get.h
U trunk/src/lib/krb5/asn.1/asn1_k_decode.c
U trunk/src/lib/krb5/asn.1/asn1_k_decode.h
U trunk/src/lib/krb5/asn.1/asn1_k_encode.h
U trunk/src/lib/krb5/asn.1/asn1_make.c
U trunk/src/lib/krb5/asn.1/asn1_misc.c
U trunk/src/lib/krb5/asn.1/asn1_misc.h
U trunk/src/lib/krb5/asn.1/asn1buf.c
U trunk/src/lib/krb5/asn.1/asn1glue.h
U trunk/src/lib/krb5/asn.1/krb5_encode.c
U trunk/src/lib/krb5/asn.1/krbasn1.h
U trunk/src/lib/krb5/asn.1/ldap_key_seq.c
Modified: trunk/src/lib/krb5/asn.1/asn1_decode.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_decode.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_decode.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_decode.c
*
@@ -39,23 +39,23 @@
#include <time.h>
#endif
-#define setup()\
-asn1_error_code retval;\
-taginfo tinfo
+#define setup() \
+ asn1_error_code retval; \
+ taginfo tinfo
#define asn1class (tinfo.asn1class)
#define construction (tinfo.construction)
#define tagnum (tinfo.tagnum)
#define length (tinfo.length)
-#define tag(type)\
-retval = asn1_get_tag_2(buf,&tinfo);\
-if (retval) return retval;\
-if (asn1class != UNIVERSAL || construction != PRIMITIVE || tagnum != type)\
- return ASN1_BAD_ID
+#define tag(type) \
+ retval = asn1_get_tag_2(buf,&tinfo); \
+ if (retval) return retval; \
+ if (asn1class != UNIVERSAL || construction != PRIMITIVE || tagnum != type) \
+ return ASN1_BAD_ID
-#define cleanup()\
-return 0
+#define cleanup() \
+ return 0
asn1_error_code
asn1_decode_integer(asn1buf *buf, long int *val)
Modified: trunk/src/lib/krb5/asn.1/asn1_encode.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_encode.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_encode.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_encode.c
*
@@ -325,10 +325,10 @@
*/
#ifdef POINTERS_ARE_ALL_THE_SAME
-#define LOADPTR(PTR,TYPE) \
+#define LOADPTR(PTR,TYPE) \
(assert((TYPE)->loadptr != NULL), (TYPE)->loadptr(PTR))
#else
-#define LOADPTR(PTR,TYPE) \
+#define LOADPTR(PTR,TYPE) \
(*(const void *const *)(PTR))
#endif
Modified: trunk/src/lib/krb5/asn.1/asn1_get.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_get.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_get.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_get.c
*
Modified: trunk/src/lib/krb5/asn.1/asn1_get.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_get.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_get.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_get.h
*
@@ -36,12 +36,12 @@
typedef struct {
#if 1
- /*
- * Smaller run-time storage, and on x86 the compiler can use byte
- * loads, stores, and compares, but on other platforms the compiler
- * may need to load and widen before comparing... see how this works
- * out.
- */
+ /*
+ * Smaller run-time storage, and on x86 the compiler can use byte
+ * loads, stores, and compares, but on other platforms the compiler
+ * may need to load and widen before comparing... see how this works
+ * out.
+ */
unsigned int asn1class : 8, construction : 8;
#else
asn1_class asn1class;
Modified: trunk/src/lib/krb5/asn.1/asn1_k_decode.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_k_decode.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_k_decode.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_k_decode.c
*
@@ -34,26 +34,26 @@
/* Declare useful decoder variables. */
#define setup() \
- asn1_error_code retval; \
- asn1_class asn1class; \
- asn1_construction construction; \
- asn1_tagnum tagnum; \
- unsigned int length, taglen
+ asn1_error_code retval; \
+ asn1_class asn1class; \
+ asn1_construction construction; \
+ asn1_tagnum tagnum; \
+ unsigned int length, taglen
#define unused_var(x) if (0) { x = 0; x = x - x; }
/* This is used for prefetch of next tag in sequence. */
-#define next_tag() \
-{ taginfo t2; \
- retval = asn1_get_tag_2(&subbuf, &t2); \
- if (retval) clean_return(retval); \
- /* Copy out to match previous functionality, until better integrated. */ \
- asn1class = t2.asn1class; \
- construction = t2.construction; \
- tagnum = t2.tagnum; \
- taglen = t2.length; \
- indef = t2.indef; \
-}
+#define next_tag() \
+ { taginfo t2; \
+ retval = asn1_get_tag_2(&subbuf, &t2); \
+ if (retval) clean_return(retval); \
+ /* Copy out to match previous functionality, until better integrated. */ \
+ asn1class = t2.asn1class; \
+ construction = t2.construction; \
+ tagnum = t2.tagnum; \
+ taglen = t2.length; \
+ indef = t2.indef; \
+ }
static asn1_error_code
asn1_get_eoc_tag (asn1buf *buf)
@@ -77,40 +77,40 @@
}
#define alloc_field(var) \
- var = calloc(1, sizeof(*var)); \
- if ((var) == NULL) clean_return(ENOMEM)
+ var = calloc(1, sizeof(*var)); \
+ if ((var) == NULL) clean_return(ENOMEM)
/*
* Allocate a principal and initialize enough fields for
* krb5_free_principal to have defined behavior.
*/
#define alloc_principal(var) \
- alloc_field(var); \
- var->realm.data = NULL; \
- var->data = NULL
+ alloc_field(var); \
+ var->realm.data = NULL; \
+ var->data = NULL
/*
* Allocate a data structure and initialize enough fields for
* krb5_free_data to have defined behavior.
*/
#define alloc_data(var) \
- alloc_field(var); \
- var->data = NULL
+ alloc_field(var); \
+ var->data = NULL
/* Fetch an expected APPLICATION class tag and verify. */
-#define apptag(tagexpect) \
- { \
- taginfo t1; \
- retval = asn1_get_tag_2(buf, &t1); \
- if (retval) clean_return(retval); \
- if (t1.asn1class != APPLICATION || t1.construction != CONSTRUCTED || \
- t1.tagnum != (tagexpect)) clean_return(ASN1_BAD_ID); \
- /* Copy out to match previous functionality, until better integrated. */ \
- asn1class = t1.asn1class; \
- construction = t1.construction; \
- tagnum = t1.tagnum; \
- applen = t1.length; \
- }
+#define apptag(tagexpect) \
+ { \
+ taginfo t1; \
+ retval = asn1_get_tag_2(buf, &t1); \
+ if (retval) clean_return(retval); \
+ if (t1.asn1class != APPLICATION || t1.construction != CONSTRUCTED || \
+ t1.tagnum != (tagexpect)) clean_return(ASN1_BAD_ID); \
+ /* Copy out to match previous functionality, until better integrated. */ \
+ asn1class = t1.asn1class; \
+ construction = t1.construction; \
+ tagnum = t1.tagnum; \
+ applen = t1.length; \
+ }
/**** normal fields ****/
@@ -122,10 +122,10 @@
* enclosed in a context-specific tag.
*/
#define get_field_body(var, decoder) \
- retval = decoder(&subbuf, &(var)); \
- if (retval) clean_return(retval); \
- if (!taglen && indef) { get_eoc(); } \
- next_tag()
+ retval = decoder(&subbuf, &(var)); \
+ if (retval) clean_return(retval); \
+ if (!taglen && indef) { get_eoc(); } \
+ next_tag()
/*
* error_if_bad_tag
@@ -133,8 +133,8 @@
* Checks that the next tag is the expected one; returns with an error
* if not.
*/
-#define error_if_bad_tag(tagexpect) \
- if (tagnum != (tagexpect)) { clean_return((tagnum < (tagexpect)) ? ASN1_MISPLACED_FIELD : ASN1_MISSING_FIELD); }
+#define error_if_bad_tag(tagexpect) \
+ if (tagnum != (tagexpect)) { clean_return((tagnum < (tagexpect)) ? ASN1_MISPLACED_FIELD : ASN1_MISSING_FIELD); }
/*
* get_field
@@ -144,11 +144,11 @@
* verification of tag numbers.
*/
#define get_field(var, tagexpect, decoder) \
- error_if_bad_tag(tagexpect); \
- if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
- && (tagnum || taglen || asn1class != UNIVERSAL)) \
- clean_return(ASN1_BAD_ID); \
- get_field_body(var,decoder)
+ error_if_bad_tag(tagexpect); \
+ if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
+ && (tagnum || taglen || asn1class != UNIVERSAL)) \
+ clean_return(ASN1_BAD_ID); \
+ get_field_body(var,decoder)
/*
* opt_field
@@ -159,59 +159,59 @@
* values that happen to have the value of OPTVAL.
*/
#define opt_field(var, tagexpect, decoder, optvalue) \
- if (asn1buf_remains(&subbuf, seqindef)) { \
- if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
- && (tagnum || taglen || asn1class != UNIVERSAL)) \
- clean_return(ASN1_BAD_ID); \
- if (tagnum == (tagexpect)) { \
- get_field_body(var, decoder); \
- } else var = optvalue; \
- }
+ if (asn1buf_remains(&subbuf, seqindef)) { \
+ if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
+ && (tagnum || taglen || asn1class != UNIVERSAL)) \
+ clean_return(ASN1_BAD_ID); \
+ if (tagnum == (tagexpect)) { \
+ get_field_body(var, decoder); \
+ } else var = optvalue; \
+ }
/**** fields w/ length ****/
/* similar to get_field_body */
#define get_lenfield_body(len, var, decoder) \
- retval = decoder(&subbuf, &(len), &(var)); \
- if (retval) clean_return(retval); \
- if (!taglen && indef) { get_eoc(); } \
- next_tag()
+ retval = decoder(&subbuf, &(len), &(var)); \
+ if (retval) clean_return(retval); \
+ if (!taglen && indef) { get_eoc(); } \
+ next_tag()
/* similar to get_field_body */
#define get_lenfield(len, var, tagexpect, decoder) \
- error_if_bad_tag(tagexpect); \
- if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
- && (tagnum || taglen || asn1class != UNIVERSAL)) \
- clean_return(ASN1_BAD_ID); \
- get_lenfield_body(len, var, decoder)
+ error_if_bad_tag(tagexpect); \
+ if ((asn1class != CONTEXT_SPECIFIC || construction != CONSTRUCTED) \
+ && (tagnum || taglen || asn1class != UNIVERSAL)) \
+ clean_return(ASN1_BAD_ID); \
+ get_lenfield_body(len, var, decoder)
/* similar to opt_field */
#define opt_lenfield(len, var, tagexpect, decoder) \
- if (tagnum == (tagexpect)) { \
- get_lenfield_body(len, var, decoder); \
- } else { len = 0; var = 0; }
+ if (tagnum == (tagexpect)) { \
+ get_lenfield_body(len, var, decoder); \
+ } else { len = 0; var = 0; }
/*
* Deal with implicitly tagged fields
*/
-#define get_implicit_octet_string(len, var, tagexpect) \
- if (tagnum != (tagexpect)) clean_return(ASN1_MISSING_FIELD); \
- if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \
- clean_return(ASN1_BAD_ID); \
- retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \
- if (retval) clean_return(retval); \
- (len) = taglen; \
- next_tag()
+#define get_implicit_octet_string(len, var, tagexpect) \
+ if (tagnum != (tagexpect)) clean_return(ASN1_MISSING_FIELD); \
+ if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \
+ clean_return(ASN1_BAD_ID); \
+ retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \
+ if (retval) clean_return(retval); \
+ (len) = taglen; \
+ next_tag()
-#define opt_implicit_octet_string(len, var, tagexpect) \
- if (tagnum == (tagexpect)) { \
- if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \
- clean_return(ASN1_BAD_ID); \
- retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \
- if (retval) clean_return(retval); \
- (len) = taglen; \
- next_tag(); \
- } else { (len) = 0; (var) = NULL; }
+#define opt_implicit_octet_string(len, var, tagexpect) \
+ if (tagnum == (tagexpect)) { \
+ if (asn1class != CONTEXT_SPECIFIC || construction != PRIMITIVE) \
+ clean_return(ASN1_BAD_ID); \
+ retval = asn1buf_remove_octetstring(&subbuf, taglen, &(var)); \
+ if (retval) clean_return(retval); \
+ (len) = taglen; \
+ next_tag(); \
+ } else { (len) = 0; (var) = NULL; }
/*
* begin_structure
@@ -221,14 +221,14 @@
* end_structure().
*/
#define begin_structure() \
- asn1buf subbuf; \
- int seqindef; \
- int indef; \
- retval = asn1_get_sequence(buf, &length, &seqindef); \
- if (retval) clean_return(retval); \
- retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
- if (retval) clean_return(retval); \
- next_tag()
+ asn1buf subbuf; \
+ int seqindef; \
+ int indef; \
+ retval = asn1_get_sequence(buf, &length, &seqindef); \
+ if (retval) clean_return(retval); \
+ retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
+ if (retval) clean_return(retval); \
+ next_tag()
/*
* This is used for structures which have no tagging.
@@ -236,19 +236,19 @@
* is not called.
*/
#define begin_structure_no_tag() \
- asn1buf subbuf; \
- int seqindef; \
- int indef; \
- retval = asn1_get_sequence(buf, &length, &seqindef); \
- if (retval) clean_return(retval); \
- retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
- if (retval) clean_return(retval)
+ asn1buf subbuf; \
+ int seqindef; \
+ int indef; \
+ retval = asn1_get_sequence(buf, &length, &seqindef); \
+ if (retval) clean_return(retval); \
+ retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
+ if (retval) clean_return(retval)
/* skip trailing garbage */
#define end_structure() \
- retval = asn1buf_sync(buf, &subbuf, asn1class, tagnum, \
- length, indef, seqindef); \
- if (retval) clean_return(retval)
+ retval = asn1buf_sync(buf, &subbuf, asn1class, tagnum, \
+ length, indef, seqindef); \
+ if (retval) clean_return(retval)
/*
* begin_choice
@@ -258,28 +258,28 @@
* end_choice().
*/
#define begin_choice() \
- asn1buf subbuf; \
- int seqindef; \
- int indef; \
- taginfo t; \
- retval = asn1_get_tag_2(buf, &t); \
- if (retval) clean_return(retval); \
- tagnum = t.tagnum; \
- taglen = t.length; \
- indef = t.indef; \
- length = t.length; \
- seqindef = t.indef; \
- asn1class = t.asn1class; \
- construction = t.construction; \
- retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
- if (retval) clean_return(retval)
+ asn1buf subbuf; \
+ int seqindef; \
+ int indef; \
+ taginfo t; \
+ retval = asn1_get_tag_2(buf, &t); \
+ if (retval) clean_return(retval); \
+ tagnum = t.tagnum; \
+ taglen = t.length; \
+ indef = t.indef; \
+ length = t.length; \
+ seqindef = t.indef; \
+ asn1class = t.asn1class; \
+ construction = t.construction; \
+ retval = asn1buf_imbed(&subbuf, buf, length, seqindef); \
+ if (retval) clean_return(retval)
/* skip trailing garbage */
#define end_choice() \
- length -= t.length; \
- retval = asn1buf_sync(buf, &subbuf, t.asn1class, t.tagnum, \
- length, t.indef, seqindef); \
- if (retval) clean_return(retval)
+ length -= t.length; \
+ retval = asn1buf_sync(buf, &subbuf, t.asn1class, t.tagnum, \
+ length, t.indef, seqindef); \
+ if (retval) clean_return(retval)
/*
* sequence_of
@@ -289,12 +289,12 @@
* end_sequence_of().
*/
#define sequence_of(buf) \
- unsigned int length, taglen; \
- asn1_class asn1class; \
- asn1_construction construction; \
- asn1_tagnum tagnum; \
- int indef; \
- sequence_of_common(buf)
+ unsigned int length, taglen; \
+ asn1_class asn1class; \
+ asn1_construction construction; \
+ asn1_tagnum tagnum; \
+ int indef; \
+ sequence_of_common(buf)
/*
* sequence_of_no_tagvars
@@ -304,7 +304,7 @@
* than does sequence_of() to avoid shadowing.
*/
#define sequence_of_no_tagvars(buf) \
- sequence_of_common(buf)
+ sequence_of_common(buf)
/*
* sequence_of_common
@@ -314,12 +314,12 @@
* does not prefetch the next tag.
*/
#define sequence_of_common(buf) \
- asn1buf seqbuf; \
- int seqofindef; \
- retval = asn1_get_sequence(buf, &length, &seqofindef); \
- if (retval) clean_return(retval); \
- retval = asn1buf_imbed(&seqbuf, buf, length, seqofindef); \
- if (retval) clean_return(retval)
+ asn1buf seqbuf; \
+ int seqofindef; \
+ retval = asn1_get_sequence(buf, &length, &seqofindef); \
+ if (retval) clean_return(retval); \
+ retval = asn1buf_imbed(&seqbuf, buf, length, seqofindef); \
+ if (retval) clean_return(retval)
/*
* end_sequence_of
@@ -327,21 +327,21 @@
* Attempts to fetch an EOC tag, if any, and to sync over trailing
* garbage, if any.
*/
-#define end_sequence_of(buf) \
- { \
- taginfo t4; \
- retval = asn1_get_tag_2(&seqbuf, &t4); \
- if (retval) clean_return(retval); \
- /* Copy out to match previous functionality, until better integrated. */ \
- asn1class = t4.asn1class; \
- construction = t4.construction; \
- tagnum = t4.tagnum; \
- taglen = t4.length; \
- indef = t4.indef; \
- } \
- retval = asn1buf_sync(buf, &seqbuf, asn1class, tagnum, \
- length, indef, seqofindef); \
- if (retval) clean_return(retval);
+#define end_sequence_of(buf) \
+ { \
+ taginfo t4; \
+ retval = asn1_get_tag_2(&seqbuf, &t4); \
+ if (retval) clean_return(retval); \
+ /* Copy out to match previous functionality, until better integrated. */ \
+ asn1class = t4.asn1class; \
+ construction = t4.construction; \
+ tagnum = t4.tagnum; \
+ taglen = t4.length; \
+ indef = t4.indef; \
+ } \
+ retval = asn1buf_sync(buf, &seqbuf, asn1class, tagnum, \
+ length, indef, seqofindef); \
+ if (retval) clean_return(retval);
/*
* end_sequence_of_no_tagvars
@@ -363,7 +363,7 @@
t.length, t.indef, seqofindef);
return retval;
}
-#define end_sequence_of_no_tagvars(buf) \
+#define end_sequence_of_no_tagvars(buf) \
retval = end_sequence_of_no_tagvars_helper(buf, &seqbuf, seqofindef); \
if (retval) clean_return(retval)
@@ -374,20 +374,20 @@
* error) or a valid constructed structure, making cleanup easier on
* callers.
*/
-#define decode_ptr(type, structure_decoder) \
- type val; \
- asn1_error_code retval; \
-\
- *valptr = NULL; \
- val = calloc(1, sizeof(*val)); \
- if (!val) \
- return ENOMEM; \
- retval = structure_decoder(buf, val); \
- if (retval) { \
- free(val); \
- return retval; \
- } \
- *valptr = val; \
+#define decode_ptr(type, structure_decoder) \
+ type val; \
+ asn1_error_code retval; \
+ \
+ *valptr = NULL; \
+ val = calloc(1, sizeof(*val)); \
+ if (!val) \
+ return ENOMEM; \
+ retval = structure_decoder(buf, val); \
+ if (retval) { \
+ free(val); \
+ return retval; \
+ } \
+ *valptr = val; \
return 0;
/* scalars */
@@ -405,26 +405,26 @@
return 0;
}
-#define integer_convert(fname,ktype)\
-asn1_error_code fname(asn1buf * buf, ktype * val)\
-{\
- asn1_error_code retval;\
- long n;\
- retval = asn1_decode_integer(buf,&n);\
- if (retval) return retval;\
- *val = (ktype)n;\
- return 0;\
-}
-#define unsigned_integer_convert(fname,ktype)\
-asn1_error_code fname(asn1buf * buf, ktype * val)\
-{\
- asn1_error_code retval;\
- unsigned long n;\
- retval = asn1_decode_unsigned_integer(buf,&n);\
- if (retval) return retval;\
- *val = (ktype)n;\
- return 0;\
-}
+#define integer_convert(fname,ktype) \
+ asn1_error_code fname(asn1buf * buf, ktype * val) \
+ { \
+ asn1_error_code retval; \
+ long n; \
+ retval = asn1_decode_integer(buf,&n); \
+ if (retval) return retval; \
+ *val = (ktype)n; \
+ return 0; \
+ }
+#define unsigned_integer_convert(fname,ktype) \
+ asn1_error_code fname(asn1buf * buf, ktype * val) \
+ { \
+ asn1_error_code retval; \
+ unsigned long n; \
+ retval = asn1_decode_unsigned_integer(buf,&n); \
+ if (retval) return retval; \
+ *val = (ktype)n; \
+ return 0; \
+ }
integer_convert(asn1_decode_int,int)
integer_convert(asn1_decode_int32,krb5_int32)
integer_convert(asn1_decode_kvno,krb5_kvno)
@@ -915,9 +915,9 @@
/* arrays */
-#define get_element(element,decoder)\
-retval = decoder(&seqbuf,&element);\
-if (retval) clean_return(retval)
+#define get_element(element,decoder) \
+ retval = decoder(&seqbuf,&element); \
+ if (retval) clean_return(retval)
static void *
array_expand (void *array, int n_elts, size_t elt_size)
@@ -936,44 +936,44 @@
return realloc(array, new_size);
}
-#define array_append(array,size,element,type)\
- {\
- void *new_array = array_expand(*(array), (size)+2, sizeof(type*));\
- if (new_array == NULL) clean_return(ENOMEM);\
- *(array) = new_array;\
- (*(array))[(size)++] = elt;\
- }
+#define array_append(array,size,element,type) \
+ { \
+ void *new_array = array_expand(*(array), (size)+2, sizeof(type*)); \
+ if (new_array == NULL) clean_return(ENOMEM); \
+ *(array) = new_array; \
+ (*(array))[(size)++] = elt; \
+ }
/*
* Function body for array decoders. freefn is expected to look like
* a krb5_free_ function, so we pass a null first argument.
*/
-#define decode_array_body(type,decoder,freefn)\
- asn1_error_code retval;\
- type *elt = NULL, **array;\
- int size = 0, i; \
-\
- array = *val = NULL;\
- { sequence_of(buf);\
- while (asn1buf_remains(&seqbuf,seqofindef) > 0) {\
- get_element(elt,decoder);\
- array_append(&array,size,elt,type);\
- elt = NULL;\
- }\
- if (array == NULL)\
- array = malloc(sizeof(type*));\
- array[size] = NULL;\
- end_sequence_of(buf);\
- }\
- *val = array;\
- return 0;\
-error_out:\
- if (elt)\
- freefn(NULL,elt);\
- for (i = 0; i < size; i++)\
- freefn(NULL,array[i]);\
- free(array);\
- return retval
+#define decode_array_body(type,decoder,freefn) \
+ asn1_error_code retval; \
+ type *elt = NULL, **array; \
+ int size = 0, i; \
+ \
+ array = *val = NULL; \
+ { sequence_of(buf); \
+ while (asn1buf_remains(&seqbuf,seqofindef) > 0) { \
+ get_element(elt,decoder); \
+ array_append(&array,size,elt,type); \
+ elt = NULL; \
+ } \
+ if (array == NULL) \
+ array = malloc(sizeof(type*)); \
+ array[size] = NULL; \
+ end_sequence_of(buf); \
+ } \
+ *val = array; \
+ return 0; \
+error_out: \
+if (elt) \
+ freefn(NULL,elt); \
+for (i = 0; i < size; i++) \
+ freefn(NULL,array[i]); \
+free(array); \
+return retval
static void
free_authdata_elt(void *dummy, krb5_authdata *val)
@@ -1394,10 +1394,10 @@
}
#define opt_string(val,n,fn) opt_lenfield((val).length,(val).data,n,fn)
-#define opt_cksum(var,tagexpect,decoder)\
-if (tagnum == (tagexpect)) {\
- get_field_body(var,decoder); }\
-else var.length = 0
+#define opt_cksum(var,tagexpect,decoder) \
+ if (tagnum == (tagexpect)) { \
+ get_field_body(var,decoder); } \
+ else var.length = 0
asn1_error_code
asn1_decode_sam_challenge(asn1buf *buf, krb5_sam_challenge *val)
@@ -1548,15 +1548,15 @@
return retval;
}
-#define opt_encfield(fld,tag,fn) \
- if (tagnum == tag) { \
- get_field(fld,tag,fn); } \
- else {\
- fld.magic = 0;\
- fld.enctype = 0;\
- fld.kvno = 0;\
- fld.ciphertext.data = NULL;\
- fld.ciphertext.length = 0;\
+#define opt_encfield(fld,tag,fn) \
+ if (tagnum == tag) { \
+ get_field(fld,tag,fn); } \
+ else { \
+ fld.magic = 0; \
+ fld.enctype = 0; \
+ fld.kvno = 0; \
+ fld.ciphertext.data = NULL; \
+ fld.ciphertext.length = 0; \
}
asn1_error_code
@@ -1743,13 +1743,13 @@
setup();
val->armor_value.data = NULL;
{begin_structure();
- get_field(val->armor_type, 0, asn1_decode_int32);
- get_lenfield(val->armor_value.length, val->armor_value.data,
- 1, asn1_decode_charstring);
- end_structure();
+ get_field(val->armor_type, 0, asn1_decode_int32);
+ get_lenfield(val->armor_value.length, val->armor_value.data,
+ 1, asn1_decode_charstring);
+ end_structure();
}
return 0;
- error_out:
+error_out:
krb5_free_data_contents( NULL, &val->armor_value);
return retval;
}
@@ -1767,16 +1767,16 @@
val->client = NULL;
val->ticket_checksum.contents = NULL;
{begin_structure();
- get_field(val->timestamp, 0, asn1_decode_kerberos_time);
- get_field(val->usec, 1, asn1_decode_int32);
- alloc_field(val->client);
- get_field(val->client, 2, asn1_decode_realm);
- get_field(val->client, 3, asn1_decode_principal_name);
- get_field(val->ticket_checksum, 4, asn1_decode_checksum);
- end_structure();
+ get_field(val->timestamp, 0, asn1_decode_kerberos_time);
+ get_field(val->usec, 1, asn1_decode_int32);
+ alloc_field(val->client);
+ get_field(val->client, 2, asn1_decode_realm);
+ get_field(val->client, 3, asn1_decode_principal_name);
+ get_field(val->ticket_checksum, 4, asn1_decode_checksum);
+ end_structure();
}
return 0;
- error_out:
+error_out:
krb5_free_principal(NULL, val->client);
krb5_free_checksum_contents( NULL, &val->ticket_checksum);
return retval;
@@ -1795,15 +1795,15 @@
val->i_principal = NULL;
val->elements = NULL;
{begin_structure();
- get_field(val->ad_checksum, 0, asn1_decode_checksum);
- if (tagnum == 1) {
- alloc_principal(val->i_principal);
- opt_field(val->i_principal, 1, asn1_decode_realm, 0);
- opt_field(val->i_principal, 2, asn1_decode_principal_name, 0);
+ get_field(val->ad_checksum, 0, asn1_decode_checksum);
+ if (tagnum == 1) {
+ alloc_principal(val->i_principal);
+ opt_field(val->i_principal, 1, asn1_decode_realm, 0);
+ opt_field(val->i_principal, 2, asn1_decode_principal_name, 0);
+ }
+ get_field(val->elements, 3, asn1_decode_authorization_data);
+ end_structure();
}
- get_field(val->elements, 3, asn1_decode_authorization_data);
- end_structure();
- }
return 0;
error_out:
krb5_free_checksum_contents(NULL, &val->ad_checksum);
Modified: trunk/src/lib/krb5/asn.1/asn1_k_decode.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_k_decode.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_k_decode.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_k_decode.h
*
Modified: trunk/src/lib/krb5/asn.1/asn1_k_encode.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_k_encode.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_k_encode.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_k_encode.h
*
Modified: trunk/src/lib/krb5/asn.1/asn1_make.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_make.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_make.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_make.c
*
Modified: trunk/src/lib/krb5/asn.1/asn1_misc.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_misc.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_misc.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_misc.c
*
Modified: trunk/src/lib/krb5/asn.1/asn1_misc.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1_misc.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1_misc.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/asn1_misc.h
*
Modified: trunk/src/lib/krb5/asn.1/asn1buf.c
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1buf.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1buf.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* Coding Buffer Implementation */
/*
@@ -75,8 +75,8 @@
static asn1_error_code asn1buf_expand(asn1buf *, unsigned int);
#endif
-#define asn1_is_eoc(class, num, indef) \
-((class) == UNIVERSAL && !(num) && !(indef))
+#define asn1_is_eoc(class, num, indef) \
+ ((class) == UNIVERSAL && !(num) && !(indef))
asn1_error_code asn1buf_create(asn1buf **buf)
{
Modified: trunk/src/lib/krb5/asn.1/asn1glue.h
===================================================================
--- trunk/src/lib/krb5/asn.1/asn1glue.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/asn1glue.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* lib/krb5/asn.1/asn1glue.h
*
Modified: trunk/src/lib/krb5/asn.1/krb5_encode.c
===================================================================
--- trunk/src/lib/krb5/asn.1/krb5_encode.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/krb5_encode.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* src/lib/krb5/asn.1/krb5_encode.c
*
@@ -41,28 +41,28 @@
* length: length of the most-recently produced encoding
* sum: cumulative length of the entire encoding
*/
-#define krb5_setup()\
- asn1_error_code retval;\
- unsigned int length, sum = 0;\
- asn1buf *buf=NULL;\
- krb5_data *tmpcode;\
-\
- *code = NULL;\
-\
- if (rep == NULL) return ASN1_MISSING_FIELD;\
-\
- retval = asn1buf_create(&buf);\
- if (retval) return retval
+#define krb5_setup() \
+ asn1_error_code retval; \
+ unsigned int length, sum = 0; \
+ asn1buf *buf=NULL; \
+ krb5_data *tmpcode; \
+ \
+ *code = NULL; \
+ \
+ if (rep == NULL) return ASN1_MISSING_FIELD; \
+ \
+ retval = asn1buf_create(&buf); \
+ if (retval) return retval
/* produce the final output and clean up the workspace */
-#define krb5_cleanup()\
- retval = asn12krb5_buf(buf,&tmpcode);\
-error:\
- asn1buf_destroy(&buf);\
- if (retval)\
- return retval;\
- *code = tmpcode;\
- return 0
+#define krb5_cleanup() \
+ retval = asn12krb5_buf(buf,&tmpcode); \
+error: \
+asn1buf_destroy(&buf); \
+if (retval) \
+ return retval; \
+*code = tmpcode; \
+return 0
#ifndef DISABLE_PKINIT
krb5_error_code
Modified: trunk/src/lib/krb5/asn.1/krbasn1.h
===================================================================
--- trunk/src/lib/krb5/asn.1/krbasn1.h 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/krbasn1.h 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef __KRBASN1_H__
#define __KRBASN1_H__
@@ -33,7 +33,7 @@
typedef enum { PRIMITIVE = 0x00, CONSTRUCTED = 0x20 } asn1_construction;
typedef enum { UNIVERSAL = 0x00, APPLICATION = 0x40,
- CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class;
+ CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xC0 } asn1_class;
typedef INT64_TYPE asn1_intmax;
typedef UINT64_TYPE asn1_uintmax;
Modified: trunk/src/lib/krb5/asn.1/ldap_key_seq.c
===================================================================
--- trunk/src/lib/krb5/asn.1/ldap_key_seq.c 2009-11-05 04:39:48 UTC (rev 23132)
+++ trunk/src/lib/krb5/asn.1/ldap_key_seq.c 2009-11-05 04:39:54 UTC (rev 23133)
@@ -1,4 +1,4 @@
-/* -*- mode: c; indent-tabs-mode: nil -*- */
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ... copyright ... */
/*
@@ -113,21 +113,21 @@
/* Decode the Principal's keys */
/************************************************************************/
-#define cleanup(err) \
- { \
- ret = err; \
- goto last; \
- }
+#define cleanup(err) \
+ { \
+ ret = err; \
+ goto last; \
+ }
-#define checkerr \
- if (ret != 0) \
- goto last
+#define checkerr \
+ if (ret != 0) \
+ goto last
-#define safe_syncbuf(outer,inner,buflen) \
- if (! ((inner)->next == (inner)->bound + 1 && \
- (inner)->next == (outer)->next + buflen)) \
- cleanup (ASN1_BAD_LENGTH); \
- asn1buf_sync((outer), (inner), 0, 0, 0, 0, 0);
+#define safe_syncbuf(outer,inner,buflen) \
+ if (! ((inner)->next == (inner)->bound + 1 && \
+ (inner)->next == (outer)->next + buflen)) \
+ cleanup (ASN1_BAD_LENGTH); \
+ asn1buf_sync((outer), (inner), 0, 0, 0, 0, 0);
static asn1_error_code
decode_tagged_integer (asn1buf *buf, asn1_tagnum expectedtag, long *val)
More information about the cvs-krb5
mailing list