Hi there,

        I append a couple of patches that make 'uxlaunch' work (well not fully,
yet[1]) - for me on openSUSE, I hope git format-patch output, in-line
works well.

        I was also amused, when reading the code to see another hand-written
piece of 'fork / exec' code - does it deal with file descriptors
properly ? it is normal to double fork, and so on. Then of course, when
I ran it, and X crashes [ like it does ;-] - I ended up in a hung state;
the pstree output:

     
├─rc(329)───startpar(690)───xdm(763)───uxlaunch(823)───uxlaunch.bin(824)─┬─Xorg(830)
     │                                                                        
└─bkl-orbiter(973)

$ ps auwx | grep Xorg
root       830  0.1  0.0      0     0 ?        Zs   05:08   0:00 [Xorg] 
<defunct>

        Though strangely uxlaunch.bin is blocked in the waitpid for the right
pid. I can reproduce the problem by doing a killall -15 Xorg on an Intel
build.

        Any chance we can use g_spawn there instead ?

        Regards,

                Michael.

[1] - still having grief with ConsoleKit:
Error: Unable to open session with ConsoleKit:
org.freedesktop.CkConnector.Error: Unable to open session: Rejected send
message, 2 matched rules; type="method_call", sender=":1.4" (uid=1000
pid=824 comm="/usr/sbin/uxlaunch.bin ")
interface="org.freedesktop.ConsoleKit.Manager"
member="OpenSessionWithParameters" error name="(unset)"
requested_reply=0 destination="org.freedesktop.ConsoleKit" (uid=0
pid=828 comm="/usr/sbin/console-kit-daemon "))

--- boilerplate waiver ---
The attached / included patches are submitted under the terms here:
http://bugzilla.openedhand.com/waiver.html applied to whatsoever
product to which they apply, rather than to clutter:


>From 81f58edfb8e0145a34011b0270669b2d0a122e7c Mon Sep 17 00:00:00 2001
From: Michael Meeks <[email protected]>
Date: Tue, 11 Aug 2009 11:53:10 +0100
Subject: [PATCH] Make PAM happy on (chattier) SUSE.

---
 options.c |    6 +++---
 pam.c     |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/options.c b/options.c
index fbc38e6..49a7245 100644
--- a/options.c
+++ b/options.c
@@ -174,8 +174,8 @@ void get_options(int argc, char **argv)
        lprintf("user \"%s\", tty #%d, session \"%s\"", username, tty, session);
 
        pass = getpwnam(username);
-       if (!pass)
+       if (!pass) {
+               lprintf("Error: can't find user \"%s\"", username);
                exit(EXIT_FAILURE);
-
-
+       }
 }
diff --git a/pam.c b/pam.c
index 65855bf..7b9881b 100644
--- a/pam.c
+++ b/pam.c
@@ -5,6 +5,7 @@
  * Authors: 
  *     Auke Kok <[email protected]>
  *     Arjan van de Ven <[email protected]>
+ *     Michael Meeks <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -25,6 +26,48 @@ pam_handle_t *ph;
 struct pam_conv pc;
 
 /*
+ * Sometimes PAM likes to chat with you, before it is assured
+ * enough to let you log-in: fun.
+ */
+static int
+pam_conversation_fn (int msg_count,
+                    const struct pam_message **messages,
+                    struct pam_response      **responses,
+                    void *user_data)
+{
+       int i;
+       (void)user_data;
+
+       lprintf ("pam conversation with %d messages", msg_count);
+       if (responses)
+               *responses = NULL;
+
+        if (msg_count < 1) /* ping */
+                return PAM_SUCCESS;
+
+       /* otherwise find any helpful data we can to print, and bail */
+       if (!responses || !messages) {
+               lprintf ("pam conversation with no message, or response");
+               return PAM_CONV_ERR;
+       }
+       *responses = calloc (msg_count, sizeof (struct pam_response));
+        for (i = 0; i < msg_count; i++) {
+               const struct pam_message *msg = messages[i];
+
+               if (msg->msg_style == PAM_TEXT_INFO)
+                       lprintf ("pam chats to us: '%s'", msg->msg);
+               else if (msg->msg_style == PAM_ERROR_MSG)
+                       lprintf ("Error: pam error msg '%s'", msg->msg);
+               else
+                       lprintf ("pam message %d style %d: '%s'",
+                                i, msg->msg_style, msg->msg);
+               (*responses)[i].resp = NULL;
+                (*responses)[i].resp_retcode = PAM_SUCCESS;
+       }
+       return PAM_SUCCESS;
+}
+
+/*
  * Creating a PAM session. We need a pam "login" session so that the dbus
  * "at_console" logic will work correctly, as well as various /dev file
  * permissions.
@@ -40,6 +83,9 @@ void setup_pam_session(void)
 
        snprintf(x, 256, "tty%d", tty);
 
+       pc.conv = pam_conversation_fn;
+       pc.appdata_ptr = NULL;
+
        err = pam_start("login", pass->pw_name, &pc, &ph);
 
        err = pam_set_item(ph, PAM_TTY, &x);
-- 
1.6.0.2

>From 1ce5af2971371f3bc7df488aa82e1c7e7b821407 Mon Sep 17 00:00:00 2001
From: Michael Meeks <[email protected]>
Date: Tue, 11 Aug 2009 12:13:53 +0100
Subject: [PATCH] Allow the mutter libexec path to be configured at compile time

---
 Makefile  |    5 ++++-
 desktop.c |   14 +++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 5d44700..3218c16 100644
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,14 @@ install: uxlaunch
        [ -f $(DESTDIR)/etc/sysconfig/uxlaunch ] || \
            install uxlaunch.sysconfig $(DESTDIR)/etc/sysconfig/uxlaunch
 
+mutterlibexecdir = "/usr/libexec"
+
 OBJS := uxlaunch.o consolekit.o dbus.o desktop.o misc.o pam.o user.o xserver.o 
\
        lib.o options.o
 
 CFLAGS += -Wall -W -Os -g -fstack-protector -D_FORTIFY_SOURCE=2 -Wformat 
-fno-common \
         -Wimplicit-function-declaration  -Wimplicit-int \
+        -DMUTTER_LIBEXECDIR=\""$(mutterlibexecdir)"\" \
        `pkg-config --cflags dbus-1` \
        `pkg-config --cflags ck-connector` \
        `pkg-config --cflags glib-2.0` \
@@ -27,7 +30,7 @@ LDADD  += `pkg-config --libs dbus-1` \
 
 %.o: %.c uxlaunch.h Makefile
        @echo "  CC  $<"
-       @$(CC) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CFLAGS) -c -o $@ $<
 
 uxlaunch: $(OBJS) Makefile
        @echo "  LD  $@"
diff --git a/desktop.c b/desktop.c
index 52c5cf6..73a96f7 100644
--- a/desktop.c
+++ b/desktop.c
@@ -164,13 +164,13 @@ void autostart_panels(void)
        if (!strstr(session, "mutter"))
                return;
 
-       desktop_entry_add("/usr/libexec/moblin-panel-myzone", -1);
-       desktop_entry_add("/usr/libexec/moblin-panel-status", 0);
-       desktop_entry_add("/usr/libexec/moblin-panel-people", 0);
-       desktop_entry_add("/usr/libexec/moblin-panel-internet", 0);
-       desktop_entry_add("/usr/libexec/moblin-panel-media", 1);
-       desktop_entry_add("/usr/libexec/moblin-panel-pasteboard", 0);
-       desktop_entry_add("/usr/libexec/moblin-panel-applications", 1);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-myzone", -1);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-status", 0);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-people", 0);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-internet", 0);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-media", 1);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-pasteboard", 0);
+       desktop_entry_add(MUTTER_LIBEXECDIR "/moblin-panel-applications", 1);
 }
 
 
-- 
1.6.0.2

-- 
 [email protected]  <><, Pseudo Engineer, itinerant idiot

_______________________________________________
Moblin dev Mailing List
[email protected]

To manage or unsubscribe from this mailing list visit:
http://lists.moblin.org/listinfo/dev or your user account on http://moblin.org 
once logged in.

For more information on the Moblin Developer Mailing lists visit:
http://moblin.org/community/mailing-lists

Reply via email to