summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c14
-rw-r--r--src/shared/util.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index a0755efb14..43ec62eac6 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4905,7 +4905,12 @@ int socket_from_display(const char *display, char **path) {
return 0;
}
-int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home) {
+int get_user_creds(
+ const char **username,
+ uid_t *uid, gid_t *gid,
+ const char **home,
+ const char **shell) {
+
struct passwd *p;
uid_t u;
@@ -4926,6 +4931,10 @@ int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **h
if (home)
*home = "/root";
+
+ if (shell)
+ *shell = "/bin/sh";
+
return 0;
}
@@ -4957,6 +4966,9 @@ int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **h
if (home)
*home = p->pw_dir;
+ if (shell)
+ *shell = p->pw_shell;
+
return 0;
}
diff --git a/src/shared/util.h b/src/shared/util.h
index d3546ba1cd..3915904442 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -441,7 +441,7 @@ int fchmod_umask(int fd, mode_t mode);
bool display_is_local(const char *display);
int socket_from_display(const char *display, char **path);
-int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home);
+int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell);
int get_group_creds(const char **groupname, gid_t *gid);
int in_group(const char *name);