From 5829b696f3d831766c92c58b957feb6315ed7ddb Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 13 Jun 2019 18:08:11 +0200 Subject: tag class CONTEXT_SPECIFIC <-> PRIVATE was swapped --- asn1.h | 6 +++--- fmt_asn1generic.c | 2 +- fmt_ldapbindrequest.c | 4 ++-- fmt_ldapsearchfilter.c | 6 +++--- scan_asn1generic.c | 4 ++-- scan_ldapbindrequest.c | 2 +- scan_ldapsearchfilter.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/asn1.h b/asn1.h index 56a2368..6ff21c8 100644 --- a/asn1.h +++ b/asn1.h @@ -9,8 +9,8 @@ enum asn1_tagclass { UNIVERSAL=(0<<6), APPLICATION=(1<<6), - PRIVATE=(2<<6), - CONTEXT_SPECIFIC=(3<<6) + CONTEXT_SPECIFIC=(2<<6), + PRIVATE=(3<<6) }; enum asn1_tagtype { @@ -228,7 +228,7 @@ size_t fmt_asn1generic(char* dest,const char* fmt,...); * 'p' (scan only) like 's' but check that contents of string is printable * 'a' (scan only) like 's' but check that contents of string is ascii * '!' (scan only) next argument is struct string*, fill in region until end of current sequence / set (for optional data) - * 'c' context specific value (tag class PRIVATE, type CONSTRUCTED, tag taken from unsigned long arg / written to unsigned long* argument) + * 'c' context specific value (tag class CONTEXT_SPECIFIC, type CONSTRUCTED, tag taken from unsigned long arg / written to unsigned long* argument) */ #endif diff --git a/fmt_asn1generic.c b/fmt_asn1generic.c index f864012..199ba92 100644 --- a/fmt_asn1generic.c +++ b/fmt_asn1generic.c @@ -123,7 +123,7 @@ stringcopy_alt: if (application) curlen=fmt_asn1tag(realdest,APPLICATION,CONSTRUCTED,*application); else if (*fmt=='c') - curlen=fmt_asn1tag(realdest,PRIVATE,CONSTRUCTED,desttag); + curlen=fmt_asn1tag(realdest,CONTEXT_SPECIFIC,CONSTRUCTED,desttag); else curlen=fmt_asn1tag(realdest,UNIVERSAL,CONSTRUCTED,*fmt=='{'?SEQUENCE_OF:SET_OF); containerstack[curinstack++]=cursor+curlen; diff --git a/fmt_ldapbindrequest.c b/fmt_ldapbindrequest.c index a5d2e18..0d0c361 100644 --- a/fmt_ldapbindrequest.c +++ b/fmt_ldapbindrequest.c @@ -13,7 +13,7 @@ size_t fmt_ldapbindrequest(char* dest,long version,const char* name,const char* if (dest) dest+=l; // sum+=l; if (dest) dest+=l; nlen=str_len(simple); - l=fmt_asn1string(dest,PRIVATE,PRIMITIVE,0,simple,nlen); + l=fmt_asn1string(dest,CONTEXT_SPECIFIC,PRIMITIVE,0,simple,nlen); if (add_of(sum,sum,l)) return (size_t)-1; return sum; } @@ -26,7 +26,7 @@ size_t fmt_ldapbindrequeststring(char* dest,long version,const struct string* na if (add_of(sum,sum,l)) return (size_t)-1; if (dest) dest+=l; // sum+=l; if (dest) dest+=l; - l=fmt_asn1string(dest,PRIVATE,PRIMITIVE,0,simple->s,simple->l); + l=fmt_asn1string(dest,CONTEXT_SPECIFIC,PRIMITIVE,0,simple->s,simple->l); if (add_of(sum,sum,l)) return (size_t)-1; return sum; } diff --git a/fmt_ldapsearchfilter.c b/fmt_ldapsearchfilter.c index 380bb15..2f33a53 100644 --- a/fmt_ldapsearchfilter.c +++ b/fmt_ldapsearchfilter.c @@ -19,7 +19,7 @@ size_t fmt_ldapsubstring(char* dest,const struct Substring* s) { size_t sum=0,tmp=0; while (s) { - tmp=fmt_asn1string(dest,PRIVATE,PRIMITIVE,s->substrtype,s->s.s,s->s.l); + tmp=fmt_asn1string(dest,CONTEXT_SPECIFIC,PRIMITIVE,s->substrtype,s->s.s,s->s.l); if (dest) dest+=tmp; sum+=tmp; s=s->next; @@ -51,7 +51,7 @@ size_t fmt_ldapsearchfilter(char* dest,const struct Filter* f) { } break; case PRESENT: - sum=fmt_asn1string(dest,PRIVATE,PRIMITIVE,(enum asn1_tag)f->type,f->ava.desc.s,f->ava.desc.l); + sum=fmt_asn1string(dest,CONTEXT_SPECIFIC,PRIMITIVE,(enum asn1_tag)f->type,f->ava.desc.s,f->ava.desc.l); break; default: return 0; } @@ -66,7 +66,7 @@ size_t fmt_ldapsearchfilter(char* dest,const struct Filter* f) { tmp=fmt_asn1length(0,savesum); if (!dest) return sum+tmp+1; if (dest) byte_copyr(dest+tmp+1,sum,dest); - fmt_asn1tag(dest,PRIVATE,CONSTRUCTED,f->type); + fmt_asn1tag(dest,CONTEXT_SPECIFIC,CONSTRUCTED,f->type); fmt_asn1length(dest+1,savesum); return sum+tmp+1; } diff --git a/scan_asn1generic.c b/scan_asn1generic.c index cc9974d..09c84a4 100644 --- a/scan_asn1generic.c +++ b/scan_asn1generic.c @@ -220,7 +220,7 @@ stringmain: application=va_arg(args,unsigned long*); break; } - case 'c': // c = context specific; PRIVATE CONSTRUCTED 0, close with '}' + case 'c': // c = context specific; CONTEXT_SPECIFIC CONSTRUCTED 0, close with '}' desttag=va_arg(args,unsigned long*); // fall through case '[': // [ = SET @@ -233,7 +233,7 @@ stringmain: *application=tag; } else { if (*fmt=='c') { - if (tc!=PRIVATE || tt!=CONSTRUCTED) + if (tc!=CONTEXT_SPECIFIC || tt!=CONSTRUCTED) goto error; *desttag=tag; } else { diff --git a/scan_ldapbindrequest.c b/scan_ldapbindrequest.c index 0ce7e12..a5e8342 100644 --- a/scan_ldapbindrequest.c +++ b/scan_ldapbindrequest.c @@ -11,7 +11,7 @@ size_t scan_ldapbindrequest(const char* src,const char* max, enum asn1_tagclass tc; enum asn1_tagtype tt; if (!(tmp=scan_asn1tag(src+res,max,&tc,&tt,method))) return 0; - if (tc!=PRIVATE || tt!=PRIMITIVE) return 0; + if (tc!=CONTEXT_SPECIFIC || tt!=PRIMITIVE) return 0; } return res; } diff --git a/scan_ldapsearchfilter.c b/scan_ldapsearchfilter.c index 0f3eb02..a07888b 100644 --- a/scan_ldapsearchfilter.c +++ b/scan_ldapsearchfilter.c @@ -37,7 +37,7 @@ size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) const char* nmax; *f=0; if (!(res=scan_asn1tag(src,max,&tc,&tt,&tag))) goto error; - if (tc!=PRIVATE || (tt!=CONSTRUCTED && tag!=7) || tag>9) goto error; + if (tc!=CONTEXT_SPECIFIC || (tt!=CONSTRUCTED && tag!=7) || tag>9) goto error; if (!(tmp=scan_asn1length(src+res,max,&len))) goto error; res+=tmp; nmax=src+res+len; -- cgit v1.2.3-55-g7522