diff --git a/Makefile b/Makefile index a2a89ec..bf9a8fb 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #DEBUG=1 #COVERAGE=1 -all: t1 t2 parse dumpidx idx2ldif addindex bindrequest tinyldap \ +all: libowfat-warning t1 t2 parse dumpidx idx2ldif addindex bindrequest tinyldap \ tinyldap_standalone tinyldap_debug ldapclient ldapclient_str \ md5password mysql2ldif acl dumpacls ldapdelete asn1dump tls.a x # t6 # t @@ -76,6 +76,14 @@ endif %: %.c $(DIET) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -lowfat ${LIBS} +.PHONY: libowfat-warning +libowfat-warning: + @echo "#include " > a.c + @($(DIET) $(CC) $(CFLAGS) -c a.c >/dev/null 2>&1 && echo "WARNING: libowfat has moved the header files from foo.h to libowfat/foo.h\nWARNING: you still have foo.h! Please update your libowfat!") || exit 0 + @echo "#include " > a.c + @$(DIET) $(CC) $(CFLAGS) -c a.c >/dev/null 2>&1 || echo "WARNING: this package needs libowfat; get it from https://www.fefe.de/libowfat/" + @rm -f a.c a.o + t1 parse: ldif.a storage.a t2: ldap.a asn1.a t3 t4 t5 addindex: storage.a diff --git a/THANKS b/THANKS index 6966cae..82d8296 100644 --- a/THANKS +++ b/THANKS @@ -18,3 +18,5 @@ At least one of them looks like it might be exploitable if you are not using dietlibc. Georg Lehner found problems in the indexing code. + +Simon Rettberg found a double free in an error path. diff --git a/acl.c b/acl.c index 1e46483..b47b608 100644 --- a/acl.c +++ b/acl.c @@ -2,20 +2,20 @@ #define MAIN #include "ldap.h" -#include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include const char Any[]="*"; const char Self[]="self"; @@ -306,6 +306,11 @@ int marshal(const char* map,size_t filelen,const char* filename) { buffer_putulong(buffer_1,filters); buffer_putsflush(buffer_1," filters.\n"); + if (acls==0) { + buffer_putsflush(buffer_1,"No ACLs defined. We are done here.\n"); + exit(0); + } + F=malloc(sizeof(*F)*(filters+1)); filter_offset=filelen+(filters+4)*sizeof(*F); /* 2 uints for index header, 1 uint filters_count, then filter_count+1 uint32 in F */ @@ -332,6 +337,11 @@ nomem: } attribute_count=uint32_read(map+4); attrtab=5*4+uint32_read(map+16); + + if (attribute_count == 0) { + buffer_putsflush(buffer_2,"malformed data file (attribute_count zero!?)\n"); + exit(1); + } /* here we need to have each attribute mentioned in any ACL * point to the proper offset in the data file. But what if an ACL * mentions an attribute that never occurs in any of the records? In @@ -345,7 +355,7 @@ nomem: for (a=root; a; a=a->next) { unsigned int l=0; // printf("a->anum = %lu\nsizeof(*a->attrs) = %lu\n",a->anum,sizeof(*a->attrs)); - if (!(a->attrs=malloc(a->anum*sizeof(*a->attrs)))) + if (!(a->attrs=calloc(a->anum,sizeof(*a->attrs)))) goto nomem; a->attrs[l]=a->attrib; ++l; if (a->attrib!=Any) { @@ -354,6 +364,7 @@ nomem: a->attrib[k]=0; a->attrs[l]=a->attrib+k+1; } + assert(l==a->anum); // this is for the benefit of clang's static analyzer for (k=0; kanum; ++k) { int found=0; for (j=0; j #include #include -#include "buffer.h" -#include "mmap.h" -#include "uint32.h" +#include +#include +#include #include "mstorage.h" -#include +#include #include #include diff --git a/asn1dump.c b/asn1dump.c index 3db1b45..24f8937 100644 --- a/asn1dump.c +++ b/asn1dump.c @@ -1,8 +1,8 @@ #include -#include +#include #include #include "asn1.h" -#include "mmap.h" +#include #include #include "printasn1.c" diff --git a/auth.c b/auth.c index 97ea172..f5b7aa0 100644 --- a/auth.c +++ b/auth.c @@ -14,9 +14,9 @@ #include #include "ldap.h" #include "auth.h" -#include "str.h" -#include "textcode.h" -#include "byte.h" +#include +#include +#include int check_password(const char* fromdb,struct string* plaintext) { if (str_start(fromdb,"{MD5}")) { diff --git a/bstr_diff.c b/bstr_diff.c index e3d7c97..d7737e4 100644 --- a/bstr_diff.c +++ b/bstr_diff.c @@ -1,6 +1,6 @@ #include -#include "str.h" -#include "uint32.h" +#include +#include int bstr_diff(const char* a,const char* b) { const char* A,* B; diff --git a/bstr_diff2.c b/bstr_diff2.c index 525f8bf..aae94e8 100644 --- a/bstr_diff2.c +++ b/bstr_diff2.c @@ -1,6 +1,6 @@ #include -#include "str.h" -#include "uint32.h" +#include +#include #include "bstr.h" int bstr_diff2(const char* a,const char* b,size_t blen) { diff --git a/bstrfirst.c b/bstrfirst.c index 4d8ab02..db1c425 100644 --- a/bstrfirst.c +++ b/bstrfirst.c @@ -1,5 +1,5 @@ #include "bstr.h" -#include "uint32.h" +#include const char* bstrfirst(const char* a) { if (*a) return a; else return a+5; diff --git a/bstrlen.c b/bstrlen.c index 61825d5..de98002 100644 --- a/bstrlen.c +++ b/bstrlen.c @@ -1,7 +1,7 @@ #include #include "bstr.h" -#include "uint32.h" -#include "str.h" +#include +#include size_t bstrlen(const char* a) { if (*a) return str_len(a); else return uint32_read(a+1); diff --git a/bstrstart.c b/bstrstart.c index 5094d34..a7e3f02 100644 --- a/bstrstart.c +++ b/bstrstart.c @@ -1,5 +1,5 @@ #include "bstr.h" -#include "uint32.h" +#include size_t bstrstart(const char* a) { if (*a) return 0; else return 5; diff --git a/dumpacls.c b/dumpacls.c index efeaeaa..a97a331 100644 --- a/dumpacls.c +++ b/dumpacls.c @@ -1,11 +1,11 @@ #include #include -#include "buffer.h" -#include "mmap.h" -#include "uint16.h" -#include "uint32.h" +#include +#include +#include +#include #include "ldap.h" -#include "byte.h" +#include int main(int argc,char* argv[]) { unsigned long filelen; diff --git a/dumpidx.c b/dumpidx.c index d9e1467..55a325f 100644 --- a/dumpidx.c +++ b/dumpidx.c @@ -1,7 +1,7 @@ #include -#include "buffer.h" -#include "mmap.h" -#include "uint32.h" +#include +#include +#include int main(int argc,char* argv[]) { int verbose=0; diff --git a/fmt_asn1bitstring.c b/fmt_asn1bitstring.c index 18df19d..104b858 100644 --- a/fmt_asn1bitstring.c +++ b/fmt_asn1bitstring.c @@ -1,5 +1,5 @@ #include "asn1.h" -#include "byte.h" +#include /* like fmt_asn1string, but l is in BITS, not BYTES */ size_t fmt_asn1bitstring(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const char* c,size_t l) { diff --git a/fmt_asn1string.c b/fmt_asn1string.c index e0ef6ac..bdb1f1d 100644 --- a/fmt_asn1string.c +++ b/fmt_asn1string.c @@ -1,5 +1,5 @@ #include "asn1.h" -#include "byte.h" +#include size_t fmt_asn1string(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const char* c,size_t l) { size_t len; diff --git a/fmt_asn1transparent.c b/fmt_asn1transparent.c index d1f9895..ece41de 100644 --- a/fmt_asn1transparent.c +++ b/fmt_asn1transparent.c @@ -1,5 +1,5 @@ #include "asn1.h" -#include "byte.h" +#include size_t fmt_asn1transparent(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,size_t l) { size_t len,tmp; diff --git a/fmt_ldapbindrequest.c b/fmt_ldapbindrequest.c index 9f8be99..cd7ffc0 100644 --- a/fmt_ldapbindrequest.c +++ b/fmt_ldapbindrequest.c @@ -1,7 +1,7 @@ #include #include "ldap.h" -#include "str.h" -#include "rangecheck.h" +#include +#include size_t fmt_ldapbindrequest(char* dest,long version,const char* name,const char* simple) { size_t l,sum; @@ -15,6 +15,5 @@ size_t fmt_ldapbindrequest(char* dest,long version,const char* name,const char* nlen=str_len(simple); l=fmt_asn1string(dest,PRIVATE,PRIMITIVE,0,simple,nlen); if (add_of(sum,sum,l)) return (size_t)-1; - if (dest) dest+=l; return sum; } diff --git a/fmt_ldapdeleterequest.c b/fmt_ldapdeleterequest.c index 7690996..980955d 100644 --- a/fmt_ldapdeleterequest.c +++ b/fmt_ldapdeleterequest.c @@ -1,6 +1,6 @@ #include #include "ldap.h" -#include "byte.h" +#include size_t fmt_ldapdeleterequest(char* dest,const struct string* s) { if (dest) byte_copy(dest,s->l,s->s); diff --git a/fmt_ldapresult.c b/fmt_ldapresult.c index a2fa6e0..dfecef3 100644 --- a/fmt_ldapresult.c +++ b/fmt_ldapresult.c @@ -1,5 +1,5 @@ #include "ldap.h" -#include "str.h" +#include size_t fmt_ldapresult(char* dest,long result,const char* matcheddn,const char* errormessage,const char* referral) { size_t l,sum=0,nlen; @@ -14,7 +14,7 @@ size_t fmt_ldapresult(char* dest,long result,const char* matcheddn,const char* e if (referral && *referral) { nlen=str_len(referral); l=fmt_asn1OCTETSTRING(dest,referral,nlen); - sum+=l; if (dest) dest+=l; + sum+=l; } return sum; } diff --git a/fmt_ldapsearchfilter.c b/fmt_ldapsearchfilter.c index ceb3746..bb96400 100644 --- a/fmt_ldapsearchfilter.c +++ b/fmt_ldapsearchfilter.c @@ -1,4 +1,4 @@ -#include +#include #include "ldap.h" #include diff --git a/fmt_ldapsearchfilterstring.c b/fmt_ldapsearchfilterstring.c index 6151609..48b6d6a 100644 --- a/fmt_ldapsearchfilterstring.c +++ b/fmt_ldapsearchfilterstring.c @@ -1,6 +1,6 @@ -#include "fmt.h" -#include "byte.h" -#include "str.h" +#include +#include +#include #include "ldap.h" size_t fmt_ldapsearchfilterstring(char* dest,const struct Filter* f) { diff --git a/fmt_tls_clienthello.c b/fmt_tls_clienthello.c index 809e4f0..d28aba6 100644 --- a/fmt_tls_clienthello.c +++ b/fmt_tls_clienthello.c @@ -1,7 +1,8 @@ #include "tinytls.h" -#include "uint16.h" -#include "uint32.h" +#include +#include #include +#include size_t fmt_tls_clienthello(char* dest, struct ssl_context* sc) { size_t hnextlen=sc->servername?strlen(sc->servername)+9:0; diff --git a/fmt_tls_packet.c b/fmt_tls_packet.c index c067fd7..9b383ae 100644 --- a/fmt_tls_packet.c +++ b/fmt_tls_packet.c @@ -1,5 +1,5 @@ #include "tinytls.h" -#include "uint16.h" +#include size_t fmt_tls_packet(char* dest,enum contenttype ct, size_t len) { if (len>0xffff) return 0; diff --git a/fmt_tls_serverhello.c b/fmt_tls_serverhello.c index fe1a79f..8437898 100644 --- a/fmt_tls_serverhello.c +++ b/fmt_tls_serverhello.c @@ -1,5 +1,5 @@ -#include "uint16.h" -#include "uint32.h" +#include +#include #include "tinytls.h" #include #include @@ -115,7 +115,7 @@ invalid: sc->compressionmethod=0; if (hostlen!=-1) { char* sn; - if (!(sn=malloc(hostlen+1))) { + if ((sn=malloc(hostlen+1))) { memcpy(sn,host,hostlen); sn[hostlen]=0; sc->servername=sn; diff --git a/idx2ldif.c b/idx2ldif.c index 73783ae..c3c0f84 100644 --- a/idx2ldif.c +++ b/idx2ldif.c @@ -1,11 +1,11 @@ #include #include #include -#include "buffer.h" -#include "mmap.h" -#include "uint32.h" +#include +#include +#include #include "bstr.h" -#include "textcode.h" +#include #include static void dumpbstr(const char* c) { diff --git a/init_tls_context.c b/init_tls_context.c index 1c5f9a2..460ddc9 100644 --- a/init_tls_context.c +++ b/init_tls_context.c @@ -1,6 +1,7 @@ #include "tinytls.h" -#include "open.h" +#include #include +#include void init_tls_context_norandom(struct ssl_context* sc, const char* servername) { memset(sc,0,sizeof *sc); diff --git a/ldap_match_mapped.c b/ldap_match_mapped.c index b3cf234..5cd1f76 100644 --- a/ldap_match_mapped.c +++ b/ldap_match_mapped.c @@ -1,8 +1,8 @@ #include "ldif.h" -#include "byte.h" -#include "str.h" -#include "uint32.h" -#include "case.h" +#include +#include +#include +#include #include #include #include diff --git a/ldap_match_sre.c b/ldap_match_sre.c index b0e69c1..4a8f189 100644 --- a/ldap_match_sre.c +++ b/ldap_match_sre.c @@ -1,7 +1,7 @@ #include #include "ldap.h" -#include "byte.h" -#include "case.h" +#include +#include #include static int matchcasestr(struct string* a,struct string* b) { diff --git a/ldapclient.c b/ldapclient.c index 1fecc9f..8695504 100644 --- a/ldapclient.c +++ b/ldapclient.c @@ -2,13 +2,13 @@ #include #include #include -#include "byte.h" -#include "buffer.h" +#include +#include #include "ldap.h" -#include "socket.h" -#include "ip4.h" -#include "str.h" -#include "textcode.h" +#include +#include +#include +#include #include #include @@ -254,7 +254,7 @@ nextmessage: /* copy partial message */ copypartialandcontinue: byte_copy(buf,len-cur,buf+cur); - len-=cur; cur=0; + len-=cur; } } diff --git a/ldapclient_str.c b/ldapclient_str.c index 2b0bda3..fbcb8eb 100644 --- a/ldapclient_str.c +++ b/ldapclient_str.c @@ -1,13 +1,13 @@ #include #include #include -#include "byte.h" -#include "buffer.h" +#include +#include #include "ldap.h" -#include "socket.h" -#include "ip4.h" -#include "str.h" -#include "open.h" +#include +#include +#include +#include #define BUFSIZE 8192 diff --git a/ldapdelete.c b/ldapdelete.c index 8ac9f0c..764a9fe 100644 --- a/ldapdelete.c +++ b/ldapdelete.c @@ -2,13 +2,13 @@ #include #include #include -#include "byte.h" -#include "buffer.h" +#include +#include #include "ldap.h" -#include "socket.h" -#include "ip4.h" -#include "str.h" -#include "textcode.h" +#include +#include +#include +#include #include #include @@ -41,11 +41,6 @@ int main(int argc,char* argv[]) { int sock; char buf[BUFSIZE]; int len=0; - char* me; - if ((me=strrchr(argv[0],'/'))) - ++me; - else - me=argv[0]; if (argc<2) { usage: diff --git a/ldif_parse.c b/ldif_parse.c index 8210989..10b74c2 100644 --- a/ldif_parse.c +++ b/ldif_parse.c @@ -1,19 +1,19 @@ #define _FILE_OFFSET_BITS 64 #include -#include -#include -#include +#include +#include +#include #include #include #include #include "mduptab.h" #include "mstorage.h" -#include "str.h" +#include #include "ldif.h" -#include "byte.h" -#include "textcode.h" -#include "stralloc.h" -#include "uint32.h" +#include +#include +#include +#include mduptab_t attributes,classes; mstorage_t stringtable; diff --git a/matchcaseprefix.c b/matchcaseprefix.c index 7ba8335..861d0d3 100644 --- a/matchcaseprefix.c +++ b/matchcaseprefix.c @@ -1,7 +1,7 @@ #include -#include "case.h" +#include #include "ldif.h" -#include "str.h" +#include /* behave like strcmp, but also return 0 if s is a prefix of c. */ int matchcaseprefix(struct string* s,const char* c) { diff --git a/matchcasestring.c b/matchcasestring.c index 4f0aab2..f3a33bc 100644 --- a/matchcasestring.c +++ b/matchcasestring.c @@ -1,4 +1,4 @@ -#include "case.h" +#include #include "bstr.h" #include "ldif.h" diff --git a/matchprefix.c b/matchprefix.c index 90d9bc2..659191f 100644 --- a/matchprefix.c +++ b/matchprefix.c @@ -1,4 +1,4 @@ -#include "byte.h" +#include #include "ldif.h" #include "bstr.h" diff --git a/matchstring.c b/matchstring.c index fdae726..693c2ac 100644 --- a/matchstring.c +++ b/matchstring.c @@ -1,4 +1,4 @@ -#include "byte.h" +#include #include "bstr.h" #include "ldif.h" diff --git a/md5password.c b/md5password.c index 946a5b1..f772942 100644 --- a/md5password.c +++ b/md5password.c @@ -8,9 +8,9 @@ #define MD5Final MD5_Final #endif #include -#include "buffer.h" -#include "str.h" -#include "textcode.h" +#include +#include +#include int main(int argc,char* argv[]) { unsigned char digest[17]; diff --git a/mduptab_add.c b/mduptab_add.c index ddf5b46..8705c6b 100644 --- a/mduptab_add.c +++ b/mduptab_add.c @@ -1,10 +1,10 @@ #include #include -#include "str.h" +#include #include "bstr.h" #include "mstorage.h" #include "mduptab.h" -#include "uint32.h" +#include long mduptab_add(mduptab_t* t,const char* s,size_t len) { unsigned int i; diff --git a/mduptab_adds.c b/mduptab_adds.c index 7f3a043..409bc61 100644 --- a/mduptab_adds.c +++ b/mduptab_adds.c @@ -1,6 +1,6 @@ #include "mstorage.h" #include "mduptab.h" -#include "str.h" +#include long mduptab_adds(mduptab_t* t,const char* s) { return mduptab_add(t,s,str_len(s)); diff --git a/mstorage_add.c b/mstorage_add.c index 55c5751..ada0594 100644 --- a/mstorage_add.c +++ b/mstorage_add.c @@ -5,7 +5,7 @@ #include #include #include -#include "byte.h" +#include #include "mstorage.h" #ifndef PAGE_SIZE diff --git a/mstorage_add_bin.c b/mstorage_add_bin.c index d0e288e..322f1ca 100644 --- a/mstorage_add_bin.c +++ b/mstorage_add_bin.c @@ -1,4 +1,4 @@ -#include "uint32.h" +#include #include "mstorage.h" /* this is tinyldap specific. If the data contains at least one 0-byte, diff --git a/mysql2ldif.c b/mysql2ldif.c index cd77e51..fa414cb 100644 --- a/mysql2ldif.c +++ b/mysql2ldif.c @@ -1,9 +1,9 @@ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #define _BSD_SOURCE diff --git a/parse.c b/parse.c index 7e26e52..a7d8b17 100644 --- a/parse.c +++ b/parse.c @@ -9,13 +9,13 @@ #include #include #include -#include "buffer.h" +#include #include "ldif.h" #include "mduptab.h" -#include "uint32.h" -#include "byte.h" -#include "fmt.h" -#include "errmsg.h" +#include +#include +#include +#include /* these are defined in ldif_parse.c. * We extern them here so we can initialize them. @@ -280,7 +280,7 @@ writeerror: len = outofs; indices_offset=len; - len+=record_count*4; + // len+=record_count*4; // not actually needed after this if (buffer_put(&outbuf,(char*)offsets,sizeof(uint32)*record_count)) diesys(1,"short write (disk full?)"); free(offsets); diff --git a/scan_ldapaddrequest.c b/scan_ldapaddrequest.c index 9fb4b1d..0d778a6 100644 --- a/scan_ldapaddrequest.c +++ b/scan_ldapaddrequest.c @@ -1,7 +1,7 @@ #include #include "ldap.h" -#include "buffer.h" -#include "byte.h" +#include +#include #if 0 AddRequest ::= [APPLICATION 8] SEQUENCE { diff --git a/scan_ldapmodifyrequest.c b/scan_ldapmodifyrequest.c index 832d629..2df0e48 100644 --- a/scan_ldapmodifyrequest.c +++ b/scan_ldapmodifyrequest.c @@ -1,5 +1,5 @@ #include -#include +#include #include "ldap.h" #if 0 diff --git a/scan_ldapsearchfilterstring.c b/scan_ldapsearchfilterstring.c index 733f37a..c4c01e5 100644 --- a/scan_ldapsearchfilterstring.c +++ b/scan_ldapsearchfilterstring.c @@ -1,6 +1,6 @@ #include #include "ldap.h" -#include "str.h" +#include size_t scan_ldapsearchfilterstring(const char* src,struct Filter** f) { char* s=(char*)src; diff --git a/scan_ldapsearchrequest.c b/scan_ldapsearchrequest.c index 26a6646..182edda 100644 --- a/scan_ldapsearchrequest.c +++ b/scan_ldapsearchrequest.c @@ -39,7 +39,7 @@ size_t scan_ldapsearchrequest(const char* src,const char* max, if (src+res==nmax) break; if (!*a) *a=calloc(1,sizeof(struct AttributeDescriptionList)); if (!*a) goto error; - if (!(tmp=scan_ldapstring(src+res,nmax,&(*a)->a))) { free(*a); goto error; } + if (!(tmp=scan_ldapstring(src+res,nmax,&(*a)->a))) { goto error; } res+=tmp; a=&(*a)->next; } diff --git a/strduptab.c b/strduptab.c index 07dd244..bc9a3a7 100644 --- a/strduptab.c +++ b/strduptab.c @@ -1,8 +1,8 @@ #include -#include "str.h" +#include #include "strduptab.h" #include "strstorage.h" -#include "str.h" +#include #define PAGESIZE 4096 diff --git a/strstorage.c b/strstorage.c index 3cc98b7..ea29499 100644 --- a/strstorage.c +++ b/strstorage.c @@ -1,5 +1,5 @@ #include -#include "byte.h" +#include #include "strstorage.h" #define PAGESIZE 4096 diff --git a/t1.c b/t1.c index 2bec4ab..38b2086 100644 --- a/t1.c +++ b/t1.c @@ -1,11 +1,11 @@ -#include -#include -#include +#include +#include +#include #include #include #include "strduptab.h" #include "strstorage.h" -#include "str.h" +#include /* how many attributes do we allow per record? */ #define ATTRIBS 8 diff --git a/t2.c b/t2.c index 925cf07..8cf7004 100644 --- a/t2.c +++ b/t2.c @@ -1,7 +1,7 @@ #ifndef INCLUDE #include #include -#include "mmap.h" +#include #include "ldap.h" #endif diff --git a/tinyldap.c b/tinyldap.c index 40dd3ed..ba4350d 100644 --- a/tinyldap.c +++ b/tinyldap.c @@ -2,21 +2,21 @@ #include #include #include -#include "str.h" -#include "case.h" -#include "byte.h" -#include "buffer.h" +#include +#include +#include +#include #include "ldap.h" #include "mduptab.h" #include "ldif.h" -#include "open.h" -#include "mmap.h" -#include "uint32.h" +#include +#include +#include #include "auth.h" #include "bstr.h" #ifdef STANDALONE -#include "socket.h" -#include "ip6.h" +#include +#include #ifdef __FreeBSD__ #include #include @@ -24,16 +24,16 @@ #include #endif #endif -#include "case.h" +#include #include -#include "uint16.h" +#include #include "acl.h" #include #include #include -#include "errmsg.h" -#include "textcode.h" -#include "fmt.h" +#include +#include +#include #include #include #include diff --git a/tls_accept.c b/tls_accept.c index 0f58932..a84eceb 100644 --- a/tls_accept.c +++ b/tls_accept.c @@ -62,7 +62,7 @@ nocert: x+=fmt_tls_serverhellodone(x); } - r=WRITE_SERVERHELLO; + // r=WRITE_SERVERHELLO; // dead store because we fall through sc->ofsinmessage=0; // fall through diff --git a/tls_connect.c b/tls_connect.c index d9c47de..e2e84b4 100644 --- a/tls_connect.c +++ b/tls_connect.c @@ -1,8 +1,8 @@ #include "tinytls.h" #include -#include "uint16.h" -#include "uint32.h" -#include "buffer.h" +#include +#include +#include #include inline int puts(const char* s) { @@ -35,7 +35,7 @@ tls_error_code tls_connect(uintptr_t fd,struct ssl_context* sc) { puts("WRITE_CLIENTHELLO"); r=tls_dowrite(fd,sc); if (r!=OK) return r; - r=READ_SERVERHELLO; + // r=READ_SERVERHELLO; // since we fall through, don't do dead store sc->ofsinmessage=0; // fall through @@ -66,7 +66,7 @@ decodeerror: sc->cipher=cipher; sc->compressionmethod=0; } - r=READ_CERT; + // r=READ_CERT; // since we fall through, this would be a dead store sc->ofsinmessage=0; // fall through @@ -96,7 +96,7 @@ decodeerror: } } - r=READ_SERVERHELLODONE; + // r=READ_SERVERHELLODONE; // since we fall through, this would be a dead store sc->ofsinmessage=0; // fall through diff --git a/tls_doread.c b/tls_doread.c index b30b3c6..3afecd6 100644 --- a/tls_doread.c +++ b/tls_doread.c @@ -1,5 +1,5 @@ #include "tinytls.h" -#include "uint16.h" +#include #include #include #include diff --git a/x.c b/x.c index 00975e9..fc4ffe2 100644 --- a/x.c +++ b/x.c @@ -1,7 +1,7 @@ #include "tinytls.h" -#include "errmsg.h" -#include "ip4.h" -#include "socket.h" +#include +#include +#include #include