mirror of
https://github.com/linux-pam/linux-pam.git
synced 2024-11-23 17:53:40 +08:00
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>
This commit is contained in:
parent
9228077d76
commit
1e2c6cecf8
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user