/usr/share/xul-ext/enigmail/modules/keyserver.jsm is in enigmail 2:1.9.9-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /*global Components: false */
/*jshint -W097 */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
"use strict";
var EXPORTED_SYMBOLS = ["EnigmailKeyServer"];
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://enigmail/log.jsm"); /*global EnigmailLog: false */
Cu.import("resource://enigmail/locale.jsm"); /*global EnigmailLocale: false */
Cu.import("resource://enigmail/httpProxy.jsm"); /*global EnigmailHttpProxy: false */
Cu.import("resource://enigmail/gpg.jsm"); /*global EnigmailGpg: false */
Cu.import("resource://enigmail/gpgAgent.jsm"); /*global EnigmailGpgAgent: false */
Cu.import("resource://enigmail/files.jsm"); /*global EnigmailFiles: false */
Cu.import("resource://enigmail/keyRing.jsm"); /*global EnigmailKeyRing: false */
Cu.import("resource://enigmail/subprocess.jsm"); /*global subprocess: false */
Cu.import("resource://enigmail/core.jsm"); /*global EnigmailCore: false */
const nsIEnigmail = Ci.nsIEnigmail;
const EnigmailKeyServer = {
/**
* search, download or upload key on, from or to a keyserver
*
* @actionFlags: Integer - flags (bitmap) to determine the required action
* (see nsIEnigmail - Keyserver action flags for details)
* @keyserver: String - keyserver URL (optionally incl. protocol)
* @searchTerms: String - space-separated list of search terms or key IDs
* @listener: Object - execStart Listener Object. See execStart for details.
* @errorMsgObj: Object - object to hold error message in .value
*
* @return: Subprocess object, or null in case process could not be started
*/
access: function(actionFlags, keyserver, searchTerms, listener, errorMsgObj) {
EnigmailLog.DEBUG("keyserver.jsm: access: " + searchTerms + "\n");
if (!keyserver) {
errorMsgObj.value = EnigmailLocale.getString("failNoServer");
return null;
}
if (!searchTerms && !(actionFlags & nsIEnigmail.REFRESH_KEY)) {
errorMsgObj.value = EnigmailLocale.getString("failNoID");
return null;
}
const proxyHost = EnigmailHttpProxy.getHttpProxy(keyserver);
let args = EnigmailGpg.getStandardArgs(true);
if (actionFlags & nsIEnigmail.SEARCH_KEY) {
args = EnigmailGpg.getStandardArgs(false).
concat(["--command-fd", "0", "--fixed-list", "--with-colons"]);
}
if (proxyHost) {
args = args.concat(["--keyserver-options", "http-proxy=" + proxyHost]);
}
args = args.concat(["--keyserver", keyserver.trim()]);
// if (actionFlags & nsIEnigmail.SEARCH_KEY | nsIEnigmail.DOWNLOAD_KEY | nsIEnigmail.REFRESH_KEY) {
// args = args.concat(["--command-fd", "0", "--fixed-list", "--with-colons"]);
// }
let inputData = null;
const searchTermsList = searchTerms.split(" ");
if (actionFlags & nsIEnigmail.DOWNLOAD_KEY) {
args.push("--recv-keys");
args = args.concat(searchTermsList);
}
else if (actionFlags & nsIEnigmail.REFRESH_KEY) {
args.push("--refresh-keys");
}
else if (actionFlags & nsIEnigmail.SEARCH_KEY) {
args.push("--search-keys");
args = args.concat(searchTermsList);
inputData = "quit\n";
}
else if (actionFlags & nsIEnigmail.UPLOAD_KEY) {
args.push("--send-keys");
args = args.concat(searchTermsList);
}
const isDownload = actionFlags & (nsIEnigmail.REFRESH_KEY | nsIEnigmail.DOWNLOAD_KEY);
EnigmailLog.CONSOLE("enigmail> " + EnigmailFiles.formatCmdLine(EnigmailGpgAgent.agentPath, args) + "\n");
let proc = null;
let exitCode = null;
try {
proc = subprocess.call({
command: EnigmailGpgAgent.agentPath,
arguments: args,
environment: EnigmailCore.getEnvList(),
charset: null,
stdin: inputData,
stdout: function(data) {
listener.stdout(data);
},
stderr: function(data) {
if (data.search(/^\[GNUPG:\] ERROR/m) >= 0) {
exitCode = 4;
}
listener.stderr(data);
},
done: function(result) {
try {
if (result.exitCode === 0 && isDownload) {
EnigmailKeyRing.clearCache();
}
if (exitCode === null) {
exitCode = result.exitCode;
}
listener.done(exitCode);
}
catch (ex) {}
},
mergeStderr: false
});
}
catch (ex) {
EnigmailLog.ERROR("keyserver.jsm: access: subprocess.call failed with '" + ex.toString() + "'\n");
throw ex;
}
if (!proc) {
EnigmailLog.ERROR("keyserver.jsm: access: subprocess failed due to unknown reasons\n");
return null;
}
return proc;
}
};
|