← Back to team overview

desktop-packages team mailing list archive

[Bug 862559] Re: Does not set PAM_XDISPLAY and or XDISPLAY, XAUTHORITY variables

 

The following code writes this to /var/log/auth.log:

------
...	PAM_SERVICE: lightdm.
...	Have no PAM_TTY.
...	Have now XDisplay: "(null)" and XAuth: "(null)".
------

This is the pam_sm_authenticate function of the PAM module:

<code>

PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    const char *service = NULL;
    char* xdisp = getenv("DISPLAY");
    char* xauth = getenv("XAUTHORITY");

    
    // Requested service
    pam_get_item(pamh, PAM_SERVICE, (const void **)(const void*)&service);
    if (service != NULL && strlen(service) > 0) {
        syslog(LOG_DEBUG, "PAM_SERVICE: %s.", (const char*)service);
    }

    if (xdisp == NULL) {    // Trying to get the xdisplay
        pam_get_item(pamh, PAM_XDISPLAY, (const void **)(const void*)&xdisp);
        if (xdisp == NULL) {
            pam_get_item(pamh, PAM_TTY, (const void **)(const void*)&xdisp);
            if (xdisp == NULL || strlen(xdisp) == 0) {
                syslog(LOG_DEBUG, "Have no PAM_TTY.");
                xdisp = NULL;
            }
            else {
                syslog(LOG_DEBUG, "Have PAM_TTY: %s.", xdisp);
                if(xdisp[0] != ':'){// looks not like a X-Display
                    syslog(LOG_DEBUG, "Have no DISPLAY from PAM_TTY.");
                    xdisp = NULL;
                }
                else{
                    syslog(LOG_DEBUG, "Have DISPLAY %s from PAM_TTY.", xdisp);
                    setenv("DISPLAY", xdisp, -1);
                }
            }
        }
        else {
            syslog(LOG_DEBUG, "Have DISPLAY %s from pam_get_item.", xdisp);
            setenv("DISPLAY", xdisp, -1);
        }
    }
    else
        syslog(LOG_DEBUG, "Have DISPLAY %s from getenv.", xdisp);

    syslog(LOG_DEBUG, "Have now XDisplay: \"%s\" and XAuth: \"%s\".", xdisp, xauth);
}

</code>


This means none of the variables are set. The module cannot display it's widget.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to lightdm in Ubuntu.
https://bugs.launchpad.net/bugs/862559

Title:
  Does not set PAM_XDISPLAY and or XDISPLAY, XAUTHORITY variables

Status in Light Display Manager:
  Triaged
Status in “lightdm” package in Ubuntu:
  Triaged

Bug description:
  If a PAM module with GUI interface for alternative authentication
  methods (like fingerprint authentication) is used, this module needs
  information about the xdisplay to connect to for showing up it's
  widget. Therefore PAM has two enviroment variables to be setup by the
  application before calling the "pam_authenticate" function. These
  variables are PAM_XDISPLAY and PAM_TTY, both to be set to the current
  display number (e.g. ":0"). Alternatively the environment variables
  XDISPLAY and XAUTHORITY can be set, so the PAM module can get the
  information by calling "getenv()".

To manage notifications about this bug go to:
https://bugs.launchpad.net/lightdm/+bug/862559/+subscriptions