Grant Nathan his wish - add an --disable-getpwuid to the configure options and protect all users of that code so it disappears if disabled.
cmr=v1.7.5:reviewer=hjelmn:subject=disable getpwuid if requested This commit was SVN r30413.
Этот коммит содержится в:
родитель
b32556e6dc
Коммит
e3cb4b4a5b
@ -464,4 +464,19 @@ AC_ARG_WITH([libltdl],
|
||||
AC_DEFINE_UNQUOTED([OPAL_ENABLE_CRDEBUG], [0],
|
||||
[Whether we want checkpoint/restart enabled debugging functionality or not])
|
||||
|
||||
# some systems don't want/like getpwuid
|
||||
AC_MSG_CHECKING([if want getpwuid support])
|
||||
AC_ARG_ENABLE([getpwuid],
|
||||
[AC_HELP_STRING([--disable-getpwuid],
|
||||
[Disable getpwuid support (default: enabled)])])
|
||||
if test "$enable_getpwuid" = "no"; then
|
||||
AC_MSG_RESULT([no])
|
||||
opal_want_getpwuid=0
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
opal_want_getpwuid=1
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([OPAL_ENABLE_GETPWUID], [$opal_want_getpwuid],
|
||||
[Disable getpwuid support (default: enabled)])
|
||||
|
||||
])dnl
|
||||
|
@ -1492,12 +1492,16 @@ static int setup_shell(orte_plm_rsh_shell_t *rshell,
|
||||
char *nodename, int *argc, char ***argv)
|
||||
{
|
||||
orte_plm_rsh_shell_t remote_shell, local_shell;
|
||||
struct passwd *p;
|
||||
char *param;
|
||||
int rc;
|
||||
|
||||
/* What is our local shell? */
|
||||
local_shell = ORTE_PLM_RSH_SHELL_UNKNOWN;
|
||||
|
||||
#if OPAL_ENABLE_GETPWUID
|
||||
{
|
||||
struct passwd *p;
|
||||
|
||||
p = getpwuid(getuid());
|
||||
if( NULL == p ) {
|
||||
/* This user is unknown to the system. Therefore, there is no reason we
|
||||
@ -1508,6 +1512,8 @@ static int setup_shell(orte_plm_rsh_shell_t *rshell,
|
||||
}
|
||||
param = p->pw_shell;
|
||||
local_shell = find_shell(p->pw_shell);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we didn't find it in getpwuid(), try looking at the $SHELL
|
||||
environment variable (see https://svn.open-mpi.org/trac/ompi/ticket/1060)
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
#include "orte/util/proc_info.h"
|
||||
#include "orte/util/show_help.h"
|
||||
|
||||
#include "opal/runtime/opal.h"
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
@ -268,7 +269,6 @@ void kill_procs(void) {
|
||||
char *inputline;
|
||||
char *this_user;
|
||||
int uid;
|
||||
struct passwd *pwdent;
|
||||
char *separator = " \t"; /* output can be delimited by space or tab */
|
||||
|
||||
/*
|
||||
@ -303,18 +303,31 @@ void kill_procs(void) {
|
||||
|
||||
/* get the name of the user */
|
||||
uid = getuid();
|
||||
#if OPAL_ENABLE_GETPWUID
|
||||
{
|
||||
struct passwd *pwdent;
|
||||
|
||||
#ifdef HAVE_GETPWUID
|
||||
pwdent = getpwuid(uid);
|
||||
if (NULL == pwdent) {
|
||||
/* this indicates a problem with the passwd system,
|
||||
* so pretty-print a message just for info
|
||||
*/
|
||||
orte_show_help("help-orte-runtime.txt",
|
||||
"orte:session:dir:nopwname", true);
|
||||
}
|
||||
#else
|
||||
pwdent = NULL;
|
||||
#endif
|
||||
if (NULL != pwdent) {
|
||||
this_user = strdup(pwdent->pw_name);
|
||||
} else {
|
||||
if (0 > asprintf(&this_user, "%d", uid)) {
|
||||
return;
|
||||
asprintf(&this_user, "%d", uid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
asprintf(&this_user, "%d", uid);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There is a race condition here. The problem is that we are looking
|
||||
|
@ -132,15 +132,25 @@ orte_session_dir_get_name(char **fulldirpath,
|
||||
int exit_status = ORTE_SUCCESS;
|
||||
size_t len;
|
||||
int uid;
|
||||
struct passwd *pwdent;
|
||||
|
||||
/* Ensure that system info is set */
|
||||
orte_proc_info();
|
||||
|
||||
/* get the name of the user */
|
||||
uid = getuid();
|
||||
#if OPAL_ENABLE_GETPWUID
|
||||
{
|
||||
struct passwd *pwdent;
|
||||
|
||||
#ifdef HAVE_GETPWUID
|
||||
pwdent = getpwuid(uid);
|
||||
if (NULL == pwdent) {
|
||||
/* this indicates a problem with the passwd system,
|
||||
* so pretty-print a message just for info
|
||||
*/
|
||||
orte_show_help("help-orte-runtime.txt",
|
||||
"orte:session:dir:nopwname", true);
|
||||
}
|
||||
#else
|
||||
pwdent = NULL;
|
||||
#endif
|
||||
@ -149,6 +159,11 @@ orte_session_dir_get_name(char **fulldirpath,
|
||||
} else {
|
||||
asprintf(&user, "%d", uid);
|
||||
}
|
||||
}
|
||||
#else
|
||||
asprintf(&user, "%d", uid);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* set the 'hostname'
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user