]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam_logind: skip leading /dev/ from PAM_TTY field before passing it on 6582/head
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Aug 2017 17:04:36 +0000 (19:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Aug 2017 17:04:36 +0000 (19:04 +0200)
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
src/login/pam_systemd.c

index df16907ed2d323336a7b54ebce4030a176b3fcec..730e0f1b5ad1a064d51eb428a6bab192c8040bd3 100644 (file)
@@ -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,
@@ -335,7 +336,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))