History log of /openbsd-current/usr.sbin/ldapd/modify.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.24 20-Dec-2021 claudio

When removing the last value from an attribute in ldap_del_values()
the actuall attribute needs to removed instead of leaving back an
empty attribute. Empty attributes are not valid and fail later on
in ldap_modify(). By calling ldap_del_attribute() in this case
properly removes the attribute and with that validate_entry() no
longer fails later on.
OK jmatthew@


Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.23 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.22 18-May-2019 rob

branches: 1.22.2;
Fix LDAP RFC reference in comment. Also noticed by martijn.

ok guenther@, claudio@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 14-May-2018 reyk

Add support to filter on attributes.

This can be used to allow users to change their password (and a few
other things) but not their entire dn. For example:

allow read access to any by self
allow write access to any attribute userPassword by self

This is currently only supported for "write" (modify, add, delete) and
not "read" (search) filter rules.

OK jmatthew@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.20 28-Jul-2017 florian

One negation is enough; pointed out by clang.

OK gsoares who says that he forgot about the same diff for months and
that millert@ had OK'ed it.


Revision tags: OPENBSD_6_1_BASE
# 1.19 11-Feb-2017 guenther

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)


# 1.18 20-Jan-2017 benno

work on making log.c similar in all daemons:

move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.

ok krw@ jmatthew@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 24-Dec-2015 mmcc

bzero -> memset. No binary change.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 11-Feb-2015 pelikan

initialize a variable in case "goto done" makes us compare it

found by clang, ok henning


# 1.15 21-Sep-2014 daniel

eliminate the use of a gcc C extension (conditionals with omitted
operands).

ok deraadt@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 28-Jul-2010 martinh

Revert parts of previous change leading to assertion failure for
certain modify operations. Also fix logic error when replacing an attribute
with the empty set.


# 1.13 13-Jul-2010 martinh

Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are
freed. Fix this by unlinking the values from the request.


# 1.12 06-Jul-2010 martinh

Plug another memory leak. Forgot to reset key returned from cursor, having
a reference to a cached page.


# 1.11 06-Jul-2010 martinh

Check return code from commit. Incorrectly returned success when commit
failed due to disk full.


# 1.10 05-Jul-2010 martinh

Close cursor on delete. Fixes memory leak introduced by non-leaf delete
check.


# 1.9 02-Jul-2010 martinh

Don't validate modification of immutable attributes if the namespace is
configured with relaxed schema checking.


# 1.8 02-Jul-2010 martinh

Disallow deleting non-leaf nodes.


# 1.7 01-Jul-2010 martinh

Add checks that we're not adding immutable attributes, just as we're
disallowing modifying immutable attributes. Remove the check for modifying
operational attributes, as there's nothing that disallows that (except that
they're also often marked as immutable).

While here, check the return value from ber_add_* and ldap_add_attribute.


# 1.6 29-Jun-2010 martinh

Add support for referrals. Referrals are configured in the config file,
either in the global context or in a namespace. The latter can be used to
delegate requests to different servers for specific parts of the DIT. The
former is a global catch-all referral.


# 1.5 29-Jun-2010 martinh

don't overwrite the return code from validate_entry


# 1.4 29-Jun-2010 martinh

Rewrite the schema parser, as it's not a context-free grammar.
This also brings the config parser more in line with other parse.y in the
tree. The new schema parser also supports symbolic OID names.

You need to update your /etc/ldapd.conf. Schema files are no longer
included with the 'include' keyword, you have to use 'schema' for that.

Moves schema-related structures to a separate include file to ease reuse.


# 1.3 23-Jun-2010 martinh

Set errno to appropriate values when returning failure in btree. Make btree
functions only return success or failure (-1 or NULL). Update callers to
check errno.


# 1.2 15-Jun-2010 martinh

Make modify and simple auth requests open their own transactions, as search
already does. Trigger a reopen imsg request if either the data or index
databases are compacted. Queue the failed request and try again when the
file is reopened.

Compaction can now be done by a separate process, and ldapd will pick up
the change and reopen the file.


# 1.1 31-May-2010 martinh

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

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


# 1.23 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.22 18-May-2019 rob

Fix LDAP RFC reference in comment. Also noticed by martijn.

ok guenther@, claudio@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 14-May-2018 reyk

Add support to filter on attributes.

This can be used to allow users to change their password (and a few
other things) but not their entire dn. For example:

allow read access to any by self
allow write access to any attribute userPassword by self

This is currently only supported for "write" (modify, add, delete) and
not "read" (search) filter rules.

OK jmatthew@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.20 28-Jul-2017 florian

One negation is enough; pointed out by clang.

OK gsoares who says that he forgot about the same diff for months and
that millert@ had OK'ed it.


Revision tags: OPENBSD_6_1_BASE
# 1.19 11-Feb-2017 guenther

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)


# 1.18 20-Jan-2017 benno

work on making log.c similar in all daemons:

move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.

ok krw@ jmatthew@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 24-Dec-2015 mmcc

bzero -> memset. No binary change.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 11-Feb-2015 pelikan

initialize a variable in case "goto done" makes us compare it

found by clang, ok henning


# 1.15 21-Sep-2014 daniel

eliminate the use of a gcc C extension (conditionals with omitted
operands).

ok deraadt@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 28-Jul-2010 martinh

Revert parts of previous change leading to assertion failure for
certain modify operations. Also fix logic error when replacing an attribute
with the empty set.


# 1.13 13-Jul-2010 martinh

Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are
freed. Fix this by unlinking the values from the request.


# 1.12 06-Jul-2010 martinh

Plug another memory leak. Forgot to reset key returned from cursor, having
a reference to a cached page.


# 1.11 06-Jul-2010 martinh

Check return code from commit. Incorrectly returned success when commit
failed due to disk full.


# 1.10 05-Jul-2010 martinh

Close cursor on delete. Fixes memory leak introduced by non-leaf delete
check.


# 1.9 02-Jul-2010 martinh

Don't validate modification of immutable attributes if the namespace is
configured with relaxed schema checking.


# 1.8 02-Jul-2010 martinh

Disallow deleting non-leaf nodes.


# 1.7 01-Jul-2010 martinh

Add checks that we're not adding immutable attributes, just as we're
disallowing modifying immutable attributes. Remove the check for modifying
operational attributes, as there's nothing that disallows that (except that
they're also often marked as immutable).

While here, check the return value from ber_add_* and ldap_add_attribute.


# 1.6 29-Jun-2010 martinh

Add support for referrals. Referrals are configured in the config file,
either in the global context or in a namespace. The latter can be used to
delegate requests to different servers for specific parts of the DIT. The
former is a global catch-all referral.


# 1.5 29-Jun-2010 martinh

don't overwrite the return code from validate_entry


# 1.4 29-Jun-2010 martinh

Rewrite the schema parser, as it's not a context-free grammar.
This also brings the config parser more in line with other parse.y in the
tree. The new schema parser also supports symbolic OID names.

You need to update your /etc/ldapd.conf. Schema files are no longer
included with the 'include' keyword, you have to use 'schema' for that.

Moves schema-related structures to a separate include file to ease reuse.


# 1.3 23-Jun-2010 martinh

Set errno to appropriate values when returning failure in btree. Make btree
functions only return success or failure (-1 or NULL). Update callers to
check errno.


# 1.2 15-Jun-2010 martinh

Make modify and simple auth requests open their own transactions, as search
already does. Trigger a reopen imsg request if either the data or index
databases are compacted. Queue the failed request and try again when the
file is reopened.

Compaction can now be done by a separate process, and ldapd will pick up
the change and reopen the file.


# 1.1 31-May-2010 martinh

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

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


# 1.22 18-May-2019 rob

Fix LDAP RFC reference in comment. Also noticed by martijn.

ok guenther@, claudio@


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.21 14-May-2018 reyk

Add support to filter on attributes.

This can be used to allow users to change their password (and a few
other things) but not their entire dn. For example:

allow read access to any by self
allow write access to any attribute userPassword by self

This is currently only supported for "write" (modify, add, delete) and
not "read" (search) filter rules.

OK jmatthew@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.20 28-Jul-2017 florian

One negation is enough; pointed out by clang.

OK gsoares who says that he forgot about the same diff for months and
that millert@ had OK'ed it.


Revision tags: OPENBSD_6_1_BASE
# 1.19 11-Feb-2017 guenther

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)


# 1.18 20-Jan-2017 benno

work on making log.c similar in all daemons:

move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.

ok krw@ jmatthew@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 24-Dec-2015 mmcc

bzero -> memset. No binary change.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 11-Feb-2015 pelikan

initialize a variable in case "goto done" makes us compare it

found by clang, ok henning


# 1.15 21-Sep-2014 daniel

eliminate the use of a gcc C extension (conditionals with omitted
operands).

ok deraadt@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 28-Jul-2010 martinh

Revert parts of previous change leading to assertion failure for
certain modify operations. Also fix logic error when replacing an attribute
with the empty set.


# 1.13 13-Jul-2010 martinh

Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are
freed. Fix this by unlinking the values from the request.


# 1.12 06-Jul-2010 martinh

Plug another memory leak. Forgot to reset key returned from cursor, having
a reference to a cached page.


# 1.11 06-Jul-2010 martinh

Check return code from commit. Incorrectly returned success when commit
failed due to disk full.


# 1.10 05-Jul-2010 martinh

Close cursor on delete. Fixes memory leak introduced by non-leaf delete
check.


# 1.9 02-Jul-2010 martinh

Don't validate modification of immutable attributes if the namespace is
configured with relaxed schema checking.


# 1.8 02-Jul-2010 martinh

Disallow deleting non-leaf nodes.


# 1.7 01-Jul-2010 martinh

Add checks that we're not adding immutable attributes, just as we're
disallowing modifying immutable attributes. Remove the check for modifying
operational attributes, as there's nothing that disallows that (except that
they're also often marked as immutable).

While here, check the return value from ber_add_* and ldap_add_attribute.


# 1.6 29-Jun-2010 martinh

Add support for referrals. Referrals are configured in the config file,
either in the global context or in a namespace. The latter can be used to
delegate requests to different servers for specific parts of the DIT. The
former is a global catch-all referral.


# 1.5 29-Jun-2010 martinh

don't overwrite the return code from validate_entry


# 1.4 29-Jun-2010 martinh

Rewrite the schema parser, as it's not a context-free grammar.
This also brings the config parser more in line with other parse.y in the
tree. The new schema parser also supports symbolic OID names.

You need to update your /etc/ldapd.conf. Schema files are no longer
included with the 'include' keyword, you have to use 'schema' for that.

Moves schema-related structures to a separate include file to ease reuse.


# 1.3 23-Jun-2010 martinh

Set errno to appropriate values when returning failure in btree. Make btree
functions only return success or failure (-1 or NULL). Update callers to
check errno.


# 1.2 15-Jun-2010 martinh

Make modify and simple auth requests open their own transactions, as search
already does. Trigger a reopen imsg request if either the data or index
databases are compacted. Queue the failed request and try again when the
file is reopened.

Compaction can now be done by a separate process, and ldapd will pick up
the change and reopen the file.


# 1.1 31-May-2010 martinh

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

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


# 1.21 14-May-2018 reyk

Add support to filter on attributes.

This can be used to allow users to change their password (and a few
other things) but not their entire dn. For example:

allow read access to any by self
allow write access to any attribute userPassword by self

This is currently only supported for "write" (modify, add, delete) and
not "read" (search) filter rules.

OK jmatthew@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.20 28-Jul-2017 florian

One negation is enough; pointed out by clang.

OK gsoares who says that he forgot about the same diff for months and
that millert@ had OK'ed it.


Revision tags: OPENBSD_6_1_BASE
# 1.19 11-Feb-2017 guenther

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)


# 1.18 20-Jan-2017 benno

work on making log.c similar in all daemons:

move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.

ok krw@ jmatthew@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 24-Dec-2015 mmcc

bzero -> memset. No binary change.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 11-Feb-2015 pelikan

initialize a variable in case "goto done" makes us compare it

found by clang, ok henning


# 1.15 21-Sep-2014 daniel

eliminate the use of a gcc C extension (conditionals with omitted
operands).

ok deraadt@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 28-Jul-2010 martinh

Revert parts of previous change leading to assertion failure for
certain modify operations. Also fix logic error when replacing an attribute
with the empty set.


# 1.13 13-Jul-2010 martinh

Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are
freed. Fix this by unlinking the values from the request.


# 1.12 06-Jul-2010 martinh

Plug another memory leak. Forgot to reset key returned from cursor, having
a reference to a cached page.


# 1.11 06-Jul-2010 martinh

Check return code from commit. Incorrectly returned success when commit
failed due to disk full.


# 1.10 05-Jul-2010 martinh

Close cursor on delete. Fixes memory leak introduced by non-leaf delete
check.


# 1.9 02-Jul-2010 martinh

Don't validate modification of immutable attributes if the namespace is
configured with relaxed schema checking.


# 1.8 02-Jul-2010 martinh

Disallow deleting non-leaf nodes.


# 1.7 01-Jul-2010 martinh

Add checks that we're not adding immutable attributes, just as we're
disallowing modifying immutable attributes. Remove the check for modifying
operational attributes, as there's nothing that disallows that (except that
they're also often marked as immutable).

While here, check the return value from ber_add_* and ldap_add_attribute.


# 1.6 29-Jun-2010 martinh

Add support for referrals. Referrals are configured in the config file,
either in the global context or in a namespace. The latter can be used to
delegate requests to different servers for specific parts of the DIT. The
former is a global catch-all referral.


# 1.5 29-Jun-2010 martinh

don't overwrite the return code from validate_entry


# 1.4 29-Jun-2010 martinh

Rewrite the schema parser, as it's not a context-free grammar.
This also brings the config parser more in line with other parse.y in the
tree. The new schema parser also supports symbolic OID names.

You need to update your /etc/ldapd.conf. Schema files are no longer
included with the 'include' keyword, you have to use 'schema' for that.

Moves schema-related structures to a separate include file to ease reuse.


# 1.3 23-Jun-2010 martinh

Set errno to appropriate values when returning failure in btree. Make btree
functions only return success or failure (-1 or NULL). Update callers to
check errno.


# 1.2 15-Jun-2010 martinh

Make modify and simple auth requests open their own transactions, as search
already does. Trigger a reopen imsg request if either the data or index
databases are compacted. Queue the failed request and try again when the
file is reopened.

Compaction can now be done by a separate process, and ldapd will pick up
the change and reopen the file.


# 1.1 31-May-2010 martinh

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

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


Revision tags: OPENBSD_6_2_BASE
# 1.20 28-Jul-2017 florian

One negation is enough; pointed out by clang.

OK gsoares who says that he forgot about the same diff for months and
that millert@ had OK'ed it.


Revision tags: OPENBSD_6_1_BASE
# 1.19 11-Feb-2017 guenther

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)


# 1.18 20-Jan-2017 benno

work on making log.c similar in all daemons:

move daemon-local functions into new logmsg.c, and reduce
the (mostly whitespace) differences so that log.c's can be diffed easily.

ok krw@ jmatthew@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 24-Dec-2015 mmcc

bzero -> memset. No binary change.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.16 11-Feb-2015 pelikan

initialize a variable in case "goto done" makes us compare it

found by clang, ok henning


# 1.15 21-Sep-2014 daniel

eliminate the use of a gcc C extension (conditionals with omitted
operands).

ok deraadt@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 28-Jul-2010 martinh

Revert parts of previous change leading to assertion failure for
certain modify operations. Also fix logic error when replacing an attribute
with the empty set.


# 1.13 13-Jul-2010 martinh

Avoid double free in ldap modify requests. The values received in the
modify request is linked into the stored ber structure, and then both are
freed. Fix this by unlinking the values from the request.


# 1.12 06-Jul-2010 martinh

Plug another memory leak. Forgot to reset key returned from cursor, having
a reference to a cached page.


# 1.11 06-Jul-2010 martinh

Check return code from commit. Incorrectly returned success when commit
failed due to disk full.


# 1.10 05-Jul-2010 martinh

Close cursor on delete. Fixes memory leak introduced by non-leaf delete
check.


# 1.9 02-Jul-2010 martinh

Don't validate modification of immutable attributes if the namespace is
configured with relaxed schema checking.


# 1.8 02-Jul-2010 martinh

Disallow deleting non-leaf nodes.


# 1.7 01-Jul-2010 martinh

Add checks that we're not adding immutable attributes, just as we're
disallowing modifying immutable attributes. Remove the check for modifying
operational attributes, as there's nothing that disallows that (except that
they're also often marked as immutable).

While here, check the return value from ber_add_* and ldap_add_attribute.


# 1.6 29-Jun-2010 martinh

Add support for referrals. Referrals are configured in the config file,
either in the global context or in a namespace. The latter can be used to
delegate requests to different servers for specific parts of the DIT. The
former is a global catch-all referral.


# 1.5 29-Jun-2010 martinh

don't overwrite the return code from validate_entry


# 1.4 29-Jun-2010 martinh

Rewrite the schema parser, as it's not a context-free grammar.
This also brings the config parser more in line with other parse.y in the
tree. The new schema parser also supports symbolic OID names.

You need to update your /etc/ldapd.conf. Schema files are no longer
included with the 'include' keyword, you have to use 'schema' for that.

Moves schema-related structures to a separate include file to ease reuse.


# 1.3 23-Jun-2010 martinh

Set errno to appropriate values when returning failure in btree. Make btree
functions only return success or failure (-1 or NULL). Update callers to
check errno.


# 1.2 15-Jun-2010 martinh

Make modify and simple auth requests open their own transactions, as search
already does. Trigger a reopen imsg request if either the data or index
databases are compacted. Queue the failed request and try again when the
file is reopened.

Compaction can now be done by a separate process, and ldapd will pick up
the change and reopen the file.


# 1.1 31-May-2010 martinh

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

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