nss-pam-ldapd branch master updated. 0.9.12-12-gb42d8c0
[Date Prev][
Date Next]
[Thread Prev][
Thread Next]
nss-pam-ldapd branch master updated. 0.9.12-12-gb42d8c0
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org, nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd branch master updated. 0.9.12-12-gb42d8c0
- Date: Sat, 24 Feb 2024 16:14:15 +0100 (CET)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".
The branch, master has been updated
via b42d8c0a313b25db9cd7e1147c5489aacfda7a50 (commit)
via baf3beef2b6edffdfd8767f2d1be8da3cd63a9a9 (commit)
from 33cf91cbbcc92c10fc99c828f9d9b94752299800 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://arthurdejong.org/git/nss-pam-ldapd/commit/?id=b42d8c0a313b25db9cd7e1147c5489aacfda7a50
commit b42d8c0a313b25db9cd7e1147c5489aacfda7a50
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sat Feb 24 15:50:43 2024 +0100
Add an option to test the configuration file
diff --git a/man/nslcd.8.xml b/man/nslcd.8.xml
index 00208dc..72cbd80 100644
--- a/man/nslcd.8.xml
+++ b/man/nslcd.8.xml
@@ -129,6 +129,20 @@
</listitem>
</varlistentry>
+ <varlistentry id="test">
+ <term>
+ <option>-t</option>, <option>--test</option>
+ </term>
+ <listitem>
+ <para>
+ Validate the configuration and exit. This performs syntax checking of
the configuration,
+ checks for presence of files referred in the configuration and does some
minimal other
+ sanity checking.
+ This causes <command>nslcd</command> to return 0 if the configuration
appears valid and 1 if it is not.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="help">
<term>
<option>--help</option>
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index 55da9ac..d54e2db 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -94,6 +94,9 @@ static int nslcd_checkonly = 0;
/* name of the configuration file to load */
static char *nslcd_conf_path = NSLCD_CONF_PATH;
+/* flag to indicate user requested the --test option */
+static int nslcd_testconfig = 0;
+
/* the flag to indicate that a signal was received */
static volatile int nslcd_receivedsignal = 0;
@@ -138,6 +141,7 @@ static void display_usage(FILE *fp, const char
*program_name)
fprintf(fp, " -d, --debug don't fork and print debugging to
stderr\n");
fprintf(fp, " -n, --nofork don't fork\n");
fprintf(fp, " -f, --config=FILE alternative configuration file (default
%s)\n", NSLCD_CONF_PATH);
+ fprintf(fp, " -t, --test test configuration for validity and
exit\n");
fprintf(fp, " --help display this help and exit\n");
fprintf(fp, " --version output version information and exit\n");
fprintf(fp, "\n" "Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
@@ -149,11 +153,12 @@ static struct option const nslcd_options[] = {
{"debug", no_argument, NULL, 'd'},
{"nofork", no_argument, NULL, 'n'},
{"config", required_argument, NULL, 'f'},
+ {"test", no_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
};
-#define NSLCD_OPTIONSTRING "cndf:hV"
+#define NSLCD_OPTIONSTRING "cndf:thV"
/* parse command line options and save settings in struct */
static void parse_cmdline(int argc, char *argv[])
@@ -181,6 +186,9 @@ static void parse_cmdline(int argc, char *argv[])
exit(EXIT_FAILURE);
}
break;
+ case 't': /* -t, --test test configuration for validity and exit
*/
+ nslcd_testconfig = 1;
+ break;
case 'h': /* --help display this help and exit */
display_usage(stdout, argv[0]);
exit(EXIT_SUCCESS);
@@ -735,6 +743,12 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
/* read configuration file */
cfg_init(nslcd_conf_path);
+ /* exit if we only wanted to check the configuration */
+ if (nslcd_testconfig)
+ {
+ log_log(LOG_INFO, "config (%s) OK", nslcd_conf_path);
+ exit(EXIT_SUCCESS);
+ }
/* set default mode for pidfile and socket */
(void)umask((mode_t)0022);
/* see if someone already locked the pidfile
https://arthurdejong.org/git/nss-pam-ldapd/commit/?id=baf3beef2b6edffdfd8767f2d1be8da3cd63a9a9
commit baf3beef2b6edffdfd8767f2d1be8da3cd63a9a9
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sat Feb 24 15:18:42 2024 +0100
Make configuration file to use configurable
diff --git a/man/nslcd.8.xml b/man/nslcd.8.xml
index 96b053d..00208dc 100644
--- a/man/nslcd.8.xml
+++ b/man/nslcd.8.xml
@@ -6,7 +6,7 @@
nslcd.8.xml - docbook manual page for nslcd
Copyright (C) 2006 West Consulting
- Copyright (C) 2006-2021 Arthur de Jong
+ Copyright (C) 2006-2024 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -116,6 +116,19 @@
</listitem>
</varlistentry>
+ <varlistentry id="config">
+ <term>
+ <option>-f</option>, <option>--config</option>
+ <option><replaceable>FILE</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ Parse the supplied configuration file in place of the default
+ <filename>/etc/nslcd.conf</filename> file.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="help">
<term>
<option>--help</option>
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index ead4bcc..55da9ac 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -2,7 +2,7 @@
nslcd.c - ldap local connection daemon
Copyright (C) 2006 West Consulting
- Copyright (C) 2006-2019 Arthur de Jong
+ Copyright (C) 2006-2024 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -91,6 +91,9 @@ static int nslcd_nofork = 0;
/* flag to indicate user requested the --check option */
static int nslcd_checkonly = 0;
+/* name of the configuration file to load */
+static char *nslcd_conf_path = NSLCD_CONF_PATH;
+
/* the flag to indicate that a signal was received */
static volatile int nslcd_receivedsignal = 0;
@@ -134,6 +137,7 @@ static void display_usage(FILE *fp, const char
*program_name)
fprintf(fp, " -c, --check check if the daemon already is running\n");
fprintf(fp, " -d, --debug don't fork and print debugging to
stderr\n");
fprintf(fp, " -n, --nofork don't fork\n");
+ fprintf(fp, " -f, --config=FILE alternative configuration file (default
%s)\n", NSLCD_CONF_PATH);
fprintf(fp, " --help display this help and exit\n");
fprintf(fp, " --version output version information and exit\n");
fprintf(fp, "\n" "Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
@@ -141,14 +145,15 @@ static void display_usage(FILE *fp, const char
*program_name)
/* the definition of options for getopt(). see getopt(2) */
static struct option const nslcd_options[] = {
- {"check", no_argument, NULL, 'c'},
- {"debug", no_argument, NULL, 'd'},
- {"nofork", no_argument, NULL, 'n'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'V'},
- {NULL, 0, NULL, 0}
+ {"check", no_argument, NULL, 'c'},
+ {"debug", no_argument, NULL, 'd'},
+ {"nofork", no_argument, NULL, 'n'},
+ {"config", required_argument, NULL, 'f'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'},
+ {NULL, 0, NULL, 0}
};
-#define NSLCD_OPTIONSTRING "cndhV"
+#define NSLCD_OPTIONSTRING "cndf:hV"
/* parse command line options and save settings in struct */
static void parse_cmdline(int argc, char *argv[])
@@ -168,6 +173,14 @@ static void parse_cmdline(int argc, char *argv[])
case 'n': /* -n, --nofork don't fork */
nslcd_nofork++;
break;
+ case 'f': /* -f, --config=FILE alternative configuration file */
+ nslcd_conf_path = strdup(optarg);
+ if (nslcd_conf_path == NULL)
+ {
+ log_log(LOG_CRIT, "strdup() failed to allocate memory");
+ exit(EXIT_FAILURE);
+ }
+ break;
case 'h': /* --help display this help and exit */
display_usage(stdout, argv[0]);
exit(EXIT_SUCCESS);
@@ -721,7 +734,7 @@ int main(int argc, char *argv[])
if (myldap_set_debuglevel(nslcd_debugging) != LDAP_SUCCESS)
exit(EXIT_FAILURE);
/* read configuration file */
- cfg_init(NSLCD_CONF_PATH);
+ cfg_init(nslcd_conf_path);
/* set default mode for pidfile and socket */
(void)umask((mode_t)0022);
/* see if someone already locked the pidfile
-----------------------------------------------------------------------
Summary of changes:
man/nslcd.8.xml | 29 ++++++++++++++++++++++++++++-
nslcd/nslcd.c | 45 ++++++++++++++++++++++++++++++++++++---------
2 files changed, 64 insertions(+), 10 deletions(-)
hooks/post-receive
--
nss-pam-ldapd
- nss-pam-ldapd branch master updated. 0.9.12-12-gb42d8c0,
Commits of the nss-pam-ldapd project