int -> unsigned int

This commit is contained in:
leitner
2005-07-08 20:50:53 +00:00
parent 7b412d42e4
commit 86bcdeb915
19 changed files with 37 additions and 33 deletions

View File

@@ -1,7 +1,7 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1STRING(const char* src,const char* max,const char** s,unsigned long* l) { unsigned int scan_asn1STRING(const char* src,const char* max,const char** s,unsigned long* l) {
int tmp; unsigned int tmp;
long tag; long tag;
enum asn1_tagclass tc; enum asn1_tagclass tc;
enum asn1_tagtype tt; enum asn1_tagtype tt;

View File

@@ -1,7 +1,7 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1int(const char* src,const char* max,enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag,signed long* l) { unsigned int scan_asn1int(const char* src,const char* max,enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag,signed long* l) {
int len,tmp; unsigned int len,tmp;
long tlen; long tlen;
if (!(len=scan_asn1tag(src,max,tc,tt,tag))) return 0; if (!(len=scan_asn1tag(src,max,tc,tt,tag))) return 0;
if (!(tmp=scan_asn1length(src+len,max,&tlen))) return 0; if (!(tmp=scan_asn1length(src+len,max,&tlen))) return 0;

View File

@@ -1,6 +1,6 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1length(const char* src,const char* max,unsigned long* length) { unsigned int scan_asn1length(const char* src,const char* max,unsigned long* length) {
const char* orig=src; const char* orig=src;
if (src>max) return 0; if (src>max) return 0;
/* If the highest bit of the first byte is clear, the byte is the length. /* If the highest bit of the first byte is clear, the byte is the length.

View File

@@ -1,7 +1,7 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1oid(const char* src,const char* max) { unsigned int scan_asn1oid(const char* src,const char* max) {
int res,tmp; unsigned int res,tmp;
unsigned long tag,tlen; unsigned long tag,tlen;
enum asn1_tagclass tc; enum asn1_tagclass tc;
enum asn1_tagtype tt; enum asn1_tagtype tt;

View File

@@ -1,6 +1,6 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1rawint(const char* src,const char* max,unsigned int len,long* l) { unsigned int scan_asn1rawint(const char* src,const char* max,unsigned int len,long* l) {
unsigned int i,j; unsigned int i,j;
long m; long m;
if (*src<0) m=-1; else m=0; if (*src<0) m=-1; else m=0;

View File

@@ -1,9 +1,9 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1string(const char* src,const char* max, unsigned int scan_asn1string(const char* src,const char* max,
enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag, enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag,
const char** s,unsigned long* l) { const char** s,unsigned long* l) {
int len,tmp; unsigned int len,tmp;
if (!(len=scan_asn1tag(src,max,tc,tt,tag))) return 0; if (!(len=scan_asn1tag(src,max,tc,tt,tag))) return 0;
if (!(tmp=scan_asn1length(src+len,max,l))) return 0; if (!(tmp=scan_asn1length(src+len,max,l))) return 0;
len+=tmp; len+=tmp;

View File

@@ -1,6 +1,6 @@
#include "asn1.h" #include "asn1.h"
int scan_asn1tag(const char* src,const char* max,enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag) { unsigned int scan_asn1tag(const char* src,const char* max,enum asn1_tagclass* tc,enum asn1_tagtype* tt,unsigned long* tag) {
const char* orig=src; const char* orig=src;
*tc=(*src&0xC0); *tc=(*src&0xC0);
*tt=(*src&0x20); *tt=(*src&0x20);

View File

@@ -15,8 +15,8 @@
vals SET OF AttributeValue } vals SET OF AttributeValue }
#endif #endif
int scan_ldapaddrequest(const char* src,const char* max,struct AddRequest* a) { unsigned int scan_ldapaddrequest(const char* src,const char* max,struct AddRequest* a) {
int res,tmp; unsigned int res,tmp;
long oslen; /* outer sequence length */ long oslen; /* outer sequence length */
struct Addition* last=0; struct Addition* last=0;
a->a.next=0; a->a.next=0;

View File

@@ -1,8 +1,8 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapava(const char* src,const char* max,struct AttributeValueAssertion* ava) { unsigned int scan_ldapava(const char* src,const char* max,struct AttributeValueAssertion* ava) {
int res,tmp; unsigned int res,tmp;
if (!(res=scan_ldapstring(src,max,&ava->desc))) goto error; if (!(res=scan_ldapstring(src,max,&ava->desc))) goto error;
if (!(tmp=scan_ldapstring(src+res,max,&ava->value))) goto error; if (!(tmp=scan_ldapstring(src+res,max,&ava->value))) goto error;
return res+tmp; return res+tmp;

View File

@@ -1,10 +1,10 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapbindrequest(const char* src,const char* max, unsigned int scan_ldapbindrequest(const char* src,const char* max,
unsigned long* version,struct string* name, unsigned long* version,struct string* name,
unsigned long* method) { unsigned long* method) {
int res,tmp; unsigned int res,tmp;
if (!(res=scan_asn1INTEGER(src,max,(signed long*)version))) return 0; if (!(res=scan_asn1INTEGER(src,max,(signed long*)version))) return 0;
if (!(tmp=scan_ldapstring(src+res,max,name))) return 0; if (!(tmp=scan_ldapstring(src+res,max,name))) return 0;
res+=tmp; res+=tmp;

View File

@@ -1,10 +1,10 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapbindresponse(const char* src,const char* max, unsigned int scan_ldapbindresponse(const char* src,const char* max,
unsigned long* result,struct string* matcheddn, unsigned long* result,struct string* matcheddn,
struct string* errormessage,struct string* referral) { struct string* errormessage,struct string* referral) {
int res,tmp; unsigned int res,tmp;
if (!(res=scan_asn1ENUMERATED(src,max,result))) return 0; if (!(res=scan_asn1ENUMERATED(src,max,result))) return 0;
if (!(tmp=scan_ldapstring(src+res,max,matcheddn))) return 0; if (!(tmp=scan_ldapstring(src+res,max,matcheddn))) return 0;
res+=tmp; res+=tmp;

View File

@@ -1,9 +1,9 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapmessage(const char* src,const char* max, unsigned int scan_ldapmessage(const char* src,const char* max,
unsigned long* messageid,unsigned long* op,unsigned long* len) { unsigned long* messageid,unsigned long* op,unsigned long* len) {
int res,tmp; unsigned int res,tmp;
if (!(res=scan_asn1SEQUENCE(src,max,len))) goto error; if (!(res=scan_asn1SEQUENCE(src,max,len))) goto error;
if (!(tmp=scan_asn1INTEGER(src+res,max,(long*)messageid))) goto error; if (!(tmp=scan_asn1INTEGER(src+res,max,(long*)messageid))) goto error;
res+=tmp; res+=tmp;

View File

@@ -17,8 +17,8 @@
vals SET OF AttributeValue } vals SET OF AttributeValue }
#endif #endif
int scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyRequest* m) { unsigned int scan_ldapmodifyrequest(const char* src,const char* max,struct ModifyRequest* m) {
int res,tmp; unsigned int res,tmp;
long oslen; /* outer sequence length */ long oslen; /* outer sequence length */
struct Modification* last=0; struct Modification* last=0;
m->m.next=0; m->m.next=0;

View File

@@ -1,10 +1,10 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapresult(const char* src,const char* max,long* result, unsigned int scan_ldapresult(const char* src,const char* max,long* result,
struct string* matcheddn,struct string* errormessage, struct string* matcheddn,struct string* errormessage,
struct string* referral) { struct string* referral) {
int res,tmp; unsigned int res,tmp;
if (!(res=scan_asn1ENUMERATED(src,max,result))) return 0; if (!(res=scan_asn1ENUMERATED(src,max,result))) return 0;
if (!(tmp=scan_ldapstring(src+res,max,matcheddn))) return 0; if (!(tmp=scan_ldapstring(src+res,max,matcheddn))) return 0;
res+=tmp; res+=tmp;

View File

@@ -30,11 +30,11 @@
dnAttributes [4] BOOLEAN DEFAULT FALSE } dnAttributes [4] BOOLEAN DEFAULT FALSE }
*/ */
int scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) { unsigned int scan_ldapsearchfilter(const char* src,const char* max,struct Filter** f) {
enum asn1_tagclass tc; enum asn1_tagclass tc;
enum asn1_tagtype tt; enum asn1_tagtype tt;
unsigned long tag,len; unsigned long tag,len;
int res; unsigned int res;
unsigned int tmp; unsigned int tmp;
const char* nmax; const char* nmax;
*f=0; *f=0;

View File

@@ -2,9 +2,13 @@
#include "ldap.h" #include "ldap.h"
#include "str.h" #include "str.h"
int scan_ldapsearchfilterstring(const char* src,struct Filter** f) { unsigned int scan_ldapsearchfilterstring(const char* src,struct Filter** f) {
char* s=(char*)src; char* s=(char*)src;
if (!(*f=calloc(sizeof(struct Filter),1))) goto error; if (!(*f=calloc(sizeof(struct Filter),1))) goto error;
if (s[0]=='*' && (s[1]==0 || s[1]=='(')) {
int i=scan_ldapsearchfilterstring("(objectClass=*)",f);
if (i) return 1;
}
if (*s!='(') goto error; if (*s!='(') goto error;
switch (*(++s)) { switch (*(++s)) {
case '&': ++s; (*f)->type=AND; case '&': ++s; (*f)->type=AND;

View File

@@ -2,9 +2,9 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapsearchrequest(const char* src,const char* max, unsigned int scan_ldapsearchrequest(const char* src,const char* max,
struct SearchRequest* s) { struct SearchRequest* s) {
int res,tmp; unsigned int res,tmp;
unsigned long etmp; unsigned long etmp;
s->attributes=0; s->attributes=0;
s->filter=0; s->filter=0;

View File

@@ -2,8 +2,8 @@
#include "asn1.h" #include "asn1.h"
#include "ldap.h" #include "ldap.h"
int scan_ldapsearchresultentry(const char* src,const char* max,struct SearchResultEntry* sre) { unsigned int scan_ldapsearchresultentry(const char* src,const char* max,struct SearchResultEntry* sre) {
int res,tmp; unsigned int res,tmp;
long oslen; /* outer sequence length */ long oslen; /* outer sequence length */
struct PartialAttributeList** a=&sre->attributes; struct PartialAttributeList** a=&sre->attributes;
*a=0; *a=0;

View File

@@ -1,6 +1,6 @@
#include <asn1.h> #include <asn1.h>
#include <ldap.h> #include <ldap.h>
int scan_ldapstring(const char* src,const char* max,struct string* s) { unsigned int scan_ldapstring(const char* src,const char* max,struct string* s) {
return scan_asn1STRING(src,max,&s->s,&s->l); return scan_asn1STRING(src,max,&s->s,&s->l);
} }