OpenBSD CVS

CVS log for src/lib/libutil/ber.c


[BACK] Up to [local] / src / lib / libutil

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.26 / (download) - annotate - [select for diffs], Fri Nov 10 12:12:02 2023 UTC (7 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.25: +24 -8 lines
Diff to previous 1.25 (colored)

Give ober_printf_elements() a ber_element array, similar to
ober_scanf_elements(). This allows us to move down and back up multiple
levels in with nested sequences and sets.

While here, on failure, make sure we free (and unlink if needed) all
elements we created.

OK claudio@, tb@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Aug 22 12:50:27 2023 UTC (9 months, 2 weeks ago) by gerhard
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

Don't fail in ober_scanf_elements() when encountering empty sequences.

Ok martijn@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Nov 3 17:58:10 2022 UTC (19 months, 1 week ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.23: +13 -5 lines
Diff to previous 1.23 (colored)

When decoding a sequence/set, make sure that:
- We don't create an uninitialized element when there are no subelements to
  decode
- If subelements overflow we return EINVAL

While here fix an eyesore of a line continuation.

OK claudio@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Oct 21 08:17:33 2021 UTC (2 years, 7 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.22: +12 -17 lines
Diff to previous 1.22 (colored)

Sync ober_oid_cmp with ax_oid_cmp from libagentx.
This flips the returned signedness and adds the weight of 2 for
parent-child relationship in both direction.

This makes ober_oid_cmp consistent with the rest of the *_cmp based
functions.

OK tb@

Revision 1.22 / (download) - annotate - [select for diffs], Sun Aug 29 13:27:11 2021 UTC (2 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.21: +38 -1 lines
Diff to previous 1.21 (colored)

Add ober_dup. Needed for upcoming SNMPv3 support for trap receiver in
snmpd(8).

OK jmatthew@
OK deraadt@ for bumping libutil now.

Revision 1.21 / (download) - annotate - [select for diffs], Mon Feb 22 17:15:02 2021 UTC (3 years, 3 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.20: +38 -14 lines
Diff to previous 1.20 (colored)

Make the ober_get_* set of function to accept a NULL-pointer.
This allows us to do ber-type checking inside ober_scanf_elements, which
will allow for stricter ASN.1 parsing in the future.

Manpage feedback and OK claudio@, jmc@
OK claudio@

Revision 1.20 / (download) - annotate - [select for diffs], Thu Jan 28 19:56:33 2021 UTC (3 years, 4 months ago) by martijn
Branch: MAIN
Changes since 1.19: +7 -2 lines
Diff to previous 1.19 (colored)

Add '$' to ober_scanf_elements().
This allows us to enforce end of sequence/set without having to manually
check be_next for NULL.

No lib bump needed according to millert@
OK millert@ rob@

Revision 1.19 / (download) - annotate - [select for diffs], Fri Jan 22 18:27:52 2021 UTC (3 years, 4 months ago) by rob
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

Gracefully handle any erroneous closing bracket/brace trailers in
ober_scanf_elements().

OK martijn@

Revision 1.18 / (download) - annotate - [select for diffs], Fri Jan 22 03:20:56 2021 UTC (3 years, 4 months ago) by rob
Branch: MAIN
Changes since 1.17: +5 -1 lines
Diff to previous 1.17 (colored)

Valid integer and enumerated types always have non-zero length. Perform
check to ensure we avoid a possible (undefined) negative shift. Found
with clang static analyzer.

Tweaked and OK martijn@

Revision 1.17 / (download) - annotate - [select for diffs], Thu Sep 3 19:09:57 2020 UTC (3 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.16: +4 -2 lines
Diff to previous 1.16 (colored)

Missed one case of errno not being set in previous.

double check and OK tb@

Revision 1.16 / (download) - annotate - [select for diffs], Thu Sep 3 17:01:15 2020 UTC (3 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.15: +10 -4 lines
Diff to previous 1.15 (colored)

Make sure ober_read_elements sets errno on every case where NULL is
returned.

OK deraadt@ tb@

Revision 1.14.2.1 / (download) - annotate - [select for diffs], Sun Oct 27 20:05:12 2019 UTC (4 years, 7 months ago) by tb
Branch: OPENBSD_6_6
Changes since 1.14: +152 -152 lines
Diff to previous 1.14 (colored) next main 1.15 (colored)

The ber_* namespace is used by liblber since time immemorial,
so move our BER API to the unused ober_* prefix to avoid some
breakage in ports.

Problem diagnosed by jmatthew with ber_free() in samba, but
there are many others as pointed out by sthen.

tests & ok rob
ok sthen (who had an almost identical diff for libutil)
"go head hit it" deraadt

OpenBSD 6.6 errata 002

Revision 1.15 / (download) - annotate - [select for diffs], Thu Oct 24 12:39:26 2019 UTC (4 years, 7 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.14: +152 -152 lines
Diff to previous 1.14 (colored)

The ber_* namespace is used by liblber since time immemorial,
so move our BER API to the unused ober_* prefix to avoid some
breakage in ports.

Problem diagnosed by jmatthew with ber_free() in samba, but
there are many others as pointed out by sthen.

tests & ok rob
ok sthen (who had an almost identical diff for libutil)
"go head hit it" deraadt

Revision 1.14 / (download) - annotate - [select for diffs], Thu Aug 15 06:11:18 2019 UTC (4 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Revert previous. There were some users of the quirky behaviour that were
missed during code scan.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Aug 14 17:20:41 2019 UTC (4 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Make ber_scanf_elements's 'e' attribute eat the element.
Right now all consumers use 'e' at the end of the list, so no regressions
should be introduced.

OK claudio@
Seems sensible to deraadt@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Aug 14 04:48:13 2019 UTC (4 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

Make sure that ber in ber_scanf_elements is not NULL before parsing format
where ber is utilized. This also allows us to remove the ber->be_next
check, which can cause weird behaviour, because a NULL be_next would result
in parsing the last element twice.

OK claudio@ on previous version
OK rob@

Revision 1.11 / (download) - annotate - [select for diffs], Mon Aug 5 12:38:14 2019 UTC (4 years, 10 months ago) by martijn
Branch: MAIN
Changes since 1.10: +17 -17 lines
Diff to previous 1.10 (colored)

Don't use a 0 element to determine the end of an OID when comparing two
OIDS. This can result in false equality matches.

OK claudio@

Revision 1.10 / (download) - annotate - [select for diffs], Mon Aug 5 12:30:50 2019 UTC (4 years, 10 months ago) by martijn
Branch: MAIN
Changes since 1.9: +1 -4 lines
Diff to previous 1.9 (colored)

There's no reason why the first digit of an OID can't be 0.

OK claudio@
"Good find" deraadt@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jun 1 19:40:05 2019 UTC (5 years ago) by rob
Branch: MAIN
Changes since 1.8: +5 -2 lines
Diff to previous 1.8 (colored)

Limit maximum number of length octets to platform independent sizeof(int32_t).

Problem noticed by bluhm@. Discussed on hackers.

ok claudio@

Revision 1.8 / (download) - annotate - [select for diffs], Tue May 21 13:29:44 2019 UTC (5 years ago) by rob
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

whitespace

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 16 21:12:33 2019 UTC (5 years ago) by rob
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Add XXX to a comment.

Revision 1.6 / (download) - annotate - [select for diffs], Sun May 12 20:25:10 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.5: +1 -2 lines
Diff to previous 1.5 (colored)

Enable support for the writting of BITSTRING by treating it as an OCTETSTRING.

ok claudio@

Revision 1.5 / (download) - annotate - [select for diffs], Sun May 12 20:13:08 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.4: +9 -2 lines
Diff to previous 1.4 (colored)

Enforce smallest number of contents octets for int (and enum).

ok claudio@

Revision 1.4 / (download) - annotate - [select for diffs], Sun May 12 18:11:51 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.3: +17 -1 lines
Diff to previous 1.3 (colored)

Fail early if a (universal) primitive type identifies as constructed, or if a
boolean has a contents length other than 1.

ok claudio@

Revision 1.3 / (download) - annotate - [select for diffs], Sun May 12 17:50:32 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.2: +8 -1 lines
Diff to previous 1.2 (colored)

Enforce minimal number of octets for tag > 30.

"sure" claudio@

Revision 1.2 / (download) - annotate - [select for diffs], Sun May 12 17:42:14 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN
Changes since 1.1: +7 -1 lines
Diff to previous 1.1 (colored)

In long form encoding, explicitly prohibit an initial length octet of 0xff
which is reserved for future use.

ok claudio@

Revision 1.1 / (download) - annotate - [select for diffs], Sat May 11 17:46:02 2019 UTC (5 years, 1 month ago) by rob
Branch: MAIN

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@

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.