VirtualBox

Ignore:
Timestamp:
May 31, 2022 3:19:40 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151641
Message:

IPRT/Process creation: Fixed fallback handling for using stdin's TTY as a last resort, added IPRT_WITH_PAM_TTY_KLUDGE (disabled by default) along with a @todo. bugref:10225

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/process-creation-posix.cpp

    r95007 r95147  
    392392            }
    393393
    394             /* As a last resort, try the TTY's name instead. */
     394            /** @todo Should we - distinguished from the login service - also set the hostname as PAM_TTY?
     395             *        The pam_access and pam_systemd talk about this. Similarly, SSH and cron use "ssh" and "cron" for PAM_TTY
     396             *        (see PAM_TTY_KLUDGE). */
     397#ifdef IPRT_WITH_PAM_TTY_KLUDGE
    395398            if (RT_FAILURE(rc2))
    396399            {
    397                 if (RTStrPrintf2(szTTY, sizeof(szTTY), "%s", ttyname(0)) <= 0)
     400                if (!RTStrICmp(pszPamService, "access")) /* Access management needed? */
     401                {
     402                    int err = gethostname(szTTY, sizeof(szTTY));
     403                    if (err == 0)
     404                        rc2 = VINF_SUCCESS;
     405                }
     406            }
     407#endif
     408            /* As a last resort, try stdin's TTY name instead (if any). */
     409            if (RT_FAILURE(rc2))
     410            {
     411                if (RTStrPrintf2(szTTY, sizeof(szTTY), "%s", ttyname(STDIN_FILENO)) > 0)
     412                    rc2 = VINF_SUCCESS;
     413                else
    398414                    rc2 = VERR_BUFFER_OVERFLOW;
    399415            }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette