OpenBSD CVS

CVS log for src/usr.sbin/ldapd/Attic/ber.c


[BACK] Up to [local] / src / usr.sbin / ldapd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.33, Sat May 11 17:46:02 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
CVS Tags: HEAD
Changes since 1.32: +1 -1 lines
FILE REMOVED

The BER API is currently used by ldap, ldapd, ldapctl, ypldap, snmpd, and
snmpctl. Separate copies of ber.[ch] have existed and been maintained in sync
in ldap, ldapd, ypldap and snmpd.

This commit moves the BER API into /usr/lib/libutil. All current consumers
already link libutil. ldapd and snmpd regress passes, and release builds.

With help from tb@ and guenther@.

ok deraadt@, tb@

Revision 1.32 / (download) - annotate - [select for diffs], Sat Apr 27 14:58:14 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.31: +4 -3 lines
Diff to previous 1.31 (colored)

Only apply sign extension when less than eight bytes have been consumed. This
fixes a problem when handling large negative integers.

ok claudio@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Nov 27 12:09:38 2018 UTC (5 years, 6 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.30: +23 -1 lines
Diff to previous 1.30 (colored)

Sync with ldap(1)

Revision 1.30 / (download) - annotate - [select for diffs], Tue Nov 20 07:20:21 2018 UTC (5 years, 6 months ago) by martijn
Branch: MAIN
Changes since 1.29: +3 -1 lines
Diff to previous 1.29 (colored)

Fix when ber_free_elements is called with a NULL-value.
Found via snmpctl snmp walk 127.0.0.1 oid 1

OK claudio@

Revision 1.29 / (download) - annotate - [select for diffs], Sun Aug 12 22:04:09 2018 UTC (5 years, 9 months ago) by rob
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Change ber_write_elements() to return ssize_t instead of int.

ok claudio@

Revision 1.28 / (download) - annotate - [select for diffs], Fri Aug 3 01:51:28 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.27: +11 -2 lines
Diff to previous 1.27 (colored)

Place a limit on the number of elements in a ber sequence/set. This prevents
possible stack overflow due to recursion in ber_free_elements().

ok claudio@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jul 31 19:38:09 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.26: +63 -63 lines
Diff to previous 1.26 (colored)

Relocate some public functions above the internal functions comment.

ok claudio@

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jul 31 11:37:18 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Fix some debugging output now that ber type and encoding are unsigned int.

ok claudio@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jul 31 11:01:00 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.24: +16 -16 lines
Diff to previous 1.24 (colored)

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@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jul 13 08:50:38 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.23: +5 -5 lines
Diff to previous 1.23 (colored)

Fix some comments referencing sockets which are not used by the ber api. The
api uses read and write buffers (byte streams) that are utilized by calling
applications which may or may not use sockets.

ok claudio@

buffer byte streams that applications then use for

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jul 13 08:30:10 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.22: +5 -6 lines
Diff to previous 1.22 (colored)

Fix loop condition in ber.c. Discussed with claudio.

ok claudio@, jca@

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jul 9 09:21:26 2018 UTC (5 years, 11 months ago) by jca
Branch: MAIN
Changes since 1.21: +16 -36 lines
Diff to previous 1.21 (colored)

Simplify ber_read()

After the removal of fd-based read/writes I could have trimmed the code
further.

- no socket-based reads so ber_read() doesn't need to loop until it gets
the desired amount of data
- return either the requested amount of data or -1/ECANCELED, the caller
shouldn't have to handle partial reads itself
- inline ber_readbuf() into ber_read()

ok rob@ claudio@ tb@

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jul 4 15:21:24 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.20: +2 -4 lines
Diff to previous 1.20 (colored)

More whitespace.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jul 4 13:31:57 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Cleanup some whitespace.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Jul 4 13:04:30 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.18: +4 -8 lines
Diff to previous 1.18 (colored)

Relocate the update of br_offs from ber_read() to ber_readbuf() so ber_getc()
can call ber_readbuf() in all cases. This resolves a problem previously
encountered with SNMPv3 authentication, simplifies the code, and completes a
full synchronization of all ber instances.

Proposed by claudio@. Problematic use case in snmpd tested by sthen@ and me.
ldap(s) appear happy as well.

looks good to claudio@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jul 3 18:49:10 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.17: +62 -3 lines
Diff to previous 1.17 (colored)

Synchronize ber changes from the snmpd instance to ldap, ldapd, and ypldap.

See usr.sbin/snmpd/ber.c revision 1.24 commit log for a summary of these
changes (e.g. SNMPv2 traps, User-based Security Model, callback for USM HMAC
calculations).

There is one final ber piece to copy from the snmpd instance related to
ber_getc() which will be done in a separate diff.

"looks good to me" deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Sun Jul 1 20:03:48 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

s/constructive/constructed in DPRINTF output.

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jun 29 18:28:42 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Consistent use of copyright notices.

Ok reyk@

Revision 1.15 / (download) - annotate - [select for diffs], Fri Jun 29 15:18:03 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

Synchronize ber.c and ber.h across ldap, ldapd, and ypldap, and reduce diff
with snmpd. More tweaks to come once things are fully synchronized.

Feedback from claudio and Robert Klein.

Ok claudio@

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jun 27 13:22:17 2018 UTC (5 years, 11 months ago) by rob
Branch: MAIN
Changes since 1.13: +3 -2 lines
Diff to previous 1.13 (colored)

Synchronize correct processing of BER_TYPE_EOC. Fixes support for empty LDAP
passwords. A similar fix was applied to snmpd in 2010 (rev 1.23).

Pointers from Reyk.

Ok claudio@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Feb 8 18:02:06 2018 UTC (6 years, 4 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.12: +7 -33 lines
Diff to previous 1.12 (colored)

Kill ber.c support for direct fd read/writes

This mechanism is already unused and annotated with lots of XXX's, no
need to keep it around.  ok claudio@

Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 11 20:40:03 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.11: +14 -1 lines
Diff to previous 1.11 (colored)

Correct handling of requests to delete individual attribute values.

reported by ZHANG Huangbin (zhb (at) iredmail.org)
fix by Robert Klein (roklein (at) roklein.de)

Revision 1.11 / (download) - annotate - [select for diffs], Thu Dec 24 17:47:57 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.10: +4 -4 lines
Diff to previous 1.10 (colored)

bzero -> memset. No binary change.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Dec 10 18:40:46 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
Changes since 1.9: +2 -3 lines
Diff to previous 1.9 (colored)

Remove NULL-checks before free(). ok tb@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Dec 5 16:26:45 2015 UTC (8 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

#include <string.h> not strings.h

Revision 1.8 / (download) - annotate - [select for diffs], Thu Feb 12 00:30:38 2015 UTC (9 years, 3 months ago) by pelikan
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.7: +31 -14 lines
Diff to previous 1.7 (colored)

ber_printf_elements should return NULL if any of its parts fail.

Leave the error handling up to its callers.

ok reyk

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jan 16 16:04:38 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

change to <limits.h> universe.  The only changes in the binary are due
to the heavy use of assert.
ok millert

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jan 8 19:42:45 2011 UTC (13 years, 5 months ago) by martinh
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.5: +7 -7 lines
Diff to previous 1.5 (colored)

Change detection of indefinite BER lenghts (which is not allowed). Only a
length byte of 0x80 is now treated as meaning indefinite. This fixes empty
sets sent by the winldap api. Makes authentication through pGina work.

with william@

Revision 1.5 / (download) - annotate - [select for diffs], Tue Oct 19 09:20:48 2010 UTC (13 years, 7 months ago) by martinh
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

When checking if the input buffer is large enough to hold an LDAP request,
compare with available space, not the total space. This fixes rejection of
messages when there are multiple requests queued in the input buffer.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jul 1 04:21:41 2010 UTC (13 years, 11 months ago) by martinh
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.3: +8 -1 lines
Diff to previous 1.3 (colored)

If the length of an element being read is larger than what is available in
the buffer, return immediately. This fixes reading large messages, and
allows bad requests to be cancelled earlier.

Originally from Alexander Schrijver, tweaked by me.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jun 8 17:52:47 2010 UTC (14 years ago) by martinh
Branch: MAIN
Changes since 1.2: +5 -5 lines
Diff to previous 1.2 (colored)

ber_calc_len() is not an internal function, so adjust the comment.

from Dawe

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jun 5 15:27:35 2010 UTC (14 years ago) by martinh
Branch: MAIN
Changes since 1.1: +9 -5 lines
Diff to previous 1.1 (colored)

Minimize changes against the ber.c in snmpd and ypldap. This also fixes an
erroneous protocol error return in ldap_extended(), which prevented
StartTLS from working.

Revision 1.1 / (download) - annotate - [select for diffs], Mon May 31 17:36:31 2010 UTC (14 years ago) by martinh
Branch: MAIN

Initial import of ldapd, a small LDAP daemon. Work in progress.

ok deraadt@ jacekm@ gilles@ back@ henning@ blambert@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.