Bug 54974 - pam_runasroot univention-mount-homedir: Empty argv
pam_runasroot univention-mount-homedir: Empty argv
Status: NEW
Product: UCS
Classification: Unclassified
Component: PAM
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-12 13:16 CEST by Philipp Hahn
Modified: 2022-07-13 14:46 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize, Cleanup, Debt Technical, Error handling, Security
Max CVSS v3 score:
hahn: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2022-07-12 13:16:54 CEST
Warning from linux-4.19:
$ dmesg -H
> process 'cron' launched '/usr/sbin/univention-mount-homedir' with NULL argv: empty string added


/etc/pam.d/cron
> @include common-session
/etc/pam.d/common-session
> session    required   pam_runasroot.so program=/usr/sbin/univention-mount-homedir


univention/ucs> base/pam-runasroo/pam_runasroot.c:279
> 279 »···»···»···»···execl ( prog, NULL );

<man:execl(3)>
> The first argument, by convention, should point to the filename associated with the file being executed.

> execl(prog, prog, NULL);

Maybe change it to <man:execve(2)>?

The following warnings exist:

cc -O2 -D_GNU_SOURCE -D_REENTRANT -DLINUX_PAM  -Wall -fPIC -Dlinux -DPAM_DYNAMIC  -Di386 -c pam_runasroot.c -o dynamic/pam_runasroot.o
pam_runasroot.c: In function ‘pam_sm_authenticate’:
pam_runasroot.c:384:8: warning: the address of ‘demouserscript’ will always evaluate as ‘true’ [-Waddress]
   if ( demouserscript && *demouserscript != '\0')
        ^~~~~~~~~~~~~~
At top level:
pam_runasroot.c:126:12: warning: ‘converse’ defined but not used [-Wunused-function]
 static int converse(pam_handle_t * pamh, int ctrl, int nargs
            ^~~~~~~~
pam_runasroot.c: In function ‘_pam_parse’:
pam_runasroot.c:113:4: warning: ‘strncpy’ specified bound 8192 equals destination size [-Wstringop-truncation]
    strncpy(demouserscript,*argv+15,BUFSIZ);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pam_runasroot.c:111:4: warning: ‘strncpy’ specified bound 8192 equals destination size [-Wstringop-truncation]
    strncpy(demouser,*argv+9,BUFSIZ);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/security/pam_modules.h: In function ‘pam_sm_authenticate’:
pam_runasroot.c:369:40: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
  snprintf(demouser_prefix, BUFSIZ, "%s-", demouser);
                                        ^
pam_runasroot.c:369:2: note: ‘snprintf’ output between 2 and 8193 bytes into a destination of size 8192
  snprintf(demouser_prefix, BUFSIZ, "%s-", demouser);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pam_runasroot.c:391:3: warning: ‘strncpy’ specified bound 8192 equals destination size [-Wstringop-truncation]
   strncpy(user, auth_user, BUFSIZ);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~