Skip to content

Fix getpwuid errors on systems using winbind - #8

Merged
jjallaire merged 1 commit into
rstudio:masterfrom
themel:master
Feb 28, 2012
Merged

jjallaire merged 1 commit into
rstudio:masterfrom
themel:master

Conversation

@themel

@themel themel commented Feb 13, 2012

Copy link
Copy Markdown

Hi,

I've been trying to get RStudio Server to run in an enterprise environment where users are authenticated via pam_winbind. I have the same problems that others have already reported, see this thread and the one linked from there:

http://support.rstudio.org/help/discussions/problems/914-pam-authentication-and-winbind-revisited

What was going wrong here is that pam_winbind talks to winbindd through a socket, and you close all open file descriptors - https://github.com/rstudio/rstudio/blob/master/src/cpp/server/util/system/PosixSystem.cpp#L396 - before determining the current user a few lines later. Simply moving the getpwuid call before the file descriptor closing worked around the issue at hand for me, but of course getpwuid will remain broken in the child process, so maybe a more general fix should be considered...

ciao,
Thomas

@jjallaire

Copy link
Copy Markdown
Member

Thanks for sorting this out. I was genuinely at a loss to explain how the call to getpwuid was failing -- your explanation makes perfect sense. We've got some other PAM related issues relevant to enterprise environments (e.g. calling the session API for dynamic home directory loading) which we hope to sort out in our next release. At the same time we'll also make a hopefully more general change to make sure we don't hammer the winbindd socket (or others like it).

@jjallaire jjallaire closed this Feb 18, 2012
@jjallaire jjallaire reopened this Feb 28, 2012
@jjallaire

Copy link
Copy Markdown
Member

Hey there, we'd like to take this change however we need to get a contributor agreement from anyone we pull from. If you don't have a problem with this send us a copy of either the individual or corporate agreement (as appropriate) and we'll take the change. You can find copies of both agreements here: https://github.com/rstudio/rstudio/downloads

jjallaire added a commit that referenced this pull request Feb 28, 2012
Fix getpwuid errors on systems using winbind
@jjallaire
jjallaire merged commit 57c28ac into rstudio:master Feb 28, 2012
@alaimos alaimos mentioned this pull request Apr 24, 2020
4 tasks done
gtritchie added a commit that referenced this pull request Aug 6, 2020
On Centos7 (Desktop), unit tests were failing because global static initialization was causing access to an uninitialized string.

Fix by wrapping the static strings in functions.

The trigger is here: https://github.com/rstudio/rstudio/blob/e6fd9fd85f9088c13e8b2c5b78176111b4f2b485/src/cpp/core/LogOptions.cpp#L61

The crash stack was:
```
#0  0x000055ed09fbbdbe in std::string::size (this=0x55ed0b7d5188 <rstudio::core::(anonymous namespace)::s_homePathLeafAlias>)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:3817
#1  0x000055ed09fdc60c in std::operator==<char> (__lhs="~/.local/share", __rhs=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>)
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/basic_string.h:6007
#2  0x000055ed0a97ce4c in rstudio::core::FilePath::resolveAliasedPath (in_aliasedPath="~/.local/share", in_userHomePath=...) at /src/src/cpp/shared_core/FilePath.cpp:476
#3  0x000055ed0a832e7f in rstudio::core::system::xdg::(anonymous namespace)::resolveXdgDir (envVar="XDG_DATA_HOME", defaultDir="~/.local/share", user=..., homeDir=...)
    at /src/src/cpp/core/system/Xdg.cpp:97
#4  0x000055ed0a833213 in rstudio::core::system::xdg::userDataDir (user=..., homeDir=...) at /src/src/cpp/core/system/Xdg.cpp:135
#5  0x000055ed0a8972ea in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /src/src/cpp/core/LogOptions.cpp:61
#6  0x000055ed0a89740c in _GLOBAL__sub_I_LogOptions.cpp(void) () at /src/src/cpp/core/LogOptions.cpp:347
#7  0x000055ed0aa9580d in __libc_csu_init ()
#8  0x00007f948396c4e5 in __libc_start_main () from /lib64/libc.so.6
#9  0x000055ed09fb44f5 in _start ()
```
@kevinushey kevinushey mentioned this pull request Nov 15, 2022
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants