--- gnome-screensaver-2.16.1/src/gs-auth-pam.c 2010-08-25 17:31:34.000000000 -0400 +++ gnome-screensaver-2.16.1/src/gs-auth-pam.c 2010-08-25 17:36:40.000000000 -0400 @@ -92,7 +92,7 @@ typedef struct { GSAuthMessageStyle style; const char *msg; char **resp; - gboolean should_interrupt_stack; + gboolean waiting_for_response; } GsAuthMessageHandlerData; static GCond *message_handled_condition; static GMutex *message_handler_mutex; @@ -196,7 +196,7 @@ gs_auth_queued_message_handler (GsAuthMe data->resp, data->closure->cb_data); - data->should_interrupt_stack = res == FALSE; + data->waiting_for_response = res == FALSE; g_cond_signal (message_handled_condition); g_mutex_unlock (message_handler_mutex); @@ -208,7 +208,7 @@ gs_auth_queued_message_handler (GsAuthMe return FALSE; } -static gboolean +static void gs_auth_run_message_handler (struct pam_closure *c, GSAuthMessageStyle style, const char *msg, @@ -220,7 +220,7 @@ gs_auth_run_message_handler (struct pam_ data.style = style; data.msg = msg; data.resp = resp; - data.should_interrupt_stack = TRUE; + data.waiting_for_response = TRUE; g_mutex_lock (message_handler_mutex); @@ -228,6 +228,8 @@ gs_auth_run_message_handler (struct pam_ */ g_idle_add ((GSourceFunc) gs_auth_queued_message_handler, &data); + again: + if (gs_auth_get_verbose ()) { g_message ("Waiting for respose to message style %d: '%s'", style, msg); } @@ -236,13 +238,15 @@ gs_auth_run_message_handler (struct pam_ */ g_cond_wait (message_handled_condition, message_handler_mutex); + if (data.waiting_for_response) { + goto again; + } + g_mutex_unlock (message_handler_mutex); if (gs_auth_get_verbose ()) { - g_message ("Got respose to message style %d: interrupt:%d", style, data.should_interrupt_stack); + g_message ("Got respose to message style %d", style); } - - return data.should_interrupt_stack == FALSE; } static int @@ -284,20 +288,11 @@ pam_conversation (int /* blocks until the gui responds */ - res = gs_auth_run_message_handler (c, style, - msg [replies]->msg, - &reply [replies].resp); - - if (gs_auth_get_verbose ()) { - g_message ("Msg handler returned %d", res); - } + gs_auth_run_message_handler (c, style, + msg [replies]->msg, + &reply [replies].resp); - /* If the handler returns FALSE - interrupt the PAM stack */ - if (res) { - reply [replies].resp_retcode = PAM_SUCCESS; - } else { - reply [replies].resp_retcode = PAM_INCOMPLETE; - } + reply [replies].resp_retcode = PAM_SUCCESS; } /* iterate the glib event loop inbetween processing pam