[Git][NTPsec/ntpsec][master] > No, there is no hint about the fact that /etc/ntpsec/ntp.d

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Tue May 12 09:34:31 UTC 2026



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
ae64cb1a by James Browning at 2026-05-12T02:23:50-07:00
> No, there is no hint about the fact that /etc/ntpsec/ntp.d
> is used to look for additional configurations. But it should.
> A single line in syslog would help a lot.

So, a toy sample now looks like:

INIT: ntpd ntpsec-1.2.4+<REDACTED>: Starting
INIT: Command line: build/main/ntpd/ntpd -Nnq
INIT: successfully locked into RAM
CONFIG: readconfig: parsing file: /etc/ntp.conf
CONFIG: readconfig: automatically walking directory: /etc/ntp.d
CONFIG: opening </etc/ntp.d/default.conf> from dir </etc/ntp.d>
CONFIG: opening <use-pool> from </etc/ntp.d/default.conf:6>
CONFIG: opening <use-no-remote-configuration> from </etc/ntp.d/default.conf:7>
CONFIG: opening <use-minimal-logging> from </etc/ntp.d/default.conf:8>

- - - - -


2 changed files:

- ntpd/ntp_config.c
- ntpd/ntp_scanner.c


Changes:

=====================================
ntpd/ntp_config.c
=====================================
@@ -3168,8 +3168,8 @@ void readconfig(const char *config_file)
 
 	/* parse configs in parallel subdirectory if that exists */
 	reparent(dirpath, sizeof(dirpath), config_file, CONFIG_DIR);
+	msyslog(LOG_INFO, "CONFIG: readconfig: automatically walking directory: %s", dirpath);
 	if (is_directory(dirpath) && lex_push_file(dirpath)) {
-		msyslog(LOG_INFO, "CONFIG: readconfig: parsing directory: %s", dirpath);
 	    yyparse();
 	    ++srccount;
 	}


=====================================
ntpd/ntp_scanner.c
=====================================
@@ -447,8 +447,10 @@ bool lex_push_file(
                               rcmpstring);
 			for (int i = 0; i < basecount; i++) {
 				char subpath[PATH_MAX];
-				strlcpy(subpath, fullpath, PATH_MAX);
-				if (strlen(subpath) < PATH_MAX - 1) {
+				size_t pathlen = strlcpy(subpath, fullpath, PATH_MAX);
+				if ((pathlen < PATH_MAX - 1) &&
+					(subpath[pathlen -1] != DIR_SEP)
+				) {
 					char *ep = subpath + strlen(subpath);
 					*ep++ = DIR_SEP;
 					*ep = '\0';
@@ -457,6 +459,9 @@ bool lex_push_file(
 				/* This should barf safely if the complete
 				 * filename was too long to fit in the buffer.
 				 */
+				msyslog(LOG_NOTICE,
+					"CONFIG: opening <%s> from dir <%s>",
+					subpath, fullpath);
 				lex_push_file(subpath);
 			}
 			for (int i = 0; i < basecount; i++) {



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/ae64cb1a342694eb00714ff52c4788a96e2e92d6

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/ae64cb1a342694eb00714ff52c4788a96e2e92d6
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20260512/96627b26/attachment-0001.htm>


More information about the vc mailing list