finish size_t conversion from unsigned long
This commit is contained in:
@@ -64,7 +64,7 @@ uint32 hashmapped(uint32 ofs,int ignorecase) {
|
||||
|
||||
int main(int argc,char* argv[]) {
|
||||
enum { SORTEDTABLE, HASHTABLE } mode;
|
||||
unsigned long filelen;
|
||||
size_t filelen;
|
||||
char* filename=argv[1];
|
||||
uint32 magic,attribute_count,record_count,indices_offset,size_of_string_table;
|
||||
uint32 wanted,casesensitive,dn,objectClass;
|
||||
|
||||
2
asn1.h
2
asn1.h
@@ -102,7 +102,7 @@ size_t fmt_asn1bitstring(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,
|
||||
/* write ASN.1 SET */
|
||||
#define fmt_asn1SET(dest,l) fmt_asn1transparent(dest,UNIVERSAL,CONSTRUCTED,SET_OF,l)
|
||||
|
||||
size_t fmt_asn1OID(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const unsigned long* array,unsigned long len);
|
||||
size_t fmt_asn1OID(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const size_t* array,size_t len);
|
||||
|
||||
|
||||
/* conventions for the parser routines:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <libowfat/byte.h>
|
||||
|
||||
int main(int argc,char* argv[]) {
|
||||
unsigned long filelen;
|
||||
size_t filelen;
|
||||
char* fn=argc<2?"data":argv[1];
|
||||
const char* map=mmap_read(fn,&filelen);
|
||||
uint32 magic,attribute_count,record_count,indices_offset,size_of_string_table,acl_ofs;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
int main(int argc,char* argv[]) {
|
||||
int verbose=0;
|
||||
unsigned long filelen;
|
||||
size_t filelen;
|
||||
char* fn=argc<2?"data":argv[1];
|
||||
const char* map=mmap_read(fn,&filelen);
|
||||
uint32 magic,attribute_count,record_count,indices_offset,size_of_string_table;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "asn1.h"
|
||||
|
||||
size_t fmt_asn1OID(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const unsigned long* array,unsigned long len) {
|
||||
size_t fmt_asn1OID(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const size_t* array,size_t len) {
|
||||
size_t i,l,l2;
|
||||
if (len<2) return 0;
|
||||
for (l=1,i=2; i<len; ++i) {
|
||||
|
||||
@@ -37,7 +37,7 @@ static void dumpbstr(const char* c) {
|
||||
|
||||
int main(int argc,char* argv[]) {
|
||||
int verbose=1;
|
||||
unsigned long filelen;
|
||||
size_t filelen;
|
||||
char* fn=argc<2?"data":argv[1];
|
||||
const char* map=mmap_read(fn,&filelen);
|
||||
uint32 magic,attribute_count,record_count,indices_offset,size_of_string_table;
|
||||
|
||||
@@ -14,7 +14,7 @@ extern uint32 magic,attribute_count,record_count,indices_offset,size_of_string_t
|
||||
extern uint32 dn_ofs,objectClass_ofs;
|
||||
|
||||
int substringmatch(struct Substring* x,const char* attr,int ignorecase) {
|
||||
int (*diff)(const void* a, unsigned long len, const void* b);
|
||||
int (*diff)(const void* a, size_t len, const void* b);
|
||||
if (ignorecase)
|
||||
diff=case_diffb;
|
||||
else
|
||||
|
||||
@@ -45,7 +45,7 @@ static int ldap_match_present_sre(struct SearchResultEntry* sre,struct string* s
|
||||
}
|
||||
|
||||
static int substrmatch(struct Substring* x,struct string* s,int ignorecase) {
|
||||
int (*diff)(const void* a, unsigned long len, const void* b);
|
||||
int (*diff)(const void* a, size_t len, const void* b);
|
||||
if (ignorecase)
|
||||
diff=case_diffb;
|
||||
else
|
||||
|
||||
@@ -19,7 +19,8 @@ static int ldapbind(int sock) {
|
||||
int len=fmt_ldapbindrequest(outbuf+s,3,"","");
|
||||
int hlen=fmt_ldapmessage(0,messageid,BindRequest,len);
|
||||
int res;
|
||||
unsigned long op,Len,result;
|
||||
unsigned long op,result;
|
||||
size_t Len;
|
||||
struct string matcheddn,errormessage,referral;
|
||||
fmt_ldapmessage(outbuf+s-hlen,messageid,BindRequest,len);
|
||||
if (write(sock,outbuf+s-hlen,len+hlen)!=len+hlen) return 0;;
|
||||
@@ -97,7 +98,8 @@ usage:
|
||||
char* max;
|
||||
struct SearchResultEntry sre;
|
||||
for (;;) {
|
||||
unsigned long slen,mid,op;
|
||||
unsigned long mid,op;
|
||||
size_t slen;
|
||||
tmp=read(sock,buf+len,sizeof(buf)-len);
|
||||
if (tmp<=0) {
|
||||
buffer_putsflush(buffer_2,"read error.\n");
|
||||
|
||||
@@ -28,7 +28,8 @@ size_t scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyReque
|
||||
max=src+res+oslen;
|
||||
if (src+res>=max) goto error; /* need at least one record */
|
||||
do {
|
||||
size_t islen, etmp;
|
||||
size_t islen;
|
||||
unsigned long etmp;
|
||||
if (last) {
|
||||
struct Modification* cur;
|
||||
if (!(cur=malloc(sizeof(struct Modification)))) goto error;
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
size_t scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) {
|
||||
enum asn1_tagclass tc;
|
||||
enum asn1_tagtype tt;
|
||||
size_t tag,len,res,tmp;
|
||||
size_t len,res,tmp;
|
||||
unsigned long tag;
|
||||
const char* nmax;
|
||||
*f=0;
|
||||
if (!(res=scan_asn1tag(src,max,&tc,&tt,&tag))) goto error;
|
||||
|
||||
@@ -7,6 +7,7 @@ size_t scan_ldapsearchrequest(const char* src,const char* max,
|
||||
size_t res,tmp;
|
||||
unsigned long etmp;
|
||||
signed long ltmp;
|
||||
size_t stmp;
|
||||
s->attributes=0;
|
||||
s->filter=0;
|
||||
if (!(res=scan_ldapstring(src,max,&s->baseObject))) goto error;
|
||||
@@ -27,10 +28,10 @@ size_t scan_ldapsearchrequest(const char* src,const char* max,
|
||||
if (!(tmp=scan_ldapsearchfilter(src+res,max,&s->filter))) goto error;
|
||||
res+=tmp;
|
||||
/* now for the attributelist */
|
||||
if (!(tmp=scan_asn1SEQUENCE(src+res,max,&etmp))) goto error;
|
||||
if (!(tmp=scan_asn1SEQUENCE(src+res,max,&stmp))) goto error;
|
||||
res+=tmp;
|
||||
{
|
||||
const char* nmax=src+res+etmp;
|
||||
const char* nmax=src+res+stmp;
|
||||
//#define nmax max
|
||||
struct AttributeDescriptionList** a=&s->attributes;
|
||||
if (nmax>max) goto error;
|
||||
|
||||
7
t2.c
7
t2.c
@@ -83,16 +83,17 @@ mergesub:
|
||||
#ifndef INCLUDE
|
||||
int main(int argc,char* argv[]) {
|
||||
#if 1
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
// char* ldapsequence=mmap_read("req",&size);
|
||||
const char* ldapsequence=mmap_read(argc>1?argv[1]:"/tmp/ldap/127.000.000.001.00389-127.000.000.001.38433",&size);
|
||||
unsigned long messageid, op, len;
|
||||
unsigned long messageid, op;
|
||||
size_t len;
|
||||
int res;
|
||||
unsigned long done=0;
|
||||
while (done<size) {
|
||||
printf("scan_ldapmessage: %d\n",res=scan_ldapmessage(ldapsequence+done,ldapsequence+size,&messageid,&op,&len));
|
||||
if (!res) { puts("punt!"); break; }
|
||||
printf("message id %lu, op %lu, len %lu\n",messageid,op,len);
|
||||
printf("message id %lu, op %lu, len %zu\n",messageid,op,len);
|
||||
switch (op) {
|
||||
case BindRequest:
|
||||
puts(" >> BindRequest <<");
|
||||
|
||||
Reference in New Issue
Block a user