authPrompt: fix disable-user-list / Not Listed?

If the first question asked to a user is from the
shell and not from the PAM service (i.e. Username: ),
then we'll save what the user types until PAM asks
a question and then try to send it to PAM.

This commit makes sure the preemptive answer can be used
before the PAM conversation gets started, and makes sure
to discard the preemptive answer if we're not expecting it.

https://bugzilla.gnome.org/show_bug.cgi?id=705370
This commit is contained in:
Ray Strode 2013-08-02 14:10:16 -04:00
parent 4d34abeeef
commit a70e74e478

View File

@ -190,7 +190,8 @@ const AuthPrompt = new Lang.Class({
_onAskQuestion: function(verifier, serviceName, question, passwordChar) {
if (this._preemptiveAnswer) {
this._userVerifier.answerQuery(this._queryingService, this._preemptiveAnswer);
if (this._queryingService)
this._userVerifier.answerQuery(this._queryingService, this._preemptiveAnswer);
this._preemptiveAnswer = null;
return;
}
@ -341,7 +342,14 @@ const AuthPrompt = new Lang.Class({
},
getAnswer: function() {
let text = this._entry.get_text();
let text;
if (this._preemptiveAnswer) {
text = this._preemptiveAnswer;
this._preemptiveAnswer = null;
} else {
text = this._entry.get_text();
}
return text;
},