After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678057 - support an initial-setup mode
support an initial-setup mode
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-13 23:23 UTC by Matthias Clasen
Modified: 2012-11-16 22:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Update .gitignore (1.76 KB, patch)
2012-07-18 22:45 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
libgdm: Make sure to install gdm-client-glue.h (993 bytes, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Allow passing a username to SetupForProgram (5.10 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Allow setting the PAM_AUTHTOK for the login (7.54 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Start replacing old method/signal-based API with async method calls (30.72 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Allow starting a transient program (8.55 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
daemon: Remove GdmGreeterSession and GdmChooserSession (21.17 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Remove unused GdmWelcomeSession properties (5.32 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Rename GdmWelcomeSession to GdmProgramSpawner (61.25 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
daemon: Add initial setup integration (13.07 KB, patch)
2012-07-18 22:46 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
daemon: Allow setting the PAM_AUTHTOK for the login (5.91 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
daemon: Start replacing old method/signal-based API with async method calls (30.72 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Allow starting a transient program (8.55 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment (62.71 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Add initial setup integration (13.01 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
simple-greeter: Fix warnings (2.31 KB, patch)
2012-07-19 19:34 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Remove dummy constructor/property functions (2.60 KB, patch)
2012-07-19 19:47 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
daemon: Fix error handling in BeginVerification and siblings (1.92 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Refactor BeginVerification and siblings (3.61 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Provide mechanism for providing authentication secret up front (6.36 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
daemon: Start replacing old method/signal-based API with async method calls (33.77 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Allow starting a transient program (9.18 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment (67.52 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Add initial setup integration (13.29 KB, patch)
2012-07-20 02:32 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Remove dummy constructor/property functions (2.60 KB, patch)
2012-07-20 02:33 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Debug message fixes (1.46 KB, patch)
2012-07-20 02:33 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Clean up memory leaks (1.13 KB, patch)
2012-07-24 09:05 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Remove old, unused signals (1.44 KB, patch)
2012-07-24 09:05 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Start replacing old method/signal-based API with async method calls (86.70 KB, patch)
2012-07-24 09:05 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Provide mechanism for providing an authentication secret up front (7.41 KB, patch)
2012-07-24 09:05 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Allow starting a transient program (11.37 KB, patch)
2012-07-24 09:05 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment (66.83 KB, patch)
2012-07-24 09:06 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
daemon: Add initial setup integration (13.27 KB, patch)
2012-07-24 09:06 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
add clear_pointer (5.41 KB, patch)
2012-07-24 09:06 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
kenny loggins (994 bytes, patch)
2012-07-24 09:06 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
daemon: Start replacing old method/signal-based API with async method calls (112.95 KB, patch)
2012-07-31 17:56 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
daemon: Provide mechanism for providing an authentication secret up front (7.41 KB, patch)
2012-07-31 17:56 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment (69.72 KB, patch)
2012-07-31 17:56 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
daemon: Add initial setup integration (13.78 KB, patch)
2012-07-31 17:56 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Replace old method/signal-based API with async method calls (120.74 KB, patch)
2012-07-31 21:21 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
daemon: Provide mechanism for providing an authentication secret up front (7.41 KB, patch)
2012-07-31 21:21 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment (69.82 KB, patch)
2012-07-31 21:21 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Add initial setup integration (13.04 KB, patch)
2012-07-31 21:21 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
daemon: Replace old method/signal-based API with async method calls (122.84 KB, patch)
2012-07-31 22:48 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
Some log and a backtrace of fault introduced in 3.5.5 (15.27 KB, text/plain)
2012-08-13 08:12 UTC, Colin Guthrie
  Details
GdmSessionWorker: fix signature of Reauthenticated signal (1.61 KB, patch)
2012-08-13 13:07 UTC, Giovanni Campagna
needs-work Details | Review
GdmSession: don't access conversation after closing the connection (11.99 KB, patch)
2012-08-13 14:57 UTC, Giovanni Campagna
committed Details | Review
GdmSession: fix signature of Reauthenticated signal handler (1.18 KB, patch)
2012-08-13 15:53 UTC, Giovanni Campagna
committed Details | Review
daemon: Fix session setting code (913 bytes, patch)
2012-08-17 19:31 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
Revert "daemon: Provide mechanism for providing an authentication secret up front" (8.03 KB, patch)
2012-08-17 19:43 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
Enable initial setup by default (754 bytes, patch)
2012-10-06 00:42 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2012-06-13 23:23:29 UTC
The https://live.gnome.org/ThreePointFive/Features/InitialSetup feature needs some support in gdm to run the initial setup app. The needed changes are (in a unrefined form) in the http://git.gnome.org/browse/gdm/log/?h=wip/initial-setup-redux branch
Comment 1 Matthias Clasen 2012-07-18 13:36:57 UTC
See bug 679474 for the current plans for how to do this.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:45:58 UTC
Created attachment 219162 [details] [review]
Update .gitignore
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:00 UTC
Created attachment 219163 [details] [review]
libgdm: Make sure to install gdm-client-glue.h

Otherwise, clients using libgdm will fail.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:03 UTC
Created attachment 219164 [details] [review]
daemon: Allow passing a username to SetupForProgram

This allows the setup session to pass the gdm-initial-setup user.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:05 UTC
Created attachment 219165 [details] [review]
daemon: Allow setting the PAM_AUTHTOK for the login

This lets us do an auto-login in the general case where we know the
user's password, for gnome-initial-setup.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:08 UTC
Created attachment 219166 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

For now, just replace three method/signal API pairs on the worker that are
a part of the state machine, and leave the rest of the cleanup for another
day.
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:17 UTC
Created attachment 219167 [details] [review]
daemon: Allow starting a transient program

The setup session will need to start a transient program before the
actual session runs, in order to run a process that copies all data
from the gdm-initial-setup user to the user's directory. Give it an
API to do so that it can call. Nothing uses it quite yet, though...
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:19 UTC
Created attachment 219168 [details] [review]
daemon: Remove GdmGreeterSession and GdmChooserSession

With the recent cleanup, these two are just dummy class subtypes.
Duplicating this one more time for the setup session wouldn't be
worth it. Into the trash it goes.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:22 UTC
Created attachment 219169 [details] [review]
daemon: Remove unused GdmWelcomeSession properties

These weren't used, either in the implementation, nor the interface.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:25 UTC
Created attachment 219170 [details] [review]
daemon: Rename GdmWelcomeSession to GdmProgramSpawner

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmProgramSpawner" is an
appropriate name for this.
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-07-18 22:46:28 UTC
Created attachment 219171 [details] [review]
daemon: Add initial setup integration
Comment 12 Ray Strode [halfline] 2012-07-19 16:52:58 UTC
I committed a few of these before my brown bag 3.5.4.1 release today
Comment 13 Ray Strode [halfline] 2012-07-19 16:55:05 UTC
Comment on attachment 219166 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

This probably needs to be more exhaustive before it can go in.
Comment 14 Ray Strode [halfline] 2012-07-19 17:11:59 UTC
Review of attachment 219165 [details] [review]:

::: daemon/gdm-session-worker.c
@@ +2657,3 @@
+                    GdmSessionWorker     *worker)
+{
+        worker->priv->pam_authtok = g_strdup (pam_authtok);

I'd call pam_set_item directly here.  I wouldn't defer to do_setup.  I don't think it's a good idea to keep the password sitting around, so I wouldn't keep it in the worker priv struct.  Also, I think this function needs to ensure the current state is after SETUP and before AUTHENTICATE.

::: daemon/gdm-session.xml
@@ +116,3 @@
       <arg name="display_is_local" type="b"/>
     </signal>
+    <signal name="SetPamAuthTok">

The inner details of pam and even the word pam are fairly deliberately abstracted away in the API. The closest existing interfaces we have to this are SecretInfoQuery and AnswerQuery.  How about SetInitialSecret ?
Comment 15 Ray Strode [halfline] 2012-07-19 17:19:51 UTC
Review of attachment 219170 [details] [review]:

So the more I think about this, I think GdmProgramSpawner isn't a great fit either.  Like you said, it does a lot more than spawn a program.  It sets up a whole environment for the program to run in (including dbus, and environment variables for that environment etc).  How about GdmLaunchEnvironment ?
Comment 16 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:08 UTC
Created attachment 219264 [details] [review]
daemon: Allow setting the PAM_AUTHTOK for the login

This lets us do an auto-login in the general case where we know the
user's password, for gnome-initial-setup.
Comment 17 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:11 UTC
Created attachment 219265 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

For now, just replace three method/signal API pairs on the worker that are
a part of the state machine, and leave the rest of the cleanup for another
day.
Comment 18 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:13 UTC
Created attachment 219266 [details] [review]
daemon: Allow starting a transient program

The setup session will need to start a transient program before the
actual session runs, in order to run a process that copies all data
from the gdm-initial-setup user to the user's directory. Give it an
API to do so that it can call. Nothing uses it quite yet, though...
Comment 19 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:16 UTC
Created attachment 219267 [details] [review]
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmLaunchEnvironment" is an
appropriate name for this.
Comment 20 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:19 UTC
Created attachment 219268 [details] [review]
daemon: Add initial setup integration
Comment 21 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:34:24 UTC
Created attachment 219269 [details] [review]
simple-greeter: Fix warnings
Comment 22 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:39:09 UTC
While we would like to have the async method patch to be finished too, it's just a lot of manual labor, so I'd like some feedback on the approach before we convert everything.
Comment 23 Ray Strode [halfline] 2012-07-19 19:41:05 UTC
Review of attachment 219267 [details] [review]:

My only complaint is the spacing gets all messed up by the rename.  Other than that, it's fine.
Comment 24 Ray Strode [halfline] 2012-07-19 19:45:27 UTC
Comment on attachment 219269 [details] [review]
simple-greeter: Fix warnings

Attachment 219269 [details] pushed as a071378 - simple-greeter: Fix warnings
Comment 25 Jasper St. Pierre (not reading bugmail) 2012-07-19 19:47:39 UTC
Created attachment 219271 [details] [review]
daemon: Remove dummy constructor/property functions

They don't do anything.
Comment 26 Ray Strode [halfline] 2012-07-19 19:58:12 UTC
Review of attachment 219264 [details] [review]:

Commit message should be something like:

daemon: Provide mechanism for providing authentication secret up front

Some PAM modules can be told their password ahead of time to preventing them having to ask later.
This is accomplished by setting the PAM_AUTHTOK item before calling pam_authenticate.

gnome-initial-setup needs to be able to do this to reuse the username/password entered at the user creation/enrollment page.

This commit enables this capability with a new "blah" interface.

::: daemon/gdm-session-worker.c
@@ +2656,3 @@
+                       GdmSessionWorker     *worker)
+{
+        worker->priv->initial_secret = g_strdup (initial_secret);

I think you should call pam_set_item here after ensuring the state is SETUP_COMPLETE

::: daemon/gdm-session.c
@@ +1433,3 @@
+
+        conversation = find_conversation_by_name (self, service_name);
+

need to check null here. in fact, it will always be null right? conversations are started implicitly at BeginVerification time, so I don't think this can work.  I think instead you'll need one or two more WithInitialSecret variants to BeginVerification
Comment 27 Ray Strode [halfline] 2012-07-19 20:22:19 UTC
Review of attachment 219265 [details] [review]:

general approach seems fine, and more logical than what we're doing now.  You should make sure there's an unlimited timeout for the method calls to reply, and that everything is ported over to the new style.

::: daemon/gdm-session-worker.c
@@ +161,3 @@
         GdmSessionSettings *user_settings;
+
+        GDBusMethodInvocation *invocation;

I'd probably add the prefix pending_ to this variable, but that's just me, do whatever.

@@ +2745,3 @@
+                                                       get_state_name (new_state),
+                                                       get_state_name (worker->priv->state + 1));
+                return FALSE;

You should return TRUE even for errors.  FALSE means "i haven't handled this, let the next person who has connected to the signal give it a go."

@@ +2767,3 @@
+gdm_session_worker_handle_authenticate (GdmDBusWorker         *object,
+                                        GDBusMethodInvocation *invocation,
+                                        const gchar           *arg_service_name)

just use 

const char *service_name,

instead of

const gchar *service_name,

@@ +2789,3 @@
+        GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
+        if (!validate_and_queue_state_change (worker, invocation, GDM_SESSION_WORKER_STATE_ACCREDITED))
+                return FALSE;

gdm codebase tries to alway use braces for if statements

@@ +2869,3 @@
+                                      GDM_WORKER_DBUS_NAME,
+                                      G_BUS_NAME_OWNER_FLAGS_NONE,
+                                      NULL, NULL, NULL, NULL);

You don't need to take a name.  Just pass NULL for the name on the other end of the pipe.

::: daemon/gdm-session.c
@@ +326,3 @@
 
+static void
+on_authenticate_cb (GdmDBusWorker *proxy,

using past-tense is more common in GDM than _cb, so e.g. on_authenticated

::: daemon/gdm-session.xml
@@ +1,3 @@
 <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
 <node name="/org/gnome/DisplayManager/Session">
+  <interface name="org.gnome.DisplayManager.Worker">

Shouldn't this interface be on a separate /org/gnome/DisplayManager/SessionServer node ?
Comment 28 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:37 UTC
Created attachment 219297 [details] [review]
daemon: Fix error handling in BeginVerification and siblings

We were trying to return an error on the wrong invocation.
Comment 29 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:42 UTC
Created attachment 219298 [details] [review]
daemon: Refactor BeginVerification and siblings

As we're going to add a new variant that additionally asks for a
secret, we need to do this.
Comment 30 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:45 UTC
Created attachment 219299 [details] [review]
daemon: Provide mechanism for providing authentication secret up front

Some PAM modules can be told their password ahead of time to preventing them
having to ask later. This is accomplished by setting the PAM_AUTHTOK item
before calling pam_authenticate.
Comment 31 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:49 UTC
Created attachment 219300 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

For now, just replace three method/signal API pairs on the worker that are
a part of the state machine, and leave the rest of the cleanup for another
day.
Comment 32 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:52 UTC
Created attachment 219301 [details] [review]
daemon: Allow starting a transient program

The setup session will need to start a transient program before the
actual session runs, in order to run a process that copies all data
from the gdm-initial-setup user to the user's directory. Give it an
API to do so that it can call. Nothing uses it quite yet, though...
Comment 33 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:56 UTC
Created attachment 219302 [details] [review]
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmLaunchEnvironment" is an
appropriate name for this.
Comment 34 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:32:59 UTC
Created attachment 219303 [details] [review]
daemon: Add initial setup integration
Comment 35 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:33:02 UTC
Created attachment 219304 [details] [review]
daemon: Remove dummy constructor/property functions

They don't do anything.
Comment 36 Jasper St. Pierre (not reading bugmail) 2012-07-20 02:33:05 UTC
Created attachment 219305 [details] [review]
daemon: Debug message fixes
Comment 37 Ray Strode [halfline] 2012-07-20 05:11:29 UTC
Review of attachment 219297 [details] [review]:

doh, error handling hard.
Comment 38 Ray Strode [halfline] 2012-07-20 05:11:30 UTC
Review of attachment 219297 [details] [review]:

doh, error handling hard.
Comment 39 Ray Strode [halfline] 2012-07-20 05:12:41 UTC
Review of attachment 219298 [details] [review]:

sure
Comment 40 Ray Strode [halfline] 2012-07-20 05:24:30 UTC
Review of attachment 219305 [details] [review]:

::: daemon/gdm-session.c
@@ +2256,3 @@
         }
 
+        g_debug ("GdmSession: Beginning setup for session for program with log '%s' %s", log_file, service_name);

second %s should probably have a "using PAM service " before it or so
Comment 41 Jasper St. Pierre (not reading bugmail) 2012-07-20 05:34:59 UTC
Attachment 219297 [details] pushed as 48d2e54 - daemon: Fix error handling in BeginVerification and siblings
Attachment 219298 [details] pushed as 416f7e6 - daemon: Refactor BeginVerification and siblings
Attachment 219304 [details] pushed as fc276c4 - daemon: Remove dummy constructor/property functions
Attachment 219305 [details] pushed as fec3124 - daemon: Debug message fixes
Comment 42 Ray Strode [halfline] 2012-07-20 19:29:43 UTC
Review of attachment 219299 [details] [review]:

commit message has "preventing them having" instead of "prevent them from having" (my fault).

Looks good. Just needs a few small changes.

::: daemon/gdm-session.c
@@ +75,3 @@
         GDBusMethodInvocation *starting_invocation;
         char                  *starting_username;
+        char                  *secret;

since the other two state variables used at the same time have a starting_ prefix, secret should probably be called starting_secret

@@ +1182,3 @@
+                if (conversation->secret != NULL) {
+                        gdm_dbus_worker_manager_emit_set_initial_secret (worker_manager_interface,
+                                                                         conversation->secret);

needs a g_clear_pointer here to clean it up.  Also, probably needs to get cleared in the error case for gdm_session_start_conversation
Comment 43 Ray Strode [halfline] 2012-07-20 19:39:28 UTC
Review of attachment 219300 [details] [review]:

So again, I'm fine with this, but only if you go all the way. I don't want a mixture of old-school-dbus-way and new way.
Comment 44 Ray Strode [halfline] 2012-07-20 19:39:29 UTC
Review of attachment 219300 [details] [review]:

So again, I'm fine with this, but only if you go all the way. I don't want a mixture of old-school-dbus-way and new way.
Comment 45 Ray Strode [halfline] 2012-07-20 19:51:39 UTC
Review of attachment 219301 [details] [review]:

::: daemon/gdm-session-worker.c
@@ +2422,3 @@
+parse_start_program (GdmSessionWorker *worker,
+                     char           ***argv,
+                     const char       *text)

The name "parse_start_program" doesn't really describe what this function does.  One other thing is, I'd suggest putting out arguments at the end of the argument list.

Though, this function does two things:

1) validates the worker is in a state where it can start the program
2) converts the command to an arg array

Those things are actually conceptually separate enough, I'm not sure I would even put them in the same function.

@@ +2480,3 @@
+        pid = gdm_session_execute (argv[0], argv,
+                                   gdm_session_worker_get_environment (worker),
+                                   TRUE);

gdm_session_execute doesn't return; it transmutates the currently running process into the new process.  You need a fork() somewhere, to give it a sacrificial child to execute.
Comment 46 Ray Strode [halfline] 2012-07-20 19:56:36 UTC
Review of attachment 219302 [details] [review]:

overall looks fine.  The spacing got messed up by your rename. I know it's pain, but I'd appreciate it if you went through and realigned all the function signatures and multi-line function calls to keep things tidy.

The other thing is I think you forgot to "git mv gdm-welcome.pam gdm-launch-environment.pam" since I don't see them in your patch

::: daemon/gdm-xdmcp-chooser-slave.c
@@ +65,3 @@
         guint              connection_attempts;
 
+        GdmLaunchEnvironment *chooser;

don't you want to rename this chooser_environment too, like you renamed greeter to greeter_environment ? (i don't care either way)
Comment 47 Ray Strode [halfline] 2012-07-20 20:26:13 UTC
Review of attachment 219303 [details] [review]:

commit message should describe briefly what initial setup is, point to the wiki page, and basically just give a small contained overview of the feature.

::: daemon/gdm-simple-slave.c
@@ +851,2 @@
 static GdmLaunchEnvironment *
+create_environment_for (const char *session_id,

not sure about the _for suffix is it for a session? for a user? for a display? for a seat?  I'd just elide the _for

@@ +859,3 @@
 {
         gboolean debug = FALSE;
+        char *command_base;

const char * (I know it was char * before)

@@ +877,1 @@
         }

One idea is you could GPtrArray *args; 
args = g_ptr_array_new(); 
g_array_add(args, BINDIR "/gnome-session
g_ptr_array_add(args, "-f"); 
if (debug) g_ptr_array_add (args, "--debug"); 
if (session_id != NULL) { ... } etc
g_ptr_array_add(args, NULL);

command = g_strjoinv (" ", g_ptr_array_free (args, FALSE));

Just an idea.  Do whatever you like better.

@@ +947,2 @@
         g_debug ("GdmSimpleSlave: Creating greeter on %s %s %s", display_name, display_device, display_hostname);
+        slave->priv->greeter_environment = create_environment_for (NULL,

shouldn't this be session_id ? 

Another thought: the name session_id is sort of loaded, unfortunately. We have gnome-session's session, gdm's xsession name, logind's user session id all in play.  Might make sense to call this gnome_session_id.

ANOTHER THOUGHT, have a separate dconf profile for initial setup and then pass that in instead of session_id.  It would change change what we cause the g_hash_table_insert (hash, g_strdup ("DCONF_PROFILE"), g_strdup ("gdm")) to get changed.

Then you could just put your session in dconf like we do currently for the greeter session

@@ +1107,3 @@
+
+static void
+start_session_timed (GdmSimpleSlave *slave)

maybe call this start_greeter_or_autologin

@@ +1115,3 @@
+
+        setup_server (slave);
+

Though, don't you need to call setup_server() and create_new_session() in the start_initial_setup case too? Maybe you should merge this with its caller, so its

setup_server();

if (wants_initial_setup) start_initial_setup();
else if (!autologin) { start_greeter (); }
else { run_script ("/Init"); }

create_new_session ();

@@ +1125,3 @@
+                /* Run the init script. gdmslave suspends until script has terminated */
+                gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/Init", GDM_USERNAME);
+                reset_session (slave);

there was an upstream fix to this code recently, you'll need to rebase. (reset_session should be create_new_session ())

@@ +1136,3 @@
+        if (!g_file_test ("/run/wants-initial-setup", G_FILE_TEST_EXISTS))
+                return FALSE;
+

if statements are always supposed to have braces in GDM code.
Comment 48 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:05:38 UTC
Created attachment 219553 [details] [review]
daemon: Clean up memory leaks

We need to make sure we free these dup'd strings so that we
do not leak private information or memory.
Comment 49 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:05:44 UTC
Created attachment 219554 [details] [review]
daemon: Remove old, unused signals

These are all dead signals that never got removed.
Comment 50 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:05:49 UTC
Created attachment 219555 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

So, reverse the API so that the worker manager calls async methods on the
worker itself.
Comment 51 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:05:52 UTC
Created attachment 219556 [details] [review]
daemon: Provide mechanism for providing an authentication secret up front

Some PAM modules can be told their password ahead of time to preventing them
having to ask later. This is accomplished by setting the PAM_AUTHTOK item
before calling pam_authenticate.
Comment 52 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:05:56 UTC
Created attachment 219557 [details] [review]
daemon: Allow starting a transient program

The setup session will need to start a transient program before the
actual session runs, in order to run a process that copies all data
from the gdm-initial-setup user to the user's directory. Give it an
API to do so that it can call. Nothing uses it quite yet, though...
Comment 53 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:06:00 UTC
Created attachment 219558 [details] [review]
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmLaunchEnvironment" is an
appropriate name for this.
Comment 54 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:06:04 UTC
Created attachment 219559 [details] [review]
daemon: Add initial setup integration
Comment 55 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:06:39 UTC
Created attachment 219560 [details] [review]
add clear_pointer

xxx for live installs
Comment 56 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:06:43 UTC
Created attachment 219561 [details] [review]
kenny loggins
Comment 57 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:07:11 UTC
Review of attachment 219561 [details] [review]:

did not mean to attach this
Comment 58 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:07:18 UTC
Review of attachment 219560 [details] [review]:

did not mean to attach this
Comment 59 Jasper St. Pierre (not reading bugmail) 2012-07-24 09:07:55 UTC
Review of attachment 219557 [details] [review]:

This one is still wrong. I want to play around with scrapping the special exec code and just use gspawn directly.
Comment 60 Ray Strode [halfline] 2012-07-24 18:10:42 UTC
Review of attachment 219553 [details] [review]:

::: daemon/gdm-session.c
@@ +1823,3 @@
         }
 
+        g_clear_pointer (&conversation->service_name, (GDestroyNotify) g_free);

This one is already done a few lines lower

@@ +1824,3 @@
 
+        g_clear_pointer (&conversation->service_name, (GDestroyNotify) g_free);
+        g_clear_pointer (&conversation->starting_username, (GDestroyNotify) g_free);

This one should normally be freed as soon as the worker chimes in, but I guess the worker could potentially get stopped before it chimes in in some cases, so this fix makes sense.

@@ +1826,3 @@
+        g_clear_pointer (&conversation->starting_username, (GDestroyNotify) g_free);
+        g_clear_pointer (&conversation->session_id, (GDestroyNotify) g_free);
+

looks good.
Comment 61 Ray Strode [halfline] 2012-07-24 18:14:35 UTC
Review of attachment 219554 [details] [review]:

looks mostly fine.

::: daemon/gdm-session.xml
@@ -148,3 @@
-    <signal name="OpenSession">
-      <arg name="service_name" type="s"/>
-    </signal>

we still emit this one from gdm_session_open_session, so you'll need to drop that function too.
Comment 62 Ray Strode [halfline] 2012-07-24 18:26:31 UTC
Review of attachment 219555 [details] [review]:

So this seems like a good clean up, but I don't understand why there is still a worker manager interface.  If we're reversing things and adding a new worker interface, why are we keeping the worker manager interface ?  You should do this all the way.
Comment 63 Ray Strode [halfline] 2012-07-24 18:28:13 UTC
Review of attachment 219556 [details] [review]:

Description still says "preventing", otherwise seems fine.
Comment 64 Ray Strode [halfline] 2012-07-24 18:32:02 UTC
Review of attachment 219558 [details] [review]:

same comments as before: "spacing", and "do you want to rename chooser to chooser_environment, like you renamed greeter to greeter_environment ?"
Comment 65 Ray Strode [halfline] 2012-07-24 18:35:07 UTC
Review of attachment 219559 [details] [review]:

Same comments as before.
Comment 66 Jasper St. Pierre (not reading bugmail) 2012-07-24 18:39:49 UTC
Review of attachment 219555 [details] [review]:

Because the four PAM interfaces should be async methods that the worker calls, unless we want to pull the same method/signal hacks on the greeter itself.

Reauth is hard as well.
Comment 67 Ray Strode [halfline] 2012-07-24 18:58:19 UTC
Review of attachment 219555 [details] [review]:

Well, there's the gdm-session.c middle man, so for Info, InfoQuery, SecretInfo, and SecretInfoQuery you could switch them to signals without affecting the greeter, but you're right, I agree it doesn't make sense for those 4 (the whole point is to try to get away from using signals for method calls after all).  Still, why isn't ServiceUnavailable a signal, SetupComplete/SetupFailed dropped in favor of replies to Setup* calls.  What makes reauthentication hard? I'd expect StartReauthentication to be a method call, ReauthenticationStarted dropped in favor of a reply to that call, and Reauthenticated becoming a signal.
Comment 68 Jasper St. Pierre (not reading bugmail) 2012-07-24 19:06:38 UTC
(In reply to comment #67)
> Review of attachment 219555 [details] [review]:
> 
> SetupComplete/SetupFailed dropped in favor of replies to Setup* calls

The code path we take doesn't currently vary the complete_* method calls back, but I suppose it doesn't actually matter.
Comment 69 Ray Strode [halfline] 2012-07-24 19:13:34 UTC
yea you can just use g_dbus_method_invocation_return_value (just like if you have an error you have to use g_dbus_method_invocation_return_error and not a generated function)
Comment 70 Jasper St. Pierre (not reading bugmail) 2012-07-30 23:57:29 UTC
Review of attachment 219557 [details] [review]:

This won't be needed.
Comment 71 Jasper St. Pierre (not reading bugmail) 2012-07-31 00:00:15 UTC
Attachment 219553 [details] pushed as a19d6d8 - daemon: Clean up memory leaks
Attachment 219554 [details] pushed as ae725b0 - daemon: Remove old, unused signals
Comment 72 Jasper St. Pierre (not reading bugmail) 2012-07-31 17:56:27 UTC
Created attachment 220012 [details] [review]
daemon: Start replacing old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

So, reverse the API so that the worker manager calls async methods on the
worker itself.
Comment 73 Jasper St. Pierre (not reading bugmail) 2012-07-31 17:56:34 UTC
Created attachment 220013 [details] [review]
daemon: Provide mechanism for providing an authentication secret up front

Some PAM modules can be told their password ahead of time to prevent them
having to ask later. This is accomplished by setting the PAM_AUTHTOK item
before calling pam_authenticate.
Comment 74 Jasper St. Pierre (not reading bugmail) 2012-07-31 17:56:39 UTC
Created attachment 220014 [details] [review]
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmLaunchEnvironment" is an
appropriate name for this.
Comment 75 Jasper St. Pierre (not reading bugmail) 2012-07-31 17:56:43 UTC
Created attachment 220015 [details] [review]
daemon: Add initial setup integration

When a system boots for the first time, we want to show a special
tool that will allow the user to set up their system the way they
want to. This will be triggered by a special file:

    /var/run/wants-initial-setup

The responsibilities of this tool include creating the user's
account, so we have to create a special user account to run the
tool under.

Administrators are given the ability to turn this off in a GDM
setting if they want to.
Comment 76 Jasper St. Pierre (not reading bugmail) 2012-07-31 18:03:52 UTC
OK, this should address all of the review comments. provided I haven't forgotten one.
Comment 77 Ray Strode [halfline] 2012-07-31 19:02:56 UTC
Review of attachment 220014 [details] [review]:

Feel free to commit this one after considering what i mention below.

::: daemon/gdm-welcome-session.c
@@ +107,3 @@
+static void     gdm_launch_environment_class_init    (GdmLaunchEnvironmentClass *klass);
+static void     gdm_launch_environment_init          (GdmLaunchEnvironment      *launch_environment);
+static void     gdm_launch_environment_finalize      (GObject                *object);

spacing

@@ +777,3 @@
  * @disp: Pointer to a GdmDisplay structure
  *
+ * Starts a local X launch_environment. Handles retries and fatal errors properly.

X launch_environment sounds weird so you could clean it up if you wanted (but no biggie either way)

::: daemon/gdm-simple-slave.c
@@ +799,3 @@
 static void
+on_greeter_environment_session_opened (GdmLaunchEnvironment *greeter,
+                                       GdmSimpleSlave    *slave)

spacing, also maybe s/greeter/greeter_environment/ ?

@@ +812,3 @@
 static void
+on_greeter_environment_session_started (GdmLaunchEnvironment *greeter,
+                                        GdmSimpleSlave    *slave)

likewise

@@ +819,3 @@
 static void
+on_greeter_environment_session_stopped (GdmLaunchEnvironment *greeter,
+                                        GdmSimpleSlave    *slave)

likewise

@@ +834,2 @@
 static void
+on_greeter_environment_session_exited (GdmLaunchEnvironment    *greeter,

likewise

@@ +845,2 @@
 static void
+on_greeter_environment_session_died (GdmLaunchEnvironment    *greeter,

likewise

::: data/Makefile.am
@@ +92,3 @@
 pam_redhat_files = pam-redhat/gdm.pam		\
 	pam-redhat/gdm-autologin.pam		\
+	pam-redhat/gdm-launch-environment.pam	\

Still forgot to git mv this.
Comment 78 Ray Strode [halfline] 2012-07-31 19:27:33 UTC
Review of attachment 220012 [details] [review]:

Commit message says "Start replacing" but should say "Replace".  The patch didn't apply because of StartConversation still being in the xml file.  Seems to work in brief (not exhaustive) testing. go for it.

::: daemon/gdm-session-worker.c
@@ +2105,3 @@
                                      GDM_SESSION_WORKER_ERROR_SERVICE_UNAVAILABLE)) {
+                        gdm_dbus_worker_emit_service_unavailable (GDM_DBUS_WORKER (worker),
+                                                                  error->message);

You need to g_dbus_method_invocation_return_value (worker->priv->pending_invocation, NULL); here to reply and free the invocation.  Though, maybe it would be better to drop the ServiceUnavailable signal and instead just make it a separate error code.  Either way.

@@ +2123,3 @@
                                               G_CALLBACK (on_saved_language_name_read),
                                               worker);
+        worker->priv->pending_invocation = NULL;

should do this immediately after each g_dbus_method_invocation_return_* call so we don't have dangling pointers.

@@ +2154,3 @@
                         g_debug ("GdmSessionWorker: Unable to use authentication service");
+                        gdm_dbus_worker_emit_service_unavailable (GDM_DBUS_WORKER (worker),
+                                                                  error->message);

same as above

::: daemon/gdm-session-worker.xml
@@ +1,3 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/org/gnome/DisplayManager/SessionServer">
+  <interface name="org.gnome.DisplayManager.Worker">

It's a little strange the interface is "Worker" and the object is "SessionServer". It might make sense to use the same name for both. I'd vote for ditching SessionServer since we no longer user the BlahServer lingo anywhere else (we dropped GreeterServer, ChooserServer, etc)
Comment 79 Ray Strode [halfline] 2012-07-31 19:29:35 UTC
Review of attachment 220013 [details] [review]:

looks fine.
Comment 80 Ray Strode [halfline] 2012-07-31 19:42:45 UTC
Review of attachment 220015 [details] [review]:

::: daemon/gdm-simple-slave.c
@@ +981,2 @@
         }
 

need a g_ptr_array_add (args, NULL); here to NULL terminate the list

@@ +1148,3 @@
+        if (preexisting_user) {
+                if (!g_file_test (dest_filename, G_FILE_TEST_EXISTS)) {
+                        g_warning ("User '%s' exists, but file '%s' doesn't", username, dest_filename);

maybe it should just put the file in place instead of failing?  I can imagine the user accidentally kicking the plug at exactly the wrong moment here and then ending up in a state where there computer doesn't work anymore.  It's kind of a tough question, because we need to be cautious about doling out the policy since it gives extra privileges

@@ +1168,3 @@
+                        g_free (contents);
+                        return FALSE;
+                }

This is fine, though g_file_copy might be better?

@@ +1227,3 @@
+        gboolean enabled;
+
+        if (!g_file_test ("/var/run/wants-initial-setup", G_FILE_TEST_EXISTS)) {

/var/run is a symlink to /run which is a ram disk.  That means it would be hard to actually put the file in place and have it stick around through reboots. you probably want /var/lib/gdm/run-initial-setup or /var/spool/gdm/run-initial-setup

@@ +1257,3 @@
+                if (wants_initial_setup (slave)) {
+                        start_initial_setup (slave);
+                } else if (!wants_autologin (slave)) {

should be wants_autologin, not !wants_autologin

@@ +1260,3 @@
                         /* Run the init script. gdmslave suspends until script has terminated */
                         gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/Init", GDM_USERNAME);
+                        reset_session (slave);

as mentioned earlier, this is a hold over from a bug fixed in git. you need create_new_session() not reset_session().
Comment 81 Jasper St. Pierre (not reading bugmail) 2012-07-31 20:17:05 UTC
(In reply to comment #77)
> Still forgot to git mv this.

I didn't; look at the raw patch. For some reason Splinter doesn't show it, though.
Comment 82 Jasper St. Pierre (not reading bugmail) 2012-07-31 21:21:22 UTC
Created attachment 220024 [details] [review]
daemon: Replace old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

So, reverse the API so that the worker manager calls async methods on the
worker itself.
Comment 83 Jasper St. Pierre (not reading bugmail) 2012-07-31 21:21:29 UTC
Created attachment 220025 [details] [review]
daemon: Provide mechanism for providing an authentication secret up front

Some PAM modules can be told their password ahead of time to prevent them
having to ask later. This is accomplished by setting the PAM_AUTHTOK item
before calling pam_authenticate.
Comment 84 Jasper St. Pierre (not reading bugmail) 2012-07-31 21:21:37 UTC
Created attachment 220026 [details] [review]
daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment

"GdmWelcomeSession" was always a sort of bad name, as it is not a
GdmSession, itself (it has-a GdmSession), and it's unnecessarily generic;
it doesn't really have anything to do with "Welcome" or "Session"
itself. It managed a non-user GdmSession, spawned the process in the
correct environment (spawning a DBus daemon if need be) and made sure to
keep track of it until it died. I think "GdmLaunchEnvironment" is an
appropriate name for this.
Comment 85 Jasper St. Pierre (not reading bugmail) 2012-07-31 21:21:42 UTC
Created attachment 220027 [details] [review]
daemon: Add initial setup integration

When a system boots for the first time, we want to show a special
tool that will allow the user to set up their system the way they
want to. This will be triggered by a special file:

    /var/run/wants-initial-setup

The responsibilities of this tool include creating the user's
account, so we have to create a special user account to run the
tool under.

Administrators are given the ability to turn this off in a GDM
setting if they want to.
Comment 86 Ray Strode [halfline] 2012-07-31 21:44:18 UTC
Review of attachment 220026 [details] [review]:

Assuming this is the same as before (but maybe with spacing fix ups), so just transfering the acn
Comment 87 Ray Strode [halfline] 2012-07-31 22:00:30 UTC
Review of attachment 220027 [details] [review]:

commmit message references /var/run.

::: daemon/gdm-simple-slave.c
@@ +1005,3 @@
+start_launch_environment (GdmSimpleSlave *slave,
+                          char           *username,
+                          char           *session_id)

So you decided to stick with the session_id argument instead of my DCONF_PROFILE alternative (which is fine). It might make sense at some point to rename /etc/dconf/db/gdm to something more generic-y so the environment variable isn't DCONF_PROFILE=gdm for gnome-initial-setup but on the other hand gdm is still behind launching gnome-initial-setup so maybe there's nothing wrong with keeping things exactly like they are.

@@ +1212,3 @@
+
+#define INITIAL_SETUP_TRIGGER_FILE LOCALSTATEDIR "gdm/run-initial-setup"
+

LOCALSTATEDIR "lib/gdm/run-initial-setup" 
or
LOCALSTATEDIR "spool/gdm/run-initial-setup"
Comment 88 Ray Strode [halfline] 2012-07-31 22:02:50 UTC
Review of attachment 220024 [details] [review]:

::: daemon/Makefile.am
@@ +160,3 @@
 	gdm-session-record.h		\
+	gdm-session-worker-common.c	\
+	gdm-session-worker-common.h	\

Why did you split this out?
Comment 89 Jasper St. Pierre (not reading bugmail) 2012-07-31 22:05:58 UTC
(In reply to comment #88)
> Why did you split this out?

The error quark is in gdm-session-worker.c, which I can't include in the slave.
Comment 90 Ray Strode [halfline] 2012-07-31 22:22:55 UTC
Review of attachment 220024 [details] [review]:

::: daemon/gdm-session.c
@@ +291,3 @@
+                                                               GDM_SESSION_WORKER_ERROR,
+                                                               GDM_SESSION_WORKER_ERROR_SERVICE_UNAVAILABLE));
+        }

if you call g_error_matches like this, then I think you need to call g_dbus_error_register_error_domain in gdm_session_worker_error_quark. 
I did some hack here to make it more automatic (see the register_error_domain function)

register_error_domain

But that's a bit over the top.

Might be easier to just do the g_strcmp0 thing you do for accounts service in the initial-setup patch.

Or just punt and keep things the way they were before with the separate signal.
Comment 91 Ray Strode [halfline] 2012-07-31 22:43:01 UTC
umm not sure what happened in the last comment.

Above where it says:

register_error_domain

It should say

http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/identity/gsd-identity-service.c?h=wip/identity#n579

(not necessarily recommending that approach, just pointing it out as code i wrote recently).  Honestly, I'd probably just punt back to the way it was before comment 78 at this point, doesn't seem worth the increase in effort.
Comment 92 Jasper St. Pierre (not reading bugmail) 2012-07-31 22:48:57 UTC
Created attachment 220031 [details] [review]
daemon: Replace old method/signal-based API with async method calls

Before, the session worker and session communicated by a series of signals
and methods... but backwards. The session worker would listen for a series
of signals sent out by the session, and respond back by calling methods on
it. This requires a lot of annoying, silly manual labor when trying to add
another method to the API.

So, reverse the API so that the worker manager calls async methods on the
worker itself.
Comment 93 Ray Strode [halfline] 2012-08-01 03:00:54 UTC
Review of attachment 220031 [details] [review]:

seems fine, nice clean up overall. A few comments below, but otherwise ready to commit I think.

::: daemon/gdm-session-worker-common.c
@@ +53,3 @@
+                                            gdm_session_worker_error_entries,
+                                            G_N_ELEMENTS (gdm_session_worker_error_entries));
+        G_STATIC_ASSERT (G_N_ELEMENTS (gdm_session_worker_error_entries) - 1 == GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);

What's the point of this assert? It doesn't actuallly protect against anything does it?  It would be useful to try to catch the enum growing without the mapping getting updated, but this doesn't achieve that. If that's what you're after, you could add a GDM_SESSION_WORKER_NUMBER_OF_ERRORS entry to the bottom of the enum and then

G_STATIC_ASSERT (GDM_SESSION_WORKER_NUMBER_OF_ERRORS - 1 == GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);

though that might muck up introspection data. would be neat if there was a gcc extension that would give the range of an enum.

Anyway, I'd probably just drop the ASSERT unless you have a good reason for it

::: daemon/gdm-session-worker.c
@@ +2093,1 @@
                 g_error_free (error);

you could combine these two lines into g_dbus_method_invocation_take_error if you wanted

::: daemon/gdm-session.c
@@ +779,3 @@
+        } else {
+                report_problem_and_stop_conversation (self, service_name, error->message);
+                gdm_session_stop_conversation (self, service_name);

This gdm_session_stop_conversation is redundant I think after report_problem_and_stop_conversation
Comment 94 Jasper St. Pierre (not reading bugmail) 2012-08-01 12:49:33 UTC
(In reply to comment #93)
> Review of attachment 220031 [details] [review]:
> 
> seems fine, nice clean up overall. A few comments below, but otherwise ready to
> commit I think.
> 
> ::: daemon/gdm-session-worker-common.c
> @@ +53,3 @@
> +                                            gdm_session_worker_error_entries,
> +                                            G_N_ELEMENTS
> (gdm_session_worker_error_entries));
> +        G_STATIC_ASSERT (G_N_ELEMENTS (gdm_session_worker_error_entries) - 1
> == GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);
> 
> What's the point of this assert?

I stole it from the GDBusError docs.

http://developer.gnome.org/gio/unstable/gio-GDBusError.html#gio-GDBusError.description

> It doesn't actuallly protect against anything
> does it?  It would be useful to try to catch the enum growing without the
> mapping getting updated, but this doesn't achieve that.

Why not?

> G_STATIC_ASSERT (GDM_SESSION_WORKER_NUMBER_OF_ERRORS - 1 ==
> GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);

This doesn't care about the mapping at all.

> ::: daemon/gdm-session-worker.c
> @@ +2093,1 @@
>                  g_error_free (error);
> 
> you could combine these two lines into g_dbus_method_invocation_take_error if
> you wanted

Thanks, didn't know about that.

> ::: daemon/gdm-session.c
> @@ +779,3 @@
> +        } else {
> +                report_problem_and_stop_conversation (self, service_name,
> error->message);
> +                gdm_session_stop_conversation (self, service_name);
> 
> This gdm_session_stop_conversation is redundant I think after
> report_problem_and_stop_conversation

Whoops.
Comment 95 Ray Strode [halfline] 2012-08-01 14:11:23 UTC
Hi,
(In reply to comment #94)
> (In reply to comment #93)
> > Review of attachment 220031 [details] [review] [details]:
> > 
> > seems fine, nice clean up overall. A few comments below, but otherwise ready to
> > commit I think.
> > 
> > ::: daemon/gdm-session-worker-common.c
> > @@ +53,3 @@
> > +                                            gdm_session_worker_error_entries,
> > +                                            G_N_ELEMENTS
> > (gdm_session_worker_error_entries));
> > +        G_STATIC_ASSERT (G_N_ELEMENTS (gdm_session_worker_error_entries) - 1
> > == GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);
> > 
> > What's the point of this assert?
> 
> I stole it from the GDBusError docs.
> 
> http://developer.gnome.org/gio/unstable/gio-GDBusError.html#gio-GDBusError.description
Hmm, so either I'm missing something or we should get the docs fixed, too.  At a minimum, the G_STATIC_ASSERT should be at the top of the function before any lines of code are executed.

> > It doesn't actuallly protect against anything
> > does it?  It would be useful to try to catch the enum growing without the
> > mapping getting updated, but this doesn't achieve that.
> 
> Why not?
Because there's nothing to enforcing that you full use the enum.  If you have,

enum { ZERO, ONE, TWO, THREE };

and then do

static struct { int value; char *name } number_mapping[] = { { ZERO, "zero" }, { { ONE, "one" } };

then G_N_ELEMENTS (number_mapping) will be 2 (the number of things you mapped), and  G_N_ELEMENTS (number_mapping) - 1 == ONE } will be true (so the last thing you mapped is the last thing in the map), and yet 2 items won't get mapped.

> > G_STATIC_ASSERT (GDM_SESSION_WORKER_NUMBER_OF_ERRORS - 1 ==
> > GDM_SESSION_WORKER_ERROR_IN_REAUTH_SESSION);
> 
> This doesn't care about the mapping at all.
But GDM_SESSION_WORKER_NUMBER_OF_ERRORS value will be automatically incremented when the enum grows a new item, so NUMBER_OF_ERRORS - 1 will no longer equal IN_REAUTH_SESSION when someone changes the enum and then the programmer who added the entry will see the compile error, see why it failed, and fix the mapping and the assert.

If you don't think that's a strong enough test, then you could have a 

for (int i = 0; i < NUMBER_OF_ERRORS; i++) {
  switch (error_entries[i]) {
     case ERROR_GENERIC ... ERROR_IN_REAUTH_SESSION:
     break;
  }
}

and then let the compiler warn if the case range operands didn't cover the entire enum.

I personally think that's way overboard,think G_STATIC_ASSERT (NUMBER_OF_ERRORS - 1 == IN_REAUTH_SESSION) is also overboard, and
think G_STATIC_ASSERT (G_N_ELEMENTS (error_entries) - 1
== IN_REAUTH_SESSION) doesn't help anything.

So unless I'm missing something, I still think you should just drop the line and also think we should get the docs fixed.  That's just my opinion-you're the one investing time in this patch, if you feel strongly about having some sort of assert here feel free.
Comment 96 Jasper St. Pierre (not reading bugmail) 2012-08-01 15:21:46 UTC
Attachment 220025 [details] pushed as 67235fd - daemon: Provide mechanism for providing an authentication secret up front
Attachment 220026 [details] pushed as 2ebfa91 - daemon: Rename GdmWelcomeSession to GdmLaunchEnvironment
Attachment 220027 [details] pushed as 4e2a75a - daemon: Add initial setup integration
Attachment 220031 [details] pushed as 2672f6a - daemon: Replace old method/signal-based API with async method calls


Pushed outstanding patches with suggested changes. Dropped assert.
Comment 97 Jasper St. Pierre (not reading bugmail) 2012-08-01 15:37:03 UTC
Filed docs bug as https://bugzilla.gnome.org/show_bug.cgi?id=680994
Comment 98 Giovanni Campagna 2012-08-01 20:16:09 UTC
Review of attachment 220025 [details] [review]:

Did someone test this?
Looking at the source code of libpam, it is clear that:

    case PAM_AUTHTOK:
	/*
	 * PAM_AUTHTOK and PAM_OLDAUTHTOK are only accessible from
	 * modules.
	 */
	if (__PAM_FROM_MODULE(pamh)) {
	    if (pamh->authtok != item) {
		_pam_overwrite(pamh->authtok);
		TRY_SET(pamh->authtok, item);
	    }
	} else {
	    retval = PAM_BAD_ITEM;
	}

	break;

And therefore this does not work at all.
(I found this while implementing the pam helper for accountsservice to change passwords. Source code is from Linux-PAM 1.1.5)
Comment 99 Ray Strode [halfline] 2012-08-01 20:25:43 UTC
well, poo.
Comment 100 Jasper St. Pierre (not reading bugmail) 2012-08-01 20:28:44 UTC
Now what?
Comment 101 Ray Strode [halfline] 2012-08-01 20:32:20 UTC
So we have a few options I can think of, I guess:

1) try to hack around the check (bleh)
2) ship our own pam module to do the pam_set_item for us
3) feed the password to the first echo off query that comes out of the conversation.
Comment 102 Ray Strode [halfline] 2012-08-01 20:32:52 UTC
all three options sort of suck
Comment 103 Ray Strode [halfline] 2012-08-01 20:35:46 UTC
If we go with 3, i'd say we should do it at the gnome-initial-setup level
Comment 104 Jasper St. Pierre (not reading bugmail) 2012-08-01 20:36:36 UTC
pam sort of sucks

I don't know what 1) would imply, other than tricking PAM into thinking that the worker is a module. I'm quite sure that would be a big security issue if found.
Comment 105 Ray Strode [halfline] 2012-08-01 22:14:48 UTC
by 1) i meant something gross like 

struct shadow_of_pam_handle {
whatever struct pam_handle has in it here
};

((shadow_of_pam_handle *) pamh)->authtok = strdup (saved_password);
Comment 106 Jasper St. Pierre (not reading bugmail) 2012-08-03 01:18:35 UTC
Since initial setup is a "direct after install" scenario, I think we can guarantee the PAM stack here. Just responding to the first SecretInfoQuery would be fine would me.
Comment 107 Colin Guthrie 2012-08-13 08:09:42 UTC
Hi,

Just testing gdm 3.5.5 and it seems like 2672f6a1f43d054c0aab34b623f0f0e6edd8ed5f (daemon: Replace old method/signal-based API with async method calls) is a bad commit for me (although I've also reverted 67235fd797e5b9a88178f4733551814b61a4711b (daemon: Provide mechanism for providing an authentication secret up front) as it was also giving me some (red herring) errors in the logs).

The problem manifests itself when unlocking the session. It initially looks like it's unlocked fine, but then almost immediately logs me out. Checcking the locks I see that GDM has crashed in worker_on_reauthenticated(). A quick git blame and some reverts and I confirmed the above commit. I have now locked and unlocked quite happily after rebooting.

I'll attach the backtrace momentarily.
Comment 108 Colin Guthrie 2012-08-13 08:12:45 UTC
Created attachment 220971 [details]
Some log and a backtrace of fault introduced in 3.5.5

The log shows the invalid signal that the second commit mentioned in the above comment. It doesn't seem to be fatal, but I guess it could be somewhat related (i.e. the crash is triggered due to the fact that that signal is not handled as it should be), but either way gdm shouldn't crash.

I'm also not 100% sure but I think before reverting the problem commit, that if I got the password wrong on the login screen it would give me an ugly dbus/gobject error rather than the proper "Authentication Failed" toaster popup.
Comment 109 Giovanni Campagna 2012-08-13 13:07:12 UTC
Created attachment 221019 [details] [review]
GdmSessionWorker: fix signature of Reauthenticated signal

GdmSession expects to receive the service name along with the signal,
but the DBus interface does not include it, and this causes a crash.

------

Found the problem: there is a mismatch in the DBus signature (and
generated GObject signal) and the GdmSession handler, which causes the
latter to access garbage memory and segfault.
Comment 110 Ray Strode [halfline] 2012-08-13 13:44:34 UTC
Comment on attachment 221019 [details] [review]
GdmSessionWorker: fix signature of Reauthenticated signal

looks good
Comment 111 Jasper St. Pierre (not reading bugmail) 2012-08-13 14:34:05 UTC
Review of attachment 221019 [details] [review]:

We already have the service name as part of the conversation struct. Just get it from that instead of DBus.
Comment 112 Giovanni Campagna 2012-08-13 14:57:43 UTC
Created attachment 221026 [details] [review]
GdmSession: don't access conversation after closing the connection

When the connection is closed, the conversation is freed, but
method calls that are in flight would see their async callbacks
invoked at the next mainloop iteration, with the error set.
Return early in that case.
Comment 113 Jasper St. Pierre (not reading bugmail) 2012-08-13 15:07:42 UTC
Review of attachment 221026 [details] [review]:

Huh, OK.
Comment 114 Giovanni Campagna 2012-08-13 15:53:07 UTC
Comment on attachment 221026 [details] [review]
GdmSession: don't access conversation after closing the connection

Attachment 221026 [details] pushed as f073821 - GdmSession: don't access conversation after closing the connection
Comment 115 Giovanni Campagna 2012-08-13 15:53:33 UTC
Created attachment 221027 [details] [review]
GdmSession: fix signature of Reauthenticated signal handler

GdmSession expects to receive the service name along with the signal,
but the DBus interface does not include it, and this causes a crash.

This is the other way round.
Comment 116 Jasper St. Pierre (not reading bugmail) 2012-08-13 15:57:10 UTC
Review of attachment 221027 [details] [review]:

Much better.

My goal with these cleanups was to remove service_name from the DBus interface entirely, since it's unnecessary.
Comment 117 Giovanni Campagna 2012-08-13 16:31:49 UTC
You didn't complete that, though. Well, bah...

Attachment 221027 [details] pushed as 27d14a6 - GdmSession: fix signature of Reauthenticated signal handler
Comment 118 Ray Strode [halfline] 2012-08-13 20:13:58 UTC
I think you guys are conflating the service name that was used to log into the session with the service name that was used to unlock the session.

I think the first patch was right (though I'd have to do more digging to be sure)
Comment 119 Giovanni Campagna 2012-08-13 20:58:09 UTC
Uh oh. Could be.

Well, anyway that service_name is bubbled up to GdmSimpleSlave and then just ignored...
Comment 120 Ray Strode [halfline] 2012-08-13 21:59:14 UTC
still, you could imagine a the screensaver wanting know if the user unlocked with fingerprint or password so it's good to be accurate.
Comment 121 Jasper St. Pierre (not reading bugmail) 2012-08-17 19:31:53 UTC
Created attachment 221667 [details] [review]
daemon: Fix session setting code

Passing ['--session=', 'foo'] won't be picked up by GOption. Pass
[--session', 'foo'] instead.
Comment 122 Jasper St. Pierre (not reading bugmail) 2012-08-17 19:43:56 UTC
Created attachment 221668 [details] [review]
Revert "daemon: Provide mechanism for providing an authentication secret up front"

This reverts commit 67235fd797e5b9a88178f4733551814b61a4711b.

As pointed out by Giovanni, this code is incorrect, as PAM_AUTHTOK
doesn't work when not in a PAM module.
Comment 123 Ray Strode [halfline] 2012-08-18 14:11:22 UTC
Attachment 221667 [details] pushed as e476672 - daemon: Fix session setting code
Attachment 221668 [details] pushed as ff7bfd2 - Revert "daemon: Provide mechanism for providing an authentication secret up front"
Comment 124 Ray Strode [halfline] 2012-08-18 14:12:27 UTC
(reopening since initial-setup work is still pending and may need more gdm changes)
Comment 125 Matthias Clasen 2012-10-06 00:42:13 UTC
Created attachment 225909 [details] [review]
Enable initial setup by default
Comment 126 Matthias Clasen 2012-11-16 22:22:31 UTC
all done here now, I think