diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-08-07 14:45:07 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-08-07 13:10:27 +0000 |
commit | 81d5593e32ef06e749ab8c591111d37b95c42e01 (patch) | |
tree | d7dacc6007301634dbf07661dfe3782d289ec523 /modules | |
parent | dbe68128a079ee6869dc42aee37bf403e137218b (diff) | |
download | pam-81d5593e32ef06e749ab8c591111d37b95c42e01.tar.gz pam-81d5593e32ef06e749ab8c591111d37b95c42e01.tar.bz2 pam-81d5593e32ef06e749ab8c591111d37b95c42e01.zip |
pam_succeed_if: avoid returning garbage for empty configuration
If pam_succeed_if is used without any options the return value ret will
never be assigned a value. Since the case where the counted number of
options is zero will print 'no condition detected; module succeeded'
set the return value to PAM_SUCCESS.
Reported by Clang analyzer:
pam_succeed_if.c:578:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
578 | return ret;
| ^~~~~~~~~~
Diffstat (limited to 'modules')
-rw-r--r-- | modules/pam_succeed_if/pam_succeed_if.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/pam_succeed_if/pam_succeed_if.c b/modules/pam_succeed_if/pam_succeed_if.c index 5bf79c45..c80a60cd 100644 --- a/modules/pam_succeed_if/pam_succeed_if.c +++ b/modules/pam_succeed_if/pam_succeed_if.c @@ -571,6 +571,7 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED, pam_syslog(pamh, LOG_ERR, "incomplete condition detected"); } else if (count == 0) { + ret = PAM_SUCCESS; pam_syslog(pamh, LOG_INFO, "no condition detected; module succeeded"); } |