]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add ns_plugin_expandpath()
authorMichał Kępień <michal@isc.org>
Tue, 12 Feb 2019 14:59:54 +0000 (15:59 +0100)
committerEvan Hunt <each@isc.org>
Wed, 6 Mar 2019 00:52:49 +0000 (16:52 -0800)
commit3883acc5c28099032a7fef863308d4f47cd8a6f8
tree7d31cb4823a1c3a88265b664d00513dc088d606b
parent4ddfaeea3edbfab323b355a24e2485b728827cfd
Add ns_plugin_expandpath()

Implement a helper function which, given an input string:

  - copies it verbatim if it contains at least one path separator,
  - prepends the named plugin installation directory to it otherwise.

This function will allow configuration parsing code to conveniently
determine the full path to a plugin module given either a path or a
filename.

While other, simpler ways exist for making sure filenames passed to
dlopen() cause the latter to look for shared objects in a specific
directory, they are very platform-specific.  Using full paths is thus
likely the most portable and reliable solution.

Also added unit tests for ns_plugin_expandpath() to ensure it behaves
as expected for absolute paths, relative paths, and filenames, for
various target buffer sizes.

(Note: plugins share a directory with named on Windows; there is no
default plugin path. Therefore the source path is copied to the
destination path with no modification.)

(cherry picked from commit d181c28c60d245219d5418c5485042500c5432d4)
lib/ns/Makefile.in
lib/ns/hooks.c
lib/ns/include/ns/hooks.h
lib/ns/tests/Kyuafile
lib/ns/tests/Makefile.in
lib/ns/tests/plugin_test.c [new file with mode: 0644]
lib/ns/win32/libns.def
util/copyrights