diff options
Diffstat (limited to 'src/login/sd-login.c')
-rw-r--r-- | src/login/sd-login.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/login/sd-login.c b/src/login/sd-login.c index 2930b8751f..c795765620 100644 --- a/src/login/sd-login.c +++ b/src/login/sd-login.c @@ -254,6 +254,26 @@ _public_ int sd_session_is_active(const char *session) { return r; } +_public_ int sd_session_is_remote(const char *session) { + int r; + _cleanup_free_ char *p = NULL, *s = NULL; + + r = file_of_session(session, &p); + if (r < 0) + return r; + + r = parse_env_file(p, NEWLINE, "REMOTE", &s, NULL); + if (r < 0) + return r; + + if (!s) + return -EIO; + + r = parse_boolean(s); + + return r; +} + _public_ int sd_session_get_state(const char *session, char **state) { _cleanup_free_ char *p = NULL, *s = NULL; int r; @@ -364,6 +384,14 @@ _public_ int sd_session_get_display(const char *session, char **display) { return session_get_string(session, "DISPLAY", display); } +_public_ int sd_session_get_remote_user(const char *session, char **remote_user) { + return session_get_string(session, "REMOTE_USER", remote_user); +} + +_public_ int sd_session_get_remote_host(const char *session, char **remote_host) { + return session_get_string(session, "REMOTE_HOST", remote_host); +} + static int file_of_seat(const char *seat, char **_p) { char *p; int r; |