[PATCH v2][xdm] Implement ConsoleKit support.

Fernando Lemos fernandotcl at gmail.com
Sat Jul 23 08:23:12 PDT 2011


On Fri, Jul 22, 2011 at 4:49 PM, Julien Cristau <jcristau at debian.org> wrote:
> On Mon, Jun 27, 2011 at 21:04:25 +0200, Cyril Brulebois wrote:
>
>> +static int openCKSession(struct verify_info *verify, struct display *d)
>> +{
>> +    int ret;
>> +    DBusError error;
>> +    char *remote_host_name = "";
>> +    dbus_bool_t is_local;
>> +    char *display_name = "";
>> +    char *display_device = "";
>> +    char devtmp[16];
>> +
>> +    if (!use_consolekit)
>> +     return 1;
>> +
>> +    is_local = d->displayType.location == Local;
>> +    if (d->peerlen > 0 && d->peer)
>> +     remote_host_name = d->peer;
>> +    if (d->name)
>> +     display_name = d->name;
>> +    /* how can we get the corresponding tty at best...? */
>> +    if (d->windowPath) {
>> +     display_device = strchr(d->windowPath, ':');
>> +     if (display_device && display_device[1])
>> +         display_device++;
>> +     else
>> +         display_device = d->windowPath;
>> +     snprintf(devtmp, sizeof(devtmp), "/dev/tty%s", display_device);
>
> Is ck relevant to anything !linux?  If so, that path is probably wrong.
> I'm not quite sure what ck users would do with that information, though,
> and a quick codesearch doesn't really help.  So maybe we should just not
> set that…

Good point. It's ported to FreeBSD, and FreeBSD supports /dev/tty* too
(actually all BSDs do). I have no idea about other platforms, and I'm
not sure there's a portable way to do it. On the other hand, I would
think most (all?) platforms where an user would want to enable CK
support are covered, but that's more of a guess.

>
>> +     display_device = devtmp;
>> +    }
>> +
>> +    connector = ck_connector_new();
>> +    if (!connector) {
>> +     LogOutOfMem("ck_connector");
>> +     return 0;
>> +    }
>> +
>> +    dbus_error_init(&error);
>> +    ret = ck_connector_open_session_with_parameters(
>> +             connector, &error,
>> +             "unix-user", &verify->uid,
>> +             "x11-display", &display_name,
>> +             "x11-display-device", &display_device,
>> +             "remote-host-name", &remote_host_name,
>> +             "is-local", &is_local,
>> +             NULL);
>> +    if (!ret) {
>> +     if (dbus_error_is_set(&error)) {
>> +         LogError("Dbus error: %s\n", error.message);
>> +         dbus_error_free(&error);
>> +     } else {
>> +         LogError("ConsoleKit error\n");
>> +     }
>> +     LogError("console-kit-daemon not running?\n");
>> +     ck_connector_unref(connector);
>> +     connector = NULL;
>> +     return 0;
>
> Is "ck-daemon isn't running" a good reason to prevent the user from
> logging in?  (Why?)

I agree it's better to let the user log in. Without a ck session, the
user might be unable to do some pretty important stuff (configure NM,
shutdown, etc.), but that's still better than not being able to log
in.


More information about the xorg-devel mailing list