summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-08-09 19:04:36 +0200
committerSven Eden <yamakuzure@gmx.net>2017-08-09 19:04:36 +0200
commit63e7758940d27499845c3e45b61e39c47efdc8c3 (patch)
tree69295c3c2fe537c60a4513cd4184fbdb59fc225e
parent6e076a5acab532181c345d4c9846115b61699b19 (diff)
pam_logind: skip leading /dev/ from PAM_TTY field before passing it on
Apparently, PAM documents that the PAM_TTY should come with a /dev prefix, but we don't expect it so far, except that Wayland ends up setting it after all, the way the docs suggest. Hence, let's simply drop the /dev prefix if it is there. Fixes: #6516
-rw-r--r--src/login/pam_elogind.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/login/pam_elogind.c b/src/login/pam_elogind.c
index 3af3487f5..5300e218b 100644
--- a/src/login/pam_elogind.c
+++ b/src/login/pam_elogind.c
@@ -46,6 +46,7 @@
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
+#include "path-util.h"
static int parse_argv(
pam_handle_t *handle,
@@ -339,7 +340,9 @@ _public_ PAM_EXTERN int pam_sm_open_session(
type ="tty";
class = "user";
tty = NULL;
- }
+ } else
+ /* Chop off leading /dev prefix that some clients specify, but others do not. */
+ tty = skip_dev_prefix(tty);
/* If this fails vtnr will be 0, that's intended */
if (!isempty(cvtnr))