Ticket #13533: login_uid.patch

File login_uid.patch, 555 bytes (added by mjw, 2 years ago)

proposed fix.

  • src/bin/multiuser/login.cpp

    diff --git a/src/bin/multiuser/login.cpp b/src/bin/multiuser/login.cpp
    index d4dfba5..ff6efa5 100644
    a b setup_environment(struct passwd* passwd, bool preserveEnvironment) 
    156156    if (ioctl(STDIN_FILENO, TIOCSPGRP, &pid) != 0)
    157157        return errno;
    158158
     159    if (passwd->pw_gid && setgid(passwd->pw_gid) != 0)
     160        return errno;
     161
     162    if (passwd->pw_uid && setuid(passwd->pw_uid) != 0)
     163        return errno;
     164
    159165    const char* home = getenv("HOME");
    160166    if (home == NULL)
    161167        return B_ENTRY_NOT_FOUND;