414 Commits

Author SHA1 Message Date
Nicki Křížek
949110287d gitchangelog: don't break lines on hyphens in relnotes
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

(cherry picked from commit 9b0d0c0173)
2024-12-02 13:56:05 +00:00
Ondřej Surý
4fbdad515c Move contributed DLZ modules into a separate repository
The DLZ modules are poorly maintained as we only ensure they can still
be compiled, the DLZ interface is blocking, so anything that blocks the
query to the database blocks the whole server and they should not be
used except in testing.  The DLZ interface itself should be scheduled
for removal.

(cherry picked from commit a6cce753e2)
2024-11-26 16:24:35 +01:00
Ondřej Surý
c5bac96fd0 Remove redundant parentheses from the return statement
(cherry picked from commit 0258850f20)
2024-11-19 16:06:16 +01:00
Nicki Křížek
9bd8d34ffe Generate changelog to stdout
Since the changes aren't tracked in the single changelog.rst file,
generate the changelog to stdout instead, so it can be easily redirected
to the proper file.
2024-09-24 10:15:48 +02:00
Nicki Křížek
c0ca052661 Omit MR link from release notes
When manually handling the release notes (due to rst markup, fixups
etc.), the different MR number for backports causes needless friction.
Remove the reference from release notes and keep it only in changelog
which isn't manually redacted.

(cherry picked from commit 993ba7cc7f)
2024-08-20 11:51:47 +00:00
Nicki Křížek
f3367b0a83 Sort changelog & relnotes entries by issue number
To reduce the friction when handling the release notes, it is preferable
to have the sections sorted by issue number, rather than merge order.
Fallback to commit subject line if unavailable (e.g. for changelog
entries).

(cherry picked from commit 759948fffe)
2024-08-20 11:51:47 +00:00
Nicki Křížek
7f057b379d Use python3 in shebang lines for util scripts
Some distributions (notably, debian bookworm) have deprecated the
`python` interpreter in favor of `python3`. Since our scripts are
python3 anyway, use the proper numbered version in shebang to make
scripts easily executable.

(cherry picked from commit 480dcdef9a)
2024-08-14 15:43:39 +00:00
Nicki Křížek
46310aa771 Fix ordering of gitchangelog replacement regexs
Prior to this change, the issue number could be accidentally removed by
the `Backport of` text, depending on the order of the MR description
contents. Ensure all the removals for text in MR descriptions happen
first, and only then run the replacement regex for issue number, which
appends it to the end of the last non-empty line (which will no longer
be removed).

The only removals that happen after the replacement are guaranteed to
always happen after the end of MR description, since they're
auto-generated by gitlab when the merge commit is created, thus won't
affect the line with the issue number.

Also remove the needless isc-private/bind9 replacement. References
to private MRs are already removed by the very first regex.

(cherry picked from commit 37274bebe1)
2024-08-14 15:11:59 +00:00
Nicki Křížek
a88a5e2ad5 Add BIND9 configuration for gitchangelog
The configuration has been crafted to cater for BIND9 needs:
- Define actions that have an equivalent section in existing Release
  Notes
- Assume the commits that have the necessary changelog makrup are merge
  commits from GitLab and transform them into messages and proper links
- Put the resulting changelog into the proper place in
  doc/arm/changelog.rst
- Have a separate configuration for changelog and release notes. Both of
  these should be generated from the `git log`, with release notes being
  subject to more scrutiny and further editing

(cherry picked from commit 0ec8b99ea3)
2024-07-29 14:49:13 +02:00
Nicki Křížek
84a3d8ca83 Address gitchangelog deprecation warning
(cherry picked from commit 951280bca5)
2024-07-29 12:34:08 +00:00
Nicki Křížek
3fe001ae2a Adjust gitchangelog whitespace
Format the output to produce a nicer looking rst output, similar to the
former CHANGES file.

(cherry picked from commit 1c95eeeb3f)
2024-07-29 12:34:08 +00:00
Nicki Křížek
915c2a960a Allow gitchangelog to include commit sha
Add an option which can be used to put short commit sha at the end of
each commit subject line in the generated changelog.

(cherry picked from commit c2b23fa2de)
2024-07-29 12:34:08 +00:00
Nicki Křížek
2bd901a699 Remove authors from gitchangelog output
Given our workflow, this could easily lead to misattribution. It's also
not an actionable information and it can be found in the MR / git log
instead.

(cherry picked from commit a8258d1c53)
2024-07-29 12:34:08 +00:00
Nicki Křížek
ed4eb0c368 Reformat gitchangelog with black
(cherry picked from commit 9f90c1c65e)
2024-07-29 12:34:08 +00:00
Nicki Křížek
e99549f6c7 Import gitchanglog 3.0.4
The  project hasn't seen any new development/changes since 2018 and it
seems unlikely we'd be able to get any changes into the upstream. Since
it's isolated into a single file and its task is fairly straighforward,
pull the code into our own repository and maintain it here as needed.

This also makes it easier to make any changes that are specific to our
project.

(cherry picked from commit 63247d8a73)
2024-07-29 12:34:07 +00:00
Tom Krizek
b8b9b4ac2c Reformat shell scripts with shfmt
All changes in this commit were automated using the command:

shfmt -w -i 2 -ci -bn . $(find . -name "*.sh.in")

By default, only *.sh and files without extension are checked, so
*.sh.in files have to be added additionally. (See mvdan/sh#944)

(manually replayed commit 4cb8b13987)
2023-10-26 13:05:00 +02:00
Ondřej Surý
818f4dc3a7 Explicitly cast chars to unsigned chars for <ctype.h> functions
Apply the semantic patch to catch all the places where we pass 'char' to
the <ctype.h> family of functions (isalpha() and friends, toupper(),
tolower()).

(cherry picked from commit 29caa6d1f0)
2023-09-22 17:01:59 +02:00
Tom Krizek
644a0b80c8 Remove trailing whitespace from all text files
I've used the following command to remove the trailing whitespace for
all tracked text files:

git grep -Il '' | xargs sed -i 's/[ \t]*$//'
2023-06-13 16:13:16 +02:00
Tom Krizek
ee4a18ee23 Remove obsolete gitignore file in mysqldyn
The Makefile used to be autogenerated prior to
67f76b1269 which is the reason why the
.gitignore existed in the first place. Since then, a static Makefile is
used and is supposed to be tracked in the git repo.

(cherry picked from commit a02da6cf21)
2022-12-23 14:29:47 +01:00
Michal Nowak
1d7d504338 Update sources to Clang 15 formatting 2022-11-29 09:14:07 +01:00
Michal Nowak
56abbea62c Add install target for Perl DLZ module
Perl DLZ module Makefile lacked "install" target, add it as we want to
test DLZ module installation in the CI.

(cherry picked from commit 35e44978b5)
2022-11-28 13:30:38 +01:00
Michal Nowak
d25dc23563 Leverage CFLAGS from environment in contrib Makefiles
(cherry picked from commit 4affc436d3)
2022-11-28 13:30:37 +01:00
Michal Nowak
e23fb140fa Fix statement may fall through warnings in dlz_ldap_dynamic.c
dlz_ldap_dynamic.c: In function ‘dlz_create’:
    dlz_ldap_dynamic.c:971:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      971 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:974:9: note: here
      974 |         case 11:
          |         ^~~~
    dlz_ldap_dynamic.c:976:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      976 |                 if (result != ISC_R_SUCCESS) {
          |                    ^
    dlz_ldap_dynamic.c:979:9: note: here
      979 |         case 10:
          |         ^~~~
    dlz_ldap_dynamic.c:980:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
      980 |                 if (strlen(argv[9]) > 0) {
          |                    ^
    dlz_ldap_dynamic.c:987:9: note: here
      987 |         case 9:
          |         ^~~~

(cherry picked from commit 99912ed2f7)
2022-11-28 13:30:37 +01:00
Michal Nowak
f47990aa6e Fix compilation warnings in dlz_wildcard_dynamic.c
dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:227:14: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
      227 |         bool origin = true;
          |              ^~~~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_lookup’:
    dlz_wildcard_dynamic.c:252:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
      252 |                 cd->record = "@";
          |                            ^
    dlz_wildcard_dynamic.c: In function ‘dlz_authority’:
    dlz_wildcard_dynamic.c:328:22: warning: unused variable ‘origin’ [-Wunused-variable]
      328 |                 bool origin;
          |                      ^~~~~~
    dlz_wildcard_dynamic.c:312:25: warning: unused variable ‘name’ [-Wunused-variable]
      312 |         const char *p, *name = "@";
          |                         ^~~~
    dlz_wildcard_dynamic.c: In function ‘dlz_create’:
    dlz_wildcard_dynamic.c:441:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      441 |         for (i = 4; i < argc; i += 4) {
          |                       ^

(cherry picked from commit 76c8c58d54)
2022-11-28 13:30:37 +01:00
Michal Nowak
48c3891603 Fix compilation warnings in dlz_sqlite3_dynamic.c
dlz_sqlite3_dynamic.c: In function ‘dlz_sqlite3_fetch_row’:
    dlz_sqlite3_dynamic.c:447:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                               ^
    dlz_sqlite3_dynamic.c:447:50: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
      447 |                 if (rs->pnRow > 0U && rs->curRow < rs->pnRow) {
          |                                                  ^

(cherry picked from commit 60f68dc0d6)
2022-11-28 13:30:37 +01:00
Michal Nowak
2a52f343a3 Fix warnings in dlz_mysqldyn_mod.c
dlz_mysqldyn_mod.c: In function ‘dlz_findzonedb’:
    dlz_mysqldyn_mod.c:1079:73: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1079 | dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
          |                                                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c:1080:34: warning: unused parameter ‘clientinfo’ [-Wunused-parameter]
     1080 |                dns_clientinfo_t *clientinfo) {
          |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    dlz_mysqldyn_mod.c: In function ‘dlz_lookup’:
    dlz_mysqldyn_mod.c:1111:63: warning: unused parameter ‘methods’ [-Wunused-parameter]
     1111 |            dns_sdlzlookup_t *lookup, dns_clientinfomethods_t *methods,
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    dlz_mysqldyn_mod.c: In function ‘build_query’:
    dlz_mysqldyn_mod.c:465:19: warning: pointer ‘item’ used after ‘free’ [-Wuse-after-free]
      465 |              item = DLZ_LIST_NEXT(item, link))
    dlz_mysqldyn_mod.c:470:17: note: call to ‘free’ here
      470 |                 free(item);
          |                 ^~~~~~~~~~

(cherry picked from commit 587ea10567)
2022-11-28 13:30:37 +01:00
Michal Nowak
0d8032842c Fix compilation warnings in dlz_perl_driver.c
dlz_perl_driver.c: In function ‘dlz_version’:
    dlz_perl_driver.c:116:27: warning: unused parameter ‘flags’ [-Wunused-parameter]
      116 | dlz_version(unsigned int *flags) {
          |             ~~~~~~~~~~~~~~^~~~~
    In file included from /usr/lib64/perl5/CORE/perl.h:5685,
                     from dlz_perl_driver.c:33:
    dlz_perl_driver.c: In function ‘dlz_allnodes’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:151:17: note: in expansion of macro ‘POPs’
      151 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_allowzonexfr’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:251:17: note: in expansion of macro ‘POPs’
      251 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_findzonedb’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:328:17: note: in expansion of macro ‘POPs’
      328 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c: In function ‘dlz_lookup’:
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:407:17: note: in expansion of macro ‘POPs’
      407 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:472:1: error: no previous prototype for ‘missing_perl_method’ [-Werror=missing-prototypes]
      472 | missing_perl_method(const char *perl_class_name, PerlInterpreter *my_perl)
          | ^~~~~~~~~~~~~~~~~~~
    dlz_perl_driver.c: In function ‘missing_perl_method’:
    dlz_perl_driver.c:485:9: error: ISO C90 forbids array ‘full_name’ whose size cannot be evaluated [-Werror=vla]
      485 |         char full_name[BUF_LEN];
          |         ^~~~
    dlz_perl_driver.c: In function ‘dlz_create’:
    dlz_perl_driver.c:613:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
      613 |         if (missing_method_name = missing_perl_method(perl_class_name, my_perl))
          |             ^~~~~~~~~~~~~~~~~~~
    /usr/lib64/perl5/CORE/pp.h:162:26: warning: value computed is not used [-Wunused-value]
      162 | #define POPs            (*sp--)
          |                         ~^~~~~~
    dlz_perl_driver.c:657:17: note: in expansion of macro ‘POPs’
      657 |                 POPs;
          |                 ^~~~
    dlz_perl_driver.c:502:15: warning: unused variable ‘init_args’ [-Wunused-variable]
      502 |         char *init_args[] = { NULL, NULL };
          |               ^~~~~~~~~

(cherry picked from commit be928dbba2)
2022-11-28 13:30:36 +01:00
Matthijs Mekking
4078990717 Fix mysql bindings
There was a copy paste error in the Makefile of the mysql dlz modules,
instead of setting the MYSQL_LIBS, LDAP_LIBS where set. This caused
the mysql bindings not to be generated.

(cherry picked from commit 38c740053b)
2022-08-08 09:45:49 +02:00
Michal Nowak
d3eb307e3c Update clang to version 14
(cherry picked from commit 1c45a9885a)
2022-06-16 18:09:33 +02:00
Petr Mensik
ae42ff5c15 Fix few warnings in DLZ modules
Also make similar change to ldap module. Change few public functions in
module to dlz_<module> prefix, so they cannot collide with used library.

(cherry picked from commit be39b3d84c)
2022-05-02 15:08:17 +10:00
Mark Andrews
9ced9a6202 Define local instances of FALLTHROUGH and UNREACHABLE
FALLTHOUGH is a copy of how it is defined in <isc/util.h>

UNREACHABLE follows the model used in MacOS /usr/include/c++/v1/cstdlib
to determine if __builtin_ureachable is available

(cherry picked from commit 6d68a22954)
2022-04-29 10:53:12 +10:00
Ondřej Surý
cf4e08d9cb Use MARIADB_BASE_VERSION instead of LIBMARIADB to detect Maria DB
It was discovered that MariaDB 10 didn't define LIBMARIADB leading
to compilation errors of MySQL DLZ modules on Debian stretch.

Use MARIADB_BASE_VERSION instead which is defined in all tested MariaDB
versions.

(cherry picked from commit 5835aae694)
2022-04-28 18:05:17 +02:00
Ondřej Surý
5e19bbb48a Remove use of the inline keyword used as suggestion to compiler
Historically, the inline keyword was a strong suggestion to the compiler
that it should inline the function marked inline.  As compilers became
better at optimising, this functionality has receded, and using inline
as a suggestion to inline a function is obsolete.  The compiler will
happily ignore it and inline something else entirely if it finds that's
a better optimisation.

Therefore, remove all the occurences of the inline keyword with static
functions inside single compilation unit and leave the decision whether
to inline a function or not entirely on the compiler

NOTE: We keep the usage the inline keyword when the purpose is to change
the linkage behaviour.

(cherry picked from commit 20f0936cf2)
2022-03-25 08:42:18 +01:00
Ondřej Surý
128c550a95 Simplify way we tag unreachable code with only ISC_UNREACHABLE()
Previously, the unreachable code paths would have to be tagged with:

    INSIST(0);
    ISC_UNREACHABLE();

There was also older parts of the code that used comment annotation:

    /* NOTREACHED */

Unify the handling of unreachable code paths to just use:

    UNREACHABLE();

The UNREACHABLE() macro now asserts when reached and also uses
__builtin_unreachable(); when such builtin is available in the compiler.

(cherry picked from commit 584f0d7a7e)
2022-03-25 08:42:16 +01:00
Ondřej Surý
c62a94363d Add FALLTHROUGH macro for __attribute__((fallthrough))
Gcc 7+ and Clang 10+ have implemented __attribute__((fallthrough)) which
is explicit version of the /* FALLTHROUGH */ comment we are currently
using.

Add and apply FALLTHROUGH macro that uses the attribute if available,
but does nothing on older compilers.

In one case (lib/dns/zone.c), using the macro revealed that we were
using the /* FALLTHROUGH */ comment in wrong place, remove that comment.

(cherry picked from commit fe7ce629f4)
2022-03-25 08:41:09 +01:00
Ondřej Surý
485a2b329e Add couple missing braces around single-line statements
The clang-format-15 has new option InsertBraces that could add missing
branches around single line statements.  Use that to our advantage
without switching to not-yet-released LLVM version to add missing braces
in couple of places.
2022-03-17 18:29:57 +01:00
Evan Hunt
7923f86bdd complete removal of !PTHREADS code from DLZ modules
DLZ modules no longer support being built without threads,
so the "#if PTHREADS" conditionals were no longer necessary,
and were also causing errors in some of the modules due to
PTHREADS no longer being defined in dlz_pthread.h.

(cherry picked from commit c3a715123b)
2022-01-31 10:37:45 -08:00
Evan Hunt
8bd431a251 update dlz_minimal.h
the addition of support for ECS client information in DLZ
modules omitted some necessary changes to build modules
in contrib.

(cherry picked from commit d3fed6f400)
2022-01-27 16:18:34 -08:00
Evan Hunt
60f97b6432 test ECS information is passed in dlzexternal
the dlzexternal test driver now includes ECS, if present in the
query, in the TXT record returned for QNAME "source-addr".

(cherry picked from commit 79ddedabf8)
2022-01-27 14:51:11 -08:00
Petr Špaček
34f6cce2c6 extend DLZ interface and example with ECS support
Apparently we forgot about DLZ when updating DNS_CLIENTINFO_VERSION
constant for ECS, which is at value "3" since ECS was introduced.

The code in example drivers and tests now hardcodes version numbers
2 (without ECS) and 3 (with ECS) depending on what a given code path
requires.

(cherry picked from commit f81debe1c8)
2022-01-27 14:51:11 -08:00
Ondřej Surý
58bd26b6cf Update the copyright information in all files in the repository
This commit converts the license handling to adhere to the REUSE
specification.  It specifically:

1. Adds used licnses to LICENSES/ directory

2. Add "isc" template for adding the copyright boilerplate

3. Changes all source files to include copyright and SPDX license
   header, this includes all the C sources, documentation, zone files,
   configuration files.  There are notes in the doc/dev/copyrights file
   on how to add correct headers to the new files.

4. Handle the rest that can't be modified via .reuse/dep5 file.  The
   binary (or otherwise unmodifiable) files could have license places
   next to them in <foo>.license file, but this would lead to cluttered
   repository and most of the files handled in the .reuse/dep5 file are
   system test files.
2022-01-11 09:05:02 +01:00
Petr Mensik
7bce3e7791 Change all internal functions to dlz_ldap prefix
To prevent any conflict in the future, avoid ldap_ prefix in any
internal functions. Keep it reserved for openldap only.
2021-12-22 22:10:05 +01:00
Petr Mensik
49e523e56f Avoid conflict with ldap_connect function of openldap
ldap_connect is defined by OpenLDAP 2.6. Compiler complains there are
conflicting declarations. Use dlz_ldap prefix instead of ldap to avoid
conflict.
2021-12-22 22:10:05 +01:00
Petr Špaček
ed7fe739c4 remove last remaining reference to _REENTRANT macro and fix DLZ example
It was used only as guard against unused variable declaration, but the
surrounding code depends on strtok_r being defined unconditionally, so
there is no point in guarding a variable.
Glibc documentation suggests it is obsolete anyway and e.g. Meson build
system decided to ignore it. It seems to be required only by old
Solaris compiler and OpenIndiana uses gcc.
2021-10-29 09:08:20 +02:00
Ondřej Surý
f3635bcc14 Use #pragma once as header guards
Unify the header guard style and replace the inconsistent include guards
with #pragma once.

The #pragma once is widely and very well supported in all compilers that
BIND 9 supports, and #pragma once was already in use in several new or
refactored headers.

Using simpler method will also allow us to automate header guard checks
as this is simpler to programatically check.

For reference, here are the reasons for the change taken from
Wikipedia[1]:

> In the C and C++ programming languages, #pragma once is a non-standard
> but widely supported preprocessor directive designed to cause the
> current source file to be included only once in a single compilation.
>
> Thus, #pragma once serves the same purpose as include guards, but with
> several advantages, including: less code, avoidance of name clashes,
> and sometimes improvement in compilation speed. On the other hand,
> #pragma once is not necessarily available in all compilers and its
> implementation is tricky and might not always be reliable.

1. https://en.wikipedia.org/wiki/Pragma_once
2021-10-13 00:49:15 -07:00
Matthijs Mekking
af17ca9704 Replace "master/slave" terms in documentation
Replace those terms with the preferred "primary/secondary" keywords.
2021-10-12 13:09:04 -07:00
Ondřej Surý
ed95f9fba3 Update the source code formatting using clang-format-13
clang-format-13 fixed some of the formatting that clang-format-12 got
wrong.  Update the formatting.
2021-10-12 11:14:40 +02:00
Ondřej Surý
b9319fc998 Remove couple old and rusty scripts from contrib/
* dnssec-keyset.sh - obsoleted by dnssec-policy
* named-bootconf.sh - unmaintained script from NetBSD that would
		      generate named.conf
2021-09-20 22:26:17 +02:00
Ondřej Surý
57b8a12734 Remove scripts to convert KASP to old dnssec-keymgr policy
The dnssec-keymgr has been replaces with dnssec-policy in the named, so
there's no need to carry the conversion script in the contrib/ anymore.
2021-09-20 22:26:17 +02:00
Ondřej Surý
b964e7882b Remove dnspriv example from the contrib directory
BIND 9 has now native DoH support, so there's no need to have nginx
proxy example in the contrib/ directory.
2021-09-20 22:26:17 +02:00