# # # patch "keys.cc" # from [fc641c30bef693c66d73201e59cf445bba573539] # to [13cdc59da1f561e520cfb36a5b05f5bac60626a2] # # patch "options_list.hh" # from [2e55c32ec7ea26c97ea7b3fbc2539088aaa6f858] # to [f6ca3e482b51276679a5d78a005c38623b1c2a6c] # ============================================================ --- keys.cc fc641c30bef693c66d73201e59cf445bba573539 +++ keys.cc 13cdc59da1f561e520cfb36a5b05f5bac60626a2 @@ -354,8 +354,11 @@ make_signature(app_state & app, string const & tosign, base64 & signature) { + E(!app.opts.ssh_sign.empty(), F("--ssh-sign requires a value ['yes', 'no', or 'check']")); + E(app.opts.ssh_sign == "yes" || app.opts.ssh_sign == "no" || app.opts.ssh_sign == "check", + F("--ssh-sign must be set to 'yes', 'no', or 'check'")); string sig_string; - if (app.opts.ssh_sign_given || app.opts.ssh_sign_check_given) { + if (app.opts.ssh_sign == "yes" || app.opts.ssh_sign == "check") { scoped_ptr a(new ssh_agent()); a->connect(); vector ssh_keys = a->get_keys(); @@ -393,7 +396,7 @@ make_signature(app_state & app, E(sig_string.length() > 0, F("make_signature: monotone and ssh-agent keys do not match")); } string ssh_sig = sig_string; - if (!app.opts.ssh_sign_given || app.opts.ssh_sign_check_given) { + if (app.opts.ssh_sign == "no" || app.opts.ssh_sign == "check") { SecureVector sig; // we permit the user to relax security here, by caching a decrypted key @@ -425,7 +428,7 @@ make_signature(app_state & app, sig_string = string(reinterpret_cast(sig.begin()), sig.size()); } - if (app.opts.ssh_sign_check_given) { + if (app.opts.ssh_sign == "check") { E(ssh_sig == sig_string, F("make_signature: ssh signature (%i) != monotone sugnature (%i)\nssh signature : %s\nmonotone signature: %s") % ssh_sig.length() % sig_string.length() % encode_hexenc(ssh_sig) % encode_hexenc(sig_string)); } ============================================================ --- options_list.hh 2e55c32ec7ea26c97ea7b3fbc2539088aaa6f858 +++ options_list.hh f6ca3e482b51276679a5d78a005c38623b1c2a6c @@ -257,22 +257,14 @@ OPT(execute, "execute,e", bool, false, } #endif -GOPT(ssh_sign, "ssh-sign", bool, false, - gettext_noop("sign with ssh-agent")) +GOPT(ssh_sign, "ssh-sign", std::string, "yes", + gettext_noop("sign with ssh-agent, 'yes' to sign with ssh if key found, 'no' to force monotone to sign, 'check' to sign with both and compare")) #ifdef option_bodies { - ssh_sign = true; + ssh_sign = "yes"; } #endif -GOPT(ssh_sign_check, "ssh-sign-check", bool, false, - gettext_noop("sign with ssh-agent, then sign with monotone and compare")) -#ifdef option_bodies -{ - ssh_sign_check = true; -} -#endif - GOPT(full_version, "full-version", bool, false, gettext_noop("print detailed version number, then exit")) #ifdef option_bodies