| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Close pipes opened via popen(3) with pclose(3).
Also close the pipe in error branches.
Reported by cppcheck.
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
| |
Use getline instead of fgets to allow arbitrarily long lines.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
Also rename buflen to retlen, since it is not associated with the
variable buf, but ret.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function _unix_comesfromsource calls _unix_getpwnam internally.
When changing the authentication token, it is first called to read
local passwd file and optionally contacting NIS. If an entry is
found, _unix_getpwnam is called, this time definitely reading passwd
file and contacting NIS (if support exists) and parsing the entry.
This is meant to check if the entry is not just available but also
valid.
Since the return value of _unix_getpwnam is not checked and the
supplied pointer is only set in case of success, the check for a
NULl pointer afterwards can lead to undefined behavior.
It is easier to call _unix_getpwnam directly, check its return value
and then check if the entry could be parsed. This in turn reduces the
amount of /etc/passwd accesses (and fixes a theoretical TOCTOU race).
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
Even if these checks reveal that a function does not exist, there are
no corresponding HAVE_* or ac_cv_func_* checks in source files.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If more than INT_MAX uids are found in a configuration line, the
variable `count` would trigger a signed integer overflow.
If more than UINT_MAX uids are found in a configuration line, then
the `num_uids` counter is invalid, which could eventually lead to out
of boundary accesses.
Also make sure that size multiplication for malloc does not overflow.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the `rm` subprocess and the namespace init script inherit a
random set of open file descriptors from the process running PAM.
Depending on the actual PAM stack configuration these can even be
security sensitive files. In any case it is unclean to inherit
unexpected open file descriptors to child processes like this.
To address this close all file descriptors except stdio before executing
a new program.
|
| |
|
|
|
|
|
|
|
|
|
| |
If a line in namespace.conf only consists of one field then the error
handling logic in process_line() ends up in a double-free, resulting in
a process abort in libc.
It looks like instead of NULLing the `dir` variable, the
`instance_prefix` is NULLed, without purpose. Fix this.
|
|
|
|
|
|
|
|
|
| |
Before this change, pam_exec allowed expose_authtok option to be
specified for "auth" PAM_TYPE only.
* modules/pam_exec/pam_exec.c (call_exec): Allow expose_authtok
to be specified for "password" PAM_TYPE.
* modules/pam_exec/pam_exec.8.xml: Document it.
|
|
|
|
|
|
|
| |
The ifname variable is only assigned, but the string content itself is
never modified. Drop the strdup call to simplify the code.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
| |
Allow arbitrary lengths of arguments coming from pam configuration file.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
| |
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
The formatting made the code look like there is an "else"-block
followed by an "else if"-block.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
The FAILLOCK_CONF_MAX_LINELINE limitation is not true for arguments
which derive from pam configuration file.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
If a pam configuration file contains a very long group name, do not
silently truncate it.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
| |
The strndup call is easier to review than malloc + strncpy.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
| |
This will simplify further changes.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
| |
The zu formatter is available, as can be seen one line above. Do not
cast unnecessarily to unsigned long. Cosmetic change on pretty much
all supported systems.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
| |
The tmpptr variable is only used for resolved variables. If the
creation of expanded string overflows at other places, log the actually
overflowing character instead of a "random" string in tmpptr.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
| |
It is not required to have a copy of the string in stack. This removes
the need of another strncpy call which also makes future cleanups
easier.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
|
| |
If DEFAULT or OVERRIDE is supplied multiple times in a line then memory
leaks can occur.
Adjusted test case (compile with address sanitizer to see failure).
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
|
|
| |
The pam_listfile is apparently the only module in the tree that has
mandatory options and at the same time bails out in case of unknown
options. Use this specific behaviour of the module to test libpam
configuration file parsing.
* modules/pam_listfile/tst-pam_listfile-retval.c (main): Perform a test
dedicated to configuration file parsing.
|
|
|
|
|
|
|
| |
The pam_permit module is the easiest around. Use its test to add another
test case for configuration file parsing in libpam itself.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
|
| |
Use getline in _pam_assemble_line to allow very long lines.
Also handle escaped newlines and NUL bytes better, even though
the latter are not valid for text files.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
This support has to be added before arbitrarily long lines are allowed
in configuration files.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
|
| |
The pam_split_string function should not use unsigned int to make sure
that the counter will never overflow if arbitrarily long configuration
file lines are supported.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
Prepare the calculation to support very large argc values in order to
support arbitrarily long configuration lines in the future.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
|
|
| |
The return value of strlen has to be stored in size_t for future
support of arbitrarily long configuration file lines.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
|
|
|
|
|
| |
* modules/pam_listfile/pam_listfile.8.xml: Fix formatting of option
arguments.
|
|
|
|
| |
* modules/pam_listfile/pam_listfile.8.xml: Fix a few grammar issues.
|
|
|
|
|
| |
* modules/pam_listfile/pam_listfile.8.xml: Tweak item=tty description
so it no longer implies that PAM_TTY is always set.
|
|
|
|
|
|
| |
* modules/pam_listfile/tst-pam_listfile-retval.c: New file.
* modules/pam_listfile/Makefile.am (TESTS): Add $(check_PROGRAMS).
(check_PROGRAMS, tst_pam_listfile_retval_LDADD): New variables.
|
|
|
|
|
|
|
|
|
| |
* modules/pam_canonicalize_user/tst-pam_canonicalize_user-retval.c: Fix.
* modules/pam_canonicalize_user/Makefile.am (TESTS): Add $(check_PROGRAMS).
(AM_LDFLAGS): Rename to pam_canonicalize_user_la_LDFLAGS.
(tst_pam_canonicalize_user_retval_LDFLAGS): New variable.
Fixes: 980ddf706777 ("pam_canonicalize_user: add a test for return values")
|
|
|
|
|
|
| |
Currently translated at 17.8% (18 of 101 strings).
Translate-URL: https://translate.fedoraproject.org/projects/linux-pam/master/sl/
|