History log of /openbsd-current/lib/libutil/shlib_version
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.36 12-Dec-2023 claudio

Extend imsg and ibuf API with useful getter methods

For ibufs:
- various getters for ibufs (ibuf_get* and ibuf_skip)
- additional ibuf set/add functions that don't alter byte order
- ibuf_truncate and ibuf_rewind
- ibuf_from_buffer and ibuf_from_ibuf to populate a reader ibuf
- a getter for the msgbuf queuelen

For imsg:
- various getters for imsg (especially imsg_get_data() which can be used
in most cases as a simple one call api with all error checks).
All the imsg.hdr fields can also be accessed by getters.
- The imsg data is now actually an ibuf but the old imsg.data pointer is
kept for now to not break every imsg application.
- Introduce imsg_forward to simply forward a message from one channel to
an other (used in the control socket code).

Since this requires a major bump take the oportunity to also cleanup some
function signatures to use size_t for length fields. Also internal data
structures are removed from the public header.

With and OK tb@


Revision tags: OPENBSD_7_4_BASE
# 1.35 19-Jun-2023 claudio

Improve the ibuf API by adding these functions:
Functions extending ibuf_add to work with more specific data types
ibuf_add_buf, ibuf_add_zero, ibuf_add_n8, ibuf_add_n16, ibuf_add_n32,
ibuf_add_n64
Functions replacing ibuf_seek where data at a specific offset is modified
ibuf_set, ibuf_set_n8, ibuf_set_n16, ibuf_set_n32, ibuf_set_n64
Functions to check, get and set the filedescriptor stored on the ibuf
ibuf_fd_avail, ibuf_fd_get, ibuf_fd_set
and ibuf_data() to access the data buffer, to be used together with ibuf_size()

On top of this add an optimized imsg_compose_ibuf() where an ibuf is wrapped
into an imsg in an efficent way.

Finally remove msgbuf_drain since it is not used by anything outside of
the ibuf code. Because of this removal bump the major of libutil.

Remove ibuf_data() in iked since the same function is now provided by libutil.
OK tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE
# 1.34 31-Oct-2021 tb

bump major after struct size change


Revision tags: OPENBSD_7_0_BASE
# 1.33 29-Aug-2021 martijn

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

OK jmatthew@
OK deraadt@ for bumping libutil now.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.32 31-Dec-2019 martijn

Increase BER_MAX_OID_LEN from 32 to 64. Not every snmp OID found in the
wild fits inside 32 elements, like UsmUserEntry objects.

OK rob@, claudio@


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.35 19-Jun-2023 claudio

Improve the ibuf API by adding these functions:
Functions extending ibuf_add to work with more specific data types
ibuf_add_buf, ibuf_add_zero, ibuf_add_n8, ibuf_add_n16, ibuf_add_n32,
ibuf_add_n64
Functions replacing ibuf_seek where data at a specific offset is modified
ibuf_set, ibuf_set_n8, ibuf_set_n16, ibuf_set_n32, ibuf_set_n64
Functions to check, get and set the filedescriptor stored on the ibuf
ibuf_fd_avail, ibuf_fd_get, ibuf_fd_set
and ibuf_data() to access the data buffer, to be used together with ibuf_size()

On top of this add an optimized imsg_compose_ibuf() where an ibuf is wrapped
into an imsg in an efficent way.

Finally remove msgbuf_drain since it is not used by anything outside of
the ibuf code. Because of this removal bump the major of libutil.

Remove ibuf_data() in iked since the same function is now provided by libutil.
OK tb@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE
# 1.34 31-Oct-2021 tb

bump major after struct size change


Revision tags: OPENBSD_7_0_BASE
# 1.33 29-Aug-2021 martijn

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

OK jmatthew@
OK deraadt@ for bumping libutil now.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.32 31-Dec-2019 martijn

Increase BER_MAX_OID_LEN from 32 to 64. Not every snmp OID found in the
wild fits inside 32 elements, like UsmUserEntry objects.

OK rob@, claudio@


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.34 31-Oct-2021 tb

bump major after struct size change


Revision tags: OPENBSD_7_0_BASE
# 1.33 29-Aug-2021 martijn

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

OK jmatthew@
OK deraadt@ for bumping libutil now.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.32 31-Dec-2019 martijn

Increase BER_MAX_OID_LEN from 32 to 64. Not every snmp OID found in the
wild fits inside 32 elements, like UsmUserEntry objects.

OK rob@, claudio@


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.33 29-Aug-2021 martijn

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

OK jmatthew@
OK deraadt@ for bumping libutil now.


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.32 31-Dec-2019 martijn

Increase BER_MAX_OID_LEN from 32 to 64. Not every snmp OID found in the
wild fits inside 32 elements, like UsmUserEntry objects.

OK rob@, claudio@


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.32 31-Dec-2019 martijn

Increase BER_MAX_OID_LEN from 32 to 64. Not every snmp OID found in the
wild fits inside 32 elements, like UsmUserEntry objects.

OK rob@, claudio@


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.31 24-Oct-2019 tb

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 tags: OPENBSD_6_6_BASE
# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.30 11-May-2019 rob

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 tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.29 14-Dec-2017 kettenis

Make a few internal symbols static and add a Symbols.map version script
to control which symbols are exported from the shared library.

ok guenther@, deraadt@, jca@


Revision tags: OPENBSD_6_2_BASE
# 1.28 20-Apr-2017 nicm

Add getptmfd(), fdopenpty(), fdforkpty() functions. These allow programs
to separate the open(/dev/ptm) from the ioctl(PTMGET) for privilege
separation or pledge().

Based on a diff from reyk@.

ok deraadt millert


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.27 12-May-2014 espie

move the ohash functions into libutil by popular demand.
It's not a standard interface, so it doesn't belong in libc.
I hate duplicating the code in client programs, so do beck@, kettenis@,
schwarze@, millert@, miod@... and they agree with libutil.


Revision tags: OPENBSD_5_5_BASE
# 1.26 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.25 03-Jun-2013 tedu

Add bcrypt_pbkdf, a password based key derivation function using bcrypt.
Technically, it's a slight variant of bcrypt better suited for use as a
pluggable hash with PKCS #5 PBKDF2.
ok djm
(also tweak pkcs5_pbkdf2() prototype to have consistent types.)


Revision tags: OPENBSD_5_3_BASE
# 1.24 06-Sep-2012 tedu

move pkcs5_pbkdf5 function to libutil so everybody can play with it
ok deraadt jsing matthew


Revision tags: OPENBSD_5_2_BASE
# 1.23 04-Jun-2012 deraadt

crank minor, since a symbol was added


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.22 16-Nov-2010 jsing

Crank minor due to the addition of isduid().


Revision tags: OPENBSD_4_8_BASE
# 1.21 26-May-2010 nicm

Move imsg into libutil and add a man page.

Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.20 13-Jul-2004 marc

errno changes, lib major version bumps, and general flag day
To build you must:
cd /usr/src && make obj && make includes
cd lib/libc && make depend && make && NOMAN=1 sudo make install
cd /usr/src && make build


# 1.19 20-Apr-2004 millert

Change pw_copy(3) to take a 3rd arguement, the existing passwd entry.
This allows an application to only update a password entry if it is
in the state it expects. Additionally, if the old passwd struct
is specified the new one may have a different pw_name field since
matching is done on the original. Adapted from FreeBSD.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.18 23-Jul-2003 deraadt

move junk (bad code, terrible APIs) to the only program that uses it;
millert ok


# 1.17 15-May-2003 ian

New: fmt_scaled() and scan_scaled() convert to and from "human readable"
or scaled numbers. fmt_scaled, and the format, based on Ken Stailey's
code for "df -h"; scan_scaled is new. Significantly commented on
and reworked by pjanzen@; other comments from millert@. OK pjanzen@.


Revision tags: OPENBSD_3_3_BASE
# 1.16 03-Dec-2002 millert

Crank all library major numbers. Needed due to the fact that we
now build libraries with propolice enabled. Without this, existing
binaries (such as ports/packages) that link with any system library
other than libc will fail with an undefined symbol of "___guard"
(__guard on ELF).
Pointed out by markus@ and discussed with deraadt@


Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE
# 1.15 29-Sep-2001 jakob

re-enable pidfile(3). ok millert@


# 1.14 29-Sep-2001 deraadt

jakob did not even do a make build, sigh


# 1.13 28-Sep-2001 jakob

add pidfile(3) - write a daemon pid file. ok deraadt@, millert@.


# 1.12 16-Aug-2001 millert

Add new 'secureonly' arg to pw_mkdb() to correspond to pwd_mkdb's new -s
flag and crank the library major due to the interface change.


Revision tags: OPENBSD_2_9_BASE
# 1.11 31-Jan-2001 deraadt

move utmp to large format, usernames to 32 chars; downsj


# 1.10 26-Nov-2000 millert

Add a username argument to pw_mkdb to match 'pwd_mkdb -u username'.
Crank the shlib major number due to the interface change.


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 30-Apr-2000 millert

crank minor


Revision tags: OPENBSD_2_6_BASE
# 1.8 21-Sep-1999 deraadt

crank minor; costa forgot


# 1.7 20-Jul-1999 jakob

Added fparseln from NetBSD.
ok deraadt@


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
# 1.6 08-Jun-1998 brian

Add uu_lock_txfr() for donating locks to another process.
Reviewed by: Theo


Revision tags: OPENBSD_2_3_BASE
# 1.5 09-Nov-1997 bri

Introduce uu_lock(), uu_unlock() and uu_lockerr()
into libutil.
Obtained from: FreeBSD
Reviewed by: Theo


Revision tags: OPENBSD_2_1_BASE OPENBSD_2_2_BASE
# 1.4 23-Dec-1996 downsj

readlabelfs() takes two arguments now, update prototype, inc major number.


# 1.3 03-Dec-1996 downsj

inc


Revision tags: OPENBSD_2_0_BASE
# 1.2 22-May-1996 deraadt

libutil


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision