summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2018-07-31 11:02:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2018-07-31 11:02:02 +0000
commita31794118e989997fab3dccd9b78dbea0364b013 (patch)
treef705cfb44e7c884f452f0df269a08a9e83e28c76
parenta85b8997d4aeb6110fe8c965d66c419f1aa37e49 (diff)
Make ber type and encoding a unsigned int instead of unsigned long.
This way the size is the same on all archs and 32bit should be good enough. OK rob@
-rw-r--r--usr.bin/ldap/aldap.c19
-rw-r--r--usr.bin/ldap/ber.c32
-rw-r--r--usr.bin/ldap/ber.h16
-rw-r--r--usr.sbin/ldapd/ber.c32
-rw-r--r--usr.sbin/ldapd/ber.h16
-rw-r--r--usr.sbin/ldapd/conn.c12
-rw-r--r--usr.sbin/ldapd/filter.c6
-rw-r--r--usr.sbin/ldapd/ldapd.h6
-rw-r--r--usr.sbin/ldapd/ldape.c14
-rw-r--r--usr.sbin/ldapd/logmsg.c6
-rw-r--r--usr.sbin/ldapd/search.c8
-rw-r--r--usr.sbin/snmpd/ber.310
-rw-r--r--usr.sbin/snmpd/ber.c32
-rw-r--r--usr.sbin/snmpd/ber.h16
-rw-r--r--usr.sbin/snmpd/smi.c4
-rw-r--r--usr.sbin/snmpd/snmpd.h4
-rw-r--r--usr.sbin/snmpd/snmpe.c4
-rw-r--r--usr.sbin/ypldap/aldap.c19
-rw-r--r--usr.sbin/ypldap/ber.c32
-rw-r--r--usr.sbin/ypldap/ber.h16
20 files changed, 151 insertions, 153 deletions
diff --git a/usr.bin/ldap/aldap.c b/usr.bin/ldap/aldap.c
index cf4313e9fb3..4c0f87004bd 100644
--- a/usr.bin/ldap/aldap.c
+++ b/usr.bin/ldap/aldap.c
@@ -1,5 +1,5 @@
-/* $Id: aldap.c,v 1.2 2018/06/21 08:27:35 reyk Exp $ */
-/* $OpenBSD: aldap.c,v 1.2 2018/06/21 08:27:35 reyk Exp $ */
+/* $Id: aldap.c,v 1.3 2018/07/31 11:02:01 claudio Exp $ */
+/* $OpenBSD: aldap.c,v 1.3 2018/07/31 11:02:01 claudio Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -47,7 +47,7 @@ int aldap_create_page_control(struct ber_element *,
int, struct aldap_page_control *);
int aldap_send(struct aldap *,
struct ber_element *);
-unsigned long aldap_application(struct ber_element *);
+unsigned int aldap_application(struct ber_element *);
#ifdef DEBUG
void ldap_debug_elements(struct ber_element *);
@@ -61,7 +61,7 @@ void ldap_debug_elements(struct ber_element *);
#define LDAP_DEBUG(x, y) do { } while (0)
#endif
-unsigned long
+unsigned int
aldap_application(struct ber_element *elm)
{
return BER_TYPE_OCTETSTRING;
@@ -168,8 +168,7 @@ aldap_req_starttls(struct aldap *ldap)
goto fail;
ber = ber_printf_elements(root, "d{tst", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long) LDAP_REQ_EXTENDED, LDAP_STARTTLS_OID,
- BER_CLASS_CONTEXT, (unsigned long) 0);
+ LDAP_REQ_EXTENDED, LDAP_STARTTLS_OID, BER_CLASS_CONTEXT, 0);
if (ber == NULL) {
ldap->err = ALDAP_ERR_OPERATION_FAILED;
goto fail;
@@ -201,8 +200,8 @@ aldap_bind(struct aldap *ldap, char *binddn, char *bindcred)
goto fail;
elm = ber_printf_elements(root, "d{tdsst", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long)LDAP_REQ_BIND, VERSION, binddn, bindcred,
- BER_CLASS_CONTEXT, (unsigned long)LDAP_AUTH_SIMPLE);
+ LDAP_REQ_BIND, VERSION, binddn, bindcred, BER_CLASS_CONTEXT,
+ LDAP_AUTH_SIMPLE);
if (elm == NULL)
goto fail;
@@ -261,7 +260,7 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter,
goto fail;
ber = ber_printf_elements(root, "d{t", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long) LDAP_REQ_SEARCH);
+ LDAP_REQ_SEARCH);
if (ber == NULL) {
ldap->err = ALDAP_ERR_OPERATION_FAILED;
goto fail;
@@ -350,7 +349,7 @@ struct aldap_message *
aldap_parse(struct aldap *ldap)
{
int class;
- unsigned long type;
+ unsigned int type;
long long msgid = 0;
struct aldap_message *m;
struct ber_element *a = NULL, *ep;
diff --git a/usr.bin/ldap/ber.c b/usr.bin/ldap/ber.c
index 54c31212106..2eef9d7d80d 100644
--- a/usr.bin/ldap/ber.c
+++ b/usr.bin/ldap/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.14 2018/07/13 08:50:38 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.15 2018/07/31 11:02:01 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -42,7 +42,7 @@ static int ber_dump_element(struct ber *ber, struct ber_element *root);
static void ber_dump_header(struct ber *ber, struct ber_element *root);
static void ber_putc(struct ber *ber, u_char c);
static void ber_write(struct ber *ber, void *buf, size_t len);
-static ssize_t get_id(struct ber *b, unsigned long *tag, int *class,
+static ssize_t get_id(struct ber *b, unsigned int *tag, int *class,
int *cstruct);
static ssize_t get_len(struct ber *b, ssize_t *len);
static ssize_t ber_read_element(struct ber *ber, struct ber_element *elm);
@@ -56,7 +56,7 @@ static ssize_t ber_read(struct ber *ber, void *buf, size_t len);
#endif
struct ber_element *
-ber_get_element(unsigned long encoding)
+ber_get_element(unsigned int encoding)
{
struct ber_element *elm;
@@ -70,7 +70,7 @@ ber_get_element(unsigned long encoding)
}
void
-ber_set_header(struct ber_element *elm, int class, unsigned long type)
+ber_set_header(struct ber_element *elm, int class, unsigned int type)
{
elm->be_class = class & BER_CLASS_MASK;
if (type == BER_TYPE_DEFAULT)
@@ -521,7 +521,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
va_list ap;
int d, class;
size_t len;
- unsigned long type;
+ unsigned int type;
long long i;
char *s;
void *p;
@@ -578,7 +578,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
class = va_arg(ap, int);
- type = va_arg(ap, unsigned long);
+ type = va_arg(ap, unsigned int);
ber_set_header(ber, class, type);
break;
case 'x':
@@ -626,7 +626,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
#define _MAX_SEQ 128
va_list ap;
int *d, level = -1;
- unsigned long *t;
+ unsigned int *t;
long long *i, l;
void **ptr;
size_t *len, ret = 0, n = strlen(fmt);
@@ -694,7 +694,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
d = va_arg(ap, int *);
- t = va_arg(ap, unsigned long *);
+ t = va_arg(ap, unsigned int *);
*d = ber->be_class;
*t = ber->be_type;
ret++;
@@ -867,7 +867,7 @@ ber_free_elements(struct ber_element *root)
size_t
ber_calc_len(struct ber_element *root)
{
- unsigned long t;
+ unsigned int t;
size_t s;
size_t size = 2; /* minimum 1 byte head and 1 byte size */
@@ -945,8 +945,8 @@ ber_dump_element(struct ber *ber, struct ber_element *root)
static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
- u_char id = 0, t, buf[8];
- unsigned long type;
+ u_char id = 0, t, buf[5];
+ unsigned int type;
size_t size;
/* class universal, type encoding depending on type value */
@@ -1010,11 +1010,11 @@ ber_write(struct ber *ber, void *buf, size_t len)
* extract a BER encoded tag. There are two types, a short and long form.
*/
static ssize_t
-get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
+get_id(struct ber *b, unsigned int *tag, int *class, int *cstruct)
{
u_char u;
size_t i = 0;
- unsigned long t = 0;
+ unsigned int t = 0;
if (ber_getc(b, &u) == -1)
return -1;
@@ -1032,7 +1032,7 @@ get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
return -1;
t = (t << 7) | (u & ~BER_TAG_MORE);
i++;
- if (i > sizeof(unsigned long)) {
+ if (i > sizeof(unsigned int)) {
errno = ERANGE;
return -1;
}
@@ -1093,7 +1093,7 @@ ber_read_element(struct ber *ber, struct ber_element *elm)
{
long long val = 0;
struct ber_element *next;
- unsigned long type;
+ unsigned int type;
int i, class, cstruct;
ssize_t len, r, totlen = 0;
u_char c;
@@ -1221,7 +1221,7 @@ ber_get_writebuf(struct ber *b, void **buf)
}
void
-ber_set_application(struct ber *b, unsigned long (*cb)(struct ber_element *))
+ber_set_application(struct ber *b, unsigned int (*cb)(struct ber_element *))
{
b->br_application = cb;
}
diff --git a/usr.bin/ldap/ber.h b/usr.bin/ldap/ber.h
index ad0f6d9023a..9c76a815179 100644
--- a/usr.bin/ldap/ber.h
+++ b/usr.bin/ldap/ber.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.h,v 1.4 2018/07/03 18:49:10 rob Exp $ */
+/* $OpenBSD: ber.h,v 1.5 2018/07/31 11:02:01 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -22,8 +22,8 @@
struct ber_element {
struct ber_element *be_next;
- unsigned long be_type;
- unsigned long be_encoding;
+ unsigned int be_type;
+ unsigned int be_encoding;
size_t be_len;
off_t be_offs;
int be_free;
@@ -49,11 +49,11 @@ struct ber {
u_char *br_rptr;
u_char *br_rend;
- unsigned long (*br_application)(struct ber_element *);
+ unsigned int (*br_application)(struct ber_element *);
};
/* well-known ber_element types */
-#define BER_TYPE_DEFAULT ((unsigned long)-1)
+#define BER_TYPE_DEFAULT ((unsigned int)-1)
#define BER_TYPE_EOC 0
#define BER_TYPE_BOOLEAN 1
#define BER_TYPE_INTEGER 2
@@ -84,9 +84,9 @@ struct ber_oid {
};
__BEGIN_DECLS
-struct ber_element *ber_get_element(unsigned long);
+struct ber_element *ber_get_element(unsigned int);
void ber_set_header(struct ber_element *, int,
- unsigned long);
+ unsigned int);
void ber_link_elements(struct ber_element *,
struct ber_element *);
struct ber_element *ber_unlink_elements(struct ber_element *);
@@ -131,7 +131,7 @@ void ber_free_element(struct ber_element *);
void ber_free_elements(struct ber_element *);
size_t ber_calc_len(struct ber_element *);
void ber_set_application(struct ber *,
- unsigned long (*)(struct ber_element *));
+ unsigned int (*)(struct ber_element *));
void ber_set_writecallback(struct ber_element *,
void (*)(void *, size_t), void *);
void ber_free(struct ber *);
diff --git a/usr.sbin/ldapd/ber.c b/usr.sbin/ldapd/ber.c
index e55c41a73d6..47a8cf891b6 100644
--- a/usr.sbin/ldapd/ber.c
+++ b/usr.sbin/ldapd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.24 2018/07/13 08:50:38 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.25 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -42,7 +42,7 @@ static int ber_dump_element(struct ber *ber, struct ber_element *root);
static void ber_dump_header(struct ber *ber, struct ber_element *root);
static void ber_putc(struct ber *ber, u_char c);
static void ber_write(struct ber *ber, void *buf, size_t len);
-static ssize_t get_id(struct ber *b, unsigned long *tag, int *class,
+static ssize_t get_id(struct ber *b, unsigned int *tag, int *class,
int *cstruct);
static ssize_t get_len(struct ber *b, ssize_t *len);
static ssize_t ber_read_element(struct ber *ber, struct ber_element *elm);
@@ -56,7 +56,7 @@ static ssize_t ber_read(struct ber *ber, void *buf, size_t len);
#endif
struct ber_element *
-ber_get_element(unsigned long encoding)
+ber_get_element(unsigned int encoding)
{
struct ber_element *elm;
@@ -70,7 +70,7 @@ ber_get_element(unsigned long encoding)
}
void
-ber_set_header(struct ber_element *elm, int class, unsigned long type)
+ber_set_header(struct ber_element *elm, int class, unsigned int type)
{
elm->be_class = class & BER_CLASS_MASK;
if (type == BER_TYPE_DEFAULT)
@@ -521,7 +521,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
va_list ap;
int d, class;
size_t len;
- unsigned long type;
+ unsigned int type;
long long i;
char *s;
void *p;
@@ -578,7 +578,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
class = va_arg(ap, int);
- type = va_arg(ap, unsigned long);
+ type = va_arg(ap, unsigned int);
ber_set_header(ber, class, type);
break;
case 'x':
@@ -626,7 +626,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
#define _MAX_SEQ 128
va_list ap;
int *d, level = -1;
- unsigned long *t;
+ unsigned int *t;
long long *i, l;
void **ptr;
size_t *len, ret = 0, n = strlen(fmt);
@@ -694,7 +694,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
d = va_arg(ap, int *);
- t = va_arg(ap, unsigned long *);
+ t = va_arg(ap, unsigned int *);
*d = ber->be_class;
*t = ber->be_type;
ret++;
@@ -867,7 +867,7 @@ ber_free_elements(struct ber_element *root)
size_t
ber_calc_len(struct ber_element *root)
{
- unsigned long t;
+ unsigned int t;
size_t s;
size_t size = 2; /* minimum 1 byte head and 1 byte size */
@@ -945,8 +945,8 @@ ber_dump_element(struct ber *ber, struct ber_element *root)
static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
- u_char id = 0, t, buf[8];
- unsigned long type;
+ u_char id = 0, t, buf[5];
+ unsigned int type;
size_t size;
/* class universal, type encoding depending on type value */
@@ -1010,11 +1010,11 @@ ber_write(struct ber *ber, void *buf, size_t len)
* extract a BER encoded tag. There are two types, a short and long form.
*/
static ssize_t
-get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
+get_id(struct ber *b, unsigned int *tag, int *class, int *cstruct)
{
u_char u;
size_t i = 0;
- unsigned long t = 0;
+ unsigned int t = 0;
if (ber_getc(b, &u) == -1)
return -1;
@@ -1032,7 +1032,7 @@ get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
return -1;
t = (t << 7) | (u & ~BER_TAG_MORE);
i++;
- if (i > sizeof(unsigned long)) {
+ if (i > sizeof(unsigned int)) {
errno = ERANGE;
return -1;
}
@@ -1093,7 +1093,7 @@ ber_read_element(struct ber *ber, struct ber_element *elm)
{
long long val = 0;
struct ber_element *next;
- unsigned long type;
+ unsigned int type;
int i, class, cstruct;
ssize_t len, r, totlen = 0;
u_char c;
@@ -1221,7 +1221,7 @@ ber_get_writebuf(struct ber *b, void **buf)
}
void
-ber_set_application(struct ber *b, unsigned long (*cb)(struct ber_element *))
+ber_set_application(struct ber *b, unsigned int (*cb)(struct ber_element *))
{
b->br_application = cb;
}
diff --git a/usr.sbin/ldapd/ber.h b/usr.sbin/ldapd/ber.h
index a97b1b756dd..d7d19631104 100644
--- a/usr.sbin/ldapd/ber.h
+++ b/usr.sbin/ldapd/ber.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.h,v 1.5 2018/07/03 18:49:10 rob Exp $ */
+/* $OpenBSD: ber.h,v 1.6 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -22,8 +22,8 @@
struct ber_element {
struct ber_element *be_next;
- unsigned long be_type;
- unsigned long be_encoding;
+ unsigned int be_type;
+ unsigned int be_encoding;
size_t be_len;
off_t be_offs;
int be_free;
@@ -49,11 +49,11 @@ struct ber {
u_char *br_rptr;
u_char *br_rend;
- unsigned long (*br_application)(struct ber_element *);
+ unsigned int (*br_application)(struct ber_element *);
};
/* well-known ber_element types */
-#define BER_TYPE_DEFAULT ((unsigned long)-1)
+#define BER_TYPE_DEFAULT ((unsigned int)-1)
#define BER_TYPE_EOC 0
#define BER_TYPE_BOOLEAN 1
#define BER_TYPE_INTEGER 2
@@ -84,9 +84,9 @@ struct ber_oid {
};
__BEGIN_DECLS
-struct ber_element *ber_get_element(unsigned long);
+struct ber_element *ber_get_element(unsigned int);
void ber_set_header(struct ber_element *, int,
- unsigned long);
+ unsigned int);
void ber_link_elements(struct ber_element *,
struct ber_element *);
struct ber_element *ber_unlink_elements(struct ber_element *);
@@ -131,7 +131,7 @@ void ber_free_element(struct ber_element *);
void ber_free_elements(struct ber_element *);
size_t ber_calc_len(struct ber_element *);
void ber_set_application(struct ber *,
- unsigned long (*)(struct ber_element *));
+ unsigned int (*)(struct ber_element *));
void ber_set_writecallback(struct ber_element *,
void (*)(void *, size_t), void *);
void ber_free(struct ber *);
diff --git a/usr.sbin/ldapd/conn.c b/usr.sbin/ldapd/conn.c
index fff636db48e..8c3ffc1daf8 100644
--- a/usr.sbin/ldapd/conn.c
+++ b/usr.sbin/ldapd/conn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conn.c,v 1.16 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: conn.c,v 1.17 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -28,11 +28,11 @@
int conn_dispatch(struct conn *conn);
int conn_tls_init(struct conn *);
-unsigned long ldap_application(struct ber_element *elm);
+unsigned int ldap_application(struct ber_element *elm);
struct conn_list conn_list;
-unsigned long
+unsigned int
ldap_application(struct ber_element *elm)
{
return BER_TYPE_OCTETSTRING;
@@ -99,7 +99,7 @@ request_dispatch(struct request *req)
{
unsigned long i;
struct {
- unsigned long type;
+ unsigned int type;
int (*fn)(struct request *);
} requests[] = {
{ LDAP_REQ_SEARCH, ldap_search },
@@ -132,7 +132,7 @@ request_dispatch(struct request *req)
}
if (requests[i].fn == NULL) {
- log_warnx("unhandled request %lu (not implemented)", req->type);
+ log_warnx("unhandled request %u (not implemented)", req->type);
ldap_respond(req, LDAP_PROTOCOL_ERROR);
}
}
@@ -183,7 +183,7 @@ conn_dispatch(struct conn *conn)
ldap_debug_elements(req->root, req->type,
"received request on fd %d", conn->fd);
- log_debug("got request type %lu, id %lld", req->type, req->msgid);
+ log_debug("got request type %u, id %lld", req->type, req->msgid);
request_dispatch(req);
return 0;
}
diff --git a/usr.sbin/ldapd/filter.c b/usr.sbin/ldapd/filter.c
index a56b14b2bf4..15fadfa1ed9 100644
--- a/usr.sbin/ldapd/filter.c
+++ b/usr.sbin/ldapd/filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.c,v 1.5 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: filter.c,v 1.6 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martinh@openbsd.org>
@@ -64,7 +64,7 @@ static int
ldap_filt_subs_value(struct ber_element *v, struct ber_element *sub)
{
int class;
- unsigned long type;
+ unsigned int type;
const char *cmpval;
char *vs, *p, *end;
@@ -101,7 +101,7 @@ ldap_filt_subs_value(struct ber_element *v, struct ber_element *sub)
return 1; /* no match */
break;
default:
- log_warnx("invalid subfilter type %lu", type);
+ log_warnx("invalid subfilter type %u", type);
return -1;
}
}
diff --git a/usr.sbin/ldapd/ldapd.h b/usr.sbin/ldapd/ldapd.h
index f6249594537..3f995d184b4 100644
--- a/usr.sbin/ldapd/ldapd.h
+++ b/usr.sbin/ldapd/ldapd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapd.h,v 1.30 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: ldapd.h,v 1.31 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -82,7 +82,7 @@ SIMPLEQ_HEAD(acl, aci);
*/
struct request {
TAILQ_ENTRY(request) next;
- unsigned long type;
+ unsigned int type;
long long msgid;
struct ber_element *root;
struct ber_element *op;
@@ -365,7 +365,7 @@ int ldap_compare(struct request *req);
int ldap_extended(struct request *req);
void send_ldap_result(struct conn *conn, int msgid,
- unsigned long type, long long result_code);
+ unsigned int type, long long result_code);
int ldap_respond(struct request *req, int code);
int ldap_refer(struct request *req, const char *basedn,
struct search *search, struct referrals *refs);
diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c
index 0bdb6191ed4..1d852f1ff7c 100644
--- a/usr.sbin/ldapd/ldape.c
+++ b/usr.sbin/ldapd/ldape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldape.c,v 1.28 2018/07/04 10:05:56 rob Exp $ */
+/* $OpenBSD: ldape.c,v 1.29 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -42,7 +42,7 @@ static void ldape_needfd(struct imsgev *iev);
int ldap_starttls(struct request *req);
void send_ldap_extended_response(struct conn *conn,
- int msgid, unsigned long type,
+ int msgid, unsigned int type,
long long result_code,
const char *extended_oid);
@@ -69,14 +69,14 @@ ldape_sig_handler(int sig, short why, void *data)
}
void
-send_ldap_extended_response(struct conn *conn, int msgid, unsigned long type,
+send_ldap_extended_response(struct conn *conn, int msgid, unsigned int type,
long long result_code, const char *extended_oid)
{
int rc;
struct ber_element *root, *elm;
void *buf;
- log_debug("sending response %lu with result %lld", type, result_code);
+ log_debug("sending response %u with result %lld", type, result_code);
if ((root = ber_add_sequence(NULL)) == NULL)
goto fail;
@@ -116,7 +116,7 @@ ldap_refer(struct request *req, const char *basedn, struct search *search,
struct ber_element *root, *elm, *ref_root = NULL;
struct referral *ref;
long long result_code = LDAP_REFERRAL;
- unsigned long type;
+ unsigned int type;
int rc;
void *buf;
char *url, *scope_str = NULL;
@@ -133,7 +133,7 @@ ldap_refer(struct request *req, const char *basedn, struct search *search,
scope_str = "sub";
}
- log_debug("sending referral in response %lu on msgid %lld",
+ log_debug("sending referral in response %u on msgid %lld",
type, req->msgid);
if ((root = ber_add_sequence(NULL)) == NULL)
@@ -189,7 +189,7 @@ fail:
}
void
-send_ldap_result(struct conn *conn, int msgid, unsigned long type,
+send_ldap_result(struct conn *conn, int msgid, unsigned int type,
long long result_code)
{
send_ldap_extended_response(conn, msgid, type, result_code, NULL);
diff --git a/usr.sbin/ldapd/logmsg.c b/usr.sbin/ldapd/logmsg.c
index 4fe2e0f8ba6..ccf7d54a3de 100644
--- a/usr.sbin/ldapd/logmsg.c
+++ b/usr.sbin/ldapd/logmsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logmsg.c,v 1.2 2018/05/15 11:19:21 reyk Exp $ */
+/* $OpenBSD: logmsg.c,v 1.3 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -208,7 +208,7 @@ ldap_debug_elements(struct ber_element *root, int context, const char *fmt, ...)
break;
case BER_CLASS_PRIVATE:
fprintf(stderr, "class: private(%u) type: ", root->be_class);
- fprintf(stderr, "encoding (%lu) type: ", root->be_encoding);
+ fprintf(stderr, "encoding (%u) type: ", root->be_encoding);
break;
case BER_CLASS_CONTEXT:
fprintf(stderr, "class: context(%u) type: ", root->be_class);
@@ -257,7 +257,7 @@ ldap_debug_elements(struct ber_element *root, int context, const char *fmt, ...)
fprintf(stderr, "class: <INVALID>(%u) type: ", root->be_class);
break;
}
- fprintf(stderr, "(%lu) encoding %lu ",
+ fprintf(stderr, "(%u) encoding %u ",
root->be_type, root->be_encoding);
if (constructed)
diff --git a/usr.sbin/ldapd/search.c b/usr.sbin/ldapd/search.c
index d583c89d6ce..85b3d2d2b86 100644
--- a/usr.sbin/ldapd/search.c
+++ b/usr.sbin/ldapd/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.22 2018/05/18 12:36:30 reyk Exp $ */
+/* $OpenBSD: search.c,v 1.23 2018/07/31 11:01:00 claudio Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -140,7 +140,7 @@ search_result(const char *dn, size_t dnlen, struct ber_element *attrs,
}
elm = ber_printf_elements(root, "i{txe", search->req->msgid,
- BER_CLASS_APP, (unsigned long)LDAP_RES_SEARCH_ENTRY,
+ BER_CLASS_APP, LDAP_RES_SEARCH_ENTRY,
dn, dnlen, filtered_attrs);
if (elm == NULL)
goto fail;
@@ -678,7 +678,7 @@ static struct plan *
search_planner(struct namespace *ns, struct ber_element *filter)
{
int class;
- unsigned long type;
+ unsigned int type;
char *s, *attr;
struct ber_element *elm;
struct index *indx;
@@ -815,7 +815,7 @@ search_planner(struct namespace *ns, struct ber_element *filter)
break;
default:
- log_warnx("filter type %lu not implemented", filter->be_type);
+ log_warnx("filter type %u not implemented", filter->be_type);
plan->undefined = 1;
break;
}
diff --git a/usr.sbin/snmpd/ber.3 b/usr.sbin/snmpd/ber.3
index e2173bc6030..8de49f06e28 100644
--- a/usr.sbin/snmpd/ber.3
+++ b/usr.sbin/snmpd/ber.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ber.3,v 1.16 2018/06/29 20:28:11 jmc Exp $
+.\" $OpenBSD: ber.3,v 1.17 2018/07/31 11:01:29 claudio Exp $
.\"
.\" Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 29 2018 $
+.Dd $Mdocdate: July 31 2018 $
.Dt BER 3
.Os
.Sh NAME
@@ -65,9 +65,9 @@
.Sh SYNOPSIS
.Fd #include <ber.h>
.Ft "struct ber_element *"
-.Fn "ber_get_element" "unsigned long encoding"
+.Fn "ber_get_element" "unsigned int encoding"
.Ft "void"
-.Fn "ber_set_header" "struct ber_element *elm" "int class" "unsigned long type"
+.Fn "ber_set_header" "struct ber_element *elm" "int class" "unsigned int type"
.Ft "void"
.Fn "ber_link_elements" "struct ber_element *prev" "struct ber_element *elm"
.Ft "struct ber_element *"
@@ -145,7 +145,7 @@
.Ft "size_t"
.Fn "ber_calc_len" "struct ber_element *root"
.Ft "void"
-.Fn "ber_set_application" "struct ber *ber" "unsigned long (*cb)(struct ber_element *)"
+.Fn "ber_set_application" "struct ber *ber" "unsigned int (*cb)(struct ber_element *)"
.Ft "void"
.Fn "ber_set_writecallback" "struct ber_element *elm" "void (*cb)(void *arg, size_t offs)" "void *arg"
.Ft "void"
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c
index 1eb78b024c6..1cedb4d5bf7 100644
--- a/usr.sbin/snmpd/ber.c
+++ b/usr.sbin/snmpd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.43 2018/07/13 08:50:38 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.44 2018/07/31 11:01:29 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -42,7 +42,7 @@ static int ber_dump_element(struct ber *ber, struct ber_element *root);
static void ber_dump_header(struct ber *ber, struct ber_element *root);
static void ber_putc(struct ber *ber, u_char c);
static void ber_write(struct ber *ber, void *buf, size_t len);
-static ssize_t get_id(struct ber *b, unsigned long *tag, int *class,
+static ssize_t get_id(struct ber *b, unsigned int *tag, int *class,
int *cstruct);
static ssize_t get_len(struct ber *b, ssize_t *len);
static ssize_t ber_read_element(struct ber *ber, struct ber_element *elm);
@@ -56,7 +56,7 @@ static ssize_t ber_read(struct ber *ber, void *buf, size_t len);
#endif
struct ber_element *
-ber_get_element(unsigned long encoding)
+ber_get_element(unsigned int encoding)
{
struct ber_element *elm;
@@ -70,7 +70,7 @@ ber_get_element(unsigned long encoding)
}
void
-ber_set_header(struct ber_element *elm, int class, unsigned long type)
+ber_set_header(struct ber_element *elm, int class, unsigned int type)
{
elm->be_class = class & BER_CLASS_MASK;
if (type == BER_TYPE_DEFAULT)
@@ -521,7 +521,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
va_list ap;
int d, class;
size_t len;
- unsigned long type;
+ unsigned int type;
long long i;
char *s;
void *p;
@@ -578,7 +578,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
class = va_arg(ap, int);
- type = va_arg(ap, unsigned long);
+ type = va_arg(ap, unsigned int);
ber_set_header(ber, class, type);
break;
case 'x':
@@ -626,7 +626,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
#define _MAX_SEQ 128
va_list ap;
int *d, level = -1;
- unsigned long *t;
+ unsigned int *t;
long long *i, l;
void **ptr;
size_t *len, ret = 0, n = strlen(fmt);
@@ -694,7 +694,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
d = va_arg(ap, int *);
- t = va_arg(ap, unsigned long *);
+ t = va_arg(ap, unsigned int *);
*d = ber->be_class;
*t = ber->be_type;
ret++;
@@ -867,7 +867,7 @@ ber_free_elements(struct ber_element *root)
size_t
ber_calc_len(struct ber_element *root)
{
- unsigned long t;
+ unsigned int t;
size_t s;
size_t size = 2; /* minimum 1 byte head and 1 byte size */
@@ -945,8 +945,8 @@ ber_dump_element(struct ber *ber, struct ber_element *root)
static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
- u_char id = 0, t, buf[8];
- unsigned long type;
+ u_char id = 0, t, buf[5];
+ unsigned int type;
size_t size;
/* class universal, type encoding depending on type value */
@@ -1010,11 +1010,11 @@ ber_write(struct ber *ber, void *buf, size_t len)
* extract a BER encoded tag. There are two types, a short and long form.
*/
static ssize_t
-get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
+get_id(struct ber *b, unsigned int *tag, int *class, int *cstruct)
{
u_char u;
size_t i = 0;
- unsigned long t = 0;
+ unsigned int t = 0;
if (ber_getc(b, &u) == -1)
return -1;
@@ -1032,7 +1032,7 @@ get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
return -1;
t = (t << 7) | (u & ~BER_TAG_MORE);
i++;
- if (i > sizeof(unsigned long)) {
+ if (i > sizeof(unsigned int)) {
errno = ERANGE;
return -1;
}
@@ -1093,7 +1093,7 @@ ber_read_element(struct ber *ber, struct ber_element *elm)
{
long long val = 0;
struct ber_element *next;
- unsigned long type;
+ unsigned int type;
int i, class, cstruct;
ssize_t len, r, totlen = 0;
u_char c;
@@ -1221,7 +1221,7 @@ ber_get_writebuf(struct ber *b, void **buf)
}
void
-ber_set_application(struct ber *b, unsigned long (*cb)(struct ber_element *))
+ber_set_application(struct ber *b, unsigned int (*cb)(struct ber_element *))
{
b->br_application = cb;
}
diff --git a/usr.sbin/snmpd/ber.h b/usr.sbin/snmpd/ber.h
index 4a8f194f4a7..e8865849a30 100644
--- a/usr.sbin/snmpd/ber.h
+++ b/usr.sbin/snmpd/ber.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.h,v 1.11 2018/06/29 19:28:02 rob Exp $ */
+/* $OpenBSD: ber.h,v 1.12 2018/07/31 11:01:29 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -22,8 +22,8 @@
struct ber_element {
struct ber_element *be_next;
- unsigned long be_type;
- unsigned long be_encoding;
+ unsigned int be_type;
+ unsigned int be_encoding;
size_t be_len;
off_t be_offs;
int be_free;
@@ -49,11 +49,11 @@ struct ber {
u_char *br_rptr;
u_char *br_rend;
- unsigned long (*br_application)(struct ber_element *);
+ unsigned int (*br_application)(struct ber_element *);
};
/* well-known ber_element types */
-#define BER_TYPE_DEFAULT ((unsigned long)-1)
+#define BER_TYPE_DEFAULT ((unsigned int)-1)
#define BER_TYPE_EOC 0
#define BER_TYPE_BOOLEAN 1
#define BER_TYPE_INTEGER 2
@@ -84,9 +84,9 @@ struct ber_oid {
};
__BEGIN_DECLS
-struct ber_element *ber_get_element(unsigned long);
+struct ber_element *ber_get_element(unsigned int);
void ber_set_header(struct ber_element *, int,
- unsigned long);
+ unsigned int);
void ber_link_elements(struct ber_element *,
struct ber_element *);
struct ber_element *ber_unlink_elements(struct ber_element *);
@@ -131,7 +131,7 @@ void ber_free_element(struct ber_element *);
void ber_free_elements(struct ber_element *);
size_t ber_calc_len(struct ber_element *);
void ber_set_application(struct ber *,
- unsigned long (*)(struct ber_element *));
+ unsigned int (*)(struct ber_element *));
void ber_set_writecallback(struct ber_element *,
void (*)(void *, size_t), void *);
void ber_free(struct ber *);
diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c
index 0e951d0ef5e..676e8ff2fb5 100644
--- a/usr.sbin/snmpd/smi.c
+++ b/usr.sbin/snmpd/smi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smi.c,v 1.21 2018/07/23 19:51:39 rob Exp $ */
+/* $OpenBSD: smi.c,v 1.22 2018/07/31 11:01:29 claudio Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -537,7 +537,7 @@ smi_print_element(struct ber_element *root)
return (NULL);
}
-unsigned long
+unsigned int
smi_application(struct ber_element *elm)
{
if (elm->be_class != BER_CLASS_APPLICATION)
diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h
index 6d93ac66144..945da0bdc42 100644
--- a/usr.sbin/snmpd/snmpd.h
+++ b/usr.sbin/snmpd/snmpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpd.h,v 1.78 2018/04/15 11:57:29 mpf Exp $ */
+/* $OpenBSD: snmpd.h,v 1.79 2018/07/31 11:01:29 claudio Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -736,7 +736,7 @@ void smi_delete(struct oid *);
int smi_insert(struct oid *);
int smi_oid_cmp(struct oid *, struct oid *);
int smi_key_cmp(struct oid *, struct oid *);
-unsigned long smi_application(struct ber_element *);
+unsigned int smi_application(struct ber_element *);
void smi_debug_elements(struct ber_element *);
char *smi_print_element(struct ber_element *);
diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c
index b1e4f60c60e..97503f46a12 100644
--- a/usr.sbin/snmpd/snmpe.c
+++ b/usr.sbin/snmpd/snmpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpe.c,v 1.53 2018/07/24 01:31:20 rob Exp $ */
+/* $OpenBSD: snmpe.c,v 1.54 2018/07/31 11:01:29 claudio Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -222,7 +222,7 @@ snmpe_parse(struct snmp_message *msg)
struct ber_element *a;
long long ver, req;
long long errval, erridx;
- unsigned long type;
+ unsigned int type;
u_int class;
char *comn;
char *flagstr, *ctxname;
diff --git a/usr.sbin/ypldap/aldap.c b/usr.sbin/ypldap/aldap.c
index bf3a7833539..d54a0ac27e6 100644
--- a/usr.sbin/ypldap/aldap.c
+++ b/usr.sbin/ypldap/aldap.c
@@ -1,5 +1,5 @@
-/* $Id: aldap.c,v 1.40 2018/06/21 10:37:00 reyk Exp $ */
-/* $OpenBSD: aldap.c,v 1.40 2018/06/21 10:37:00 reyk Exp $ */
+/* $Id: aldap.c,v 1.41 2018/07/31 11:00:12 claudio Exp $ */
+/* $OpenBSD: aldap.c,v 1.41 2018/07/31 11:00:12 claudio Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -47,7 +47,7 @@ int aldap_create_page_control(struct ber_element *,
int, struct aldap_page_control *);
int aldap_send(struct aldap *,
struct ber_element *);
-unsigned long aldap_application(struct ber_element *);
+unsigned int aldap_application(struct ber_element *);
#ifdef DEBUG
void ldap_debug_elements(struct ber_element *);
@@ -61,7 +61,7 @@ void ldap_debug_elements(struct ber_element *);
#define LDAP_DEBUG(x, y) do { } while (0)
#endif
-unsigned long
+unsigned int
aldap_application(struct ber_element *elm)
{
return BER_TYPE_OCTETSTRING;
@@ -168,8 +168,7 @@ aldap_req_starttls(struct aldap *ldap)
goto fail;
ber = ber_printf_elements(root, "d{tst", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long) LDAP_REQ_EXTENDED, LDAP_STARTTLS_OID,
- BER_CLASS_CONTEXT, (unsigned long) 0);
+ LDAP_REQ_EXTENDED, LDAP_STARTTLS_OID, BER_CLASS_CONTEXT, 0);
if (ber == NULL) {
ldap->err = ALDAP_ERR_OPERATION_FAILED;
goto fail;
@@ -201,8 +200,8 @@ aldap_bind(struct aldap *ldap, char *binddn, char *bindcred)
goto fail;
elm = ber_printf_elements(root, "d{tdsst", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long)LDAP_REQ_BIND, VERSION, binddn, bindcred,
- BER_CLASS_CONTEXT, (unsigned long)LDAP_AUTH_SIMPLE);
+ LDAP_REQ_BIND, VERSION, binddn, bindcred,
+ BER_CLASS_CONTEXT, LDAP_AUTH_SIMPLE);
if (elm == NULL)
goto fail;
@@ -261,7 +260,7 @@ aldap_search(struct aldap *ldap, char *basedn, enum scope scope, char *filter,
goto fail;
ber = ber_printf_elements(root, "d{t", ++ldap->msgid, BER_CLASS_APP,
- (unsigned long) LDAP_REQ_SEARCH);
+ LDAP_REQ_SEARCH);
if (ber == NULL) {
ldap->err = ALDAP_ERR_OPERATION_FAILED;
goto fail;
@@ -350,7 +349,7 @@ struct aldap_message *
aldap_parse(struct aldap *ldap)
{
int class;
- unsigned long type;
+ unsigned int type;
long long msgid = 0;
struct aldap_message *m;
struct ber_element *a = NULL, *ep;
diff --git a/usr.sbin/ypldap/ber.c b/usr.sbin/ypldap/ber.c
index 4db5645cb0e..81bf6328214 100644
--- a/usr.sbin/ypldap/ber.c
+++ b/usr.sbin/ypldap/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.26 2018/07/13 08:50:38 rob Exp $ */
+/* $OpenBSD: ber.c,v 1.27 2018/07/31 11:00:12 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -42,7 +42,7 @@ static int ber_dump_element(struct ber *ber, struct ber_element *root);
static void ber_dump_header(struct ber *ber, struct ber_element *root);
static void ber_putc(struct ber *ber, u_char c);
static void ber_write(struct ber *ber, void *buf, size_t len);
-static ssize_t get_id(struct ber *b, unsigned long *tag, int *class,
+static ssize_t get_id(struct ber *b, unsigned int *tag, int *class,
int *cstruct);
static ssize_t get_len(struct ber *b, ssize_t *len);
static ssize_t ber_read_element(struct ber *ber, struct ber_element *elm);
@@ -56,7 +56,7 @@ static ssize_t ber_read(struct ber *ber, void *buf, size_t len);
#endif
struct ber_element *
-ber_get_element(unsigned long encoding)
+ber_get_element(unsigned int encoding)
{
struct ber_element *elm;
@@ -70,7 +70,7 @@ ber_get_element(unsigned long encoding)
}
void
-ber_set_header(struct ber_element *elm, int class, unsigned long type)
+ber_set_header(struct ber_element *elm, int class, unsigned int type)
{
elm->be_class = class & BER_CLASS_MASK;
if (type == BER_TYPE_DEFAULT)
@@ -521,7 +521,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
va_list ap;
int d, class;
size_t len;
- unsigned long type;
+ unsigned int type;
long long i;
char *s;
void *p;
@@ -578,7 +578,7 @@ ber_printf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
class = va_arg(ap, int);
- type = va_arg(ap, unsigned long);
+ type = va_arg(ap, unsigned int);
ber_set_header(ber, class, type);
break;
case 'x':
@@ -626,7 +626,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
#define _MAX_SEQ 128
va_list ap;
int *d, level = -1;
- unsigned long *t;
+ unsigned int *t;
long long *i, l;
void **ptr;
size_t *len, ret = 0, n = strlen(fmt);
@@ -694,7 +694,7 @@ ber_scanf_elements(struct ber_element *ber, char *fmt, ...)
break;
case 't':
d = va_arg(ap, int *);
- t = va_arg(ap, unsigned long *);
+ t = va_arg(ap, unsigned int *);
*d = ber->be_class;
*t = ber->be_type;
ret++;
@@ -867,7 +867,7 @@ ber_free_elements(struct ber_element *root)
size_t
ber_calc_len(struct ber_element *root)
{
- unsigned long t;
+ unsigned int t;
size_t s;
size_t size = 2; /* minimum 1 byte head and 1 byte size */
@@ -945,8 +945,8 @@ ber_dump_element(struct ber *ber, struct ber_element *root)
static void
ber_dump_header(struct ber *ber, struct ber_element *root)
{
- u_char id = 0, t, buf[8];
- unsigned long type;
+ u_char id = 0, t, buf[5];
+ unsigned int type;
size_t size;
/* class universal, type encoding depending on type value */
@@ -1010,11 +1010,11 @@ ber_write(struct ber *ber, void *buf, size_t len)
* extract a BER encoded tag. There are two types, a short and long form.
*/
static ssize_t
-get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
+get_id(struct ber *b, unsigned int *tag, int *class, int *cstruct)
{
u_char u;
size_t i = 0;
- unsigned long t = 0;
+ unsigned int t = 0;
if (ber_getc(b, &u) == -1)
return -1;
@@ -1032,7 +1032,7 @@ get_id(struct ber *b, unsigned long *tag, int *class, int *cstruct)
return -1;
t = (t << 7) | (u & ~BER_TAG_MORE);
i++;
- if (i > sizeof(unsigned long)) {
+ if (i > sizeof(unsigned int)) {
errno = ERANGE;
return -1;
}
@@ -1093,7 +1093,7 @@ ber_read_element(struct ber *ber, struct ber_element *elm)
{
long long val = 0;
struct ber_element *next;
- unsigned long type;
+ unsigned int type;
int i, class, cstruct;
ssize_t len, r, totlen = 0;
u_char c;
@@ -1221,7 +1221,7 @@ ber_get_writebuf(struct ber *b, void **buf)
}
void
-ber_set_application(struct ber *b, unsigned long (*cb)(struct ber_element *))
+ber_set_application(struct ber *b, unsigned int (*cb)(struct ber_element *))
{
b->br_application = cb;
}
diff --git a/usr.sbin/ypldap/ber.h b/usr.sbin/ypldap/ber.h
index 95932649f1e..55e6cd44eb2 100644
--- a/usr.sbin/ypldap/ber.h
+++ b/usr.sbin/ypldap/ber.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.h,v 1.6 2018/07/03 18:49:10 rob Exp $ */
+/* $OpenBSD: ber.h,v 1.7 2018/07/31 11:00:12 claudio Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -22,8 +22,8 @@
struct ber_element {
struct ber_element *be_next;
- unsigned long be_type;
- unsigned long be_encoding;
+ unsigned int be_type;
+ unsigned int be_encoding;
size_t be_len;
off_t be_offs;
int be_free;
@@ -49,11 +49,11 @@ struct ber {
u_char *br_rptr;
u_char *br_rend;
- unsigned long (*br_application)(struct ber_element *);
+ unsigned int (*br_application)(struct ber_element *);
};
/* well-known ber_element types */
-#define BER_TYPE_DEFAULT ((unsigned long)-1)
+#define BER_TYPE_DEFAULT ((unsigned int)-1)
#define BER_TYPE_EOC 0
#define BER_TYPE_BOOLEAN 1
#define BER_TYPE_INTEGER 2
@@ -84,9 +84,9 @@ struct ber_oid {
};
__BEGIN_DECLS
-struct ber_element *ber_get_element(unsigned long);
+struct ber_element *ber_get_element(unsigned int);
void ber_set_header(struct ber_element *, int,
- unsigned long);
+ unsigned int);
void ber_link_elements(struct ber_element *,
struct ber_element *);
struct ber_element *ber_unlink_elements(struct ber_element *);
@@ -131,7 +131,7 @@ void ber_free_element(struct ber_element *);
void ber_free_elements(struct ber_element *);
size_t ber_calc_len(struct ber_element *);
void ber_set_application(struct ber *,
- unsigned long (*)(struct ber_element *));
+ unsigned int (*)(struct ber_element *));
void ber_set_writecallback(struct ber_element *,
void (*)(void *, size_t), void *);
void ber_free(struct ber *);