Ticket #13533: 0001-login-process-should-call-setuid-and-setgid.patch

File 0001-login-process-should-call-setuid-and-setgid.patch, 963 bytes (added by mjw, 2 years ago)

Update patch from a git export

  • src/bin/multiuser/login.cpp

    From 64334654fba5979c37ea721a007305e480244c5f Mon Sep 17 00:00:00 2001
    From: James Woodcock <tiphphin@gmail.com>
    Date: Fri, 26 May 2017 17:14:02 +0100
    Subject: [PATCH 1/1] login process should call setuid() and setgid()
    
    The login process didn't call setuid() or setgid() so all users were
    logged in as the super user.
    ---
     src/bin/multiuser/login.cpp | 6 ++++++
     1 file changed, 6 insertions(+)
    
    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;