Commit 93e620f7 authored by Patrick Brunschwig's avatar Patrick Brunschwig

ignore exit code for gpg --list-key commands

parent 2992cc51
......@@ -1144,7 +1144,7 @@ Enigmail.prototype = {
execCmd: function (command, args, passphrase, input, exitCodeObj, statusFlagsObj,
statusMsgObj, errorMsgObj)
statusMsgObj, errorMsgObj, retStatusObj)
{
EC.WRITE_LOG("enigmail.js: Enigmail.execCmd: subprocess = '"+command.path+"'\n");
......@@ -1201,12 +1201,15 @@ Enigmail.prototype = {
EC.DEBUG_LOG("enigmail.js: Enigmail.execCmd: exitCode = "+exitCodeObj.value+"\n");
EC.DEBUG_LOG("enigmail.js: Enigmail.execCmd: errOutput = "+errOutput+"\n");
var retObj = {};
errorMsgObj.value = Ec.parseErrorOutput(errOutput, retObj);
statusFlagsObj.value = retObj.statusFlags;
statusMsgObj.value = retObj.statusMsg;
var blockSeparation = retObj.blockSeparation;
if (! retStatusObj) {
retStatusObj = {};
}
errorMsgObj.value = Ec.parseErrorOutput(errOutput, retStatusObj);
statusFlagsObj.value = retStatusObj.statusFlags;
statusMsgObj.value = retStatusObj.statusMsg;
var blockSeparation = retStatusObj.blockSeparation;
exitCodeObj.value = Ec.fixExitCode(proc.exitCode, statusFlagsObj.value);
......@@ -2054,6 +2057,11 @@ Enigmail.prototype = {
var listText = this.execCmd(this.agentPath, args, null, "",
exitCodeObj, statusFlagsObj, statusMsgObj, cmdErrorMsgObj);
if (! (statusFlagsObj.value & nsIEnigmail.BAD_SIGNATURE)) {
// ignore exit code as recommended by GnuPG authors
exitCodeObj.value = 0;
}
if (exitCodeObj.value != 0) {
errorMsgObj.value = EC.getString("badCommand");
if (cmdErrorMsgObj.value) {
......@@ -2105,6 +2113,11 @@ Enigmail.prototype = {
var listText = this.execCmd(this.agentPath, args, null, "",
exitCodeObj, statusFlagsObj, statusMsgObj, cmdErrorMsgObj);
if (! (statusFlagsObj.value & nsIEnigmail.BAD_SIGNATURE)) {
// ignore exit code as recommended by GnuPG authors
exitCodeObj.value = 0;
}
if (exitCodeObj.value != 0) {
errorMsgObj.value = EC.getString("badCommand");
if (cmdErrorMsgObj.value) {
......@@ -2144,6 +2157,12 @@ Enigmail.prototype = {
var listText = this.execCmd(this.agentPath, args, null, "",
exitCodeObj, statusFlagsObj, statusMsgObj, cmdErrorMsgObj);
if (! (statusFlagsObj.value & nsIEnigmail.BAD_SIGNATURE)) {
// ignore exit code as recommended by GnuPG authors
exitCodeObj.value = 0;
}
if (exitCodeObj.value != 0) {
return "";
}
......@@ -2552,7 +2571,7 @@ Enigmail.prototype = {
var outputTxt = this.simpleExecCmd(this.agentPath, args, exitCodeObj, photoDataObj);
if ((exitCodeObj.value == 0) && !outputTxt) {
if (!outputTxt) {
exitCodeObj.value = -1;
return "";
}
......
......@@ -1115,7 +1115,7 @@ var EnigmailCommon = {
* Parse error output from GnuPG
*
* @errOutput: String - the output from GnuPG
* @resStatusObj: Object: {
* @retStatusObj: Object: {
* - statusMsg: String - status message
* - statusFlags: Number - status flags as defined in nsIEnigmail.
* - blockSeparation: String - list of blocks with markers.
......@@ -2850,7 +2850,7 @@ var EnigmailCommon = {
return exitCode;
}
var hashAlgorithm = "md5"; // default as defined in RFC 4880, section 7
var hashAlgorithm = "sha1"; // default as defined in RFC 4880, section 7 is MD5 -- but that's outdated
var m = msgText.match(/^(Hash: )(.*)$/m);
if (m && (m.length > 2) && (m[1] == "Hash: ")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment