Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3944)

Unified Diff: base_policy/policy-utils.js

Issue 3107031: entd: Restart on token init failure (Closed) Base URL: http://src.chromium.org/git/entd.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bin/fix_pkcs11_token.sh » ('j') | bin/fix_pkcs11_token.sh » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base_policy/policy-utils.js
diff --git a/base_policy/policy-utils.js b/base_policy/policy-utils.js
index 1aee94406fb188b9573c5a820fc4a1c3a124a1d3..88e9beef08872457ebe25916daeda7b33a25dc3f 100644
--- a/base_policy/policy-utils.js
+++ b/base_policy/policy-utils.js
@@ -390,7 +390,7 @@ function initPkcs11() {
* PINs have been set, and neither PIN is locked.
*/
Policy.prototype.checkToken =
-function initToken(token) {
+function checkToken(token) {
token.refresh();
return ((token.flags & Token.CKF_TOKEN_INITIALIZED) &&
(token.flags & Token.CKF_USER_PIN_INITIALIZED) &&
@@ -420,6 +420,7 @@ function initToken(token, tokenLabel) {
var sopin;
token.refresh();
+
if (token.flags & Token.CKF_SO_PIN_TO_BE_CHANGED) {
// If the SO pin hasn't been initialized yet, then it's the one
// assigned by opencryptoki.
@@ -1176,7 +1177,7 @@ function cb_setPin_(arg) {
policy.setTokenPin(token, userType, arg.oldPin, arg.newPin);
}, 1);
- return Policy.CallbackSuccess('Resetting user pin');
+ return Policy.CallbackSuccess('Resetting so pin');
}
/**
@@ -1414,6 +1415,14 @@ function cb_installCert(arg) {
cert.label));
}
+Policy.Callbacks.prototype['cb:restart'] =
+function cb_restart(arg) {
+ entd.syslog.info("Restarting by client request.");
+ // Exit code two means we haven't errored, but would like to be restarted.
+ entd.scheduleShutdown(2);
+ return Policy.CallbackSuccess('Restarting');
+}
+
/**
* Return an object indicating that a callback succeeded.
*/
« no previous file with comments | « no previous file | bin/fix_pkcs11_token.sh » ('j') | bin/fix_pkcs11_token.sh » ('J')

Powered by Google App Engine
This is Rietveld 408576698