[PATCH v2][xdm] Implement ConsoleKit support.
Julien Cristau
jcristau at debian.org
Fri Jul 22 12:49:08 PDT 2011
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…
> + 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?)
> + }
> +
> + verify->userEnviron = setEnv(verify->userEnviron,
> + "XDG_SESSION_COOKIE", (char *)ck_connector_get_cookie(connector));
> + return 1;
> +}
> +
Cheers,
Julien
More information about the xorg-devel
mailing list