aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2024-02-07 19:16:03 +0100
committerTobias Stoeckmann <tobias@stoeckmann.org>2024-02-07 19:16:03 +0100
commit1e2c6cecf81dcaeea0c2c9d37bc35eea120cd77d (patch)
tree81cd8060e1767c3d6c29bbe7c179e396a5915129
parent9228077d762fc94ebc8d9fb4edfe9b481d96318d (diff)
downloadpam-1e2c6cecf81dcaeea0c2c9d37bc35eea120cd77d.tar.gz
pam-1e2c6cecf81dcaeea0c2c9d37bc35eea120cd77d.tar.bz2
pam-1e2c6cecf81dcaeea0c2c9d37bc35eea120cd77d.zip
pam_limits: print line number in warning
The line itself is modified while parsing its content. Print the line number and file name instead so an administrator can investigate it. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
-rw-r--r--modules/pam_limits/pam_limits.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index c2ca7abb..8c7f7654 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -882,6 +882,7 @@ parse_config_file(pam_handle_t *pamh, const char *uname, uid_t uid, gid_t gid,
FILE *fil;
char *buf = NULL;
size_t n = 0;
+ unsigned long long lineno = 0;
/* check for the conf_file */
if (ctrl & PAM_DEBUG_ARG)
@@ -905,6 +906,8 @@ parse_config_file(pam_handle_t *pamh, const char *uname, uid_t uid, gid_t gid,
size_t j;
uid_t min_uid = (uid_t)-1, max_uid = (uid_t)-1;
+ lineno++;
+
line = buf;
/* skip the leading white space */
while (*line && isspace((unsigned char)*line))
@@ -1073,7 +1076,8 @@ parse_config_file(pam_handle_t *pamh, const char *uname, uid_t uid, gid_t gid,
fclose(fil);
return PAM_IGNORE;
} else {
- pam_syslog(pamh, LOG_WARNING, "invalid line '%s' - skipped", line);
+ pam_syslog(pamh, LOG_WARNING, "invalid line %llu in '%s' - skipped",
+ lineno, pl->conf_file);
}
}
free(buf);