Skip to content
Snippets Groups Projects
Commit e2487c87 authored by jwindley's avatar jwindley
Browse files

Allow root user no-op for --uid

parent 68c15c34
No related branches found
No related tags found
No related merge requests found
......@@ -19,13 +19,13 @@ uid_t
uid_from_name( char *name )
{
struct passwd *p = getpwnam( name );
return p ? p->pw_uid : 0;
return p ? p->pw_uid : NFS_NOBODY;
}
gid_t
gid_from_name( char *name )
{
struct group *g = getgrnam( name );
return g ? g->gr_gid : 0;
return g ? g->gr_gid : NFS_NOBODY;
}
#ifndef __SLURM_UID_UTILITY_H__
#define __SLURM_UID_UTILITY_H__
#define NFS_NOBODY 65534
int is_digit_string( char *str );
uid_t uid_from_name( char *name );
gid_t gid_from_name( char *name );
......
......@@ -426,6 +426,9 @@ static void _opt_default()
opt.max_exit_timeout= 60; /* Warn user 60 seconds after task exit */
opt.msg_timeout = 5; /* Default launch msg timeout */
opt.euid = NULL;
opt.egid = NULL;
mode = MODE_NORMAL;
#ifdef HAVE_TOTALVIEW
......@@ -910,7 +913,7 @@ static bool _opt_verify(void)
if ( getuid() == 0 ) {
if ( opt.euid ) {
euid = _become_user( opt.euid, opt.egid );
if ( euid ) {
if ( euid != NFS_NOBODY ) {
opt.uid = euid;
strncpy( opt.user, opt.euid, MAX_USERNAME );
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment