X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Fpam-module.c;h=46509245fb4a801361a460e63bfa70acec18b992;hb=fc3c1c6e091ea16ad5600b145201ec535bbb5d7c;hp=14e706b37430a52c2f03953f48fc36a159d2793e;hpb=be5f4385d61d512f0c3c75b70df9f77eac2b8331;p=elogind.git diff --git a/src/login/pam-module.c b/src/login/pam-module.c index 14e706b37..46509245f 100644 --- a/src/login/pam-module.c +++ b/src/login/pam-module.c @@ -32,9 +32,10 @@ #include #include +#include + #include "util.h" #include "macro.h" -#include "sd-daemon.h" #include "strv.h" #include "dbus-common.h" #include "def.h" @@ -259,7 +260,6 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_ int v; assert(display); - assert(seat); assert(vtnr); /* We deduce the X11 socket from the display name, then use @@ -307,7 +307,8 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_ else if (v == 0) return -ENOENT; - *seat = "seat0"; + if (seat) + *seat = "seat0"; *vtnr = (uint32_t) v; return 0; @@ -454,8 +455,12 @@ _public_ PAM_EXTERN int pam_sm_open_session( if (!isempty(cvtnr)) safe_atou32(cvtnr, &vtnr); - if (!isempty(display) && isempty(seat) && vtnr <= 0) - get_seat_from_display(display, &seat, &vtnr); + if (!isempty(display) && vtnr <= 0) { + if (isempty(seat)) + get_seat_from_display(display, &seat, &vtnr); + else if (streq(seat, "seat0")) + get_seat_from_display(display, NULL, &vtnr); + } type = !isempty(display) ? "x11" : !isempty(tty) ? "tty" : "unspecified";