gdmUtil: Enable support for GDM's ChoiceList PAM extension

This commit hooks up support for GDM's ChoiceList PAM extension.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1978>
This commit is contained in:
Ray Strode
2017-07-17 16:48:03 -04:00
parent 051a6be121
commit 11401c13ed
4 changed files with 109 additions and 2 deletions

View File

@ -237,6 +237,10 @@ var ShellUserVerifier = class {
this._disconnectSignals();
this._userVerifier.run_dispose();
this._userVerifier = null;
if (this._userVerifierChoiceList) {
this._userVerifierChoiceList.run_dispose();
this._userVerifierChoiceList = null;
}
}
}
@ -267,6 +271,10 @@ var ShellUserVerifier = class {
}
}
selectChoice(serviceName, key) {
this._userVerifierChoiceList.call_select_choice(serviceName, key, this._cancellable, null);
}
answerQuery(serviceName, answer) {
if (!this.hasPendingMessages) {
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
@ -453,6 +461,11 @@ var ShellUserVerifier = class {
return;
}
if (this._client.get_user_verifier_choice_list)
this._userVerifierChoiceList = this._client.get_user_verifier_choice_list();
else
this._userVerifierChoiceList = null;
this.reauthenticating = true;
this._connectSignals();
this._beginVerification();
@ -471,6 +484,11 @@ var ShellUserVerifier = class {
return;
}
if (this._client.get_user_verifier_choice_list)
this._userVerifierChoiceList = this._client.get_user_verifier_choice_list();
else
this._userVerifierChoiceList = null;
this._connectSignals();
this._beginVerification();
this._hold.release();
@ -496,6 +514,9 @@ var ShellUserVerifier = class {
this._signalIds.push(id);
id = this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
this._signalIds.push(id);
if (this._userVerifierChoiceList)
this._userVerifierChoiceList.connect('choice-query', this._onChoiceListQuery.bind(this));
}
_disconnectSignals() {
@ -576,6 +597,13 @@ var ShellUserVerifier = class {
this._startService(FINGERPRINT_SERVICE_NAME);
}
_onChoiceListQuery(client, serviceName, promptMessage, list) {
if (!this.serviceIsForeground(serviceName))
return;
this.emit('show-choice-list', serviceName, promptMessage, list.deep_unpack());
}
_onInfo(client, serviceName, info) {
if (this.serviceIsForeground(serviceName)) {
this._queueMessage(serviceName, info, MessageType.INFO);