From cvs at cvs.gnupg.org Thu Dec 1 20:24:32 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu Dec 1 20:57:07 2005 Subject: [svn] GPGol - r129 - trunk/src Message-ID: Author: wk Date: 2005-12-01 20:24:32 +0100 (Thu, 01 Dec 2005) New Revision: 129 Modified: trunk/src/ChangeLog trunk/src/display.cpp trunk/src/display.h trunk/src/engine-gpgme.c trunk/src/engine.h trunk/src/gpgmsg.cpp trunk/src/gpgmsg.hh trunk/src/olflange.cpp trunk/src/olflange.h trunk/src/pgpmime.c trunk/src/pgpmime.h Log: internal cleanups and reworked the preview decryption Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/ChangeLog 2005-12-01 19:24:32 UTC (rev 129) @@ -1,3 +1,28 @@ +2005-12-01 Werner Koch + + * engine-gpgme.c (op_decrypt_stream_to_gpgme, decrypt_stream) + (op_decrypt): Add arg PREVIEW_MODE. + * pgpmime.c (pgpmime_decrypt): New arg PREVIEW_MODE. + (struct pgpmime_context): New field PREVIEW. + (message_cb, plaintext_handler): Handle preview mode. + * gpgmsg.cpp (class GpgMsgImpl): Renamed SILENT to PREVIEW. + (setSilent): Renamed to .. + (setPreview): .. this. + (decrypt): Handle preview mode. Display a string while decrypting + PGP/MIME messages. + + * display.cpp (update_display): New arg TEXT. + * gpgmsg.cpp (class GpgMsgImpl): Removed BODY_PLAIN and BODY. + (getDisplayText): Removed. + (loadBody): Changes to return the allocated body. + (getOrigText): Removed. + (getMessageType): Rewritten to take the body text as argument. + (decrypt): Pass plaintext directly to update_display. Free + plaintext. + (sign, encrypt_and_sign): Likewise. + + * olflange.cpp (OnWriteComplete): Always delete PR_BODY on error. + 2005-11-30 Werner Koch * gpgmsg.cpp: Made more strings translatable. Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/display.cpp 2005-12-01 19:24:32 UTC (rev 129) @@ -129,45 +129,46 @@ } -/* Update the display using the message MSG. Return 0 on success. */ +/* Update the display with TEXT using the message MSG. Return 0 on + success. */ int -update_display (HWND hwnd, GpgMsg *msg, void *exchange_cb, bool is_html) +update_display (HWND hwnd, GpgMsg *msg, void *exchange_cb, + bool is_html, const char *text) { HWND window; window = find_message_window (hwnd); if (window) { - const char *string, *s; + const char *s; log_debug ("%s:%s: window handle %p\n", SRCNAME, __func__, window); - string = msg->getDisplayText (); /* Decide whether we need to use the Unicode version. */ - for (s=string; *s && !(*s & 0x80); s++) + for (s=text; *s && !(*s & 0x80); s++) ; if (*s) { - wchar_t *tmp = utf8_to_wchar (string); + wchar_t *tmp = utf8_to_wchar (text); SetWindowTextW (window, tmp); xfree (tmp); } else - SetWindowTextA (window, string); + SetWindowTextA (window, text); log_debug ("%s:%s: window text is now `%s'", - SRCNAME, __func__, string); + SRCNAME, __func__, text); return 0; } else if (exchange_cb && !opt.compat.no_oom_write) { log_debug ("updating display using OOM"); return put_outlook_property (exchange_cb, is_html? "HTMLBody":"Body", - msg->getDisplayText ()); + text); } else { - log_debug ("%s: window handle not found for parent %p\n", - __func__, hwnd); + log_debug ("%s:%s: window handle not found for parent %p\n", + SRCNAME, __func__, hwnd); return -1; } } @@ -180,7 +181,7 @@ { HRESULT hr; SPropValue prop; - SPropTagArray proparray; + //SPropTagArray proparray; const char *s; assert (message); Modified: trunk/src/display.h =================================================================== --- trunk/src/display.h 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/display.h 2005-12-01 19:24:32 UTC (rev 129) @@ -28,7 +28,8 @@ char *add_html_line_endings (const char *body); -int update_display (HWND hwnd, GpgMsg *msg, void *exchange_cb, bool is_html); +int update_display (HWND hwnd, GpgMsg *msg, void *exchange_cb, + bool is_html, const char *text); int set_message_body (LPMESSAGE message, const char *string, bool is_html); Modified: trunk/src/engine-gpgme.c =================================================================== --- trunk/src/engine-gpgme.c 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/engine-gpgme.c 2005-12-01 19:24:32 UTC (rev 129) @@ -486,7 +486,7 @@ signature verification will get printed to it. */ int op_decrypt (const char *inbuf, char **outbuf, int ttl, const char *filename, - gpgme_data_t attestation) + gpgme_data_t attestation, int preview_mode) { struct decrypt_key_s dk; gpgme_data_t in = NULL; @@ -513,12 +513,17 @@ gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk); dk.ctx = ctx; - err = gpgme_op_decrypt_verify (ctx, in, out); + if (preview_mode) + err = gpgme_op_decrypt (ctx, in, out); + else + err = gpgme_op_decrypt_verify (ctx, in, out); dk.ctx = NULL; update_passphrase_cache (err, &dk); /* Act upon the result of the decryption operation. */ - if (!err) + if (!err && preview_mode) + ; + else if (!err) { /* Decryption succeeded. Store the result at OUTBUF. */ gpgme_verify_result_t res; @@ -577,7 +582,8 @@ will get printed to it. */ static int decrypt_stream (gpgme_data_t in, gpgme_data_t out, int ttl, - const char *filename, gpgme_data_t attestation) + const char *filename, gpgme_data_t attestation, + int preview_mode) { struct decrypt_key_s dk; gpgme_ctx_t ctx = NULL; @@ -592,11 +598,16 @@ gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk); dk.ctx = ctx; - err = gpgme_op_decrypt_verify (ctx, in, out); + if (preview_mode) + err = gpgme_op_decrypt (ctx, in, out); + else + err = gpgme_op_decrypt_verify (ctx, in, out); dk.ctx = NULL; update_passphrase_cache (err, &dk); /* Act upon the result of the decryption operation. */ - if (!err) + if (!err && preview_mode) + ; + else if (!err) { gpgme_verify_result_t res; @@ -656,7 +667,7 @@ if (!err) err = gpgme_data_new_from_cbs (&out, &cbs, outstream); if (!err) - err = decrypt_stream (in, out, ttl, filename, attestation); + err = decrypt_stream (in, out, ttl, filename, attestation, 0); if (in) gpgme_data_release (in); @@ -689,7 +700,7 @@ if (!err) err = gpgme_data_new (&out); if (!err) - err = decrypt_stream (in, out, ttl, filename, attestation); + err = decrypt_stream (in, out, ttl, filename, attestation, 0); if (!err) { /* Return the buffer but first make sure it is a string. */ @@ -714,7 +725,8 @@ outputs. */ int op_decrypt_stream_to_gpgme (LPSTREAM instream, gpgme_data_t out, int ttl, - const char *filename, gpgme_data_t attestation) + const char *filename, gpgme_data_t attestation, + int preview_mode) { struct gpgme_data_cbs cbs; gpgme_data_t in = NULL; @@ -725,7 +737,7 @@ err = gpgme_data_new_from_cbs (&in, &cbs, instream); if (!err) - err = decrypt_stream (in, out, ttl, filename, attestation); + err = decrypt_stream (in, out, ttl, filename, attestation, preview_mode); if (in) gpgme_data_release (in); Modified: trunk/src/engine.h =================================================================== --- trunk/src/engine.h 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/engine.h 2005-12-01 19:24:32 UTC (rev 129) @@ -57,15 +57,16 @@ gpgme_key_t sign_key, int ttl); int op_decrypt (const char *inbuf, char **outbuf, int ttl, - const char *filename, gpgme_data_t attestation); + const char *filename, gpgme_data_t attestation, + int preview_mode); int op_decrypt_stream (LPSTREAM instream, LPSTREAM outstream, int ttl, const char *filename, gpgme_data_t attestation); int op_decrypt_stream_to_buffer (LPSTREAM instream, char **outbuf, int ttl, const char *filename, gpgme_data_t attestation); int op_decrypt_stream_to_gpgme (LPSTREAM instream, gpgme_data_t out, int ttl, - const char *filename, - gpgme_data_t attestation); + const char *filename, gpgme_data_t attestation, + int preview_mode); int op_verify (const char *inbuf, char **outbuf, const char *filename, gpgme_data_t attestation); Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/gpgmsg.cpp 2005-12-01 19:24:32 UTC (rev 129) @@ -98,11 +98,9 @@ { message = NULL; exchange_cb = NULL; - body = NULL; - body_plain = NULL; is_pgpmime = false; has_attestation = false; - silent = false; + preview = false; attestation = NULL; @@ -114,8 +112,6 @@ { if (message) message->Release (); - xfree (body); - xfree (body_plain); if (attestation) gpgme_data_release (attestation); @@ -162,15 +158,13 @@ exchange_cb = cb; } - void setSilent (bool value) + void setPreview (bool value) { - silent = value; + preview = value; } - openpgp_t getMessageType (void); + openpgp_t getMessageType (const char *s); bool hasAttachments (void); - const char *getOrigText (bool want_html); - const char *GpgMsgImpl::getDisplayText (void); const char *getPlainText (void); int decrypt (HWND hwnd); @@ -200,12 +194,10 @@ private: LPMESSAGE message; /* Pointer to the message. */ void *exchange_cb; /* Call back used with the display function. */ - char *body; /* utf-8 encoded body string or NULL. */ - char *body_plain; /* Plaintext version of BODY or NULL. */ bool is_pgpmime; /* True if the message is a PGP/MIME encrypted one. */ bool has_attestation;/* True if we found an attestation attachment. */ - bool silent; /* Don't pop up message boxes. Currently this - is only used with decryption. */ + bool preview; /* Don't pop up message boxes and run only a + body decryption. */ /* If not NULL, collect attestation information here. */ gpgme_data_t attestation; @@ -218,7 +210,7 @@ LPSRowSet rows; /* The retrieved set of rows from the table. */ } attach; - void loadBody (bool want_html); + char *loadBody (bool want_html); bool isPgpmimeVersionPart (int pos); void writeAttestation (void); attach_info_t gatherAttachmentInfo (void); @@ -363,9 +355,9 @@ -/* Load the body and make it available as an UTF8 string in the - instance variable BODY. */ -void +/* Load the body from the MAP and return it as an UTF8 string. + Returns NULL on error. */ +char * GpgMsgImpl::loadBody (bool want_html) { HRESULT hr; @@ -374,9 +366,10 @@ // SPropValue prop; STATSTG statInfo; ULONG nread; + char *body = NULL; - if (body || !message) - return; + if (!message) + return NULL; hr = HrGetOneProp ((LPMAPIPROP)message, want_html? PR_BODY_HTML : PR_BODY, &lpspvFEID); @@ -418,7 +411,7 @@ goto ready; } - return; + return NULL; } hr = stream->Stat (&statInfo, STATFLAG_NONAME); @@ -426,7 +419,7 @@ { log_debug ("%s:%s: Stat failed: hr=%#lx", SRCNAME, __func__, hr); stream->Release (); - return; + return NULL; } /* Fixme: We might want to read only the first 1k to decide @@ -439,9 +432,8 @@ { log_debug ("%s:%s: Read failed: hr=%#lx", SRCNAME, __func__, hr); xfree (body); - body = NULL; stream->Release (); - return; + return NULL; } body[nread] = 0; body[nread+1] = 0; @@ -449,13 +441,12 @@ { log_debug ("%s:%s: not enough bytes returned\n", SRCNAME, __func__); xfree (body); - body = NULL; stream->Release (); - return; + return NULL; } stream->Release (); - /* FIXME: We need to optimize this. */ + /* FIXME: We should to optimize this. */ { char *tmp; tmp = wchar_to_utf8 ((wchar_t*)body); @@ -481,6 +472,7 @@ // if (FAILED (hr)) // log_debug ("%s:%s: updating message access to 0x%08lx failed: hr=%#lx", // SRCNAME, __func__, prop.Value.l, hr); + return body; } @@ -561,61 +553,32 @@ #endif -/* Return the type of a message. */ +/* Return the type of a message with the body text in TEXT. */ openpgp_t -GpgMsgImpl::getMessageType (void) +GpgMsgImpl::getMessageType (const char *text) { const char *s; - - loadBody (false); - - if (!body || !(s = strstr (body, "BEGIN PGP "))) + + if (!text || !(s = strstr (text, "BEGIN PGP "))) return OPENPGP_NONE; /* (The extra strstr() above is just a simple optimization.) */ - if (strstr (body, "BEGIN PGP MESSAGE")) + if (strstr (text, "BEGIN PGP MESSAGE")) return OPENPGP_MSG; - else if (strstr (body, "BEGIN PGP SIGNED MESSAGE")) + else if (strstr (text, "BEGIN PGP SIGNED MESSAGE")) return OPENPGP_CLEARSIG; - else if (strstr (body, "BEGIN PGP SIGNATURE")) + else if (strstr (text, "BEGIN PGP SIGNATURE")) return OPENPGP_SIG; - else if (strstr (body, "BEGIN PGP PUBLIC KEY")) + else if (strstr (text, "BEGIN PGP PUBLIC KEY")) return OPENPGP_PUBKEY; - else if (strstr (body, "BEGIN PGP PRIVATE KEY")) + else if (strstr (text, "BEGIN PGP PRIVATE KEY")) return OPENPGP_SECKEY; else return OPENPGP_NONE; } -/* Return the body text as received or composed. This is guaranteed - to never return NULL. */ -const char * -GpgMsgImpl::getOrigText (bool want_html) -{ - loadBody (want_html); - - return body? body : ""; -} - -/* Return the text of the message to be used for the display. The - message objects has intrinsic knowledge about the correct text. */ -const char * -GpgMsgImpl::getDisplayText (void) -{ - loadBody (false); - - if (body_plain) - return body_plain; - else if (body) - return body; - else - return ""; -} - - - /* Return an array of strings with the recipients of the message. On success a malloced array is returned containing allocated strings for each recipient. The end of the array is marked by NULL. @@ -857,7 +820,7 @@ /* Decrypt the message MSG and update the window. HWND identifies the - current window. */ + current window. */ int GpgMsgImpl::decrypt (HWND hwnd) { @@ -872,8 +835,12 @@ unsigned int n_signed = 0; HRESULT hr; int pgpmime_succeeded = 0; + char *body; - mtype = getMessageType (); + /* Load the body text into BODY. Note that body may be NULL but in + this case MTYPE will be OPENPGP_NONE. */ + body = loadBody (false); + mtype = getMessageType (body); /* Check whether this possibly encrypted message has encrypted attachments. We check right now because we need to get into the @@ -915,20 +882,20 @@ if (!opt.compat.old_reply_hack && (s = msgcache_get_from_mapi (message, &refhandle))) { - xfree (body_plain); - body_plain = xstrdup (s); - update_display (hwnd, this, exchange_cb, is_html_body (s)); + update_display (hwnd, this, exchange_cb, is_html_body (s), s); msgcache_unref (refhandle); log_debug ("%s:%s: leave (already decrypted)\n", SRCNAME, __func__); } else { - MessageBox (hwnd, _("No valid OpenPGP data found."), - _("Decryption"), MB_ICONWARNING|MB_OK); + if (!preview) + MessageBox (hwnd, _("No valid OpenPGP data found."), + _("Decryption"), MB_ICONWARNING|MB_OK); log_debug ("%s:%s: leave (no OpenPGP data)\n", SRCNAME, __func__); } release_attach_info (table); + xfree (body); return 0; } @@ -942,10 +909,9 @@ log_debug ("%s:%s: we already have an attestation\n", SRCNAME, __func__); } - else if (!attestation && !opt.compat.no_attestation) + else if (!attestation && !opt.compat.no_attestation && !preview) gpgme_data_new (&attestation); - /* Process according to type of message. */ if (is_pgpmime) { @@ -953,15 +919,25 @@ int method; LPSTREAM from; + /* If there is no body text (this should be the case for + PGP/MIME), display a message to indicate that this is such a + message. This is useful in case of such messages with + longish attachments which might take long to decrypt. */ + if (!body || !*body) + update_display (hwnd, this, exchange_cb, 0, + _("[This is a PGP/MIME message]")); + hr = message->OpenAttach (1, NULL, MAPI_BEST_ACCESS, &att); if (FAILED (hr)) { log_error ("%s:%s: can't open PGP/MIME attachment 2: hr=%#lx", SRCNAME, __func__, hr); - MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), - _("Decryption"), MB_ICONERROR|MB_OK); + if (!preview) + MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), + _("Decryption"), MB_ICONERROR|MB_OK); log_debug ("%s:%s: leave (PGP/MIME problem)\n", SRCNAME, __func__); release_attach_info (table); + xfree (body); return gpg_error (GPG_ERR_GENERAL); } @@ -970,11 +946,13 @@ { log_error ("%s:%s: unsupported method %d for PGP/MIME attachment 2", SRCNAME, __func__, method); - MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), - _("Decryption"), MB_ICONERROR|MB_OK); + if (!preview) + MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), + _("Decryption"), MB_ICONERROR|MB_OK); log_debug ("%s:%s: leave (bad PGP/MIME method)\n",SRCNAME,__func__); att->Release (); release_attach_info (table); + xfree (body); return gpg_error (GPG_ERR_GENERAL); } @@ -984,27 +962,34 @@ { log_error ("%s:%s: can't open data of attachment 2: hr=%#lx", SRCNAME, __func__, hr); - MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), - _("Decryption"), MB_ICONERROR|MB_OK); + if (!preview) + MessageBox (hwnd, _("Problem decrypting PGP/MIME message"), + _("Decryption"), MB_ICONERROR|MB_OK); log_debug ("%s:%s: leave (OpenProperty failed)\n",SRCNAME,__func__); att->Release (); release_attach_info (table); + xfree (body); return gpg_error (GPG_ERR_GENERAL); } err = pgpmime_decrypt (from, opt.passwd_ttl, &plaintext, attestation, - hwnd); + hwnd, preview); from->Release (); att->Release (); if (!err) pgpmime_succeeded = 1; } - else if (mtype == OPENPGP_CLEARSIG) - err = op_verify (getOrigText (false), NULL, NULL, attestation); - else if (*getOrigText(false)) - err = op_decrypt (getOrigText (false), &plaintext, opt.passwd_ttl, - NULL, attestation); + else if (mtype == OPENPGP_CLEARSIG ) + { + assert (body); + err = preview? 0 : op_verify (body, NULL, NULL, attestation); + } + else if (body && *body) + { + err = op_decrypt (body, &plaintext, opt.passwd_ttl, NULL, + attestation, preview); + } else err = gpg_error (GPG_ERR_NO_DATA); if (err) @@ -1014,7 +999,7 @@ else if (mtype == OPENPGP_CLEARSIG) MessageBox (hwnd, op_strerror (err), _("Verification Failure"), MB_ICONERROR|MB_OK); - else + else if (!preview) MessageBox (hwnd, op_strerror (err), _("Decryption Failure"), MB_ICONERROR|MB_OK); } @@ -1036,12 +1021,11 @@ if (opt.compat.old_reply_hack) set_message_body (message, plaintext, is_html); - xfree (body_plain); - body_plain = plaintext; - plaintext = NULL; - msgcache_put (body_plain, 0, message); + msgcache_put (plaintext, 0, message); - if (opt.save_decrypted_attach) + if (preview) + update_display (hwnd, this, exchange_cb, is_html, plaintext); + else if (opt.save_decrypted_attach) { /* User wants us to replace the encrypted message with the plaintext version. */ @@ -1049,10 +1033,10 @@ if (FAILED (hr)) log_debug ("%s:%s: SaveChanges failed: hr=%#lx", SRCNAME, __func__, hr); - update_display (hwnd, this, exchange_cb, is_html); + update_display (hwnd, this, exchange_cb, is_html, plaintext); } - else if (!silent && update_display (hwnd, this, exchange_cb, is_html)) + else if (update_display (hwnd, this, exchange_cb, is_html, plaintext)) { const char *s = _("The message text cannot be displayed.\n" @@ -1078,7 +1062,7 @@ /* If we have signed attachments. Ask whether the signatures should be verified; we do this is case of large attachments where verification might take long. */ - if (!silent && n_signed && !pgpmime_succeeded) + if (!preview && n_signed && !pgpmime_succeeded) { /* TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it will be expanded to a list of atatchment names. */ @@ -1104,7 +1088,7 @@ } } - if (!silent && n_encrypted && !pgpmime_succeeded) + if (!preview && n_encrypted && !pgpmime_succeeded) { /* TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it will be expanded to a list of atatchment names. */ @@ -1127,9 +1111,12 @@ } } - writeAttestation (); + if (!preview) + writeAttestation (); release_attach_info (table); + xfree (plaintext); + xfree (body); log_debug ("%s:%s: leave (rc=%d)\n", SRCNAME, __func__, err); return err; } @@ -1143,7 +1130,7 @@ GpgMsgImpl::sign (HWND hwnd) { HRESULT hr; - const char *plaintext; + char *plaintext; char *signedtext = NULL; int err = 0; gpgme_key_t sign_key = NULL; @@ -1153,9 +1140,11 @@ /* We don't sign an empty body - a signature on a zero length string is pretty much useless. */ - if (!*(plaintext = getOrigText (false)) && !hasAttachments ()) + plaintext = loadBody (false); + if ( (!plaintext || !*plaintext) && !hasAttachments ()) { log_debug ("%s:%s: leave (empty)", SRCNAME, __func__); + xfree (plaintext); return 0; } @@ -1163,10 +1152,11 @@ if (signer_dialog_box (&sign_key, NULL, 0) == -1) { log_debug ("%s.%s: leave (dialog failed)\n", SRCNAME, __func__); + xfree (plaintext); return gpg_error (GPG_ERR_CANCELED); } - if (*plaintext) + if (plaintext && *plaintext) { err = op_sign (plaintext, &signedtext, OP_SIG_CLEAR, sign_key, opt.passwd_ttl); @@ -1194,7 +1184,7 @@ /* Now that we successfully processed the attachments, we can save the changes to the body. */ - if (*plaintext) + if (plaintext && *plaintext) { err = set_message_body (message, signedtext, 0); if (err) @@ -1226,6 +1216,7 @@ leave: xfree (signedtext); gpgme_key_release (sign_key); + xfree (plaintext); log_debug ("%s:%s: leave (err=%s)\n", SRCNAME, __func__, op_strerror (err)); return err; } @@ -1234,7 +1225,7 @@ /* Encrypt and optionally sign (if SIGN_FLAG is true) the entire message including all attachments. If WANT_HTML is true, the text - to encrypt will be taken from the html property. Returns 0 on + to encrypt will also be taken from the html property. Returns 0 on success. */ int GpgMsgImpl::encrypt_and_sign (HWND hwnd, bool want_html, bool sign_flag) @@ -1243,7 +1234,7 @@ HRESULT hr; gpgme_key_t *keys = NULL; gpgme_key_t sign_key = NULL; - const char *plaintext; + char *plaintext; char *ciphertext = NULL; char **recipients = NULL; char **unknown = NULL; @@ -1251,10 +1242,11 @@ size_t n_keys, n_unknown, n_recp; SPropValue prop; - - if (!*(plaintext = getOrigText (want_html)) && !hasAttachments ()) + plaintext = loadBody (false); + if ( (!plaintext || !*plaintext) && !hasAttachments ()) { log_debug ("%s:%s: leave (empty)", SRCNAME, __func__); + xfree (plaintext); return 0; } @@ -1264,6 +1256,7 @@ if (signer_dialog_box (&sign_key, NULL, 1) == -1) { log_debug ("%s.%s: leave (dialog failed)\n", SRCNAME, __func__); + xfree (plaintext); return gpg_error (GPG_ERR_CANCELED); } } @@ -1311,7 +1304,7 @@ i, keyid_from_key (keys[i]), userid_from_key (keys[i])); } - if (*plaintext) + if (plaintext && *plaintext) { err = op_encrypt (plaintext, &ciphertext, keys, sign_key, opt.passwd_ttl); @@ -1363,7 +1356,7 @@ /* Now that we successfully processed the attachments, we can save the changes to the body. */ - if (*plaintext) + if (plaintext && *plaintext) { if (want_html) { @@ -1415,6 +1408,7 @@ free_string_array (recipients); free_string_array (unknown); xfree (ciphertext); + xfree (plaintext); log_debug ("%s:%s: leave (err=%s)\n", SRCNAME, __func__, op_strerror (err)); return err; } Modified: trunk/src/gpgmsg.hh =================================================================== --- trunk/src/gpgmsg.hh 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/gpgmsg.hh 2005-12-01 19:24:32 UTC (rev 129) @@ -50,25 +50,15 @@ /* Set the callback for Exchange. */ virtual void setExchangeCallback (void *cb) = 0; - /* Don't pop up any message boxes. */ - virtual void setSilent (bool value) = 0; + /* Don't pop up any message boxes and run the decryption only on the body. */ + virtual void setPreview (bool value) = 0; /* Return the type of the message. */ - virtual openpgp_t getMessageType (void) = 0; + virtual openpgp_t getMessageType (const char *text) = 0; /* Returns whether the message has any attachments. */ virtual bool hasAttachments (void) = 0; - /* Return the body text as received or composed. This is guaranteed - to never return NULL. Usually getMessageType is used to check - whether there is a suitable message. */ - virtual const char *getOrigText (bool want_html) = 0; - - /* Return the text of the message to be used for the display. The - message objects has intrinsic knowledge about the correct - text. */ - virtual const char *getDisplayText (void) = 0; - /* Return a malloced array of malloced strings with the recipients of the message. Caller is responsible for freeing this array and the strings. On failure NULL is returned. */ Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/olflange.cpp 2005-12-01 19:24:32 UTC (rev 129) @@ -781,6 +781,7 @@ log_debug ("%s:%s: received\n", SRCNAME, __func__); if (opt.compat.preview_decryption) { + TRACEPOINT (); HRESULT hr; HWND hWnd = NULL; LPMESSAGE pMessage = NULL; @@ -793,7 +794,7 @@ { GpgMsg *m = CreateGpgMsg (pMessage); m->setExchangeCallback ((void*)pEECB); - m->setSilent (1); + m->setPreview (1); m->decrypt (hWnd); delete m; } @@ -950,8 +951,10 @@ /* If we are encrypting we need to make sure that the other format gets deleted and is not actually sent in the clear. - Note that this otehr format is always HTML because we use the - regular PR_BODY for sending the _encrypted_ html. */ + Note that this other format is always HTML because we have + moved that into an attachment and kept PR_BODY. It seems + that OL always creates text and HTML if HTML has been + selected. */ if (m_pExchExt->m_gpgEncrypt) { log_debug ("%s:%s: deleting possible extra property PR_BODY_HTML\n", @@ -975,12 +978,13 @@ SRCNAME, __func__, m_want_html?"PR_BODY":"PR_BODY_HTML"); proparray.cValues = 1; - proparray.aulPropTag[0] = m_want_html? PR_BODY_HTML : PR_BODY; + proparray.aulPropTag[0] = PR_BODY; hr = msg->DeleteProps (&proparray, NULL); if (hr != S_OK) log_debug ("%s:%s: DeleteProps failed: hr=%#lx\n", SRCNAME, __func__, hr); - /* FIXME: We should delete the attachments too. */ + /* FIXME: We should delete the attachments too. + We really, really should do this!!! */ } } @@ -1048,6 +1052,7 @@ m_lContext = 0; m_nCmdEncrypt = 0; m_nCmdSign = 0; + m_nCmdPreviewDecrypt = 0; m_nToolbarButtonID1 = 0; m_nToolbarButtonID2 = 0; m_nToolbarBitmap1 = 0; @@ -1359,6 +1364,13 @@ m_nCmdEncrypt = *pnCommandIDBase; (*pnCommandIDBase)++; + + AppendMenu (hMenuTools, MF_STRING, + *pnCommandIDBase, _("GPG decrypt preview")); + + m_nCmdPreviewDecrypt = *pnCommandIDBase; + (*pnCommandIDBase)++; + TRACEPOINT (); for (nTBIndex = nTBECnt-1; nTBIndex > -1; --nTBIndex) { @@ -1448,7 +1460,12 @@ } - + if (nCommandID == m_nCmdPreviewDecrypt && m_lContext == EECONTEXT_VIEWER) + { + opt.compat.preview_decryption = !opt.compat.preview_decryption; + return S_OK; + } + if ((nCommandID != m_nCmdEncrypt) && (nCommandID != m_nCmdSign)) return S_FALSE; Modified: trunk/src/olflange.h =================================================================== --- trunk/src/olflange.h 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/olflange.h 2005-12-01 19:24:32 UTC (rev 129) @@ -132,6 +132,7 @@ UINT m_nCmdEncrypt; UINT m_nCmdSign; + UINT m_nCmdPreviewDecrypt; UINT m_nToolbarButtonID1; UINT m_nToolbarButtonID2; Modified: trunk/src/pgpmime.c =================================================================== --- trunk/src/pgpmime.c 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/pgpmime.c 2005-12-01 19:24:32 UTC (rev 129) @@ -88,6 +88,8 @@ HWND hwnd; /* A window handle to be used for message boxes etc. */ rfc822parse_t msg; /* The handle of the RFC822 parser. */ + int preview; /* Do only decryption and pop up no message bozes. */ + int nesting_level; /* Current MIME nesting level. */ int in_data; /* We are currently in data (body or attachment). */ @@ -324,7 +326,8 @@ } else /* Other type. */ { - ctx->collect_attachment = 1; + if (!ctx->preview) + ctx->collect_attachment = 1; } } @@ -375,7 +378,7 @@ if (!gpgme_data_new (&ctx->body)) ctx->collect_body = 1; } - else + else if (!ctx->preview) ctx->collect_attachment = 1; } @@ -403,9 +406,9 @@ } tryagain: xfree (ctx->filename); - ctx->filename = get_save_filename (ctx->hwnd, p); + ctx->filename = ctx->preview? NULL:get_save_filename (ctx->hwnd, p); if (!ctx->filename) - ctx->collect_attachment = 0; /* User das not want to save it. */ + ctx->collect_attachment = 0; /* User does not want to save it. */ else { hr = OpenStreamOnFile (MAPIAllocateBuffer, MAPIFreeBuffer, @@ -416,7 +419,7 @@ log_error ("%s:%s: can't create file `%s': hr=%#lx\n", SRCNAME, __func__, ctx->filename, hr); MessageBox (ctx->hwnd, _("Error creating file\n" - "Please select another one"), + "Please select another one"), _("I/O-Error"), MB_ICONERROR|MB_OK); goto tryagain; } @@ -549,8 +552,9 @@ { log_debug ("%s:%s: Write failed: hr=%#lx", SRCNAME, __func__, hr); - MessageBox (ctx->hwnd, _("Error writing file"), - _("I/O-Error"), MB_ICONERROR|MB_OK); + if (!ctx->preview) + MessageBox (ctx->hwnd, _("Error writing file"), + _("I/O-Error"), MB_ICONERROR|MB_OK); ctx->parser_error = 1; return 0; /* Error. */ } @@ -572,10 +576,11 @@ newly allocated body will be stored at BODY. If ATTESTATION is not NULL a text with the result of the signature verification will get printed to it. HWND is the window to be used for message box and - such. */ + such. In PREVIEW_MODE no verification will be done, no messages + saved and no messages boxes will pop up. */ int pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd) + gpgme_data_t attestation, HWND hwnd, int preview_mode) { gpg_error_t err; struct gpgme_data_cbs cbs; @@ -590,6 +595,7 @@ ctx = xcalloc (1, sizeof *ctx + LINEBUFSIZE); ctx->linebufsize = LINEBUFSIZE; ctx->hwnd = hwnd; + ctx->preview = preview_mode; ctx->msg = rfc822parse_open (message_cb, ctx); if (!ctx->msg) @@ -604,7 +610,8 @@ goto leave; err = op_decrypt_stream_to_gpgme (instream, plaintext, ttl, - _("[PGP/MIME message]"), attestation); + _("[PGP/MIME message]"), attestation, + preview_mode); if (!err && (ctx->parser_error || ctx->line_too_long)) err = gpg_error (GPG_ERR_GENERAL); Modified: trunk/src/pgpmime.h =================================================================== --- trunk/src/pgpmime.h 2005-11-30 16:47:27 UTC (rev 128) +++ trunk/src/pgpmime.h 2005-12-01 19:24:32 UTC (rev 129) @@ -29,7 +29,8 @@ #endif int pgpmime_decrypt (LPSTREAM instream, int ttl, char **body, - gpgme_data_t attestation, HWND hwnd); + gpgme_data_t attestation, HWND hwnd, + int preview_mode); From cvs at cvs.gnupg.org Fri Dec 2 18:39:28 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri Dec 2 18:05:05 2005 Subject: [svn] GPGol - r130 - in trunk: . po src Message-ID: Author: wk Date: 2005-12-02 18:39:27 +0100 (Fri, 02 Dec 2005) New Revision: 130 Modified: trunk/ChangeLog trunk/Makefile.am trunk/NEWS trunk/po/POTFILES.in trunk/po/de.po trunk/src/ChangeLog trunk/src/config-dialog.c trunk/src/gpgol-ids.h trunk/src/gpgol-rsrcs.rc trunk/src/intern.h trunk/src/main.c trunk/src/olflange-dlgs.cpp trunk/src/olflange-ids.h trunk/src/olflange-rsrcs.rc trunk/src/olflange.cpp trunk/src/olflange.h trunk/src/passphrase-dialog.c trunk/src/recipient-dialog.c trunk/src/verify-dialog.c Log: i18n stuff, cleanups and made make distcheck work. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/ChangeLog 2005-12-02 17:39:27 UTC (rev 130) @@ -1,3 +1,7 @@ +2005-12-02 Werner Koch + + * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New. + 2005-11-30 Werner Koch * po/de.po: New. Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/Makefile.am 2005-12-02 17:39:27 UTC (rev 130) @@ -13,6 +13,11 @@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-bzip2 +# Because we can only build the w32 version e need to help automake here a bit. +DISTCHECK_CONFIGURE_FLAGS = --host=i586-mingw32msvc --build=i686-pc-linux-gnu \ + --prefix=@prefix@ \ + --with-gpg-error-prefix=@prefix@ \ + --with-gpgme-prefix=@prefix@ EXTRA_DIST = autogen.sh Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/NEWS 2005-12-02 17:39:27 UTC (rev 130) @@ -3,7 +3,11 @@ * Added translation framework. Provided German translation. +* New option to enable automatic decryption in the preview window. +* Removed deprecated options to configure gpg path and homedir. + + Noteworthy changes for version 0.9.3 (2005-09-29) ================================================= Modified: trunk/po/POTFILES.in =================================================================== --- trunk/po/POTFILES.in 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/po/POTFILES.in 2005-12-02 17:39:27 UTC (rev 130) @@ -5,7 +5,6 @@ src/display.cpp src/engine-gpgme.c src/gpgmsg.cpp -src/keylist.c src/main.c src/msgcache.c src/olflange-dlgs.cpp Modified: trunk/po/de.po =================================================================== --- trunk/po/de.po 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/po/de.po 2005-12-02 17:39:27 UTC (rev 130) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: GPGol 0.9.4\n" "Report-Msgid-Bugs-To: bug-gpgol@g10code.com\n" -"POT-Creation-Date: 2005-11-30 17:02+0100\n" +"POT-Creation-Date: 2005-12-02 17:48+0100\n" "PO-Revision-Date: 2005-11-30 17:06+0100\n" "Last-Translator: Werner Koch \n" "Language-Team: de\n" @@ -15,62 +15,67 @@ "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/engine-gpgme.c:880 +#: src/config-dialog.c:298 +#, fuzzy +msgid "Select GPG Key Manager" +msgstr "Die GPG Schlüsselverwaltung öffnen" + +#: src/engine-gpgme.c:892 msgid "Fingerprint: " msgstr "Fingerabdruck: " -#: src/engine-gpgme.c:937 +#: src/engine-gpgme.c:949 msgid "This signature is valid\n" msgstr "Diese Unterschrift ist korrekt\n" -#: src/engine-gpgme.c:939 +#: src/engine-gpgme.c:951 msgid "signature state is \"green\"\n" msgstr "Status der Unterschrift ist \"grün\"\n" -#: src/engine-gpgme.c:941 +#: src/engine-gpgme.c:953 msgid "signature state is \"red\"\n" msgstr "Status der Unterschrift ist \"rot\"\n" -#: src/engine-gpgme.c:945 +#: src/engine-gpgme.c:957 msgid "Warning: One of the keys has been revoked\n" msgstr "Warnung: Einer der Schlüssel wurde widerrufen\n" -#: src/engine-gpgme.c:955 +#: src/engine-gpgme.c:967 msgid "Warning: The key used to create the signature expired at: " msgstr "" "Warnung: Der Schlüssel mit der diese Unterschrift erzeugt wurde verfiel am: " -#: src/engine-gpgme.c:961 +#: src/engine-gpgme.c:973 msgid "Warning: At least one certification key has expired\n" msgstr "" "Warnung: Mindestens einer der Zertifizierungsschlüssel ist abgelaufen\n" -#: src/engine-gpgme.c:967 +#: src/engine-gpgme.c:979 msgid "Warning: The signature expired at: " msgstr "Die Unterschrift verfiel am: " -#: src/engine-gpgme.c:973 +#: src/engine-gpgme.c:985 msgid "Can't verify due to a missing key or certificate\n" msgstr "" "Aufrund eines fehlenden Schlüssels ist eine Ãœberprüfung nicht möglich\n" -#: src/engine-gpgme.c:977 +#: src/engine-gpgme.c:989 msgid "The CRL is not available\n" msgstr "Die CRL ist nicht verfügbar\n" -#: src/engine-gpgme.c:983 +#: src/engine-gpgme.c:995 msgid "Available CRL is too old\n" msgstr "Die vorhandene CRL ist zu alt\n" -#: src/engine-gpgme.c:988 +#: src/engine-gpgme.c:1000 msgid "A policy requirement was not met\n" msgstr "Eine Richtlinie wurde nicht erfüllt\n" -#: src/engine-gpgme.c:994 +#: src/engine-gpgme.c:1006 msgid "A system error occured" msgstr "Ein Systemfehler ist aufgetreten" -#: src/engine-gpgme.c:1031 +#: src/engine-gpgme.c:1043 msgid "" "WARNING: We have NO indication whether the key belongs to the person named " "as shown above\n" @@ -78,12 +83,12 @@ "WARNUNG: Es gibt keinen Hinweis darauf, ob der Schlüssel wirklich der Person " "gehört, die oben angezeigt ist\n" -#: src/engine-gpgme.c:1038 +#: src/engine-gpgme.c:1050 msgid "WARNING: The key does NOT BELONG to the person named as shown above\n" msgstr "" "WARNUNG: Der Schlüssel gehört NICHT der Person die oben angezeigt ist\n" -#: src/engine-gpgme.c:1042 +#: src/engine-gpgme.c:1054 msgid "" "WARNING: It is NOT certain that the key belongs to the person named as shown " "above\n" @@ -91,73 +96,78 @@ "WARNING: Es ist nicht sicher, daß der Schlüssel der Person gehört, die oben " "angezeigt ist\n" -#: src/engine-gpgme.c:1075 +#: src/engine-gpgme.c:1087 msgid "Verification started at: " msgstr "Ãœberprüfung begann am: " -#: src/engine-gpgme.c:1080 +#: src/engine-gpgme.c:1092 msgid "Verification result for: " msgstr "Prüfungsresultat für: " -#: src/engine-gpgme.c:1081 +#: src/engine-gpgme.c:1093 msgid "[unnamed part]" msgstr "[Unbenannter Teil]" -#: src/engine-gpgme.c:1099 src/engine-gpgme.c:1129 +#: src/engine-gpgme.c:1111 src/engine-gpgme.c:1141 msgid "Good signature from: " msgstr "Korrekte Unterschrift von: " -#: src/engine-gpgme.c:1106 +#: src/engine-gpgme.c:1118 msgid " aka: " msgstr " alias: " -#: src/engine-gpgme.c:1110 src/engine-gpgme.c:1132 +#: src/engine-gpgme.c:1122 src/engine-gpgme.c:1144 msgid " created: " msgstr " erzeugt: " -#: src/engine-gpgme.c:1119 +#: src/engine-gpgme.c:1131 msgid "*BAD* signature claimed to be from: " msgstr "*FALSCHE* Unterschrift, vorgeblich von: " -#: src/engine-gpgme.c:1142 +#: src/engine-gpgme.c:1154 msgid "Error checking signature" msgstr "Fehler beim Prüfen der Unetrschrift" -#: src/engine-gpgme.c:1158 +#: src/engine-gpgme.c:1170 msgid "*** Begin Notation (signature by: " msgstr "*** Anfang Notation (Unterschrift von: " -#: src/engine-gpgme.c:1178 +#: src/engine-gpgme.c:1190 msgid "*** End Notation ***\n" msgstr "*** Ende Notation ***\n" -#: src/gpgmsg.cpp:804 +#: src/gpgmsg.cpp:767 msgid "[No attestation computed (e.g. messages was not signed)" msgstr "" "[Kein Testat berechnet (z.B. da die Nachricht nicht unterschrieben war)" -#: src/gpgmsg.cpp:926 +#: src/gpgmsg.cpp:892 msgid "No valid OpenPGP data found." msgstr "Keine gültigen OpenPGP Daten gefunden" -#: src/gpgmsg.cpp:927 src/gpgmsg.cpp:962 src/gpgmsg.cpp:974 src/gpgmsg.cpp:988 -#: src/gpgmsg.cpp:1064 +#: src/gpgmsg.cpp:893 src/gpgmsg.cpp:937 src/gpgmsg.cpp:951 src/gpgmsg.cpp:967 +#: src/gpgmsg.cpp:1048 msgid "Decryption" msgstr "Entschlüsselung" -#: src/gpgmsg.cpp:961 src/gpgmsg.cpp:973 src/gpgmsg.cpp:987 +#: src/gpgmsg.cpp:928 +#, fuzzy +msgid "[This is a PGP/MIME message]" +msgstr "[PGP/MIME Nachricht]" + +#: src/gpgmsg.cpp:936 src/gpgmsg.cpp:950 src/gpgmsg.cpp:966 msgid "Problem decrypting PGP/MIME message" msgstr "Problem bei Entschlüsseln einer PGP/MIME Nachricht" -#: src/gpgmsg.cpp:1016 +#: src/gpgmsg.cpp:1001 msgid "Verification Failure" msgstr "Ãœberprüfungsfehler" -#: src/gpgmsg.cpp:1019 +#: src/gpgmsg.cpp:1004 msgid "Decryption Failure" msgstr "Entschlüsselungsfehler" -#: src/gpgmsg.cpp:1058 +#: src/gpgmsg.cpp:1042 msgid "" "The message text cannot be displayed.\n" "You have to save the decrypted message to view it.\n" @@ -173,7 +183,7 @@ #. TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it #. will be expanded to a list of atatchment names. -#: src/gpgmsg.cpp:1085 +#: src/gpgmsg.cpp:1069 msgid "" "Signed attachments found.\n" "\n" @@ -185,13 +195,13 @@ "@LIST@\n" "Möchten Sie diese Unterschriften überprüfen?" -#: src/gpgmsg.cpp:1093 +#: src/gpgmsg.cpp:1077 msgid "Attachment Verification" msgstr "Ãœberprüfung der Anhänge" #. TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it #. will be expanded to a list of atatchment names. -#: src/gpgmsg.cpp:1111 +#: src/gpgmsg.cpp:1095 msgid "" "Encrypted attachments found.\n" "\n" @@ -203,35 +213,35 @@ "@LIST@\n" "Möchten Sie diese entschlüsseln und abspeichern?" -#: src/gpgmsg.cpp:1118 +#: src/gpgmsg.cpp:1102 msgid "Attachment Decryption" msgstr "Entschlüsselung eines Anhangs" -#: src/gpgmsg.cpp:1176 +#: src/gpgmsg.cpp:1166 msgid "Signing Failure" msgstr "Unterschrifterstellungsfehler" -#: src/gpgmsg.cpp:1321 +#: src/gpgmsg.cpp:1314 msgid "Encryption Failure" msgstr "Verschlüsselungsfehler" -#: src/gpgmsg.cpp:1357 src/gpgmsg.cpp:2651 +#: src/gpgmsg.cpp:1350 src/gpgmsg.cpp:2645 msgid "Attachment Encryption Failure" msgstr "Verschlüsselungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2058 +#: src/gpgmsg.cpp:2052 msgid "Attachment Verification Failure" msgstr "Ãœberprüfungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2241 src/gpgmsg.cpp:2290 +#: src/gpgmsg.cpp:2235 src/gpgmsg.cpp:2284 msgid "Attachment Decryption Failure" msgstr "Entschlüsselungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2460 +#: src/gpgmsg.cpp:2454 msgid "Attachment Signing Failure" msgstr "Unterschrifterstellungsfehler eines Anhangs" -#: src/olflange.cpp:883 +#: src/olflange.cpp:884 msgid "" "Sorry, we can only encrypt plain text messages and\n" "no RTF messages. Please make sure that only the text\n" @@ -242,51 +252,51 @@ "Sie sicher, daß lediglich das Text Format ausgewählt wurde.\n" "(In der Menüleiste: \"Format\" => \"Nur Text\")" -#: src/olflange.cpp:1268 +#: src/olflange.cpp:1272 msgid "&Decrypt and verify message" msgstr "Entschlüsseln/Prüfen der Nachricht" -#: src/olflange.cpp:1306 +#: src/olflange.cpp:1310 msgid "GPG &encrypt message" msgstr "Mit GPG &verschlüsseln" -#: src/olflange.cpp:1312 +#: src/olflange.cpp:1316 msgid "GPG &sign message" msgstr "Mit GPG unter&schreiben" -#: src/olflange.cpp:1358 +#: src/olflange.cpp:1362 msgid "GPG Key &Manager" msgstr "GPG Schlüssel&verwaltung" -#: src/olflange.cpp:1491 +#: src/olflange.cpp:1494 msgid "Could not start Key-Manager" msgstr "Dei Schlüsselverwaltung konnte nicht aufgerufen werden" -#: src/olflange.cpp:1537 +#: src/olflange.cpp:1540 msgid "Decrypt and verify the message." msgstr "Entschlüsseln und Prüfen der Nachricht." -#: src/olflange.cpp:1545 +#: src/olflange.cpp:1548 msgid "Select this option to encrypt the message." msgstr "Wählen Sie diese Option zum Verschlüsseln der Nachricht." -#: src/olflange.cpp:1551 +#: src/olflange.cpp:1554 msgid "Select this option to sign the message." msgstr "Wählen Sie diese Option zum Unterschreiben der Nachricht." -#: src/olflange.cpp:1560 src/olflange.cpp:1621 src/olflange.cpp:1703 +#: src/olflange.cpp:1563 src/olflange.cpp:1624 src/olflange.cpp:1706 msgid "Open GPG Key Manager" msgstr "Die GPG Schlüsselverwaltung öffnen" -#: src/olflange.cpp:1590 src/olflange.cpp:1654 +#: src/olflange.cpp:1593 src/olflange.cpp:1657 msgid "Decrypt message and verify signature" msgstr "Nachricht entschlüsseln und Unterschrift prüfen" -#: src/olflange.cpp:1601 src/olflange.cpp:1672 +#: src/olflange.cpp:1604 src/olflange.cpp:1675 msgid "Encrypt message with GPG" msgstr "Nachricht mit GPG verschlüsseln" -#: src/olflange.cpp:1610 src/olflange.cpp:1687 +#: src/olflange.cpp:1613 src/olflange.cpp:1690 msgid "Sign message with GPG" msgstr "Nachricht mit GPG unterschreiben" @@ -334,7 +344,7 @@ "\n" "Möchten Sie wirklich abbrechen?" -#: src/pgpmime.c:418 +#: src/pgpmime.c:421 msgid "" "Error creating file\n" "Please select another one" @@ -342,19 +352,19 @@ "Fehler bei der Erstellung der Datei.\n" "Bitte wählen Sie eine anderen Namen." -#: src/pgpmime.c:420 src/pgpmime.c:553 +#: src/pgpmime.c:423 src/pgpmime.c:557 msgid "I/O-Error" msgstr "Ein-/Ausgabefehler" -#: src/pgpmime.c:552 +#: src/pgpmime.c:556 msgid "Error writing file" msgstr "Dateischreibfehler" -#: src/pgpmime.c:607 +#: src/pgpmime.c:613 msgid "[PGP/MIME message]" msgstr "[PGP/MIME Nachricht]" -#: src/pgpmime.c:623 +#: src/pgpmime.c:630 msgid "[PGP/MIME message without plain text body]" msgstr "[PGP/MIME Nachricht ohne reinen Textkörper]" @@ -373,7 +383,7 @@ msgid "Recipient Dialog" msgstr "Auswahl des Empfängerschlüssels" -#: src/recipient-dialog.c:531 src/verify-dialog.c:152 +#: src/recipient-dialog.c:537 src/verify-dialog.c:152 msgid "User-ID not found" msgstr "User-ID nicht gefunden" Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/ChangeLog 2005-12-02 17:39:27 UTC (rev 130) @@ -1,3 +1,27 @@ +2005-12-02 Werner Koch + + * verify-dialog.c (verify_dialog_box): Actually allow for German + dialog. + * recipient-dialog.c (recipient_dialog_box) + (recipient_dialog_box2): Ditto. + * passphrase-dialog.c (signer_dialog_box) + (passphrase_callback_box): Ditto. + + * intern.h (struct): New field PREVIEW_DECRYPT. Use it instead os + the old compatibility flags. + * main.c (write_options, read_options): Store/load preview decrypt. + * config-dialog.c (config_dlg_proc): Removed homedir and gpgbinary + options as they are deprecated. Put logfile entry here. + * olflange-dlgs.cpp (GPGOptionsDlgProc): Remove logfile entry. Add + preview-decrypt checkbox. + * olflange.cpp (InstallCommands): Remove experimental preview + command. + + * w32-gettext.c (gettext_localename): New. + * config-dialog.c (config_dialog_box): Use it here to match the + gettext behaviour. + (GetPages): Ditto. + 2005-12-01 Werner Koch * engine-gpgme.c (op_decrypt_stream_to_gpgme, decrypt_stream) Modified: trunk/src/config-dialog.c =================================================================== --- trunk/src/config-dialog.c 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/config-dialog.c 2005-12-02 17:39:27 UTC (rev 130) @@ -61,6 +61,7 @@ } +#if 0 static void SHFree (void *p) { @@ -71,8 +72,9 @@ pm->lpVtbl->Release(pm); } } +#endif - +#if 0 /* Open the common dialog to select a folder. Caller has to free the string. */ static char* get_folder (const char *title) @@ -95,8 +97,8 @@ } return path; } +#endif - static int load_config_value_ext (char **val) { @@ -198,6 +200,7 @@ } +#if 0 static int does_folder_exist (const char *path) { @@ -217,8 +220,8 @@ } return err; } +#endif - static int does_file_exist (const char *name, int is_file) { @@ -275,56 +278,29 @@ char *buf = NULL; char name[MAX_PATH+1]; int n; + const char *s; switch (msg) { case WM_INITDIALOG: center_window (dlg, 0); - if (!load_config_value (NULL, REGPATH, "gpgProgram", &buf)) { - SetDlgItemText (dlg, IDC_OPT_GPGPRG, buf); - xfree (buf); - buf=NULL; - } - if (!load_config_value (NULL, REGPATH, "HomeDir", &buf)) { - SetDlgItemText (dlg, IDC_OPT_HOMEDIR, buf); - xfree (buf); - buf=NULL; - } if (!load_config_value (NULL, REGPATH, "keyManager", &buf)) { SetDlgItemText (dlg, IDC_OPT_KEYMAN, buf); xfree (buf); buf=NULL; } + s = get_log_file (); + SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s); break; case WM_COMMAND: switch (LOWORD (wparam)) { - case IDC_OPT_SELPRG: - buf = get_open_file_name (NULL, "Select GnuPG Binary"); - if (buf && *buf) - SetDlgItemText(dlg, IDC_OPT_GPGPRG, buf); - break; - - case IDC_OPT_SELHOMEDIR: - buf = get_folder ("Select GnuPG Home Directory"); - if (buf && *buf) - SetDlgItemText(dlg, IDC_OPT_HOMEDIR, buf); - xfree (buf); - break; - case IDC_OPT_SELKEYMAN: - buf = get_open_file_name (NULL, "Select GnuPG Key Manager"); + buf = get_open_file_name (NULL, _("Select GPG Key Manager")); if (buf && *buf) SetDlgItemText (dlg, IDC_OPT_KEYMAN, buf); break; case IDOK: - n = GetDlgItemText (dlg, IDC_OPT_GPGPRG, name, MAX_PATH-1); - if (n > 0) { - if (does_file_exist (name, 1)) - return FALSE; - if (store_config_value (NULL, REGPATH, "gpgProgram", name)) - error_box ("GPG Config"); - } n = GetDlgItemText (dlg, IDC_OPT_KEYMAN, name, MAX_PATH-1); if (n > 0) { if (does_file_exist (name, 1)) @@ -332,12 +308,9 @@ if (store_config_value (NULL, REGPATH, "keyManager", name)) error_box ("GPG Config"); } - n = GetDlgItemText (dlg, IDC_OPT_HOMEDIR, name, MAX_PATH-1); + n = GetDlgItemText (dlg, IDC_DEBUG_LOGFILE, name, MAX_PATH-1); if (n > 0) { - if (does_folder_exist (name)) - return FALSE; - if (store_config_value (NULL, REGPATH, "HomeDir", name)) - error_box ("GPG Config"); + set_log_file (name); } EndDialog (dlg, TRUE); break; @@ -353,18 +326,16 @@ void config_dialog_box (HWND parent) { - int resid=0; + int resid; - switch (GetUserDefaultLangID ()) - { - case 0x0407: resid = IDD_OPT_DE;break; - default: resid = IDD_OPT; break; - } + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_OPT_DE; + else + resid = IDD_OPT; - if (parent == NULL) + if (!parent) parent = GetDesktopWindow (); - DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, - config_dlg_proc, 0); + DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, config_dlg_proc, 0); } Modified: trunk/src/gpgol-ids.h =================================================================== --- trunk/src/gpgol-ids.h 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/gpgol-ids.h 2005-12-02 17:39:27 UTC (rev 130) @@ -65,6 +65,7 @@ #define IDC_DECEXT_PASS 1045 #define IDC_DECEXT_HINT 1046 #define IDC_DECEXT_PASSINF 1047 +#define IDC_DEBUG_LOGFILE 1048 #endif /*GPGOL_IDS_H*/ Modified: trunk/src/gpgol-rsrcs.rc =================================================================== --- trunk/src/gpgol-rsrcs.rc 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/gpgol-rsrcs.rc 2005-12-02 17:39:27 UTC (rev 130) @@ -80,19 +80,18 @@ IDD_OPT_DE DIALOG DISCARDABLE 0, 0, 167, 119 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Konfigurations Dialog" +CAPTION "Konfigurationsdialog" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Pfad zur GnuPG EXE-Datei",IDC_STATIC,2,10,87,8 - EDITTEXT IDC_OPT_GPGPRG,2,22,145,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_OPT_SELPRG,149,21,11,14 - LTEXT "Heimatverzeichnis von GnuPG",IDC_STATIC,2,41,98,8 - EDITTEXT IDC_OPT_HOMEDIR,2,53,145,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_OPT_SELHOMEDIR,149,53,11,14 - LTEXT "Pfad zur EXE-Datei des Key Managers",IDC_STATIC,2,72, + LTEXT "Dateiname der Schlüsselverwaltung",IDC_STATIC,2,20, 122,8 - EDITTEXT IDC_OPT_KEYMAN,2,81,144,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_OPT_SELKEYMAN,148,80,11,14 + EDITTEXT IDC_OPT_KEYMAN,2,34,144,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_OPT_SELKEYMAN,148,34,11,14 + + LTEXT "Debugausgabe (zur Problemanalyse)",IDC_STATIC,2,50, + 122,8 + EDITTEXT IDC_DEBUG_LOGFILE,2,60,144,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "&OK",IDOK,112,101,50,14 END @@ -226,12 +225,6 @@ CAPTION "Configuration Dialog" FONT 8, "MS Sans Serif" BEGIN - LTEXT "Path to GnuPG binary",IDC_STATIC,2,10,70,8 - EDITTEXT IDC_OPT_GPGPRG,2,22,145,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_OPT_SELPRG,149,21,11,14 - LTEXT "GnuPG home directory",IDC_STATIC,2,41,72,8 - EDITTEXT IDC_OPT_HOMEDIR,2,53,145,12,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_OPT_SELHOMEDIR,149,53,11,14 LTEXT "Path to key-manager binary",IDC_STATIC,2,72,87,8 EDITTEXT IDC_OPT_KEYMAN,2,81,144,12,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_OPT_SELKEYMAN,148,80,11,14 Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/intern.h 2005-12-02 17:39:27 UTC (rev 130) @@ -99,6 +99,7 @@ int enc_format; /* Encryption format for attachments. */ char *default_key; /* Malloced default key or NULL. */ int add_default_key; /* Always also encrypt to the default key. */ + int preview_decrypt; /* Decrypt in preview window. */ /* The compatibility flags. */ struct @@ -106,7 +107,6 @@ unsigned int no_msgcache:1; unsigned int no_pgpmime:1; unsigned int no_oom_write:1; /* Don't write using Outlooks object model. */ - unsigned int preview_decryption:1; /* Decrypt in preview window. */ unsigned int old_reply_hack: 1; /* See gpgmsg.cpp:decrypt. */ unsigned int auto_decrypt: 1; /* Try to decrypt when clicked. */ unsigned int no_attestation: 1; /* Don't create an attestation. */ Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/main.c 2005-12-02 17:39:27 UTC (rev 130) @@ -381,6 +381,10 @@ opt.sign_default = val == NULL || *val != '1'? 0 : 1; xfree (val); val = NULL; + load_extension_value ("previewDecrypt", &val); + opt.preview_decrypt = val == NULL || *val != '1'? 0 : 1; + xfree (val); val = NULL; + load_extension_value ("addDefaultKey", &val); opt.add_default_key = val == NULL || *val != '1' ? 0 : 1; xfree (val); val = NULL; @@ -419,7 +423,7 @@ case 0: opt.compat.no_msgcache = x; break; case 1: opt.compat.no_pgpmime = x; break; case 2: opt.compat.no_oom_write = x; break; - case 3: opt.compat.preview_decryption = x; break; + case 3: /* Not used anymore */ break; case 4: opt.compat.old_reply_hack = x; break; case 5: opt.compat.auto_decrypt = x; break; case 6: opt.compat.no_attestation = x; break; @@ -447,6 +451,7 @@ {"addDefaultKey", 0, opt.add_default_key}, {"saveDecryptedAttachments", 0, opt.save_decrypted_attach}, {"autoSignAttachments", 0, opt.auto_sign_attach}, + {"previewDecrypt", 0, opt.preview_decrypt}, {"storePasswdTime", 1, opt.passwd_ttl}, {"encodingFormat", 1, opt.enc_format}, {"logFile", 2, 0, logfile}, Modified: trunk/src/olflange-dlgs.cpp =================================================================== --- trunk/src/olflange-dlgs.cpp 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/olflange-dlgs.cpp 2005-12-02 17:39:27 UTC (rev 130) @@ -128,16 +128,12 @@ case PSN_SETACTIVE: { TCHAR s[30]; - const char *f; if (opt.default_key) SetDlgItemText (hDlg, IDC_ENCRYPT_TO, opt.default_key); wsprintf(s, "%d", opt.passwd_ttl); SendDlgItemMessage(hDlg, IDC_TIME_PHRASES, WM_SETTEXT, 0, (LPARAM) s); - f = get_log_file (); - SendDlgItemMessage (hDlg, IDC_DEBUG_LOGFILE, WM_SETTEXT, - 0, (LPARAM)f); hWndPage = pnmhdr->hwndFrom; // to be used in WM_COMMAND SendDlgItemMessage (hDlg, IDC_ENCRYPT_DEFAULT, BM_SETCHECK, !!opt.encrypt_default, 0L); @@ -150,6 +146,8 @@ !!opt.save_decrypted_attach, 0L); SendDlgItemMessage (hDlg, IDC_SIGN_ATTACHMENTS, BM_SETCHECK, !!opt.auto_sign_attach, 0L); + SendDlgItemMessage (hDlg, IDC_PREVIEW_DECRYPT, BM_SETCHECK, + !!opt.preview_decrypt, 0L); bMsgResult = FALSE; /* accepts activation */ break; } @@ -173,9 +171,6 @@ SendDlgItemMessage (hDlg, IDC_TIME_PHRASES, WM_GETTEXT, 20, (LPARAM)s); opt.passwd_ttl = (int)atol (s); - SendDlgItemMessage (hDlg, IDC_DEBUG_LOGFILE, WM_GETTEXT, - 200, (LPARAM)s); - set_log_file (s); SendDlgItemMessage (hDlg, IDC_ENCRYPT_TO, WM_GETTEXT, 200, (LPARAM)s); set_default_key (s); @@ -187,7 +182,9 @@ opt.save_decrypted_attach = !!SendDlgItemMessage (hDlg, IDC_SAVE_DECRYPTED, BM_GETCHECK, 0, 0L); opt.auto_sign_attach = !!SendDlgItemMessage - (hDlg, IDC_SIGN_ATTACHMENTS, BM_GETCHECK, 0, 0L); + (hDlg, IDC_SIGN_ATTACHMENTS, BM_GETCHECK, 0, 0L); + opt.preview_decrypt = !!SendDlgItemMessage + (hDlg, IDC_PREVIEW_DECRYPT, BM_GETCHECK, 0, 0L); write_options (); bMsgResult = PSNRET_NOERROR; Modified: trunk/src/olflange-ids.h =================================================================== --- trunk/src/olflange-ids.h 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/olflange-ids.h 2005-12-02 17:39:27 UTC (rev 130) @@ -19,12 +19,12 @@ #define IDC_SAVE_DECRYPTED 4004 #define IDC_GPG_OPTIONS 4006 #define IDC_BITMAP 4007 -#define IDC_DEBUG_LOGFILE 4008 #define IDB_BANNER 4009 #define IDC_VERSION_INFO 4009 #define IDB_BANNER_HI 4010 #define IDC_ENCRYPT_TO 4010 #define IDC_SIGN_ATTACHMENTS 4011 #define IDD_GPG_OPTIONS_DE 4012 +#define IDC_PREVIEW_DECRYPT 4013 #endif /*OLFLANGE_IDS_H*/ Modified: trunk/src/olflange-rsrcs.rc =================================================================== --- trunk/src/olflange-rsrcs.rc 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/olflange-rsrcs.rc 2005-12-02 17:39:27 UTC (rev 130) @@ -56,7 +56,7 @@ CAPTION "GnuPG" FONT 8, "MS Sans Serif" BEGIN - GROUPBOX "Optionen",IDC_STATIC,9,9,242,87 + GROUPBOX "Optionen",IDC_STATIC,9,9,242,100 CONTROL "Neue Nachrichten per Voreinstellung verschlüsseln", IDC_ENCRYPT_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,19,177,10 @@ -72,14 +72,16 @@ IDC_ENCRYPT_WITH_STANDARD_KEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,67,215,10 EDITTEXT IDC_ENCRYPT_TO,36,79,133,12,ES_AUTOHSCROLL - GROUPBOX "Passphrase",IDC_STATIC,9,100,242,31 - LTEXT "Passphrase speichern für",IDC_STATIC,24,114,80,8 - EDITTEXT IDC_TIME_PHRASES,107,113,39,14,ES_AUTOHSCROLL - LTEXT "Sekunden",IDC_STATIC,151,115,34,8 - GROUPBOX "Debug (nur für erfahrene Benutzer)",IDC_STATIC,9,134, - 242,28 - LTEXT "Logdatei",IDC_STATIC,18,146,28,8 - EDITTEXT IDC_DEBUG_LOGFILE,48,145,138,13,ES_AUTOHSCROLL + + CONTROL "Auch im Vorschaufenster entschlüsseln", + IDC_PREVIEW_DECRYPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 24,95,162,10 + + GROUPBOX "Passphrase",IDC_STATIC,9,110,242,31 + LTEXT "Passphrase speichern für",IDC_STATIC,24,124,80,8 + EDITTEXT IDC_TIME_PHRASES,107,123,39,14,ES_AUTOHSCROLL + LTEXT "Sekunden",IDC_STATIC,151,125,34,8 + PUSHBUTTON "&Erweitert...",IDC_GPG_OPTIONS,202,166,50,14 LTEXT "GPGol by g10 Code GmbH", IDC_STATIC,8,185,100,8 LTEXT "Version x ",IDC_VERSION_INFO,150,185,200,9 @@ -148,9 +150,6 @@ LTEXT "Cache &passphrase for",IDC_STATIC,24,114,70,8 EDITTEXT IDC_TIME_PHRASES,107,113,39,14,ES_AUTOHSCROLL LTEXT "seconds",IDC_STATIC,151,115,28,8 - GROUPBOX "Debug (advanced users only)",IDC_STATIC,9,134,242,28 - LTEXT "Logfile",IDC_STATIC,18,146,22,8 - EDITTEXT IDC_DEBUG_LOGFILE,48,145,138,13,ES_AUTOHSCROLL PUSHBUTTON "Ad&vanced..",IDC_GPG_OPTIONS,202,166,50,14 LTEXT "GPGol by g10 Code GmbH", IDC_STATIC,8,185,100,8 LTEXT "Version x ",IDC_VERSION_INFO,150,185,200,9 Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/olflange.cpp 2005-12-02 17:39:27 UTC (rev 130) @@ -779,7 +779,7 @@ ULONG lFlags) { log_debug ("%s:%s: received\n", SRCNAME, __func__); - if (opt.compat.preview_decryption) + if (opt.preview_decrypt) { TRACEPOINT (); HRESULT hr; @@ -1052,7 +1052,6 @@ m_lContext = 0; m_nCmdEncrypt = 0; m_nCmdSign = 0; - m_nCmdPreviewDecrypt = 0; m_nToolbarButtonID1 = 0; m_nToolbarButtonID2 = 0; m_nToolbarBitmap1 = 0; @@ -1365,13 +1364,6 @@ m_nCmdEncrypt = *pnCommandIDBase; (*pnCommandIDBase)++; - AppendMenu (hMenuTools, MF_STRING, - *pnCommandIDBase, _("GPG decrypt preview")); - - m_nCmdPreviewDecrypt = *pnCommandIDBase; - (*pnCommandIDBase)++; - TRACEPOINT (); - for (nTBIndex = nTBECnt-1; nTBIndex > -1; --nTBIndex) { if (EETBID_STANDARD == pTBEArray[nTBIndex].tbid) @@ -1460,12 +1452,6 @@ } - if (nCommandID == m_nCmdPreviewDecrypt && m_lContext == EECONTEXT_VIEWER) - { - opt.compat.preview_decryption = !opt.compat.preview_decryption; - return S_OK; - } - if ((nCommandID != m_nCmdEncrypt) && (nCommandID != m_nCmdSign)) return S_FALSE; @@ -1789,27 +1775,27 @@ // containing the number of property // sheets actually used. { - int resid = 0; + int resid ; - switch (GetUserDefaultLangID ()) { - case 0x0407: resid = IDD_GPG_OPTIONS_DE;break; - default: resid = IDD_GPG_OPTIONS; break; - } + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_GPG_OPTIONS_DE; + else + resid = IDD_GPG_OPTIONS; - pPSP[0].dwSize = sizeof (PROPSHEETPAGE); - pPSP[0].dwFlags = PSP_DEFAULT | PSP_HASHELP; - pPSP[0].hInstance = glob_hinst; - pPSP[0].pszTemplate = MAKEINTRESOURCE (resid); - pPSP[0].hIcon = NULL; - pPSP[0].pszTitle = NULL; - pPSP[0].pfnDlgProc = (DLGPROC) GPGOptionsDlgProc; - pPSP[0].lParam = 0; - pPSP[0].pfnCallback = NULL; - pPSP[0].pcRefParent = NULL; + pPSP[0].dwSize = sizeof (PROPSHEETPAGE); + pPSP[0].dwFlags = PSP_DEFAULT | PSP_HASHELP; + pPSP[0].hInstance = glob_hinst; + pPSP[0].pszTemplate = MAKEINTRESOURCE (resid); + pPSP[0].hIcon = NULL; + pPSP[0].pszTitle = NULL; + pPSP[0].pfnDlgProc = (DLGPROC) GPGOptionsDlgProc; + pPSP[0].lParam = 0; + pPSP[0].pfnCallback = NULL; + pPSP[0].pcRefParent = NULL; - *plPSP = 1; + *plPSP = 1; - return S_OK; + return S_OK; } Modified: trunk/src/olflange.h =================================================================== --- trunk/src/olflange.h 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/olflange.h 2005-12-02 17:39:27 UTC (rev 130) @@ -132,7 +132,6 @@ UINT m_nCmdEncrypt; UINT m_nCmdSign; - UINT m_nCmdPreviewDecrypt; UINT m_nToolbarButtonID1; UINT m_nToolbarButtonID2; Modified: trunk/src/passphrase-dialog.c =================================================================== --- trunk/src/passphrase-dialog.c 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/passphrase-dialog.c 2005-12-02 17:39:27 UTC (rev 130) @@ -563,14 +563,19 @@ { struct dialog_context_s context; struct decrypt_key_s dec; - + int resid; + memset (&context, 0, sizeof context); memset (&dec, 0, sizeof dec); dec.hide_pwd = 1; context.dec = &dec; context.no_encrypt_warning = encrypting; - DialogBoxParam (glob_hinst, (LPCTSTR)IDD_DEC, GetDesktopWindow (), + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_DEC_DE; + else + resid = IDD_DEC; + DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (), decrypt_key_dlg_proc, (LPARAM)&context); if (dec.signer) @@ -608,6 +613,7 @@ struct decrypt_key_s *dec = opaque; DWORD nwritten = 0; char keyidstr[16+1]; + int resid; log_debug ("passphrase_callback_box: enter (uh=`%s',pi=`%s')\n", uid_hint?uid_hint:"(null)", pass_info?pass_info:"(null)"); @@ -727,13 +733,25 @@ dec->user_id = xstrdup (s); dec->last_was_bad = prev_was_bad; if (dec->flags & 0x01) - rc = DialogBoxParam (glob_hinst, (LPCSTR)IDD_DEC, - GetDesktopWindow (), - decrypt_key_dlg_proc, (LPARAM)&context); + { + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_DEC_DE; + else + resid = IDD_DEC; + rc = DialogBoxParam (glob_hinst, (LPCSTR)resid, + GetDesktopWindow (), + decrypt_key_dlg_proc, (LPARAM)&context); + } else - rc = DialogBoxParam (glob_hinst, (LPCTSTR)IDD_DEC_EXT, - GetDesktopWindow (), - decrypt_key_ext_dlg_proc, (LPARAM)&context); + { + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_DEC_EXT_DE; + else + resid = IDD_DEC_EXT; + rc = DialogBoxParam (glob_hinst, (LPCTSTR)resid, + GetDesktopWindow (), + decrypt_key_ext_dlg_proc, (LPARAM)&context); + } if (rc <= 0) log_debug_w32 (-1, "%s: dialog failed (rc=%d)", __func__, rc); release_keyarray (context.keyarray); Modified: trunk/src/recipient-dialog.c =================================================================== --- trunk/src/recipient-dialog.c 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/recipient-dialog.c 2005-12-02 17:39:27 UTC (rev 130) @@ -482,11 +482,16 @@ recipient_dialog_box (gpgme_key_t **ret_rset) { struct recipient_cb_s cb; + int resid; *ret_rset = NULL; memset (&cb, 0, sizeof (cb)); - DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow(), + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_ENC_DE; + else + resid = IDD_ENC; + DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow(), recipient_dlg_proc, (LPARAM)&cb); if (cb.opts & OPT_FLAG_CANCEL) release_keyarray (cb.selected_keys, cb.selected_keys_count); @@ -514,6 +519,7 @@ struct recipient_cb_s cb; int i; size_t n; + int resid; *ret_rset = NULL; @@ -533,7 +539,11 @@ cb.unknown_keys = unknown; - DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow (), + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_ENC_DE; + else + resid = IDD_ENC; + DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (), recipient_dlg_proc, (LPARAM)&cb); if (cb.opts & OPT_FLAG_CANCEL) Modified: trunk/src/verify-dialog.c =================================================================== --- trunk/src/verify-dialog.c 2005-12-01 19:24:32 UTC (rev 129) +++ trunk/src/verify-dialog.c 2005-12-02 17:39:27 UTC (rev 130) @@ -231,12 +231,17 @@ verify_dialog_box (gpgme_verify_result_t res, const char *filename) { struct dialog_context ctx; + int resid; memset (&ctx,0, sizeof ctx); ctx.res = res; ctx.filename = filename; - DialogBoxParam (glob_hinst, (LPCTSTR)IDD_VRY, GetDesktopWindow (), + if (!strncmp (gettext_localename (), "de", 2)) + resid = IDD_VRY_DE; + else + resid = IDD_VRY; + DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (), verify_dlg_proc, (LPARAM)&ctx); return res->signatures->summary == GPGME_SIGSUM_GREEN? 0 : -1; } From cvs at cvs.gnupg.org Tue Dec 6 11:46:26 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 6 11:12:41 2005 Subject: [svn] GPGol - r131 - in trunk: . po src Message-ID: Author: wk Date: 2005-12-06 11:46:25 +0100 (Tue, 06 Dec 2005) New Revision: 131 Modified: trunk/ChangeLog trunk/NEWS trunk/configure.ac trunk/po/de.po trunk/src/ChangeLog trunk/src/Makefile.am trunk/src/display.cpp trunk/src/engine-gpgme.c trunk/src/engine.h trunk/src/gpgmsg.cpp trunk/src/gpgmsg.hh trunk/src/olflange.cpp trunk/src/recipient-dialog.c Log: Preparing a new release Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/ChangeLog 2005-12-06 10:46:25 UTC (rev 131) @@ -1,3 +1,7 @@ +2005-12-06 Werner Koch + + Released 0.9.4. + 2005-12-02 Werner Koch * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/NEWS 2005-12-06 10:46:25 UTC (rev 131) @@ -1,4 +1,4 @@ -Noteworthy changes for version 0.9.4 +Noteworthy changes for version 0.9.4 (2005-12-06) ================================================= * Added translation framework. Provided German translation. @@ -7,7 +7,11 @@ * Removed deprecated options to configure gpg path and homedir. +* Default key from the option dialog works. +* Support for HTML mails. + + Noteworthy changes for version 0.9.3 (2005-09-29) ================================================= Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/configure.ac 2005-12-06 10:46:25 UTC (rev 131) @@ -16,7 +16,7 @@ # Version number: Remember to change it immediately *after* a release. # Make sure to run "svn up" before a "make dist". # Add a "-cvs" prefix for non-released code. -AC_INIT(gpgol, 0.9.4-cvs, bug-gpgol@g10code.com) +AC_INIT(gpgol, 0.9.4, bug-gpgol@g10code.com) NEED_GPGME_API=1 NEED_GPGME_VERSION=1.1.0 Modified: trunk/po/de.po =================================================================== --- trunk/po/de.po 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/po/de.po 2005-12-06 10:46:25 UTC (rev 131) @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: GPGol 0.9.4\n" "Report-Msgid-Bugs-To: bug-gpgol@g10code.com\n" -"POT-Creation-Date: 2005-12-02 17:48+0100\n" -"PO-Revision-Date: 2005-11-30 17:06+0100\n" +"POT-Creation-Date: 2005-12-06 11:07+0100\n" +"PO-Revision-Date: 2005-12-06 11:09+0100\n" "Last-Translator: Werner Koch \n" "Language-Team: de\n" "MIME-Version: 1.0\n" @@ -16,66 +16,65 @@ "Content-Transfer-Encoding: 8bit\n" #: src/config-dialog.c:298 -#, fuzzy msgid "Select GPG Key Manager" -msgstr "Die GPG Schl?sselverwaltung ?ffnen" +msgstr "Das Schl?sselverwaltungsprogramm festlegen" -#: src/engine-gpgme.c:892 +#: src/engine-gpgme.c:942 msgid "Fingerprint: " msgstr "Fingerabdruck: " -#: src/engine-gpgme.c:949 +#: src/engine-gpgme.c:999 msgid "This signature is valid\n" msgstr "Diese Unterschrift ist korrekt\n" -#: src/engine-gpgme.c:951 +#: src/engine-gpgme.c:1001 msgid "signature state is \"green\"\n" msgstr "Status der Unterschrift ist \"gr?n\"\n" -#: src/engine-gpgme.c:953 +#: src/engine-gpgme.c:1003 msgid "signature state is \"red\"\n" msgstr "Status der Unterschrift ist \"rot\"\n" -#: src/engine-gpgme.c:957 +#: src/engine-gpgme.c:1007 msgid "Warning: One of the keys has been revoked\n" msgstr "Warnung: Einer der Schl?ssel wurde widerrufen\n" -#: src/engine-gpgme.c:967 +#: src/engine-gpgme.c:1017 msgid "Warning: The key used to create the signature expired at: " msgstr "" "Warnung: Der Schl?ssel mit der diese Unterschrift erzeugt wurde verfiel am: " -#: src/engine-gpgme.c:973 +#: src/engine-gpgme.c:1023 msgid "Warning: At least one certification key has expired\n" msgstr "" "Warnung: Mindestens einer der Zertifizierungsschl?ssel ist abgelaufen\n" -#: src/engine-gpgme.c:979 +#: src/engine-gpgme.c:1029 msgid "Warning: The signature expired at: " msgstr "Die Unterschrift verfiel am: " -#: src/engine-gpgme.c:985 +#: src/engine-gpgme.c:1035 msgid "Can't verify due to a missing key or certificate\n" msgstr "" "Aufrund eines fehlenden Schl?ssels ist eine ?berpr?fung nicht m?glich\n" -#: src/engine-gpgme.c:989 +#: src/engine-gpgme.c:1039 msgid "The CRL is not available\n" msgstr "Die CRL ist nicht verf?gbar\n" -#: src/engine-gpgme.c:995 +#: src/engine-gpgme.c:1045 msgid "Available CRL is too old\n" msgstr "Die vorhandene CRL ist zu alt\n" -#: src/engine-gpgme.c:1000 +#: src/engine-gpgme.c:1050 msgid "A policy requirement was not met\n" msgstr "Eine Richtlinie wurde nicht erf?llt\n" -#: src/engine-gpgme.c:1006 +#: src/engine-gpgme.c:1056 msgid "A system error occured" msgstr "Ein Systemfehler ist aufgetreten" -#: src/engine-gpgme.c:1043 +#: src/engine-gpgme.c:1093 msgid "" "WARNING: We have NO indication whether the key belongs to the person named " "as shown above\n" @@ -83,12 +82,12 @@ "WARNUNG: Es gibt keinen Hinweis darauf, ob der Schl?ssel wirklich der Person " "geh?rt, die oben angezeigt ist\n" -#: src/engine-gpgme.c:1050 +#: src/engine-gpgme.c:1100 msgid "WARNING: The key does NOT BELONG to the person named as shown above\n" msgstr "" "WARNUNG: Der Schl?ssel geh?rt NICHT der Person die oben angezeigt ist\n" -#: src/engine-gpgme.c:1054 +#: src/engine-gpgme.c:1104 msgid "" "WARNING: It is NOT certain that the key belongs to the person named as shown " "above\n" @@ -96,78 +95,72 @@ "WARNING: Es ist nicht sicher, da? der Schl?ssel der Person geh?rt, die oben " "angezeigt ist\n" -#: src/engine-gpgme.c:1087 +#: src/engine-gpgme.c:1137 msgid "Verification started at: " msgstr "?berpr?fung begann am: " -#: src/engine-gpgme.c:1092 +#: src/engine-gpgme.c:1142 msgid "Verification result for: " msgstr "Pr?fungsresultat f?r: " -#: src/engine-gpgme.c:1093 +#: src/engine-gpgme.c:1143 msgid "[unnamed part]" msgstr "[Unbenannter Teil]" -#: src/engine-gpgme.c:1111 src/engine-gpgme.c:1141 +#: src/engine-gpgme.c:1161 src/engine-gpgme.c:1191 msgid "Good signature from: " msgstr "Korrekte Unterschrift von: " -#: src/engine-gpgme.c:1118 +#: src/engine-gpgme.c:1168 msgid " aka: " msgstr " alias: " -#: src/engine-gpgme.c:1122 src/engine-gpgme.c:1144 +#: src/engine-gpgme.c:1172 src/engine-gpgme.c:1194 msgid " created: " msgstr " erzeugt: " -#: src/engine-gpgme.c:1131 +#: src/engine-gpgme.c:1181 msgid "*BAD* signature claimed to be from: " msgstr "*FALSCHE* Unterschrift, vorgeblich von: " -#: src/engine-gpgme.c:1154 +#: src/engine-gpgme.c:1204 msgid "Error checking signature" msgstr "Fehler beim Pr?fen der Unetrschrift" -#: src/engine-gpgme.c:1170 +#: src/engine-gpgme.c:1220 msgid "*** Begin Notation (signature by: " msgstr "*** Anfang Notation (Unterschrift von: " -#: src/engine-gpgme.c:1190 +#: src/engine-gpgme.c:1240 msgid "*** End Notation ***\n" msgstr "*** Ende Notation ***\n" -#: src/gpgmsg.cpp:767 -msgid "[No attestation computed (e.g. messages was not signed)" -msgstr "" -"[Kein Testat berechnet (z.B. da die Nachricht nicht unterschrieben war)" - -#: src/gpgmsg.cpp:892 +#: src/gpgmsg.cpp:1039 msgid "No valid OpenPGP data found." msgstr "Keine g?ltigen OpenPGP Daten gefunden" -#: src/gpgmsg.cpp:893 src/gpgmsg.cpp:937 src/gpgmsg.cpp:951 src/gpgmsg.cpp:967 -#: src/gpgmsg.cpp:1048 +#: src/gpgmsg.cpp:1040 src/gpgmsg.cpp:1084 src/gpgmsg.cpp:1098 +#: src/gpgmsg.cpp:1114 src/gpgmsg.cpp:1279 msgid "Decryption" msgstr "Entschl?sselung" -#: src/gpgmsg.cpp:928 -#, fuzzy +#: src/gpgmsg.cpp:1075 msgid "[This is a PGP/MIME message]" msgstr "[PGP/MIME Nachricht]" -#: src/gpgmsg.cpp:936 src/gpgmsg.cpp:950 src/gpgmsg.cpp:966 +#: src/gpgmsg.cpp:1083 src/gpgmsg.cpp:1097 src/gpgmsg.cpp:1113 msgid "Problem decrypting PGP/MIME message" msgstr "Problem bei Entschl?sseln einer PGP/MIME Nachricht" -#: src/gpgmsg.cpp:1001 +#: src/gpgmsg.cpp:1234 msgid "Verification Failure" msgstr "?berpr?fungsfehler" -#: src/gpgmsg.cpp:1004 +#: src/gpgmsg.cpp:1237 msgid "Decryption Failure" msgstr "Entschl?sselungsfehler" -#: src/gpgmsg.cpp:1042 +#: src/gpgmsg.cpp:1273 msgid "" "The message text cannot be displayed.\n" "You have to save the decrypted message to view it.\n" @@ -183,7 +176,7 @@ #. TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it #. will be expanded to a list of atatchment names. -#: src/gpgmsg.cpp:1069 +#: src/gpgmsg.cpp:1300 msgid "" "Signed attachments found.\n" "\n" @@ -195,13 +188,13 @@ "@LIST@\n" "M?chten Sie diese Unterschriften ?berpr?fen?" -#: src/gpgmsg.cpp:1077 +#: src/gpgmsg.cpp:1308 msgid "Attachment Verification" msgstr "?berpr?fung der Anh?nge" #. TRANSLATORS: Keep the @LIST@ verbatim on a separate line; it #. will be expanded to a list of atatchment names. -#: src/gpgmsg.cpp:1095 +#: src/gpgmsg.cpp:1329 msgid "" "Encrypted attachments found.\n" "\n" @@ -213,35 +206,35 @@ "@LIST@\n" "M?chten Sie diese entschl?sseln und abspeichern?" -#: src/gpgmsg.cpp:1102 +#: src/gpgmsg.cpp:1336 msgid "Attachment Decryption" msgstr "Entschl?sselung eines Anhangs" -#: src/gpgmsg.cpp:1166 +#: src/gpgmsg.cpp:1405 msgid "Signing Failure" msgstr "Unterschrifterstellungsfehler" -#: src/gpgmsg.cpp:1314 +#: src/gpgmsg.cpp:1581 msgid "Encryption Failure" msgstr "Verschl?sselungsfehler" -#: src/gpgmsg.cpp:1350 src/gpgmsg.cpp:2645 +#: src/gpgmsg.cpp:1635 src/gpgmsg.cpp:2930 msgid "Attachment Encryption Failure" msgstr "Verschl?sselungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2052 +#: src/gpgmsg.cpp:2337 msgid "Attachment Verification Failure" msgstr "?berpr?fungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2235 src/gpgmsg.cpp:2284 +#: src/gpgmsg.cpp:2520 src/gpgmsg.cpp:2569 msgid "Attachment Decryption Failure" msgstr "Entschl?sselungsfehler eines Anhangs" -#: src/gpgmsg.cpp:2454 +#: src/gpgmsg.cpp:2739 msgid "Attachment Signing Failure" msgstr "Unterschrifterstellungsfehler eines Anhangs" -#: src/olflange.cpp:884 +#: src/olflange.cpp:896 msgid "" "Sorry, we can only encrypt plain text messages and\n" "no RTF messages. Please make sure that only the text\n" @@ -252,51 +245,51 @@ "Sie sicher, da? lediglich das Text Format ausgew?hlt wurde.\n" "(In der Men?leiste: \"Format\" => \"Nur Text\")" -#: src/olflange.cpp:1272 +#: src/olflange.cpp:1286 msgid "&Decrypt and verify message" msgstr "Entschl?sseln/Pr?fen der Nachricht" -#: src/olflange.cpp:1310 +#: src/olflange.cpp:1324 msgid "GPG &encrypt message" msgstr "Mit GPG &verschl?sseln" -#: src/olflange.cpp:1316 +#: src/olflange.cpp:1330 msgid "GPG &sign message" msgstr "Mit GPG unter&schreiben" -#: src/olflange.cpp:1362 +#: src/olflange.cpp:1376 msgid "GPG Key &Manager" msgstr "GPG Schl?ssel&verwaltung" -#: src/olflange.cpp:1494 +#: src/olflange.cpp:1508 msgid "Could not start Key-Manager" msgstr "Dei Schl?sselverwaltung konnte nicht aufgerufen werden" -#: src/olflange.cpp:1540 +#: src/olflange.cpp:1554 msgid "Decrypt and verify the message." msgstr "Entschl?sseln und Pr?fen der Nachricht." -#: src/olflange.cpp:1548 +#: src/olflange.cpp:1562 msgid "Select this option to encrypt the message." msgstr "W?hlen Sie diese Option zum Verschl?sseln der Nachricht." -#: src/olflange.cpp:1554 +#: src/olflange.cpp:1568 msgid "Select this option to sign the message." msgstr "W?hlen Sie diese Option zum Unterschreiben der Nachricht." -#: src/olflange.cpp:1563 src/olflange.cpp:1624 src/olflange.cpp:1706 +#: src/olflange.cpp:1577 src/olflange.cpp:1638 src/olflange.cpp:1720 msgid "Open GPG Key Manager" msgstr "Die GPG Schl?sselverwaltung ?ffnen" -#: src/olflange.cpp:1593 src/olflange.cpp:1657 +#: src/olflange.cpp:1607 src/olflange.cpp:1671 msgid "Decrypt message and verify signature" msgstr "Nachricht entschl?sseln und Unterschrift pr?fen" -#: src/olflange.cpp:1604 src/olflange.cpp:1675 +#: src/olflange.cpp:1618 src/olflange.cpp:1689 msgid "Encrypt message with GPG" msgstr "Nachricht mit GPG verschl?sseln" -#: src/olflange.cpp:1613 src/olflange.cpp:1690 +#: src/olflange.cpp:1627 src/olflange.cpp:1704 msgid "Sign message with GPG" msgstr "Nachricht mit GPG unterschreiben" @@ -368,7 +361,7 @@ msgid "[PGP/MIME message without plain text body]" msgstr "[PGP/MIME Nachricht ohne reinen Textk?rper]" -#: src/recipient-dialog.c:459 +#: src/recipient-dialog.c:477 msgid "" "If you cancel this dialog, the message will be sent in cleartext.\n" "\n" @@ -379,11 +372,11 @@ "\n" "M?chten Sie wirklich abbrechen?" -#: src/recipient-dialog.c:462 +#: src/recipient-dialog.c:480 msgid "Recipient Dialog" msgstr "Auswahl des Empf?ngerschl?ssels" -#: src/recipient-dialog.c:537 src/verify-dialog.c:152 +#: src/recipient-dialog.c:555 src/verify-dialog.c:152 msgid "User-ID not found" msgstr "User-ID nicht gefunden" @@ -431,3 +424,7 @@ #: src/verify-dialog.c:205 msgid "Verification Result" msgstr "Pr?fungsresultat" + +#~ msgid "[No attestation computed (e.g. messages was not signed)" +#~ msgstr "" +#~ "[Kein Testat berechnet (z.B. da die Nachricht nicht unterschrieben war)" Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/ChangeLog 2005-12-06 10:46:25 UTC (rev 131) @@ -1,3 +1,26 @@ +2005-12-06 Werner Koch + + * gpgmsg.cpp (getRecipients): Add the default key to the list of + recipients. + * recipient-dialog.c (recipient_dlg_proc): Add the already found + keys to the selected ones. + + * olflange.cpp (OnWriteComplete): Need to disable the deleting of + HTML bodys. + +2005-12-05 Werner Koch + + * Makefile.am (gpgol_LDADD): Add -loleaut32. + * engine-gpgme.c (op_verify_detached_sig_mem): New. + * olflange.cpp (OnWriteComplete): Pass HTML flag to sign call. + (put_outlook_property): Need to use a BSTR for the sake of putting + HTMLBody. + * gpgmsg.cpp (sign): Add arg WANT_HTML. + (free_attach_info): New. Use it in the destructor. + (createHtmlAttachment): New. + (encrypt_and_sign, sign): Use it here. + (writeAttestation): Don't write an empty attestation. + 2005-12-02 Werner Koch * verify-dialog.c (verify_dialog_box): Actually allow for German Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/Makefile.am 2005-12-06 10:46:25 UTC (rev 131) @@ -69,7 +69,8 @@ rm -f libmapi32.a libgpgme.a libgpg-error.a gpgol_LDADD = $(srcdir)/gpgol.def \ - -L . -lgpgme -lgpg-error -lmapi32 -lshell32 -lgdi32 -lcomdlg32 + -L . -lgpgme -lgpg-error -lmapi32 -lshell32 -lgdi32 -lcomdlg32 \ + -loleaut32 resource.o: resource.rc versioninfo.rc gpgol-rsrcs.rc olflange-rsrcs.rc Modified: trunk/src/display.cpp =================================================================== --- trunk/src/display.cpp 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/display.cpp 2005-12-06 10:46:25 UTC (rev 131) @@ -138,7 +138,7 @@ HWND window; window = find_message_window (hwnd); - if (window) + if (window && !is_html) { const char *s; @@ -161,7 +161,11 @@ } else if (exchange_cb && !opt.compat.no_oom_write) { - log_debug ("updating display using OOM"); + log_debug ("updating display using OOM to `%s'", text); + /* Bug in OL 2002 and 2003 - as a workaround set the body first + to empty. */ + if (is_html) + put_outlook_property (exchange_cb, "Body", "" ); return put_outlook_property (exchange_cb, is_html? "HTMLBody":"Body", text); } @@ -185,6 +189,13 @@ const char *s; assert (message); + +// if (!is_html) +// { +// prop.ulPropTag = PR_BODY_HTML_A; +// prop.Value.lpszA = ""; +// hr = HrSetOneProp (message, &prop); +// } /* Decide whether we need to use the Unicode version. */ for (s=string; *s && !(*s & 0x80); s++) Modified: trunk/src/engine-gpgme.c =================================================================== --- trunk/src/engine-gpgme.c 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/engine-gpgme.c 2005-12-06 10:46:25 UTC (rev 131) @@ -866,7 +866,57 @@ return err; } +/* Verify a detached message where the data is in the string + DATA_STRING and the signature itself is expected to be the string + SIG_STRING. FILENAME will be shown by the verification status + dialog box. If ATTESTATION is not NULL a text with the result of + the signature verification will get printed to it. */ +int +op_verify_detached_sig_mem (const char *data_string, + const char *sig_string, const char *filename, + gpgme_data_t attestation) +{ + gpgme_data_t data = NULL; + gpgme_data_t sig = NULL; + gpgme_ctx_t ctx = NULL; + gpgme_error_t err; + gpgme_verify_result_t res = NULL; + op_init (); + + err = gpgme_new (&ctx); + if (err) + goto leave; + + err = gpgme_data_new_from_mem (&data, data_string, strlen (data_string), 0); + if (err) + goto leave; + + err = gpgme_data_new_from_mem (&sig, sig_string, strlen (sig_string), 0); + if (err) + goto leave; + + err = gpgme_op_verify (ctx, sig, data, NULL); + if (!err) + { + res = gpgme_op_verify_result (ctx); + if (res) + verify_dialog_box (res, filename); + if (res && attestation) + add_verify_attestation (attestation, ctx, res, filename); + } + + leave: + if (data) + gpgme_data_release (data); + if (sig) + gpgme_data_release (sig); + if (ctx) + gpgme_release (ctx); + return err; +} + + static void at_puts (gpgme_data_t a, const char *s) Modified: trunk/src/engine.h =================================================================== --- trunk/src/engine.h 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/engine.h 2005-12-06 10:46:25 UTC (rev 131) @@ -72,6 +72,9 @@ gpgme_data_t attestation); int op_verify_detached_sig (LPSTREAM data, const char *sig, const char *filename, gpgme_data_t attestation); +int op_verify_detached_sig_mem (const char *data_string, + const char *sig_string, const char *filename, + gpgme_data_t attestation); int op_export_keys (const char *pattern[], const char *outfile); Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/gpgmsg.cpp 2005-12-06 10:46:25 UTC (rev 131) @@ -84,6 +84,7 @@ static int get_attach_method (LPATTACH obj); +static char *get_short_attach_data (LPATTACH obj); static bool set_x_header (LPMESSAGE msg, const char *name, const char *val); @@ -116,16 +117,7 @@ if (attestation) gpgme_data_release (attestation); - if (attach.att_table) - { - attach.att_table->Release (); - attach.att_table = NULL; - } - if (attach.rows) - { - FreeProws (attach.rows); - attach.rows = NULL; - } + free_attach_info (); } void destroy () @@ -168,7 +160,7 @@ const char *getPlainText (void); int decrypt (HWND hwnd); - int sign (HWND hwnd); + int sign (HWND hwnd, bool want_html); int encrypt (HWND hwnd, bool want_html) { return encrypt_and_sign (hwnd, want_html, false); @@ -210,9 +202,11 @@ LPSRowSet rows; /* The retrieved set of rows from the table. */ } attach; + void free_attach_info (void); char *loadBody (bool want_html); bool isPgpmimeVersionPart (int pos); void writeAttestation (void); + gpg_error_t createHtmlAttachment (const char *text); attach_info_t gatherAttachmentInfo (void); int encrypt_and_sign (HWND hwnd, bool want_html, bool sign); }; @@ -230,6 +224,20 @@ return m; } +void +GpgMsgImpl::free_attach_info (void) +{ + if (attach.att_table) + { + attach.att_table->Release (); + attach.att_table = NULL; + } + if (attach.rows) + { + FreeProws (attach.rows); + attach.rows = NULL; + } +} /* Release an array of GPGME keys. */ static void @@ -615,7 +623,7 @@ return NULL; } - rset = (char**)xcalloc (lpRecipientRows->cRows+1, sizeof *rset); + rset = (char**)xcalloc (lpRecipientRows->cRows+2, sizeof *rset); for (i = j = 0; (unsigned int)i < lpRecipientRows->cRows; i++) { @@ -646,6 +654,8 @@ break; } } + if (opt.default_key && *opt.default_key) + rset[j++] = xstrdup (opt.default_key); rset[j] = NULL; if (lpRecipientTable) @@ -709,7 +719,7 @@ goto leave; } - /* And not for the real name. */ + /* And now for the real name. */ prop.ulPropTag = PR_ATTACH_LONG_FILENAME_A; prop.Value.lpszA = "GPGol-Attestation.txt"; hr = HrSetOneProp (newatt, &prop); @@ -760,27 +770,132 @@ } attestation = NULL; + if (!*buffer) + goto leave; + log_debug ("writing attestation `%s'\n", buffer); hr = S_OK; - if (!*buffer) + for (p=buffer; hr == S_OK && (pend = strchr (p, '\n')); p = pend+1) { - const char *s = _("[No attestation computed " - "(e.g. messages was not signed)"); - hr = to->Write (s, strlen (s), &nwritten); + hr = to->Write (p, pend - p, &nwritten); + if (hr == S_OK) + hr = to->Write ("\r\n", 2, &nwritten); } - else + if (*p && hr == S_OK) + hr = to->Write (p, strlen (p), &nwritten); + if (hr != S_OK) { - for (p=buffer; hr == S_OK && (pend = strchr (p, '\n')); p = pend+1) - { - hr = to->Write (p, pend - p, &nwritten); - if (hr == S_OK) - hr = to->Write ("\r\n", 2, &nwritten); - } - if (*p && hr == S_OK) - hr = to->Write (p, strlen (p), &nwritten); + log_debug ("%s:%s: Write failed: hr=%#lx", SRCNAME, __func__, hr); + goto leave; } + + + to->Commit (0); + to->Release (); + to = NULL; + + hr = newatt->SaveChanges (0); if (hr != S_OK) { + log_error ("%s:%s: SaveChanges(attachment) failed: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + hr = message->SaveChanges (KEEP_OPEN_READWRITE|FORCE_SAVE); + if (hr != S_OK) + { + log_error ("%s:%s: SaveChanges(message) failed: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + + leave: + if (to) + { + to->Revert (); + to->Release (); + } + if (newatt) + newatt->Release (); + gpgme_free (buffer); +} + + +/* Create a new HTML attachment from TEXT and store it as the standard + HTML attachment (according to PGP rules). */ +gpg_error_t +GpgMsgImpl::createHtmlAttachment (const char *text) +{ + HRESULT hr; + ULONG newpos; + SPropValue prop; + LPATTACH newatt = NULL; + LPSTREAM to = NULL; + ULONG nwritten; + gpg_error_t err = gpg_error (GPG_ERR_GENERAL); + + hr = message->CreateAttach (NULL, 0, &newpos, &newatt); + if (hr != S_OK) + { + log_error ("%s:%s: can't create HTML attachment: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_METHOD; + prop.Value.ul = ATTACH_BY_VALUE; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set HTML attach method: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_LONG_FILENAME_A; + prop.Value.lpszA = "PGPexch.htm"; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set HTML attach filename: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_TAG; + prop.Value.bin.cb = sizeof oid_mimetag; + prop.Value.bin.lpb = (LPBYTE)oid_mimetag; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set HTML attach tag: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + prop.ulPropTag = PR_ATTACH_MIME_TAG_A; + prop.Value.lpszA = "text/html"; + hr = HrSetOneProp (newatt, &prop); + if (hr != S_OK) + { + log_error ("%s:%s: can't set HTML attach mime tag: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + hr = newatt->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream, 0, + MAPI_CREATE|MAPI_MODIFY, (LPUNKNOWN*)&to); + if (FAILED (hr)) + { + log_error ("%s:%s: can't create output stream: hr=%#lx\n", + SRCNAME, __func__, hr); + goto leave; + } + + hr = to->Write (text, strlen (text), &nwritten); + if (hr != S_OK) + { log_debug ("%s:%s: Write failed: hr=%#lx", SRCNAME, __func__, hr); goto leave; } @@ -805,6 +920,7 @@ goto leave; } + err = 0; leave: if (to) @@ -814,7 +930,7 @@ } if (newatt) newatt->Release (); - gpgme_free (buffer); + return err; } @@ -833,8 +949,12 @@ unsigned int n_attach = 0; unsigned int n_encrypted = 0; unsigned int n_signed = 0; + int have_pgphtml_sig = 0; + int have_pgphtml_enc = 0; + unsigned int pgphtml_pos = 0; HRESULT hr; int pgpmime_succeeded = 0; + int is_html = 0; char *body; /* Load the body text into BODY. Note that body may be NULL but in @@ -851,15 +971,42 @@ { for (pos=0; !table[pos].end_of_table; pos++) if (table[pos].is_encrypted) - n_encrypted++; + { + if (!have_pgphtml_enc && !have_pgphtml_sig + && table[pos].filename + && !strcmp (table[pos].filename, "PGPexch.htm.pgp") + && table[pos].content_type + && !strcmp (table[pos].content_type, + "application/pgp-encrypted")) + { + have_pgphtml_enc = 1; + pgphtml_pos = pos; + } + else + n_encrypted++; + } else if (table[pos].is_signed) - n_signed++; + { + if (!have_pgphtml_sig && !have_pgphtml_enc + && table[pos].filename + && !strcmp (table[pos].filename, "PGPexch.htm.asc") + && table[pos].content_type + && !strcmp (table[pos].content_type, + "application/pgp-signature")) + { + have_pgphtml_sig = 1; + pgphtml_pos = pos; + } + else + n_signed++; + } n_attach = pos; } log_debug ("%s:%s: message has %u attachments with " "%u signed and %d encrypted\n", SRCNAME, __func__, n_attach, n_signed, n_encrypted); - if (mtype == OPENPGP_NONE && !n_encrypted && !n_signed) + if (mtype == OPENPGP_NONE && !n_encrypted && !n_signed + && !have_pgphtml_enc && !have_pgphtml_sig) { /* Because we usually work around the OL object model, it can't notice that we changed the windows's text behind its back (by @@ -989,7 +1136,93 @@ { err = op_decrypt (body, &plaintext, opt.passwd_ttl, NULL, attestation, preview); + if (!err && have_pgphtml_enc) + is_html = 1; } + else if (mtype == OPENPGP_NONE && have_pgphtml_sig) + { + if (preview) + err = 0; + else + { + LPATTACH att; + char *htmlbody = loadBody (true); + + if (htmlbody && *htmlbody) + { + is_html = 1; + hr = message->OpenAttach (pgphtml_pos, NULL, + MAPI_BEST_ACCESS, &att); + if (FAILED (hr)) + { + log_error ("%s:%s: can't open attachment %d (sig): hr=%#lx", + SRCNAME, __func__, pgphtml_pos, hr); + err = gpg_error (GPG_ERR_GENERAL); + } + else if (table[pgphtml_pos].method != ATTACH_BY_VALUE) + { + log_error ("%s:%s: HTML attachment: method not supported", + SRCNAME, __func__); + att->Release (); + err = gpg_error (GPG_ERR_GENERAL); + } + else + { + char *sigpart = get_short_attach_data (att); + att->Release (); + if (!sigpart) + err = gpg_error (GPG_ERR_GENERAL); + else + { + err = op_verify_detached_sig_mem (htmlbody, sigpart, + NULL, attestation); + xfree (sigpart); + } + } + } + else + err = gpg_error (GPG_ERR_NO_DATA); + xfree (htmlbody); + } + } + else if (mtype == OPENPGP_NONE && have_pgphtml_enc) + { + LPATTACH att; + LPSTREAM from; + + is_html = 1; + hr = message->OpenAttach (pgphtml_pos, NULL, + MAPI_BEST_ACCESS, &att); + if (FAILED (hr)) + { + log_error ("%s:%s: can't open attachment %d (sig): hr=%#lx", + SRCNAME, __func__, pgphtml_pos, hr); + err = gpg_error (GPG_ERR_GENERAL); + } + else if (table[pgphtml_pos].method != ATTACH_BY_VALUE) + { + log_error ("%s:%s: HTML attachment: method not supported", + SRCNAME, __func__); + att->Release (); + err = gpg_error (GPG_ERR_GENERAL); + } + else if (FAILED(hr = att->OpenProperty (PR_ATTACH_DATA_BIN, + &IID_IStream, + 0, 0, (LPUNKNOWN*) &from))) + { + log_error ("%s:%s: can't open data stream of HTML attachment: " + "hr=%#lx", SRCNAME, __func__, hr); + att->Release (); + err = gpg_error (GPG_ERR_GENERAL); + } + else + { + err = op_decrypt_stream_to_buffer (from, &plaintext, opt.passwd_ttl, + NULL, attestation); + from->Release (); + att->Release (); + } + } else err = gpg_error (GPG_ERR_NO_DATA); if (err) @@ -1005,8 +1238,6 @@ } else if (plaintext && *plaintext) { - int is_html = is_html_body (plaintext); - log_debug ("decrypt isHtml=%d\n", is_html); /* Do we really need to set the body? update_display below @@ -1080,7 +1311,10 @@ if (what == IDYES) { for (pos=0; !table[pos].end_of_table; pos++) - if (table[pos].is_signed) + if ((have_pgphtml_sig || have_pgphtml_enc) + && pos == pgphtml_pos) + ; /* We already processed this attachment. */ + else if (table[pos].is_signed) { assert (table[pos].sig_pos < n_attach); verifyAttachment (hwnd, table, pos, table[pos].sig_pos); @@ -1105,7 +1339,10 @@ if (what == IDYES) { for (pos=0; !table[pos].end_of_table; pos++) - if (table[pos].is_encrypted) + if ((have_pgphtml_sig || have_pgphtml_enc) + && pos == pgphtml_pos) + ; /* We already processed this attachment. */ + else if (table[pos].is_encrypted) decryptAttachment (hwnd, pos, true, opt.passwd_ttl, table[pos].filename); } @@ -1127,7 +1364,7 @@ /* Sign the current message. Returns 0 on success. */ int -GpgMsgImpl::sign (HWND hwnd) +GpgMsgImpl::sign (HWND hwnd, bool want_html) { HRESULT hr; char *plaintext; @@ -1135,11 +1372,13 @@ int err = 0; gpgme_key_t sign_key = NULL; SPropValue prop; + int have_html_attach = 0; log_debug ("%s:%s: enter message=%p\n", SRCNAME, __func__, message); /* We don't sign an empty body - a signature on a zero length string - is pretty much useless. */ + is pretty much useless. We assume that a HTML message always + comes with a text/plain alternative. */ plaintext = loadBody (false); if ( (!plaintext || !*plaintext) && !hasAttachments ()) { @@ -1168,8 +1407,35 @@ } } - if (opt.auto_sign_attach && hasAttachments ()) + + /* If those brain dead html mails are requested we now figure out + whether a HTML body is actually available and move it to an + attachment so that the code below will sign it as a regular + attachments. */ + if (want_html) { + char *htmltext = loadBody (true); + + if (htmltext && *htmltext) + { + if (!createHtmlAttachment (htmltext)) + have_html_attach = 1; + } + xfree (htmltext); + + /* If we got a new attachment we need to release the loaded + attachment info so that the next getAttachment call will read + fresh info. */ + if (have_html_attach) + free_attach_info (); + } + + + /* Note, there is a side-effect when we have HTML mails: The + auto-sign-attch option is ignored. I regard auto-sign-atatch as a + silly option anyway. */ + if ((opt.auto_sign_attach || have_html_attach) && hasAttachments ()) + { unsigned int n; n = getAttachments (); @@ -1241,6 +1507,7 @@ int err = 0; size_t n_keys, n_unknown, n_recp; SPropValue prop; + int have_html_attach = 0; plaintext = loadBody (false); if ( (!plaintext || !*plaintext) && !hasAttachments ()) @@ -1315,13 +1582,6 @@ goto leave; } - if (want_html) - { - char *tmp = add_html_line_endings (ciphertext); - xfree (ciphertext); - ciphertext = tmp; - } - // { // SPropValue prop; // prop.ulPropTag=PR_MESSAGE_CLASS_A; @@ -1336,6 +1596,31 @@ } + + /* If those brain dead html mails are requested we now figure out + whether a HTML body is actually available and move it to an + attachment so that the code below will sign it as a regular + attachments. Note that the orginal HTML body will be deletated + in the code calling us. */ + if (want_html) + { + char *htmltext = loadBody (true); + + if (htmltext && *htmltext) + { + if (!createHtmlAttachment (htmltext)) + have_html_attach = 1; + } + xfree (htmltext); + + /* If we got a new attachment we need to release the loaded + attachment info so that the next getAttachment call will read + fresh info. */ + if (have_html_attach) + free_attach_info (); + } + + if (hasAttachments ()) { unsigned int n; @@ -1371,7 +1656,7 @@ } - err = set_message_body (message, ciphertext, want_html); + err = set_message_body (message, ciphertext, 0); if (err) goto leave; @@ -1953,7 +2238,7 @@ OL2003 the content-type of the body is also correctly set but we don't make use of this as it is not clear whether this is true for other storage providers. We use a hack to ignore extra - attesttation attachments: Those are assumed to come after the + attestation attachments: Those are assumed to come after the both PGP/MIME parts. */ if (opt.compat.no_pgpmime) ; @@ -1996,7 +2281,7 @@ assert (message); /* First we copy the actual signature into a memory buffer. Such a - signature is expected to be samll enough to be readable directly + signature is expected to be small enough to be readable directly (i.e.less that 16k as suggested by the MS MAPI docs). */ hr = message->OpenAttach (pos_sig, NULL, MAPI_BEST_ACCESS, &att); if (FAILED (hr)) Modified: trunk/src/gpgmsg.hh =================================================================== --- trunk/src/gpgmsg.hh 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/gpgmsg.hh 2005-12-06 10:46:25 UTC (rev 131) @@ -68,7 +68,7 @@ virtual int decrypt (HWND hwnd) = 0; /* Sign the message and optionally the attachments. */ - virtual int sign (HWND hwnd) = 0; + virtual int sign (HWND hwnd, bool want_html) = 0; /* Encrypt the entire message including any attachments. Returns 0 on success. */ Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/olflange.cpp 2005-12-06 10:46:25 UTC (rev 131) @@ -208,7 +208,7 @@ if (!punk) return; res = UlRelease (punk); - log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res); +// log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res); } @@ -415,19 +415,31 @@ else if ( (pDisp = find_outlook_property ((LPEXCHEXTCALLBACK)pEECB, key, &dispid))) { + BSTR abstr; + dispparams.cNamedArgs = 1; dispparams.rgdispidNamedArgs = &dispid_put; dispparams.cArgs = 1; dispparams.rgvarg = &aVariant; - dispparams.rgvarg[0].vt = VT_LPWSTR; - dispparams.rgvarg[0].bstrVal = utf8_to_wchar (value); - hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, - DISPATCH_PROPERTYPUT, &dispparams, - NULL, NULL, NULL); - xfree (dispparams.rgvarg[0].bstrVal); - log_debug ("%s:%s: PROPERTYPUT(%s) result -> %#lx\n", - SRCNAME, __func__, key, hr); - + { + wchar_t *tmp = utf8_to_wchar (value); + abstr = SysAllocString (tmp); + xfree (tmp); + } + if (!abstr) + log_error ("%s:%s: SysAllocString failed\n", SRCNAME, __func__); + else + { + dispparams.rgvarg[0].vt = VT_BSTR; + dispparams.rgvarg[0].bstrVal = abstr; + hr = pDisp->Invoke (dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, + DISPATCH_PROPERTYPUT, &dispparams, + NULL, NULL, NULL); + log_debug ("%s:%s: PROPERTYPUT(%s) result -> %#lx\n", + SRCNAME, __func__, key, hr); + SysFreeString (abstr); + } + pDisp->Release (); pDisp = NULL; result = 0; @@ -836,7 +848,7 @@ /* If we are going to encrypt, check that the BodyFormat is something we support. This helps avoiding surprise by sending out unencrypted messages. */ - if (m_pExchExt->m_gpgEncrypt) + if (m_pExchExt->m_gpgEncrypt || m_pExchExt->m_gpgSign) { pDisp = find_outlook_property (pEECB, "BodyFormat", &dispid); if (!pDisp) @@ -944,7 +956,7 @@ if (m_pExchExt->m_gpgEncrypt && !m_pExchExt->m_gpgSign) rc = m->encrypt (hWnd, m_want_html); if (!m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign) - rc = m->sign (hWnd); + rc = m->sign (hWnd, m_want_html); else rc = 0; delete m; @@ -955,15 +967,18 @@ moved that into an attachment and kept PR_BODY. It seems that OL always creates text and HTML if HTML has been selected. */ - if (m_pExchExt->m_gpgEncrypt) - { - log_debug ("%s:%s: deleting possible extra property PR_BODY_HTML\n", - SRCNAME, __func__); - proparray.cValues = 1; - proparray.aulPropTag[0] = PR_BODY_HTML; - msg->DeleteProps (&proparray, NULL); - } - + /* ARGHH: This seems to delete also the PR_BODY for some reasonh + - need to disable this safe net. */ +// if (m_pExchExt->m_gpgEncrypt) +// { +// log_debug ("%s:%s: deleting possible extra property PR_BODY_HTML\n", +// SRCNAME, __func__); +// proparray.cValues = 1; +// proparray.aulPropTag[0] = PR_BODY_HTML; +// msg->DeleteProps (&proparray, NULL); +// } + + if (rc) { hrReturn = E_FAIL; @@ -974,9 +989,8 @@ now. */ if (m_pExchExt->m_gpgEncrypt) { - log_debug ("%s:%s: deleting property %s due to error\n", - SRCNAME, __func__, - m_want_html?"PR_BODY":"PR_BODY_HTML"); + log_debug ("%s:%s: deleting property PR_BODY due to error\n", + SRCNAME, __func__); proparray.cValues = 1; proparray.aulPropTag[0] = PR_BODY; hr = msg->DeleteProps (&proparray, NULL); @@ -1204,7 +1218,7 @@ key = wchar_to_utf8 (aVariant.bstrVal); log_debug ("%s:%s: ConversationIndex is `%s'", SRCNAME, __func__, key); - /* The keyis a hex string. Convert it to binary. */ + /* The key is a hex string. Convert it to binary. */ for (keylen=0,p=key; hexdigitp(p) && hexdigitp(p+1); p += 2) ((unsigned char*)key)[keylen++] = xtoi_2 (p); Modified: trunk/src/recipient-dialog.c =================================================================== --- trunk/src/recipient-dialog.c 2005-12-02 17:39:27 UTC (rev 130) +++ trunk/src/recipient-dialog.c 2005-12-06 10:46:25 UTC (rev 131) @@ -42,7 +42,11 @@ unknown recipients. */ char **fnd_keys; /* A string array with the user IDs of already - found keys. */ + found keys. I am not sure why they are + needed here at all - they won't get + displayed for unknown reasons. */ + gpgme_key_t *fnd_keys_key; /* Same as above but the actual gpgme object. */ + /* A bit vector used to return selected options. */ unsigned int opts; @@ -352,7 +356,7 @@ HWND hrset; const char *warn; size_t pos; - int i; + int i, j; switch (msg) { @@ -416,9 +420,13 @@ return FALSE; } + for (j=0; rset_cb->fnd_keys_key && rset_cb->fnd_keys_key[j]; j++) + ; rset_cb->selected_keys_count = ListView_GetItemCount (hrset); - rset_cb->selected_keys = xcalloc (rset_cb->selected_keys_count + 1, + rset_cb->selected_keys = xcalloc (rset_cb->selected_keys_count + + j + 1, sizeof *rset_cb->selected_keys); + /* Add the selected keys. */ for (i=0, pos=0; i < rset_cb->selected_keys_count; i++) { gpgme_key_t key; @@ -443,7 +451,10 @@ /* Force encryption if one key is not fully trusted. Actually this is a bit silly but supposedly here to allow adding an option to - disable this "feature". */ + disable this "feature". It is however pretty + much messed up: The default key should never + be processed here but set into the gpg.conf + file becuase it is always trusted. */ rset_cb->opts |= OPT_FLAG_FORCE; break; } @@ -451,6 +462,13 @@ else log_debug ("List item not correctly initialized - ignored\n"); } + /* Add the already found keys. */ + for (i=0; rset_cb->fnd_keys_key && rset_cb->fnd_keys_key[i]; i++) + { + gpgme_key_ref (rset_cb->fnd_keys_key[i]); + rset_cb->selected_keys[pos++] = rset_cb->fnd_keys_key[i]; + } + rset_cb->selected_keys_count = pos; EndDialog (dlg, TRUE); break; @@ -537,6 +555,7 @@ cb.fnd_keys[i] = xstrdup (_("User-ID not found")); } + cb.fnd_keys_key = fnd; cb.unknown_keys = unknown; if (!strncmp (gettext_localename (), "de", 2)) From cvs at cvs.gnupg.org Tue Dec 6 11:49:02 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 6 11:14:22 2005 Subject: [svn] GPGol - r132 - tags Message-ID: Author: wk Date: 2005-12-06 11:49:01 +0100 (Tue, 06 Dec 2005) New Revision: 132 Added: tags/gpgol-0.9.4/ Log: tagged release Copied: tags/gpgol-0.9.4 (from rev 131, trunk) From cvs at cvs.gnupg.org Tue Dec 6 17:30:23 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 6 16:55:29 2005 Subject: [svn] gpgme - r1143 - in trunk: . doc gpgme tests tests/gpg tests/gpgsm Message-ID: Author: wk Date: 2005-12-06 17:30:21 +0100 (Tue, 06 Dec 2005) New Revision: 1143 Modified: trunk/NEWS trunk/doc/ChangeLog trunk/doc/gpgme.texi trunk/gpgme/ChangeLog trunk/gpgme/keylist.c trunk/tests/ChangeLog trunk/tests/gpg/t-keylist-sig.c trunk/tests/gpg/t-keylist.c trunk/tests/gpgsm/t-keylist.c Log: * Fixed a bug in that the fingerprints of subkeys are not available. * Clarified usage of the SECRET flag in key listings. It is now reset for stub keys. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/NEWS 2005-12-06 16:30:21 UTC (rev 1143) @@ -1,6 +1,11 @@ Noteworthy changes in version 1.1.1 (unreleased) ------------------------------------------------ + * Fixed a bug in that the fingerprints of subkeys are not available. + + * Clarified usage of the SECRET flag in key listings. It is now + reset for stub keys. + * Reading signature notations and policy URLs on key signatures is supported. They can be found in the new field notations of the gpgme_key_sig_t structure. This has to be enabled with the keylist Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/doc/ChangeLog 2005-12-06 16:30:21 UTC (rev 1143) @@ -1,3 +1,8 @@ +2005-12-06 Werner Koch + + * gpgme.texi (Key Management): Updated to match the fixes for + subkey fingerprints and theg secret flag. + 2005-10-06 Marcus Brinkmann * gpgme.texi (Destroying Data Buffers): Document gpgme_free. Modified: trunk/doc/gpgme.texi =================================================================== --- trunk/doc/gpgme.texi 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/doc/gpgme.texi 2005-12-06 16:30:21 UTC (rev 1143) @@ -2385,7 +2385,9 @@ according to local government regulations. @item unsigned int secret : 1 -This is true if the subkey is a secret key. +This is true if the subkey is a secret key. Note that it will be false +if the key is actually a stub key; i.e. a secret key operation is +currently not possible (offline-key). @item gpgme_pubkey_algo_t pubkey_algo This is the public key algorithm supported by this subkey. @@ -2398,7 +2400,7 @@ @item char *fpr This is the fingerprint of the subkey in hexadecimal digits, if -available. This is usually only available for the primary key. +available. @item long int timestamp This is the creation timestamp of the subkey. This is -1 if the @@ -2566,7 +2568,9 @@ to local government regulations. @item unsigned int secret : 1 -This is true if the key is a secret key. +This is true if the key is a secret key. Note, that this will always be +true even if the corresponding subkey flag may be false (offline/stub +keys). @item gpgme_protocol_t protocol This is the protocol supported by this key. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/gpgme/ChangeLog 2005-12-06 16:30:21 UTC (rev 1143) @@ -1,3 +1,9 @@ +2005-12-06 Werner Koch + + * keylist.c (keylist_colon_handler): Store fingerprints of the + subkeys. Reset the secret flag of subkeys for stub secret keys. + (NR_FIELDS): Bumped up to 16 + 2005-11-27 Marcus Brinkmann * engine.c (_gpgme_set_engine_info): Use new_file_name in Modified: trunk/gpgme/keylist.c =================================================================== --- trunk/gpgme/keylist.c 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/gpgme/keylist.c 2005-12-06 16:30:21 UTC (rev 1143) @@ -375,7 +375,7 @@ RT_SSB, RT_SEC, RT_CRT, RT_CRS, RT_REV, RT_SPK } rectype = RT_NONE; -#define NR_FIELDS 13 +#define NR_FIELDS 16 char *field[NR_FIELDS]; int fields = 0; void *hook; @@ -466,7 +466,7 @@ } if (rectype == RT_SEC || rectype == RT_CRS) - key->secret = 1; + key->secret = subkey->secret = 1; if (rectype == RT_CRT || rectype == RT_CRS) key->protocol = GPGME_PROTOCOL_CMS; finish_key (ctx, opd); @@ -528,6 +528,13 @@ /* Field 12 has the capabilities. */ if (fields >= 12) set_mainkey_capability (key, field[11]); + + /* Field 15 carries special flags of a secret key. We reset the + SECRET flag of a subkey here if the key is actually only a + stub. The SECRET flag of the key will be true even then. */ + if (fields >= 15 && key->secret) + if (*field[14] == '#') + subkey->secret = 0; break; case RT_SUB: @@ -582,6 +589,11 @@ /* Field 12 has the capabilities. */ if (fields >= 12) set_subkey_capability (subkey, field[11]); + + /* Field 15 carries special flags of a secret key. */ + if (fields >= 15 && key->secret) + if (*field[14] == '#') + subkey->secret = 0; break; case RT_UID: @@ -601,11 +613,17 @@ case RT_FPR: /* Field 10 has the fingerprint (take only the first one). */ - if (fields >= 10 && !key->subkeys->fpr && field[9] && *field[9]) + if (fields >= 10 && field[9] && *field[9]) { - key->subkeys->fpr = strdup (field[9]); - if (!key->subkeys->fpr) - return gpg_error_from_errno (errno); + /* Need to apply it to the last subkey because all subkeys + do have fingerprints. */ + subkey = key->_last_subkey; + if (!subkey->fpr) + { + subkey->fpr = strdup (field[9]); + if (!subkey->fpr) + return gpg_error_from_errno (errno); + } } /* Field 13 has the gpgsm chain ID (take only the first one). */ Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/tests/ChangeLog 2005-12-06 16:30:21 UTC (rev 1143) @@ -1,3 +1,10 @@ +2005-12-06 Werner Koch + + * gpg/t-keylist.c (main): Changed for that secondary keys now have + a fingerprint. + * gpg/t-keylist-sig.c (main): Ditto. + * gpgsm/t-keylist.c (main): Ditto. The test used to be wrong. + 2005-10-18 Werner Koch * gpg/pubdemo.asc, gpg/secdemo.asc: Add 2 expired subkeys to Modified: trunk/tests/gpg/t-keylist-sig.c =================================================================== --- trunk/tests/gpg/t-keylist-sig.c 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/tests/gpg/t-keylist-sig.c 2005-12-06 16:30:21 UTC (rev 1143) @@ -310,10 +310,9 @@ key->subkeys->next->keyid); exit (1); } - if (key->subkeys->next->fpr) + if (!key->subkeys->next->fpr) { - fprintf (stderr, "Secondary key has unexpectedly a fingerprint: %s\n", - key->subkeys->next->fpr); + fprintf (stderr, "Secondary key has unexpectedly no fingerprint\n"); exit (1); } if (key->subkeys->next->expires) @@ -467,7 +466,7 @@ after importing the secret key. We disable this test for now. */ #ifdef __GNUC__ -#warning test disabled due to problems with gpg 1.3.4 +#warning test disabled due to problems with gpg 1.3.4 generated key #endif if (key->uids && (!key->uids->next->signatures /*|| key->uids->next->signatures->next*/)) { Modified: trunk/tests/gpg/t-keylist.c =================================================================== --- trunk/tests/gpg/t-keylist.c 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/tests/gpg/t-keylist.c 2005-12-06 16:30:21 UTC (rev 1143) @@ -361,10 +361,9 @@ key->subkeys->next->keyid, keys[i].sec_keyid ); exit (1); } - if (key->subkeys->next->fpr) + if (!key->subkeys->next->fpr) { - fprintf (stderr, "Secondary key has unexpectedly a fingerprint: %s\n", - key->subkeys->next->fpr); + fprintf (stderr, "Secondary key has unexpectedly no fingerprint\n"); exit (1); } if (key->subkeys->next->expires) Modified: trunk/tests/gpgsm/t-keylist.c =================================================================== --- trunk/tests/gpgsm/t-keylist.c 2005-11-27 17:11:55 UTC (rev 1142) +++ trunk/tests/gpgsm/t-keylist.c 2005-12-06 16:30:21 UTC (rev 1143) @@ -245,9 +245,10 @@ fprintf (stderr, "Primary key unexpectedly unusable for certifications\n"); exit (1); } - if (key->subkeys->secret) + if (key->subkeys->secret != keys[i].secret) { - fprintf (stderr, "Primary key unexpectedly secret\n"); + fprintf (stderr, "Primary Key unexpectedly%s secret\n", + key->secret ? "" : " not"); exit (1); } if (key->subkeys->pubkey_algo != GPGME_PK_RSA) From cvs at cvs.gnupg.org Tue Dec 6 17:44:20 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 6 17:09:24 2005 Subject: [svn] GnuPG - r3948 - branches/GNUPG-1-9-BRANCH/scd Message-ID: Author: wk Date: 2005-12-06 17:44:20 +0100 (Tue, 06 Dec 2005) New Revision: 3948 Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog branches/GNUPG-1-9-BRANCH/scd/apdu.c Log: Print warning for missing pcsc-wrapper Modified: branches/GNUPG-1-9-BRANCH/scd/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-11-28 11:52:25 UTC (rev 3947) +++ branches/GNUPG-1-9-BRANCH/scd/ChangeLog 2005-12-06 16:44:20 UTC (rev 3948) @@ -1,3 +1,8 @@ +2005-12-06 Werner Koch + + * apdu.c (open_pcsc_reader): Check that pcsc-wrapper is actually + installed. + 2005-11-23 Werner Koch * app-nks.c (verify_pin): Give a special error message for a Nullpin. Modified: branches/GNUPG-1-9-BRANCH/scd/apdu.c =================================================================== --- branches/GNUPG-1-9-BRANCH/scd/apdu.c 2005-11-28 11:52:25 UTC (rev 3947) +++ branches/GNUPG-1-9-BRANCH/scd/apdu.c 2005-12-06 16:44:20 UTC (rev 3948) @@ -1328,7 +1328,15 @@ int err; unsigned int dummy_status; int sw = SW_HOST_CARD_IO_ERROR; + const char *wrapperpgm = GNUPG_LIBDIR "/pcsc-wrapper"; + if (access (wrapperpgm, X_OK)) + { + log_error ("can't run PC/SC access module `%s': %s\n", + wrapperpgm, strerror (errno)); + return -1; + } + slot = new_reader_slot (); if (slot == -1) return -1; @@ -1400,7 +1408,7 @@ close(i); errno = 0; - execl (GNUPG_LIBDIR "/pcsc-wrapper", + execl (wrapperpgm, "pcsc-wrapper", "--", "1", /* API version */ From cvs at cvs.gnupg.org Tue Dec 6 18:13:46 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 17:38:51 2005 Subject: [svn] GnuPG - r3949 - in trunk: . cipher Message-ID: Author: dshaw Date: 2005-12-06 18:13:44 +0100 (Tue, 06 Dec 2005) New Revision: 3949 Modified: trunk/ChangeLog trunk/cipher/ChangeLog trunk/cipher/Makefile.am trunk/configure.ac Log: * Makefile.am: Some cleanup so we don't build files that are completely ifdeffed out. This causes a warning on Sun's cc. Do sha512.c as well for consistency. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-06 16:44:20 UTC (rev 3948) +++ trunk/ChangeLog 2005-12-06 17:13:44 UTC (rev 3949) @@ -1,3 +1,9 @@ +2005-12-06 David Shaw + + * configure.ac: Some cleanup so we don't build files that are + completely ifdeffed out. This causes a warning on Sun's cc. Do + sha512.c as well for consistency. + 2005-11-17 David Shaw * NEWS: Note backsigs, the xxxxx-clean options, and the Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2005-12-06 16:44:20 UTC (rev 3948) +++ trunk/cipher/ChangeLog 2005-12-06 17:13:44 UTC (rev 3949) @@ -1,3 +1,9 @@ +2005-12-06 David Shaw + + * Makefile.am: Some cleanup so we don't build files that are + completely ifdeffed out. This causes a warning on Sun's cc. Do + sha512.c as well for consistency. + 2005-08-11 Werner Koch * rijndael.c (rijndael_cfb_encrypt): Experimental code to improve Modified: trunk/cipher/Makefile.am =================================================================== --- trunk/cipher/Makefile.am 2005-12-06 16:44:20 UTC (rev 3948) +++ trunk/cipher/Makefile.am 2005-12-06 17:13:44 UTC (rev 3949) @@ -1,4 +1,5 @@ -# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, +# 2005 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -44,16 +45,31 @@ dsa.c \ smallprime.c \ algorithms.h \ - rndlinux.c \ - rndunix.c \ - rndegd.c \ - rndw32.c \ md5.c \ rmd160.c \ sha1.c \ sha256.c -EXTRA_libcipher_a_SOURCES = idea-stub.c sha512.c +if USE_RNDLINUX +libcipher_a_SOURCES+=rndlinux.c +endif -libcipher_a_DEPENDENCIES = @IDEA_O@ @SHA512_O@ -libcipher_a_LIBADD = @IDEA_O@ @SHA512_O@ +if USE_RNDUNIX +libcipher_a_SOURCES+=rndunix.c +endif + +if USE_RNDEGD +libcipher_a_SOURCES+=rndegd.c +endif + +if USE_RNDW32 +libcipher_a_SOURCES+=rndw32.c +endif + +if USE_SHA512 +libcipher_a_SOURCES+=sha512.c +endif + +EXTRA_libcipher_a_SOURCES=idea-stub.c +libcipher_a_DEPENDENCIES=@IDEA_O@ +libcipher_a_LIBADD=@IDEA_O@ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-06 16:44:20 UTC (rev 3948) +++ trunk/configure.ac 2005-12-06 17:13:44 UTC (rev 3949) @@ -800,18 +800,21 @@ fi dnl Do we have any 64-bit data types? -if test "$ac_cv_sizeof_unsigned_int" != "8" \ +if test x"$use_sha512" = xyes \ + && test "$ac_cv_sizeof_unsigned_int" != "8" \ && test "$ac_cv_sizeof_unsigned_long" != "8" \ && test "$ac_cv_sizeof_unsigned_long_long" != "8" \ && test x"$ac_cv_sizeof_uint64_t" != "x8"; then AC_MSG_NOTICE([No 64-bit types. Disabling SHA-384 and SHA-512.]) -else - if test x"$use_sha512" = xyes ; then - AC_SUBST(SHA512_O,sha512.o) - AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests]) - fi + use_sha512=no fi +if test x"$use_sha512" ; then + AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests]) +fi + +AM_CONDITIONAL(USE_SHA512, test x"$use_sha512" = xyes) + dnl Checks for library functions. AC_CHECK_DECLS(getpagesize) AC_FUNC_FSEEKO @@ -978,23 +981,32 @@ rndlinux) AC_DEFINE(USE_RNDLINUX,1, [Defined if the /dev/random based RNG should be used.]) + use_rndlinux=yes ;; rndunix) AC_DEFINE(USE_RNDUNIX,1, [Defined if the default Unix RNG should be used.]) print_egd_warning=yes + use_rndunix=yes ;; rndegd) AC_DEFINE(USE_RNDEGD,1, [Defined if the EGD based RNG should be used.]) + use_rndegd=yes ;; rndw32) AC_DEFINE(USE_RNDW32,1, [Defined if the Windows specific RNG should be used.]) + use_rndw32=yes ;; esac done +AM_CONDITIONAL(USE_RNDLINUX, test "$use_rndlinux" = yes) +AM_CONDITIONAL(USE_RNDUNIX, test "$use_rndunix" = yes) +AM_CONDITIONAL(USE_RNDEGD, test "$use_rndegd" = yes) +AM_CONDITIONAL(USE_RNDW32, test "$use_rndw32" = yes) + dnl setup assembler stuff AC_MSG_CHECKING(for mpi assembler functions) if test -f $srcdir/mpi/config.links ; then From cvs at cvs.gnupg.org Tue Dec 6 19:24:58 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 18:50:09 2005 Subject: [svn] GnuPG - r3950 - trunk/util Message-ID: Author: dshaw Date: 2005-12-06 19:24:57 +0100 (Tue, 06 Dec 2005) New Revision: 3950 Modified: trunk/util/ChangeLog trunk/util/assuan-buffer.c trunk/util/dotlock.c trunk/util/mkdtemp.c trunk/util/secmem.c Log: * mkdtemp.c (mkdtemp): Fix warning. * secmem.c, assuan-buffer.c, dotlock.c: Fix a few warnings from printf-ing %p where the arg wasn't void *. Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-06 17:13:44 UTC (rev 3949) +++ trunk/util/ChangeLog 2005-12-06 18:24:57 UTC (rev 3950) @@ -1,3 +1,10 @@ +2005-12-06 David Shaw + + * mkdtemp.c (mkdtemp): Fix warning. + + * secmem.c, assuan-buffer.c, dotlock.c: Fix a few warnings from + printf-ing %p where the arg wasn't void *. + 2005-11-02 David Shaw * util.c [!HAVE_DECL_GETPAGESIZE]: Prototype getpagesize() if Modified: trunk/util/assuan-buffer.c =================================================================== --- trunk/util/assuan-buffer.c 2005-12-06 17:13:44 UTC (rev 3949) +++ trunk/util/assuan-buffer.c 2005-12-06 18:24:57 UTC (rev 3950) @@ -139,7 +139,7 @@ if (ctx->log_fp) fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [Error: %s]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx, strerror (errno)); + (unsigned int)getpid (), (void *)ctx, strerror (errno)); return ASSUAN_Read_Error; } if (!nread) @@ -148,7 +148,7 @@ if (ctx->log_fp) fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [EOF]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); return -1; } @@ -181,7 +181,7 @@ { fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else @@ -197,7 +197,7 @@ if (ctx->log_fp) fprintf (ctx->log_fp, "%s[%u.%p] DBG: <- [Invalid line]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); *line = 0; ctx->inbound.linelen = 0; return ctx->inbound.eof ? ASSUAN_Line_Not_Terminated @@ -253,7 +253,7 @@ fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> " "[supplied line too long -truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); if (prefixlen > 5) prefixlen = 5; if (len > ASSUAN_LINELENGTH - prefixlen - 2) @@ -265,7 +265,7 @@ { fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else @@ -313,7 +313,7 @@ fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> " "[supplied line contained a LF -truncated]\n", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); return _assuan_write_line (ctx, NULL, line, len); } @@ -370,7 +370,7 @@ { fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); @@ -418,7 +418,7 @@ { fprintf (ctx->log_fp, "%s[%u.%p] DBG: -> ", assuan_get_assuan_log_prefix (), - (unsigned int)getpid (), ctx); + (unsigned int)getpid (), (void *)ctx); if (ctx->confidential) fputs ("[Confidential data not shown]", ctx->log_fp); else Modified: trunk/util/dotlock.c =================================================================== --- trunk/util/dotlock.c 2005-12-06 17:13:44 UTC (rev 3949) +++ trunk/util/dotlock.c 2005-12-06 18:24:57 UTC (rev 3950) @@ -145,10 +145,10 @@ h->tname = xmalloc( dirpartlen + 6+30+ strlen(nodename) + 11 ); #ifndef __riscos__ sprintf( h->tname, "%.*s/.#lk%p.%s.%d", - dirpartlen, dirpart, h, nodename, (int)getpid() ); + dirpartlen, dirpart, (void *)h, nodename, (int)getpid() ); #else /* __riscos__ */ sprintf( h->tname, "%.*s.lk%p/%s/%d", - dirpartlen, dirpart, h, nodename, (int)getpid() ); + dirpartlen, dirpart, (void *)h, nodename, (int)getpid() ); #endif /* __riscos__ */ do { Modified: trunk/util/mkdtemp.c =================================================================== --- trunk/util/mkdtemp.c 2005-12-06 17:13:44 UTC (rev 3949) +++ trunk/util/mkdtemp.c 2005-12-06 18:24:57 UTC (rev 3950) @@ -40,7 +40,7 @@ char *mkdtemp(char *template) { unsigned int attempts,idx,count=0; - byte *ch; + char *ch; idx=strlen(template); Modified: trunk/util/secmem.c =================================================================== --- trunk/util/secmem.c 2005-12-06 17:13:44 UTC (rev 3949) +++ trunk/util/secmem.c 2005-12-06 18:24:57 UTC (rev 3950) @@ -409,7 +409,7 @@ mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c)); size = mb->size; if (size < sizeof(MEMBLOCK)) - log_bug ("secure memory corrupted at block %p\n", mb); + log_bug ("secure memory corrupted at block %p\n", (void *)mb); size -= ((size_t) &((MEMBLOCK*)0)->u.aligned.c); if( newsize <= size ) From cvs at cvs.gnupg.org Tue Dec 6 19:49:35 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 19:14:41 2005 Subject: [svn] GnuPG - r3951 - trunk/keyserver Message-ID: Author: dshaw Date: 2005-12-06 19:49:34 +0100 (Tue, 06 Dec 2005) New Revision: 3951 Modified: trunk/keyserver/ChangeLog trunk/keyserver/curl-shim.c Log: * curl-shim.c (curl_easy_perform): Fix build warning (code before declaration). Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2005-12-06 18:24:57 UTC (rev 3950) +++ trunk/keyserver/ChangeLog 2005-12-06 18:49:34 UTC (rev 3951) @@ -1,3 +1,8 @@ +2005-12-06 David Shaw + + * curl-shim.c (curl_easy_perform): Fix build warning (code before + declaration). + 2005-11-02 David Shaw * gpgkeys_hkp.c (search_key): Fix warning with typecast (though Modified: trunk/keyserver/curl-shim.c =================================================================== --- trunk/keyserver/curl-shim.c 2005-12-06 18:24:57 UTC (rev 3950) +++ trunk/keyserver/curl-shim.c 2005-12-06 18:49:34 UTC (rev 3951) @@ -201,9 +201,10 @@ while((len=iobuf_read_line(curl->hd.fp_read, &line,&buflen,&maxlen))) { - maxlen=1024; size_t ret; + maxlen=1024; + ret=(curl->writer)(line,len,1,curl->file); if(ret!=len) { From cvs at cvs.gnupg.org Tue Dec 6 21:27:44 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 20:52:47 2005 Subject: [svn] GnuPG - r3952 - trunk/cipher Message-ID: Author: dshaw Date: 2005-12-06 21:27:43 +0100 (Tue, 06 Dec 2005) New Revision: 3952 Modified: trunk/cipher/ChangeLog trunk/cipher/idea-stub.c trunk/cipher/rndegd.c trunk/cipher/rndlinux.c trunk/cipher/rndunix.c trunk/cipher/rndw32.c Log: * idea-stub.c (load_module): Not legal to return a void * as a function pointer. Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/ChangeLog 2005-12-06 20:27:43 UTC (rev 3952) @@ -1,9 +1,13 @@ 2005-12-06 David Shaw - * Makefile.am: Some cleanup so we don't build files that are - completely ifdeffed out. This causes a warning on Sun's cc. Do - sha512.c as well for consistency. + * idea-stub.c (load_module): Not legal to return a void * as a + function pointer. + * Makefile.am, rndegd.c, rndlinux.c, rndunix.c, rndw32.c: Some + cleanup so we don't build files that are completely ifdeffed out. + This causes a warning on Sun's cc. Do sha512.c as well for + consistency. + 2005-08-11 Werner Koch * rijndael.c (rijndael_cfb_encrypt): Experimental code to improve Modified: trunk/cipher/idea-stub.c =================================================================== --- trunk/cipher/idea-stub.c 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/idea-stub.c 2005-12-06 20:27:43 UTC (rev 3952) @@ -138,7 +138,7 @@ if ((err=dlerror())) goto failure; - return sym; + return (INFO_FNC)sym; failure: log_info ("invalid module `%s': %s\n", name?name:"???", err?err:"???"); Modified: trunk/cipher/rndegd.c =================================================================== --- trunk/cipher/rndegd.c 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/rndegd.c 2005-12-06 20:27:43 UTC (rev 3952) @@ -20,9 +20,6 @@ */ #include - -#ifdef USE_RNDEGD - #include #include #include @@ -226,5 +223,3 @@ return 0; /* success */ } - -#endif /*USE_RNDEGD*/ Modified: trunk/cipher/rndlinux.c =================================================================== --- trunk/cipher/rndlinux.c 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/rndlinux.c 2005-12-06 20:27:43 UTC (rev 3952) @@ -21,9 +21,6 @@ #include - -#ifdef USE_RNDLINUX - #include #include #include @@ -161,5 +158,3 @@ return 0; /* success */ } - -#endif /*USE_RNDLINUX*/ Modified: trunk/cipher/rndunix.c =================================================================== --- trunk/cipher/rndunix.c 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/rndunix.c 2005-12-06 20:27:43 UTC (rev 3952) @@ -48,9 +48,6 @@ /* General includes */ #include - -#ifdef USE_RNDUNIX - #include #include #include @@ -870,5 +867,3 @@ return 0; } - -#endif /*USE_RNDUNIX*/ Modified: trunk/cipher/rndw32.c =================================================================== --- trunk/cipher/rndw32.c 2005-12-06 18:49:34 UTC (rev 3951) +++ trunk/cipher/rndw32.c 2005-12-06 20:27:43 UTC (rev 3952) @@ -61,9 +61,6 @@ */ #include - -#ifdef USE_RNDW32 - #include #include #include @@ -700,5 +697,3 @@ return 0; } - -#endif /*USE_RNDW32*/ From cvs at cvs.gnupg.org Tue Dec 6 21:54:07 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 21:19:11 2005 Subject: [svn] GnuPG - r3953 - in trunk: . g10 util Message-ID: Author: dshaw Date: 2005-12-06 21:54:05 +0100 (Tue, 06 Dec 2005) New Revision: 3953 Modified: trunk/configure.ac trunk/g10/trustdb.c trunk/util/ChangeLog trunk/util/Makefile.am Log: Some cleanup so we don't build files that are completely ifdeffed out. This causes a warning on Sun's cc. Do the internal regex code as well for consistency. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-06 20:27:43 UTC (rev 3952) +++ trunk/configure.ac 2005-12-06 20:54:05 UTC (rev 3953) @@ -469,6 +469,8 @@ need_dlopen=no try_gettext="no" agent_support=no + use_simple_gettext=yes + have_w32_system=yes ;; i?86-emx-os2 | i?86-*-os2*emx ) # OS/2 with the EMX environment @@ -523,6 +525,9 @@ fi AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes) +AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes) +AM_CONDITIONAL(HAVE_W32_SYSTEM, test x"$have_w32_system" = xyes) + if test "$disable_keyserver_path" = yes; then AC_DEFINE(DISABLE_KEYSERVER_PATH,1, [define to disable exec-path for keyserver helpers]) @@ -786,7 +791,7 @@ # Ensure that we have UINT64_C before we bother to check for uint64_t gt_HEADER_INTTYPES_H AC_CACHE_CHECK([for UINT64_C], [gnupg_cv_uint64_c_works], - AC_COMPILE_IFELSE(AC_LANG_PROGRAM([ + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ],[ uint64_t foo=UINT64_C(42);]),gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no)) if test "$gnupg_cv_uint64_c_works" = "yes" ; then @@ -1070,14 +1075,14 @@ fi if test $gnupg_cv_included_regex = yes; then - AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex lib ]) - AC_SUBST(REGEX_O,regex.o) + AC_DEFINE(USE_INTERNAL_REGEX,1,[ Define if you want to use the included regex lib ]) fi else - AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ]) fi +AM_CONDITIONAL(USE_INTERNAL_REGEX, test x"$gnupg_cv_included_regex" = xyes) + dnl Do we have zlib? Must do it here because Solaris failed dnl when compiling a conftest (due to the "-lz" from LIBS). use_local_zlib=yes Modified: trunk/g10/trustdb.c =================================================================== --- trunk/g10/trustdb.c 2005-12-06 20:27:43 UTC (rev 3952) +++ trunk/g10/trustdb.c 2005-12-06 20:54:05 UTC (rev 3953) @@ -28,7 +28,7 @@ #ifndef DISABLE_REGEX #include -#ifdef USE_GNU_REGEX +#ifdef USE_INTERNAL_REGEX #include "_regex.h" #else #include Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-06 20:27:43 UTC (rev 3952) +++ trunk/util/ChangeLog 2005-12-06 20:54:05 UTC (rev 3953) @@ -1,5 +1,9 @@ 2005-12-06 David Shaw + * Makefile.am: Some cleanup so we don't build files that are + completely ifdeffed out. This causes a warning on Sun's cc. Do + the internal regex code as well for consistency. + * mkdtemp.c (mkdtemp): Fix warning. * secmem.c, assuan-buffer.c, dotlock.c: Fix a few warnings from Modified: trunk/util/Makefile.am =================================================================== --- trunk/util/Makefile.am 2005-12-06 20:27:43 UTC (rev 3952) +++ trunk/util/Makefile.am 2005-12-06 20:54:05 UTC (rev 3953) @@ -22,28 +22,35 @@ noinst_LIBRARIES = libutil.a -EXTRA_libutil_a_SOURCES = regcomp.c regex.c regexec.c regex_internal.c \ - regex_internal.h +libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \ + ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \ + dotlock.c http.c srv.h srv.c pka.c membuf.c -# We build the assuan support only if it has been requested. +if USE_SIMPLE_GETTEXT +libutil_a_SOURCES+=simple-gettext.c +endif + +if HAVE_W32_SYSTEM +libutil_a_SOURCES+=w32reg.c +endif + if ENABLE_AGENT_SUPPORT -assuan_source = assuan-buffer.c assuan-client.c assuan-defs.h \ - assuan-errors.c assuan-logging.c assuan-socket-connect.c \ - assuan-connect.c assuan-socket.c assuan-util.c -else -assuan_source = +libutil_a_SOURCES+=assuan-buffer.c assuan-client.c assuan-defs.h \ + assuan-errors.c assuan-logging.c assuan-socket-connect.c \ + assuan-connect.c assuan-socket.c assuan-util.c endif +if USE_INTERNAL_REGEX +libutil_a_SOURCES+=regex.c +endif -#libutil_a_LDFLAGS = -libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \ - ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \ - dotlock.c http.c srv.h srv.c pka.c simple-gettext.c \ - membuf.c w32reg.c $(assuan_source) +# The internal regex code #includes these. +EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \ + regex_internal.h -libutil_a_DEPENDENCIES = @LIBOBJS@ @REGEX_O@ # LIBOBJS is for the replacement functions -libutil_a_LIBADD = @LIBOBJS@ @REGEX_O@ +libutil_a_DEPENDENCIES = @LIBOBJS@ +libutil_a_LIBADD = @LIBOBJS@ http-test: http.c cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \ @@ -56,4 +63,3 @@ pka-test: pka.c cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \ -DTEST -o pka-test pka.c libutil.a @LIBINTL@ @SRVLIBS@ @CAPLIBS@ - From cvs at cvs.gnupg.org Tue Dec 6 22:10:35 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Tue Dec 6 21:35:40 2005 Subject: [svn] GnuPG - r3954 - trunk Message-ID: Author: dshaw Date: 2005-12-06 22:10:34 +0100 (Tue, 06 Dec 2005) New Revision: 3954 Modified: trunk/ChangeLog Log: Missed file. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-06 20:54:05 UTC (rev 3953) +++ trunk/ChangeLog 2005-12-06 21:10:34 UTC (rev 3954) @@ -1,8 +1,10 @@ 2005-12-06 David Shaw + * configure.ac: UINT64_C test needs #include . + * configure.ac: Some cleanup so we don't build files that are completely ifdeffed out. This causes a warning on Sun's cc. Do - sha512.c as well for consistency. + sha512.c and the internal regex code as well for consistency. 2005-11-17 David Shaw From cvs at cvs.gnupg.org Wed Dec 7 18:13:28 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Dec 7 17:38:30 2005 Subject: [svn] GPGol - r133 - in trunk: . po src Message-ID: Author: wk Date: 2005-12-07 18:13:27 +0100 (Wed, 07 Dec 2005) New Revision: 133 Modified: trunk/ChangeLog trunk/NEWS trunk/README trunk/TODO trunk/configure.ac trunk/po/de.po trunk/src/ChangeLog trunk/src/config-dialog.c trunk/src/gpgmsg.cpp trunk/src/intern.h trunk/src/main.c trunk/src/olflange-dlgs.cpp trunk/src/olflange.cpp Log: Fixes for using non-adnim accounts. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/ChangeLog 2005-12-07 17:13:27 UTC (rev 133) @@ -1,3 +1,7 @@ +2005-12-07 Werner Koch + + Released 0.9.5. + 2005-12-06 Werner Koch Released 0.9.4. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/NEWS 2005-12-07 17:13:27 UTC (rev 133) @@ -1,3 +1,11 @@ +Noteworthy changes for version 0.9.5 (2005-12-07) +================================================= + +* Fixed problems related to use on non-admin accounts. + +* Print a warning if used with OL prior to OL2003 SP2. + + Noteworthy changes for version 0.9.4 (2005-12-06) ================================================= Modified: trunk/README =================================================================== --- trunk/README 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/README 2005-12-07 17:13:27 UTC (rev 133) @@ -16,6 +16,9 @@ gpgol.dll" and start Outlook. You should then find a new tab named "GnuPG" in Outlook's option menu. +If you are missing icons in the toolbar, checkout the toolbar's +customize button - you will find the new icons there. + Bug reporting: First click on the logo on the GnuPG options tab to check whether a newer version has been released - try this first. If this does not help, check out the mailing lists and also the bug Modified: trunk/TODO =================================================================== --- trunk/TODO 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/TODO 2005-12-07 17:13:27 UTC (rev 133) @@ -2,9 +2,7 @@ For example 'No Secret Key' should contain the key-ID and if possible the primary user-ID. -* much better HTML support. - -* find out why sometimes the new body cannot set to a MAPI object. In +* Find out why sometimes the new body cannot set to a MAPI object. In this case the body is empty but the W32 API said it was correctly set. This might be due to the length of the object. HrGetOneProp has such limitations and thus it would be reasonable to assume that the Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/configure.ac 2005-12-07 17:13:27 UTC (rev 133) @@ -16,7 +16,7 @@ # Version number: Remember to change it immediately *after* a release. # Make sure to run "svn up" before a "make dist". # Add a "-cvs" prefix for non-released code. -AC_INIT(gpgol, 0.9.4, bug-gpgol@g10code.com) +AC_INIT(gpgol, 0.9.5, bug-gpgol@g10code.com) NEED_GPGME_API=1 NEED_GPGME_VERSION=1.1.0 Modified: trunk/po/de.po =================================================================== --- trunk/po/de.po 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/po/de.po 2005-12-07 17:13:27 UTC (rev 133) @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: GPGol 0.9.4\n" "Report-Msgid-Bugs-To: bug-gpgol@g10code.com\n" -"POT-Creation-Date: 2005-12-06 11:07+0100\n" -"PO-Revision-Date: 2005-12-06 11:09+0100\n" +"POT-Creation-Date: 2005-12-07 17:27+0100\n" +"PO-Revision-Date: 2005-12-07 17:31+0100\n" "Last-Translator: Werner Koch \n" "Language-Team: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/config-dialog.c:298 +#: src/config-dialog.c:289 msgid "Select GPG Key Manager" msgstr "Das Schl?sselverwaltungsprogramm festlegen" @@ -234,8 +234,29 @@ msgid "Attachment Signing Failure" msgstr "Unterschrifterstellungsfehler eines Anhangs" -#: src/olflange.cpp:896 +#: src/olflange-dlgs.cpp:165 +msgid "The default key may not contain any spaces." +msgstr "Der Standardschl?ssel darf keine Leerzeichen enthalten." + +#: src/olflange.cpp:748 msgid "" +"This version of Outlook is too old!\n" +"\n" +"At least versions of Outlook 2003 older than SP2 exhibit crashes when " +"sending messages and messages might get stuck in the outgoing queue.\n" +"\n" +"Please update at least to SP2 before trying to send a message" +msgstr "" +"Diese Version von Outlook ist zu alt!\n" +"\n" +"Einige Versionen von Outlook 2003, ?lter als SP2, verursachen\n" +"Programmabr?che beim Senden von Nachrichten und diese Nachrichten\n" +"k?nnen dabei in der Ausgabewarteschlange stecken bleiben.\n" +"\n" +"Bitte updaten Sie auf SP2 bevor Sie versuchen eine Nachricht zu versenden." + +#: src/olflange.cpp:937 +msgid "" "Sorry, we can only encrypt plain text messages and\n" "no RTF messages. Please make sure that only the text\n" "format has been selected." @@ -245,51 +266,51 @@ "Sie sicher, da? lediglich das Text Format ausgew?hlt wurde.\n" "(In der Men?leiste: \"Format\" => \"Nur Text\")" -#: src/olflange.cpp:1286 +#: src/olflange.cpp:1327 msgid "&Decrypt and verify message" msgstr "Entschl?sseln/Pr?fen der Nachricht" -#: src/olflange.cpp:1324 +#: src/olflange.cpp:1365 msgid "GPG &encrypt message" msgstr "Mit GPG &verschl?sseln" -#: src/olflange.cpp:1330 +#: src/olflange.cpp:1371 msgid "GPG &sign message" msgstr "Mit GPG unter&schreiben" -#: src/olflange.cpp:1376 +#: src/olflange.cpp:1417 msgid "GPG Key &Manager" msgstr "GPG Schl?ssel&verwaltung" -#: src/olflange.cpp:1508 +#: src/olflange.cpp:1549 msgid "Could not start Key-Manager" msgstr "Dei Schl?sselverwaltung konnte nicht aufgerufen werden" -#: src/olflange.cpp:1554 +#: src/olflange.cpp:1595 msgid "Decrypt and verify the message." msgstr "Entschl?sseln und Pr?fen der Nachricht." -#: src/olflange.cpp:1562 +#: src/olflange.cpp:1603 msgid "Select this option to encrypt the message." msgstr "W?hlen Sie diese Option zum Verschl?sseln der Nachricht." -#: src/olflange.cpp:1568 +#: src/olflange.cpp:1609 msgid "Select this option to sign the message." msgstr "W?hlen Sie diese Option zum Unterschreiben der Nachricht." -#: src/olflange.cpp:1577 src/olflange.cpp:1638 src/olflange.cpp:1720 +#: src/olflange.cpp:1618 src/olflange.cpp:1679 src/olflange.cpp:1761 msgid "Open GPG Key Manager" msgstr "Die GPG Schl?sselverwaltung ?ffnen" -#: src/olflange.cpp:1607 src/olflange.cpp:1671 +#: src/olflange.cpp:1648 src/olflange.cpp:1712 msgid "Decrypt message and verify signature" msgstr "Nachricht entschl?sseln und Unterschrift pr?fen" -#: src/olflange.cpp:1618 src/olflange.cpp:1689 +#: src/olflange.cpp:1659 src/olflange.cpp:1730 msgid "Encrypt message with GPG" msgstr "Nachricht mit GPG verschl?sseln" -#: src/olflange.cpp:1627 src/olflange.cpp:1704 +#: src/olflange.cpp:1668 src/olflange.cpp:1745 msgid "Sign message with GPG" msgstr "Nachricht mit GPG unterschreiben" Modified: trunk/src/ChangeLog =================================================================== --- trunk/src/ChangeLog 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/ChangeLog 2005-12-07 17:13:27 UTC (rev 133) @@ -1,5 +1,21 @@ +2005-12-07 Werner Koch + + * olflange.cpp (Install): Cehck the version and print a warning. + + * olflange-dlgs.cpp (GPGOptionsDlgProc): Simplified the default + key code. + + * config-dialog.c (store_config_value): Create key if it does not + exists. + (load_config_value_ext): Removed. + 2005-12-06 Werner Koch + * config-dialog.c (start_key_manager): Don't pass the options to + access. + +2005-12-06 Werner Koch + * gpgmsg.cpp (getRecipients): Add the default key to the list of recipients. * recipient-dialog.c (recipient_dlg_proc): Add the already found Modified: trunk/src/config-dialog.c =================================================================== --- trunk/src/config-dialog.c 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/config-dialog.c 2005-12-07 17:13:27 UTC (rev 133) @@ -99,24 +99,7 @@ } #endif -static int -load_config_value_ext (char **val) -{ - static char buf[MAX_PATH+64]; - - /* MSDN: This buffer must be at least MAX_PATH characters in size. */ - memset (buf, 0, sizeof (buf)); - if (w32_shgetfolderpath (NULL, CSIDL_APPDATA/*|CSIDL_FLAG_CREATE*/, - NULL, 0, buf) < 0) - return -1; - strcat (buf, "\\gnupg"); - if (GetFileAttributes (buf) == 0xFFFFFFFF) - return -1; - *val = buf; - return 0; -} - static char* expand_path (const char *path) { @@ -145,11 +128,12 @@ DWORD size=0, type; int ec; + *val = NULL; if (hk == NULL) hk = HKEY_CURRENT_USER; ec = RegOpenKeyEx (hk, path, 0, KEY_READ, &h); if (ec != ERROR_SUCCESS) - return load_config_value_ext (val); + return -1; ec = RegQueryValueEx(h, key, NULL, &type, NULL, &size); if (ec != ERROR_SUCCESS) { @@ -179,24 +163,29 @@ static int store_config_value (HKEY hk, const char *path, const char *key, const char *val) { - HKEY h; - int type = REG_SZ; - int ec; - - if (hk == NULL) - hk = HKEY_CURRENT_USER; - ec = RegOpenKeyEx (hk, path, 0, KEY_ALL_ACCESS, &h); - if (ec != ERROR_SUCCESS) - return -1; - if (strchr (val, '%')) - type = REG_EXPAND_SZ; - ec = RegSetValueEx (h, key, 0, type, (const BYTE*)val, strlen (val)); - if (ec != ERROR_SUCCESS) { - RegCloseKey(h); - return -1; + HKEY h; + int type; + int ec; + + if (hk == NULL) + hk = HKEY_CURRENT_USER; + ec = RegCreateKeyEx (hk, path, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, NULL, &h, NULL); + if (ec != ERROR_SUCCESS) + { + log_debug_w32 (ec, "creating/opening registry key `%s' failed", path); + return -1; } - RegCloseKey(h); - return 0; + type = strchr (val, '%')? REG_EXPAND_SZ : REG_SZ; + ec = RegSetValueEx (h, key, 0, type, (const BYTE*)val, strlen (val)); + if (ec != ERROR_SUCCESS) + { + log_debug_w32 (ec, "saving registry key `%s'->`%s' failed", path, key); + RegCloseKey(h); + return -1; + } + RegCloseKey(h); + return 0; } @@ -288,8 +277,10 @@ xfree (buf); buf=NULL; } + else + SetDlgItemText (dlg, IDC_OPT_KEYMAN, ""); s = get_log_file (); - SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s); + SetDlgItemText (dlg, IDC_DEBUG_LOGFILE, s? s:""); break; case WM_COMMAND: @@ -309,9 +300,8 @@ error_box ("GPG Config"); } n = GetDlgItemText (dlg, IDC_DEBUG_LOGFILE, name, MAX_PATH-1); - if (n > 0) { - set_log_file (name); - } + set_log_file (n>0?name:NULL); + EndDialog (dlg, TRUE); break; } @@ -355,7 +345,10 @@ gpgme_engine_info_t info; if (gpgme_get_engine_info (&info)) - return -1; + { + log_debug ("%s:%s: get_engine_info failed\n", SRCNAME, __func__); + return -1; + } while (info && info->protocol != GPGME_PROTOCOL_OpenPGP) info = info->next; @@ -372,12 +365,20 @@ xfree (keyman); return -1; } - strcpy (p+1, "winpt.exe --keymanager"); - if (access (keyman, F_OK)) + strcpy (p+1, "winpt.exe"); + if (!access (keyman, F_OK)) + strcat (keyman, " --keymanager"); + else { - strcpy (p+1, "gpa.exe --keyring"); - if (access (keyman, F_OK)) + log_debug ("%s:%s: accessing `%s' failed\n", + SRCNAME, __func__, keyman ); + strcpy (p+1, "gpa.exe"); + if (!access (keyman, F_OK)) + strcat (keyman, " --keyring"); + else { + log_debug ("%s:%s: accessing `%s' failed\n", + SRCNAME, __func__, keyman ); xfree (keyman); return -1; } @@ -391,6 +392,8 @@ si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; + log_debug ("%s:%s: running `%s' ...\n", + SRCNAME, __func__, keyman ); if (CreateProcess (NULL, keyman, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi) == TRUE) Modified: trunk/src/gpgmsg.cpp =================================================================== --- trunk/src/gpgmsg.cpp 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/gpgmsg.cpp 2005-12-07 17:13:27 UTC (rev 133) @@ -654,7 +654,7 @@ break; } } - if (opt.default_key && *opt.default_key) + if (opt.enable_default_key && opt.default_key && *opt.default_key) rset[j++] = xstrdup (opt.default_key); rset[j] = NULL; Modified: trunk/src/intern.h =================================================================== --- trunk/src/intern.h 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/intern.h 2005-12-07 17:13:27 UTC (rev 133) @@ -97,8 +97,8 @@ int save_decrypted_attach; /* Save decrypted attachments. */ int auto_sign_attach; /* Sign all outgoing attachments. */ int enc_format; /* Encryption format for attachments. */ - char *default_key; /* Malloced default key or NULL. */ - int add_default_key; /* Always also encrypt to the default key. */ + char *default_key; /* The key we want to always encrypt to. */ + int enable_default_key; /* Enable the use of DEFAULT_KEY. */ int preview_decrypt; /* Decrypt in preview window. */ /* The compatibility flags. */ Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/main.c 2005-12-07 17:13:27 UTC (rev 133) @@ -62,7 +62,6 @@ multiple prompts for attachment encryption are issued. */ opt.enc_format = GPG_FMT_CLASSIC; - opt.add_default_key = 1; } @@ -385,8 +384,8 @@ opt.preview_decrypt = val == NULL || *val != '1'? 0 : 1; xfree (val); val = NULL; - load_extension_value ("addDefaultKey", &val); - opt.add_default_key = val == NULL || *val != '1' ? 0 : 1; + load_extension_value ("enableDefaultKey", &val); + opt.enable_default_key = val == NULL || *val != '1' ? 0 : 1; xfree (val); val = NULL; load_extension_value ("storePasswdTime", &val); @@ -448,7 +447,6 @@ } table[] = { {"encryptDefault", 0, opt.encrypt_default}, {"signDefault", 0, opt.sign_default}, - {"addDefaultKey", 0, opt.add_default_key}, {"saveDecryptedAttachments", 0, opt.save_decrypted_attach}, {"autoSignAttachments", 0, opt.auto_sign_attach}, {"previewDecrypt", 0, opt.preview_decrypt}, @@ -456,6 +454,7 @@ {"encodingFormat", 1, opt.enc_format}, {"logFile", 2, 0, logfile}, {"defaultKey", 2, 0, opt.default_key}, + {"enableDefaultKey", 0, opt.enable_default_key}, {NULL, 0} }; char buf[32]; Modified: trunk/src/olflange-dlgs.cpp =================================================================== --- trunk/src/olflange-dlgs.cpp 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/olflange-dlgs.cpp 2005-12-07 17:13:27 UTC (rev 133) @@ -44,7 +44,6 @@ BOOL bMsgResult = FALSE; static LPNMHDR pnmhdr; static HWND hWndPage; - static int enable = 1; switch (uMsg) { @@ -71,9 +70,9 @@ } } - enable = !!(opt.default_key && *opt.default_key); - EnableWindow (GetDlgItem (hDlg, IDC_ENCRYPT_TO), enable? TRUE:FALSE); - if (enable == 1) + EnableWindow (GetDlgItem (hDlg, IDC_ENCRYPT_TO), + !!opt.enable_default_key); + if (opt.enable_default_key) CheckDlgButton (hDlg, IDC_ENCRYPT_WITH_STANDARD_KEY, BST_CHECKED); SetDlgItemText (hDlg, IDC_VERSION_INFO, "Version "VERSION " ("__DATE__")"); @@ -111,9 +110,9 @@ case WM_COMMAND: if (HIWORD (wParam) == BN_CLICKED && LOWORD (wParam) == IDC_ENCRYPT_WITH_STANDARD_KEY) { - enable ^= 1; + opt.enable_default_key = !opt.enable_default_key; EnableWindow (GetDlgItem (hDlg, IDC_ENCRYPT_TO), - enable==0? FALSE: TRUE); + !!opt.enable_default_key); } if (LOWORD(wParam) == IDC_GPG_OPTIONS) config_dialog_box (hDlg); @@ -129,8 +128,10 @@ case PSN_SETACTIVE: { TCHAR s[30]; - if (opt.default_key) + if (opt.default_key && *opt.default_key) SetDlgItemText (hDlg, IDC_ENCRYPT_TO, opt.default_key); + else + SetDlgItemText (hDlg, IDC_ENCRYPT_TO, ""); wsprintf(s, "%d", opt.passwd_ttl); SendDlgItemMessage(hDlg, IDC_TIME_PHRASES, WM_SETTEXT, 0, (LPARAM) s); @@ -140,8 +141,7 @@ SendDlgItemMessage (hDlg, IDC_SIGN_DEFAULT, BM_SETCHECK, !!opt.sign_default, 0L); SendDlgItemMessage (hDlg, IDC_ENCRYPT_WITH_STANDARD_KEY, - BM_SETCHECK, - (opt.add_default_key && enable), 0L); + BM_SETCHECK, opt.enable_default_key, 0L); SendDlgItemMessage (hDlg, IDC_SAVE_DECRYPTED, BM_SETCHECK, !!opt.save_decrypted_attach, 0L); SendDlgItemMessage (hDlg, IDC_SIGN_ATTACHMENTS, BM_SETCHECK, @@ -153,27 +153,27 @@ case PSN_APPLY: { TCHAR s[201]; + + opt.enable_default_key = !!SendDlgItemMessage + (hDlg, IDC_ENCRYPT_WITH_STANDARD_KEY, BM_GETCHECK, 0, 0L); - GetDlgItemText (hDlg, IDC_ENCRYPT_TO, s, 200); - if (strlen (s) > 0 && strchr (s, ' ')) { - MessageBox (hDlg, - "The default key may not contain any spaces.", - "Outlook GnuPG-Plugin", MB_ICONERROR|MB_OK); - bMsgResult = PSNRET_INVALID_NOCHANGEPAGE ; - break; - } - if (!*s) - opt.add_default_key = 0; - else - opt.add_default_key = !!SendDlgItemMessage - (hDlg, IDC_ENCRYPT_WITH_STANDARD_KEY, BM_GETCHECK, 0, 0L); - + GetDlgItemText (hDlg, IDC_ENCRYPT_TO, s, 200); + if (strlen (s) > 0 && strchr (s, ' ')) + { + if (opt.enable_default_key) + { + MessageBox (hDlg,_("The default key may not" + " contain any spaces."), + "GPGol", MB_ICONERROR|MB_OK); + bMsgResult = PSNRET_INVALID_NOCHANGEPAGE; + break; + } + } + set_default_key (s); + SendDlgItemMessage (hDlg, IDC_TIME_PHRASES, WM_GETTEXT, 20, (LPARAM)s); opt.passwd_ttl = (int)atol (s); - SendDlgItemMessage (hDlg, IDC_ENCRYPT_TO, WM_GETTEXT, - 200, (LPARAM)s); - set_default_key (s); opt.encrypt_default = !!SendDlgItemMessage (hDlg, IDC_ENCRYPT_DEFAULT, BM_GETCHECK, 0, 0L); Modified: trunk/src/olflange.cpp =================================================================== --- trunk/src/olflange.cpp 2005-12-06 10:49:01 UTC (rev 132) +++ trunk/src/olflange.cpp 2005-12-07 17:13:27 UTC (rev 133) @@ -681,6 +681,8 @@ CGPGExchExt::Install(LPEXCHEXTCALLBACK pEECB, ULONG lContext, ULONG lFlags) { ULONG lBuildVersion; + ULONG lActualVersion; + ULONG lVirtualVersion; /* Save the context in an instance variable. */ m_lContext = lContext; @@ -705,6 +707,25 @@ /* Check version. */ pEECB->GetVersion (&lBuildVersion, EECBGV_GETBUILDVERSION); + pEECB->GetVersion (&lActualVersion, EECBGV_GETACTUALVERSION); + pEECB->GetVersion (&lVirtualVersion, EECBGV_GETVIRTUALVERSION); + log_debug ("GPGol: detected Outlook build version 0x%lx (%lu.%lu)\n", + lBuildVersion, + (lBuildVersion & EECBGV_BUILDVERSION_MAJOR_MASK) >> 16, + (lBuildVersion & EECBGV_BUILDVERSION_MINOR_MASK)); + log_debug ("GPGol: actual version 0x%lx (%u.%u.%u.%u)\n", + lActualVersion, + (unsigned int)((lActualVersion >> 24) & 0xff), + (unsigned int)((lActualVersion >> 16) & 0xff), + (unsigned int)((lActualVersion >> 8) & 0xff), + (unsigned int)(lActualVersion & 0xff)); + log_debug ("GPGol: virtual version 0x%lx (%u.%u.%u.%u)\n", + lVirtualVersion, + (unsigned int)((lVirtualVersion >> 24) & 0xff), + (unsigned int)((lVirtualVersion >> 16) & 0xff), + (unsigned int)((lVirtualVersion >> 8) & 0xff), + (unsigned int)(lVirtualVersion & 0xff)); + if (EECBGV_BUILDVERSION_MAJOR != (lBuildVersion & EECBGV_BUILDVERSION_MAJOR_MASK)) { @@ -712,6 +733,27 @@ SRCNAME, __func__, lBuildVersion); return S_FALSE; } + if ((lBuildVersion & EECBGV_BUILDVERSION_MINOR_MASK) < 1573) + { + static int shown; + HWND hwnd; + + if (!shown) + { + shown = 1; + + if (FAILED(pEECB->GetWindow (&hwnd))) + hwnd = NULL; + MessageBox (hwnd, + _("This version of Outlook is too old!\n\n" + "At least versions of Outlook 2003 older than SP2 " + "exhibit crashes when sending messages and messages " + "might get stuck in the outgoing queue.\n\n" + "Please update at least to SP2 before trying to send " + "a message"), + "GPGol", MB_ICONSTOP|MB_OK); + } + } /* Check context. */ @@ -793,7 +835,6 @@ log_debug ("%s:%s: received\n", SRCNAME, __func__); if (opt.preview_decrypt) { - TRACEPOINT (); HRESULT hr; HWND hWnd = NULL; LPMESSAGE pMessage = NULL; From cvs at cvs.gnupg.org Wed Dec 7 18:16:54 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Dec 7 17:41:50 2005 Subject: [svn] GPGol - r134 - tags Message-ID: Author: wk Date: 2005-12-07 18:16:53 +0100 (Wed, 07 Dec 2005) New Revision: 134 Added: tags/gpgol-0.9.5/ Log: tagged release Copied: tags/gpgol-0.9.5 (from rev 133, trunk) From cvs at cvs.gnupg.org Wed Dec 7 23:25:59 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed Dec 7 22:50:55 2005 Subject: [svn] GnuPG - r3955 - trunk/keyserver Message-ID: Author: dshaw Date: 2005-12-07 23:25:58 +0100 (Wed, 07 Dec 2005) New Revision: 3955 Modified: trunk/keyserver/ChangeLog trunk/keyserver/gpgkeys_curl.c trunk/keyserver/ksutil.c Log: * ksutil.c (curl_err_to_gpg_err): Add CURLE_OK and CURLE_COULDNT_CONNECT. * gpgkeys_curl.c (get_key): Give key-not-found error if no data is found (or file itself is not found) during a fetch. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2005-12-06 21:10:34 UTC (rev 3954) +++ trunk/keyserver/ChangeLog 2005-12-07 22:25:58 UTC (rev 3955) @@ -1,3 +1,11 @@ +2005-12-07 David Shaw + + * ksutil.c (curl_err_to_gpg_err): Add CURLE_OK and + CURLE_COULDNT_CONNECT. + + * gpgkeys_curl.c (get_key): Give key-not-found error if no data is + found (or file itself is not found) during a fetch. + 2005-12-06 David Shaw * curl-shim.c (curl_easy_perform): Fix build warning (code before Modified: trunk/keyserver/gpgkeys_curl.c =================================================================== --- trunk/keyserver/gpgkeys_curl.c 2005-12-06 21:10:34 UTC (rev 3954) +++ trunk/keyserver/gpgkeys_curl.c 2005-12-07 22:25:58 UTC (rev 3955) @@ -50,6 +50,7 @@ char errorbuffer[CURL_ERROR_SIZE]; char request[MAX_URL]; struct curl_writer_ctx ctx; + int ret=KEYSERVER_OK; memset(&ctx,0,sizeof(ctx)); @@ -70,14 +71,21 @@ res=curl_easy_perform(curl); if(res!=CURLE_OK) { - fprintf(console,"gpgkeys: %s fetch error %d: %s\n",opt->scheme, - res,errorbuffer); - fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); + fprintf(console,"gpgkeys: unable to fetch %s: %s\n",request,errorbuffer); + ret=curl_err_to_gpg_err(res); } + else if(!ctx.done) + { + fprintf(console,"gpgkeys: no key data found for %s\n",request); + ret=KEYSERVER_KEY_NOT_FOUND; + } + + if(ret) + fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,ret); else fprintf(output,"\nKEY 0x%s END\n",getkey); - return curl_err_to_gpg_err(res); + return ret; } static void Modified: trunk/keyserver/ksutil.c =================================================================== --- trunk/keyserver/ksutil.c 2005-12-06 21:10:34 UTC (rev 3954) +++ trunk/keyserver/ksutil.c 2005-12-07 22:25:58 UTC (rev 3955) @@ -46,6 +46,7 @@ static void catch_alarm(int foo) { + (void)foo; _exit(KEYSERVER_TIMEOUT); } @@ -362,8 +363,10 @@ { switch(error) { + case CURLE_OK: return KEYSERVER_OK; + case CURLE_UNSUPPORTED_PROTOCOL: return KEYSERVER_SCHEME_NOT_FOUND; + case CURLE_COULDNT_CONNECT: return KEYSERVER_UNREACHABLE; case CURLE_FTP_COULDNT_RETR_FILE: return KEYSERVER_KEY_NOT_FOUND; - case CURLE_UNSUPPORTED_PROTOCOL: return KEYSERVER_SCHEME_NOT_FOUND; default: return KEYSERVER_INTERNAL_ERROR; } } From cvs at cvs.gnupg.org Wed Dec 7 23:34:13 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed Dec 7 22:59:08 2005 Subject: [svn] GnuPG - r3956 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-07 23:34:11 +0100 (Wed, 07 Dec 2005) New Revision: 3956 Modified: trunk/g10/ChangeLog trunk/g10/gpg.c trunk/g10/keyserver-internal.h trunk/g10/keyserver.c Log: * keyserver.c (keyserver_spawn): Don't print "searching for key 00000000" when fetching a URI. * keyserver-internal.h, keyserver.c (keyserver_fetch): New. Fetch an arbitrary URI using the keyserver helpers. * gpg.c (main): Call it from here for --fetch-keys. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-07 22:25:58 UTC (rev 3955) +++ trunk/g10/ChangeLog 2005-12-07 22:34:11 UTC (rev 3956) @@ -1,3 +1,13 @@ +2005-12-07 David Shaw + + * keyserver.c (keyserver_spawn): Don't print "searching for key + 00000000" when fetching a URI. + + * keyserver-internal.h, keyserver.c (keyserver_fetch): New. Fetch + an arbitrary URI using the keyserver helpers. + + * gpg.c (main): Call it from here for --fetch-keys. + 2005-11-20 David Shaw * main.h, keylist.c (print_revokers): New. Print the "rvk" Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2005-12-07 22:25:58 UTC (rev 3955) +++ trunk/g10/gpg.c 2005-12-07 22:34:11 UTC (rev 3956) @@ -127,6 +127,8 @@ aSendKeys, aRecvKeys, aSearchKeys, + aRefreshKeys, + aFetchKeys, aExport, aExportSecret, aExportSecretSub, @@ -149,7 +151,6 @@ aGenRandom, aPipeMode, aRebuildKeydbCaches, - aRefreshKeys, aCardStatus, aCardEdit, aChangePIN, @@ -399,6 +400,7 @@ N_("search for keys on a key server") }, { aRefreshKeys, "refresh-keys", 256, N_("update all keys from a keyserver")}, + { aFetchKeys, "fetch-keys" , 256, "@" }, { aExportSecret, "export-secret-keys" , 256, "@" }, { aExportSecretSub, "export-secret-subkeys" , 256, "@" }, { aImport, "import", 256 , N_("import/merge keys")}, @@ -1901,6 +1903,7 @@ case aRecvKeys: case aSearchKeys: case aRefreshKeys: + case aFetchKeys: case aExport: set_cmd (&cmd, pargs.r_opt); break; @@ -3389,6 +3392,16 @@ free_strlist(sl); break; + case aFetchKeys: + sl = NULL; + for( ; argc; argc--, argv++ ) + add_to_strlist2( &sl, *argv, utf8_strings ); + rc=keyserver_fetch(sl); + if(rc) + log_error("key fetch failed: %s\n",g10_errstr(rc)); + free_strlist(sl); + break; + case aExportSecret: sl = NULL; for( ; argc; argc--, argv++ ) Modified: trunk/g10/keyserver-internal.h =================================================================== --- trunk/g10/keyserver-internal.h 2005-12-07 22:25:58 UTC (rev 3955) +++ trunk/g10/keyserver-internal.h 2005-12-07 22:34:11 UTC (rev 3956) @@ -40,5 +40,6 @@ int keyserver_import_keyid(u32 *keyid,struct keyserver_spec *keyserver); int keyserver_refresh(STRLIST users); int keyserver_search(STRLIST tokens); +int keyserver_fetch(STRLIST urilist); #endif /* !_KEYSERVER_INTERNAL_H_ */ Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-07 22:25:58 UTC (rev 3955) +++ trunk/g10/keyserver.c 2005-12-07 22:34:11 UTC (rev 3956) @@ -883,7 +883,7 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, int count,int *prog,struct keyserver_spec *keyserver) { - int ret=0,i,gotversion=0,outofband=0; + int ret=0,i,gotversion=0,outofband=0,quiet=0; STRLIST temp; unsigned int maxlen,buflen; char *command,*end,*searchstr=NULL; @@ -1047,18 +1047,26 @@ else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID) fprintf(spawn->tochild,"0x%08lX\n", (ulong)desc[i].u.kid[1]); + else if(desc[i].mode==KEYDB_SEARCH_MODE_EXACT) + { + fprintf(spawn->tochild,"0x0000000000000000\n"); + quiet=1; + } else if(desc[i].mode==KEYDB_SEARCH_MODE_NONE) continue; else BUG(); - if(keyserver->host) - log_info(_("requesting key %s from %s server %s\n"), - keystr_from_desc(&desc[i]), - keyserver->scheme,keyserver->host); - else - log_info(_("requesting key %s from %s\n"), - keystr_from_desc(&desc[i]),keyserver->uri); + if(!quiet) + { + if(keyserver->host) + log_info(_("requesting key %s from %s server %s\n"), + keystr_from_desc(&desc[i]), + keyserver->scheme,keyserver->host); + else + log_info(_("requesting key %s from %s\n"), + keystr_from_desc(&desc[i]),keyserver->uri); + } } fprintf(spawn->tochild,"\n"); @@ -1705,7 +1713,7 @@ /* Note this is different than the original HKP refresh. It allows usernames to refresh only part of the keyring. */ -int +int keyserver_refresh(STRLIST users) { int rc,count,numdesc,fakev3=0; @@ -1802,3 +1810,34 @@ else return 0; } + +int +keyserver_fetch(STRLIST urilist) +{ + KEYDB_SEARCH_DESC desc; + STRLIST sl; + + /* A dummy desc since we're not actually fetching a particular key + ID */ + memset(&desc,0,sizeof(desc)); + desc.mode=KEYDB_SEARCH_MODE_EXACT; + + for(sl=urilist;sl;sl=sl->next) + { + struct keyserver_spec *spec; + + spec=parse_keyserver_uri(sl->d,1,NULL,0); + if(spec) + { + int rc=keyserver_work(GET,NULL,&desc,1,spec); + if(rc) + log_info("WARNING: unable to fetch URI %s: %s\n", + sl->d,g10_errstr(rc)); + free_keyserver_spec(spec); + } + else + log_info("WARNING: unable to parse URI %s\n",sl->d); + } + + return 0; +} From cvs at cvs.gnupg.org Thu Dec 8 00:00:31 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed Dec 7 23:25:26 2005 Subject: [svn] GnuPG - r3957 - trunk/keyserver Message-ID: Author: dshaw Date: 2005-12-08 00:00:30 +0100 (Thu, 08 Dec 2005) New Revision: 3957 Modified: trunk/keyserver/ChangeLog trunk/keyserver/gpgkeys_curl.c trunk/keyserver/gpgkeys_finger.c Log: * gpgkeys_finger.c (get_key), gpgkeys_curl.c (get_key): Better language for the key-not-found error. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2005-12-07 22:34:11 UTC (rev 3956) +++ trunk/keyserver/ChangeLog 2005-12-07 23:00:30 UTC (rev 3957) @@ -1,5 +1,8 @@ 2005-12-07 David Shaw + * gpgkeys_finger.c (get_key), gpgkeys_curl.c (get_key): Better + language for the key-not-found error. + * ksutil.c (curl_err_to_gpg_err): Add CURLE_OK and CURLE_COULDNT_CONNECT. Modified: trunk/keyserver/gpgkeys_curl.c =================================================================== --- trunk/keyserver/gpgkeys_curl.c 2005-12-07 22:34:11 UTC (rev 3956) +++ trunk/keyserver/gpgkeys_curl.c 2005-12-07 23:00:30 UTC (rev 3957) @@ -50,7 +50,6 @@ char errorbuffer[CURL_ERROR_SIZE]; char request[MAX_URL]; struct curl_writer_ctx ctx; - int ret=KEYSERVER_OK; memset(&ctx,0,sizeof(ctx)); @@ -71,21 +70,19 @@ res=curl_easy_perform(curl); if(res!=CURLE_OK) { - fprintf(console,"gpgkeys: unable to fetch %s: %s\n",request,errorbuffer); - ret=curl_err_to_gpg_err(res); + fprintf(console,"gpgkeys: %s fetch error %d: %s\n",opt->scheme, + res,errorbuffer); + fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); } else if(!ctx.done) { fprintf(console,"gpgkeys: no key data found for %s\n",request); - ret=KEYSERVER_KEY_NOT_FOUND; + fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,KEYSERVER_KEY_NOT_FOUND); } - - if(ret) - fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,ret); else fprintf(output,"\nKEY 0x%s END\n",getkey); - return ret; + return curl_err_to_gpg_err(res); } static void Modified: trunk/keyserver/gpgkeys_finger.c =================================================================== --- trunk/keyserver/gpgkeys_finger.c 2005-12-07 22:34:11 UTC (rev 3956) +++ trunk/keyserver/gpgkeys_finger.c 2005-12-07 23:00:30 UTC (rev 3957) @@ -339,9 +339,9 @@ fprintf (output,"KEY 0x%s END\n", getkey); else { - fprintf (console,"gpgkeys: key %s not found on keyserver\n",getkey); - fprintf (output,"KEY 0x%s FAILED %d\n", - getkey,KEYSERVER_KEY_NOT_FOUND); + fprintf(console,"gpgkeys: no key data found for finger:%s\n", + opt->opaque); + fprintf(output,"KEY 0x%s FAILED %d\n",getkey,KEYSERVER_KEY_NOT_FOUND); } xfree(line); From cvs at cvs.gnupg.org Thu Dec 8 06:29:36 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Dec 8 05:54:30 2005 Subject: [svn] GnuPG - r3958 - trunk/doc Message-ID: Author: dshaw Date: 2005-12-08 06:29:35 +0100 (Thu, 08 Dec 2005) New Revision: 3958 Modified: trunk/doc/ChangeLog trunk/doc/gpg.sgml Log: * gpg.sgml: Document -d. Add [file] to a few options. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2005-12-07 23:00:30 UTC (rev 3957) +++ trunk/doc/ChangeLog 2005-12-08 05:29:35 UTC (rev 3958) @@ -1,3 +1,7 @@ +2005-12-07 David Shaw + + * gpg.sgml: Document -d. Add [file] to a few options. + 2005-11-17 David Shaw * gpg.sgml: Clarify "xxxxx-clean" and "clean". Document Modified: trunk/doc/gpg.sgml =================================================================== --- trunk/doc/gpg.sgml 2005-12-07 23:00:30 UTC (rev 3957) +++ trunk/doc/gpg.sgml 2005-12-08 05:29:35 UTC (rev 3958) @@ -105,7 +105,7 @@ --s, --sign +-s, --sign &OptParmFile; Make a signature. This command may be combined with --encrypt (for a signed and encrypted message), --symmetric (for a signed and @@ -116,21 +116,21 @@ ---clearsign +--clearsign &OptParmFile; Make a clear text signature. --b, --detach-sign +-b, --detach-sign &OptParmFile; Make a detached signature. --e, --encrypt +-e, --encrypt &OptParmFile; Encrypt data. This option may be combined with --sign (for a signed and encrypted message), --symmetric (for a message that may be @@ -141,7 +141,7 @@ --c, --symmetric +-c, --symmetric &OptParmFile; Encrypt with a symmetric cipher using a passphrase. The default symmetric cipher used is CAST5, but may be chosen with the @@ -154,14 +154,14 @@ ---store +--store &OptParmFile; Store only (make a simple RFC1991 packet). ---decrypt &OptParmFile; +-d, --decrypt &OptParmFile; Decrypt &ParmFile; (or stdin if no file is specified) and write it to stdout (or the file specified with From cvs at cvs.gnupg.org Thu Dec 8 06:52:42 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Dec 8 06:17:38 2005 Subject: [svn] GnuPG - r3959 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-08 06:52:41 +0100 (Thu, 08 Dec 2005) New Revision: 3959 Modified: trunk/g10/ChangeLog trunk/g10/keyserver.c trunk/g10/options.h Log: * options.h, keyserver.c (curl_cant_handle, keyserver_spawn, keyserver_fetch): Set a flag to indicate that we're doing a direct URI fetch so we can differentiate between a keyserver operation and a URI fetch for protocols like LDAP that can do either. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-08 05:29:35 UTC (rev 3958) +++ trunk/g10/ChangeLog 2005-12-08 05:52:41 UTC (rev 3959) @@ -1,3 +1,10 @@ +2005-12-08 David Shaw + + * options.h, keyserver.c (curl_cant_handle, keyserver_spawn, + keyserver_fetch): Set a flag to indicate that we're doing a direct + URI fetch so we can differentiate between a keyserver operation + and a URI fetch for protocols like LDAP that can do either. + 2005-12-07 David Shaw * keyserver.c (keyserver_spawn): Don't print "searching for key Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-08 05:29:35 UTC (rev 3958) +++ trunk/g10/keyserver.c 2005-12-08 05:52:41 UTC (rev 3959) @@ -867,9 +867,9 @@ /* The PGP LDAP and the curl fetch-a-LDAP-object methodologies are sufficiently different that we can't use curl to do LDAP. */ static int -curl_cant_handle(const char *scheme) +curl_cant_handle(const char *scheme,unsigned int direct_uri) { - if(strcmp(scheme,"ldap")==0 || strcmp(scheme,"ldaps")==0) + if(!direct_uri && (strcmp(scheme,"ldap")==0 || strcmp(scheme,"ldaps")==0)) return 1; return 0; @@ -883,7 +883,7 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, int count,int *prog,struct keyserver_spec *keyserver) { - int ret=0,i,gotversion=0,outofband=0,quiet=0; + int ret=0,i,gotversion=0,outofband=0; STRLIST temp; unsigned int maxlen,buflen; char *command,*end,*searchstr=NULL; @@ -928,7 +928,7 @@ /* If exec-path was set, and DISABLE_KEYSERVER_PATH is undefined, then don't specify a full path to gpgkeys_foo, so that the PATH can work. */ - command=xmalloc(GPGKEYS_PREFIX_LEN+strlen(scheme)+1); + command=xmalloc(GPGKEYS_PREFIX_LEN+strlen(scheme)+3+1); command[0]='\0'; } else @@ -936,7 +936,7 @@ { /* Specify a full path to gpgkeys_foo. */ command=xmalloc(strlen(libexecdir)+strlen(DIRSEP_S)+ - GPGKEYS_PREFIX_LEN+strlen(scheme)+1); + GPGKEYS_PREFIX_LEN+strlen(scheme)+3+1); strcpy(command,libexecdir); strcat(command,DIRSEP_S); } @@ -946,8 +946,12 @@ strcat(command,GPGKEYS_PREFIX); strcat(command,scheme); + if(keyserver->flags.direct_uri) + strcat(command,"uri"); + #ifdef GPGKEYS_CURL - if(!curl_cant_handle(scheme) && path_access(command,X_OK)!=0) + if(!curl_cant_handle(scheme,keyserver->flags.direct_uri) + && path_access(command,X_OK)!=0) strcpy(end,GPGKEYS_CURL); #endif @@ -1018,6 +1022,8 @@ for(i=0;id,1,NULL,0); if(spec) { - int rc=keyserver_work(GET,NULL,&desc,1,spec); + int rc; + + /* + Set the direct_uri flag so we know later to call a direct + handler instead of the keyserver style. This lets us use + gpgkeys_curl or gpgkeys_ldapuri instead of gpgkeys_ldap to + fetch things like + ldap://keyserver.pgp.com/o=PGP%20keys?pgpkey?sub?pgpkeyid=99242560 + */ + spec->flags.direct_uri=1; + + rc=keyserver_work(GET,NULL,&desc,1,spec); if(rc) log_info("WARNING: unable to fetch URI %s: %s\n", sl->d,g10_errstr(rc)); + free_keyserver_spec(spec); } else Modified: trunk/g10/options.h =================================================================== --- trunk/g10/options.h 2005-12-08 05:29:35 UTC (rev 3958) +++ trunk/g10/options.h 2005-12-08 05:52:41 UTC (rev 3959) @@ -134,6 +134,10 @@ char *port; char *path; char *opaque; + struct + { + unsigned int direct_uri:1; + } flags; } *keyserver; struct { From cvs at cvs.gnupg.org Thu Dec 8 08:42:42 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu Dec 8 08:07:37 2005 Subject: [svn] GnuPG - r3960 - in trunk: g10 scripts Message-ID: Author: wk Date: 2005-12-08 08:42:41 +0100 (Thu, 08 Dec 2005) New Revision: 3960 Modified: trunk/g10/ChangeLog trunk/g10/keyserver.c trunk/g10/mainproc.c trunk/g10/pkclist.c trunk/scripts/w32installer.nsi Log: Made strings translatable. Minor fixes. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-08 05:52:41 UTC (rev 3959) +++ trunk/g10/ChangeLog 2005-12-08 07:42:41 UTC (rev 3960) @@ -1,3 +1,7 @@ +2005-12-08 Werner Koch + + * keyserver.c (keyserver_fetch): Made strings translatable. + 2005-12-08 David Shaw * options.h, keyserver.c (curl_cant_handle, keyserver_spawn, @@ -15,6 +19,10 @@ * gpg.c (main): Call it from here for --fetch-keys. +2005-12-07 Werner Koch + + * pkclist.c (do_we_trust): Add NOTREACHED comment. + 2005-11-20 David Shaw * main.h, keylist.c (print_revokers): New. Print the "rvk" @@ -363,7 +371,6 @@ --passphrase command line option. Only useful in very special circumstances. ->>>>>>> .r3884 2005-08-05 Werner Koch * gpgv.c (keyserver_import_fprint): New stub. Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-08 05:52:41 UTC (rev 3959) +++ trunk/g10/keyserver.c 2005-12-08 07:42:41 UTC (rev 3960) @@ -1848,13 +1848,13 @@ rc=keyserver_work(GET,NULL,&desc,1,spec); if(rc) - log_info("WARNING: unable to fetch URI %s: %s\n", + log_info (_("WARNING: unable to fetch URI %s: %s\n"), sl->d,g10_errstr(rc)); free_keyserver_spec(spec); } else - log_info("WARNING: unable to parse URI %s\n",sl->d); + log_info (_("WARNING: unable to parse URI %s\n"),sl->d); } return 0; Modified: trunk/g10/mainproc.c =================================================================== --- trunk/g10/mainproc.c 2005-12-08 05:52:41 UTC (rev 3959) +++ trunk/g10/mainproc.c 2005-12-08 07:42:41 UTC (rev 3960) @@ -62,7 +62,7 @@ PKT_user_id *last_user_id; md_filter_context_t mfx; int sigs_only; /* process only signatures and reject all other stuff */ - int encrypt_only; /* process only encrytion messages */ + int encrypt_only; /* process only encryption messages */ STRLIST signed_data; const char *sigfilename; DEK *dek; Modified: trunk/g10/pkclist.c =================================================================== --- trunk/g10/pkclist.c 2005-12-08 05:52:41 UTC (rev 3959) +++ trunk/g10/pkclist.c 2005-12-08 07:42:41 UTC (rev 3960) @@ -436,7 +436,7 @@ return 1; /* yes */ } - return 1; /* yes */ + return 1; /*NOTREACHED*/ } Modified: trunk/scripts/w32installer.nsi =================================================================== --- trunk/scripts/w32installer.nsi 2005-12-08 05:52:41 UTC (rev 3959) +++ trunk/scripts/w32installer.nsi 2005-12-08 07:42:41 UTC (rev 3960) @@ -1,4 +1,4 @@ -; w32installer.nsi -*- mode: lisp; coding: latin-1; -*- +; w32installer.nsi -*- coding: latin-1; -*- ; W32 Installer script ; Copyright (C) 2005 Free Software Foundation, Inc. ; From cvs at cvs.gnupg.org Thu Dec 8 16:28:14 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu Dec 8 15:53:05 2005 Subject: [svn] gcry - r1141 - branches/LIBGCRYPT-1-2-BRANCH Message-ID: Author: wk Date: 2005-12-08 16:28:08 +0100 (Thu, 08 Dec 2005) New Revision: 1141 Modified: branches/LIBGCRYPT-1-2-BRANCH/ChangeLog branches/LIBGCRYPT-1-2-BRANCH/THANKS branches/LIBGCRYPT-1-2-BRANCH/configure.ac Log: Changed NetBSd's name of random device Modified: branches/LIBGCRYPT-1-2-BRANCH/ChangeLog =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/ChangeLog 2005-11-26 15:58:08 UTC (rev 1140) +++ branches/LIBGCRYPT-1-2-BRANCH/ChangeLog 2005-12-08 15:28:08 UTC (rev 1141) @@ -1,3 +1,8 @@ +2005-12-08 Werner Koch + + * configure.ac: Changed the random device names for netbsd. From + Christian Biere. + 2005-10-05 Werner Koch Released 1.2.2. Modified: branches/LIBGCRYPT-1-2-BRANCH/THANKS =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/THANKS 2005-11-26 15:58:08 UTC (rev 1140) +++ branches/LIBGCRYPT-1-2-BRANCH/THANKS 2005-12-08 15:28:08 UTC (rev 1141) @@ -14,6 +14,7 @@ Caskey L. Dickson caskey@technocage.com Cees van de Griend cees-list@griend.xs4all.nl Charles Levert charles@comm.polymtl.ca +Christian Biere christianbiere@gmx.de Christian Grothoff grothoff@cs.purdue.edu Christian von Roques roques@pond.sub.org Christopher Oliver oliver@fritz.traverse.net Modified: branches/LIBGCRYPT-1-2-BRANCH/configure.ac =================================================================== --- branches/LIBGCRYPT-1-2-BRANCH/configure.ac 2005-11-26 15:58:08 UTC (rev 1140) +++ branches/LIBGCRYPT-1-2-BRANCH/configure.ac 2005-12-08 15:28:08 UTC (rev 1141) @@ -204,14 +204,14 @@ case "${target}" in - *-openbsd* | *-netbsd*) + *-openbsd*) # FIXME: Are these the best flags for OpenBSD? NAME_OF_DEV_RANDOM="/dev/srandom" NAME_OF_DEV_URANDOM="/dev/urandom" # DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x" ;; - *-solaris* | *-irix* | *-dec-osf* ) + *-solaris* | *-irix* | *-dec-osf* | *-netbsd* ) NAME_OF_DEV_RANDOM="/dev/random" NAME_OF_DEV_URANDOM="/dev/random" # DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC" From cvs at cvs.gnupg.org Thu Dec 8 16:34:17 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Thu Dec 8 15:59:10 2005 Subject: [svn] gcry - r1142 - in trunk: . cipher doc tests Message-ID: Author: wk Date: 2005-12-08 16:34:16 +0100 (Thu, 08 Dec 2005) New Revision: 1142 Modified: trunk/ChangeLog trunk/THANKS trunk/cipher/ChangeLog trunk/cipher/dsa.c trunk/configure.ac trunk/doc/gcrypt.texi trunk/tests/ChangeLog trunk/tests/benchmark.c trunk/tests/keygen.c Log: Assorted changeds Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/ChangeLog 2005-12-08 15:34:16 UTC (rev 1142) @@ -1,3 +1,8 @@ +2005-12-08 Werner Koch + + * configure.ac: Changed the random device names for netbsd. From + Christian Biere. + 2005-11-02 Moritz Schulte * NEWS: Documented minor API changes. Modified: trunk/THANKS =================================================================== --- trunk/THANKS 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/THANKS 2005-12-08 15:34:16 UTC (rev 1142) @@ -14,6 +14,7 @@ Caskey L. Dickson caskey@technocage.com Cees van de Griend cees-list@griend.xs4all.nl Charles Levert charles@comm.polymtl.ca +Christian Biere christianbiere@gmx.de Christian Grothoff grothoff@cs.purdue.edu Christian von Roques roques@pond.sub.org Christopher Oliver oliver@fritz.traverse.net Modified: trunk/cipher/ChangeLog =================================================================== --- trunk/cipher/ChangeLog 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/cipher/ChangeLog 2005-12-08 15:34:16 UTC (rev 1142) @@ -9,6 +9,12 @@ * pubkey.c (gcry_pk_algo_info): Don't forget to break after switch case. +2005-09-19 Werner Koch + + * dsa.c (generate): Add preliminary support for 2 and 4 keys. + Return an error code if the key size is not supported. + (_gcry_dsa_generate): Return an error. + 2005-08-22 Werner Koch * primegen.c (check_prime): New arg RM_ROUNDS. Modified: trunk/cipher/dsa.c =================================================================== --- trunk/cipher/dsa.c 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/cipher/dsa.c 2005-12-08 15:34:16 UTC (rev 1142) @@ -50,8 +50,8 @@ static gcry_mpi_t gen_k (gcry_mpi_t q); static void test_keys (DSA_secret_key *sk, unsigned qbits); static int check_secret_key (DSA_secret_key *sk); -static void generate (DSA_secret_key *sk, unsigned nbits, - gcry_mpi_t **ret_factors); +static gpg_err_code_t generate (DSA_secret_key *sk, unsigned nbits, + gcry_mpi_t **ret_factors); static void sign (gcry_mpi_t r, gcry_mpi_t s, gcry_mpi_t input, DSA_secret_key *skey); static int verify (gcry_mpi_t r, gcry_mpi_t s, gcry_mpi_t input, @@ -172,7 +172,7 @@ Returns: 2 structures filled with all needed values and an array with the n-1 factors of (p-1) */ -static void +static gpg_err_code_t generate( DSA_secret_key *sk, unsigned nbits, gcry_mpi_t **ret_factors ) { gcry_mpi_t p; /* the prime */ @@ -182,11 +182,21 @@ gcry_mpi_t x; /* the secret exponent */ gcry_mpi_t h, e; /* helper */ unsigned qbits; - byte *rndbuf; + unsigned char *rndbuf; - assert( nbits >= 512 && nbits <= 1024 ); + if ( nbits >= 512 && nbits <= 1024 ) + qbits = 160; + else if ( nbits == 2048 ) + qbits = 224; + else if ( nbits == 3072 ) + qbits = 256; +/* else if ( nbits == 7680 ) */ +/* qbits = 384; */ +/* else if ( nbits == 15360 ) */ +/* qbits = 512; */ + else + return GPG_ERR_INV_VALUE; - qbits = 160; p = _gcry_generate_elg_prime( 1, nbits, qbits, NULL, ret_factors ); /* get q out of factors */ q = mpi_copy((*ret_factors)[0]); @@ -263,6 +273,7 @@ /* Now we can test our keys (this should never fail!). */ test_keys( sk, qbits ); + return 0; } @@ -374,16 +385,20 @@ _gcry_dsa_generate (int algo, unsigned nbits, unsigned long dummy, gcry_mpi_t *skey, gcry_mpi_t **retfactors) { + gpg_err_code_t err; DSA_secret_key sk; - generate (&sk, nbits, retfactors); - skey[0] = sk.p; - skey[1] = sk.q; - skey[2] = sk.g; - skey[3] = sk.y; - skey[4] = sk.x; + err = generate (&sk, nbits, retfactors); + if (!err) + { + skey[0] = sk.p; + skey[1] = sk.q; + skey[2] = sk.g; + skey[3] = sk.y; + skey[4] = sk.x; + } - return GPG_ERR_NO_ERROR; + return err; } Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/configure.ac 2005-12-08 15:34:16 UTC (rev 1142) @@ -210,14 +210,14 @@ case "${target}" in - *-openbsd* | *-netbsd*) + *-openbsd*) # FIXME: Are these the best flags for OpenBSD? NAME_OF_DEV_RANDOM="/dev/srandom" NAME_OF_DEV_URANDOM="/dev/urandom" # DYNLINK_MOD_CFLAGS="-shared -rdynamic $CFLAGS_PIC -Wl,-Bshareable -Wl,-x" ;; - *-solaris* | *-irix* | *-dec-osf* ) + *-solaris* | *-irix* | *-dec-osf* | *-netbsd* ) NAME_OF_DEV_RANDOM="/dev/random" NAME_OF_DEV_URANDOM="/dev/random" # DYNLINK_MOD_CFLAGS="-shared $CFLAGS_PIC" Modified: trunk/doc/gcrypt.texi =================================================================== --- trunk/doc/gcrypt.texi 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/doc/gcrypt.texi 2005-12-08 15:34:16 UTC (rev 1142) @@ -1763,7 +1763,7 @@ Turn the algorithm into a HMAC message authentication algorithm. This does only work if just one algorithm is enabled for the handle and SHA-384 and SHA512 is not used. Note that the function -@code{gcry_md_setkey} must be used set the MAC key. If you want CBC +@code{gcry_md_setkey} must be used to set the MAC key. If you want CBC message authentication codes based on a cipher, see @xref{Working with cipher handles}. Modified: trunk/tests/ChangeLog =================================================================== --- trunk/tests/ChangeLog 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/tests/ChangeLog 2005-12-08 15:34:16 UTC (rev 1142) @@ -7,6 +7,10 @@ * Makefile.am (TESTS): Added keygrip. * keygrip.c: New. +2005-09-19 Werner Koch + + * benchmark.c (dsa_bench): New. + 2005-08-19 Werner Koch * hmac.c (main): Added all FIPS tests. Modified: trunk/tests/benchmark.c =================================================================== --- trunk/tests/benchmark.c 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/tests/benchmark.c 2005-12-08 15:34:16 UTC (rev 1142) @@ -28,6 +28,196 @@ #include #define PGM "benchmark" + +static const char sample_private_dsa_key_1024[] = +"(private-key\n" +" (dsa\n" +" (p #00A126202D592214C5A8F6016E2C3F4256052ACB1CB17D88E64B1293FAF08F5E4685" + "03E6F68366B326A56284370EB2103E92D8346A163E44A08FDC422AC8E9E44268557A" + "853539A6AF39353A59CE5E78FD98B57D0F3E3A7EBC8A256AC9A775BA59689F3004BF" + "C3035730C4C0C51626C5D7F5852637EC589BB29DAB46C161572E4B#)\n" +" (q #00DEB5A296421887179ECA1762884DE2AF8185AFC5#)\n" +" (g #3958B34AE7747194ECBD312F8FEE8CBE3918E94DF9FD11E2912E56318F33BDC38622" + "B18DDFF393074BCA8BAACF50DF27AEE529F3E8AEECE55C398DAB3A5E04C2EA142312" + "FACA2FE7F0A88884F8DAC3979EE67598F9A383B2A2325F035C796F352A5C3CDF2CB3" + "85AD24EC52A6E55247E1BB37D260F79E617D2A4446415B6AD79A#)\n" +" (y #519E9FE9AB0545A6724E74603B7B04E48DC1437E0284A11EA605A7BA8AB1CF354FD4" + "ECC93880AC293391C69B558AD84E7AAFA88F11D028CF3A378F241D6B056A90C588F6" + "66F68D27262B4DA84657D15057D371BCEC1F6504032507D5B881E45FC93A1B973155" + "D91C57219D090C3ACD75E7C2B9F1176A208AC03D6C12AC28A271#)\n" +" (x #4186F8A58C5DF46C5BCFC7006BEEBF05E93C0CA7#)\n" +"))\n"; + +static const char sample_public_dsa_key_1024[] = +"(public-key\n" +" (dsa\n" +" (p #00A126202D592214C5A8F6016E2C3F4256052ACB1CB17D88E64B1293FAF08F5E4685" + "03E6F68366B326A56284370EB2103E92D8346A163E44A08FDC422AC8E9E44268557A" + "853539A6AF39353A59CE5E78FD98B57D0F3E3A7EBC8A256AC9A775BA59689F3004BF" + "C3035730C4C0C51626C5D7F5852637EC589BB29DAB46C161572E4B#)\n" +" (q #00DEB5A296421887179ECA1762884DE2AF8185AFC5#)\n" +" (g #3958B34AE7747194ECBD312F8FEE8CBE3918E94DF9FD11E2912E56318F33BDC38622" + "B18DDFF393074BCA8BAACF50DF27AEE529F3E8AEECE55C398DAB3A5E04C2EA142312" + "FACA2FE7F0A88884F8DAC3979EE67598F9A383B2A2325F035C796F352A5C3CDF2CB3" + "85AD24EC52A6E55247E1BB37D260F79E617D2A4446415B6AD79A#)\n" +" (y #519E9FE9AB0545A6724E74603B7B04E48DC1437E0284A11EA605A7BA8AB1CF354FD4" + "ECC93880AC293391C69B558AD84E7AAFA88F11D028CF3A378F241D6B056A90C588F6" + "66F68D27262B4DA84657D15057D371BCEC1F6504032507D5B881E45FC93A1B973155" + "D91C57219D090C3ACD75E7C2B9F1176A208AC03D6C12AC28A271#)\n" +"))\n"; + + +static const char sample_private_dsa_key_2048[] = +"(private-key\n" +" (dsa\n" +" (p #00B54636673962B64F7DC23C71ACEF6E7331796F607560B194DFCC0CA370E858A365" + "A413152FB6EB8C664BD171AC316FE5B381CD084D07377571599880A068EF1382D85C" + "308B4E9DEAC12D66DE5C4A826EBEB5ED94A62E7301E18927E890589A2F230272A150" + "C118BC3DC2965AE0D05BE4F65C6137B2BA7EDABB192C3070D202C10AA3F534574970" + "71454DB8A73DDB6511A5BA98EF1450FD90DE5BAAFC9FD3AC22EBEA612DD075BB7405" + "D56866D125E33982C046808F7CEBA8E5C0B9F19A6FE451461660A1CBA9EF68891179" + "0256A573D3B8F35A5C7A0C6C31F2DB90E25A26845252AD9E485EF2D339E7B5890CD4" + "2F9C9F315ED409171EC35CA04CC06B275577B3#)\n" +" (q #00DA67989167FDAC4AE3DF9247A716859A30C0CF9C5A6DBA01EABA3481#)\n" +" (g #48E35DA584A089D05142AA63603FDB00D131B07A0781E2D5A8F9614D2B33D3E40A78" + "98A9E10CDBB612CF093F95A3E10D09566726F2C12823836B2D9CD974BB695665F3B3" + "5D219A9724B87F380BD5207EDA0AE38C79E8F18122C3F76E4CEB0ABED3250914987F" + "B30D4B9E19C04C28A5D4F45560AF586F6A1B41751EAD90AE7F044F4E2A4A50C1F508" + "4FC202463F478F678B9A19392F0D2961C5391C546EF365368BB46410C9C1CEE96E9F" + "0C953570C2ED06328B11C90E86E57CAA7FA5ABAA278E22A4C8C08E16EE59F484EC44" + "2CF55535BAA2C6BEA8833A555372BEFE1E665D3C7DAEF58061D5136331EF4EB61BC3" + "6EE4425A553AF8885FEA15A88135BE133520#)\n" +" (y #66E0D1A69D663466F8FEF2B7C0878DAC93C36A2FB2C05E0306A53B926021D4B92A1C" + "2FA6860061E88E78CBBBA49B0E12700F07DBF86F72CEB2927EDAC0C7E3969C3A47BB" + "4E0AE93D8BB3313E93CC7A72DFEEE442EFBC81B3B2AEC9D8DCBE21220FB760201D79" + "328C41C773866587A44B6954767D022A88072900E964089D9B17133603056C985C4F" + "8A0B648F297F8D2C3CB43E4371DC6002B5B12CCC085BDB2CFC5074A0587566187EE3" + "E11A2A459BD94726248BB8D6CC62938E11E284C2C183576FBB51749EB238C4360923" + "79C08CE1C8CD77EB57404CE9B4744395ACF721487450BADE3220576F2F816248B0A7" + "14A264330AECCB24DE2A1107847B23490897#)\n" +" (x #477BD14676E22563C5ABA68025CEBA2A48D485F5B2D4AD4C0EBBD6D0#)\n" +"))\n"; + + +static const char sample_public_dsa_key_2048[] = +"(public-key\n" +" (dsa\n" +" (p #00B54636673962B64F7DC23C71ACEF6E7331796F607560B194DFCC0CA370E858A365" + "A413152FB6EB8C664BD171AC316FE5B381CD084D07377571599880A068EF1382D85C" + "308B4E9DEAC12D66DE5C4A826EBEB5ED94A62E7301E18927E890589A2F230272A150" + "C118BC3DC2965AE0D05BE4F65C6137B2BA7EDABB192C3070D202C10AA3F534574970" + "71454DB8A73DDB6511A5BA98EF1450FD90DE5BAAFC9FD3AC22EBEA612DD075BB7405" + "D56866D125E33982C046808F7CEBA8E5C0B9F19A6FE451461660A1CBA9EF68891179" + "0256A573D3B8F35A5C7A0C6C31F2DB90E25A26845252AD9E485EF2D339E7B5890CD4" + "2F9C9F315ED409171EC35CA04CC06B275577B3#)\n" +" (q #00DA67989167FDAC4AE3DF9247A716859A30C0CF9C5A6DBA01EABA3481#)\n" +" (g #48E35DA584A089D05142AA63603FDB00D131B07A0781E2D5A8F9614D2B33D3E40A78" + "98A9E10CDBB612CF093F95A3E10D09566726F2C12823836B2D9CD974BB695665F3B3" + "5D219A9724B87F380BD5207EDA0AE38C79E8F18122C3F76E4CEB0ABED3250914987F" + "B30D4B9E19C04C28A5D4F45560AF586F6A1B41751EAD90AE7F044F4E2A4A50C1F508" + "4FC202463F478F678B9A19392F0D2961C5391C546EF365368BB46410C9C1CEE96E9F" + "0C953570C2ED06328B11C90E86E57CAA7FA5ABAA278E22A4C8C08E16EE59F484EC44" + "2CF55535BAA2C6BEA8833A555372BEFE1E665D3C7DAEF58061D5136331EF4EB61BC3" + "6EE4425A553AF8885FEA15A88135BE133520#)\n" +" (y #66E0D1A69D663466F8FEF2B7C0878DAC93C36A2FB2C05E0306A53B926021D4B92A1C" + "2FA6860061E88E78CBBBA49B0E12700F07DBF86F72CEB2927EDAC0C7E3969C3A47BB" + "4E0AE93D8BB3313E93CC7A72DFEEE442EFBC81B3B2AEC9D8DCBE21220FB760201D79" + "328C41C773866587A44B6954767D022A88072900E964089D9B17133603056C985C4F" + "8A0B648F297F8D2C3CB43E4371DC6002B5B12CCC085BDB2CFC5074A0587566187EE3" + "E11A2A459BD94726248BB8D6CC62938E11E284C2C183576FBB51749EB238C4360923" + "79C08CE1C8CD77EB57404CE9B4744395ACF721487450BADE3220576F2F816248B0A7" + "14A264330AECCB24DE2A1107847B23490897#)\n" +"))\n"; + + +static const char sample_private_dsa_key_3072[] = +"(private-key\n" +" (dsa\n" +" (p #00BA73E148AEA5E8B64878AF5BE712B8302B9671C5F3EEB7722A9D0D9868D048C938" + "877C91C335C7819292E69C7D34264F1578E32EC2DA8408DF75D0EB76E0D3030B84B5" + "62D8EF93AB53BAB6B8A5DE464F5CA87AEA43BDCF0FB0B7815AA3114CFC84FD916A83" + "B3D5FD78390189332232E9D037D215313FD002FF46C048B66703F87FAE092AAA0988" + "AC745336EBE672A01DEDBD52395783579B67CF3AE1D6F1602CCCB12154FA0E00AE46" + "0D9B289CF709194625BCB919B11038DEFC50ADBBA20C3F320078E4E9529B4F6848E2" + "AB5E6278DB961FE226F2EEBD201E071C48C5BEF98B4D9BEE42C1C7102D893EBF8902" + "D7A91266340AFD6CE1D09E52282FFF5B97EAFA3886A3FCF84FF76D1E06538D0D8E60" + "B3332145785E07D29A5965382DE3470D1D888447FA9C00A2373378FC3FA7B9F7D17E" + "95A6A5AE1397BE46D976EF2C96E89913AC4A09351CA661BF6F67E30407DA846946C7" + "62D9BAA6B77825097D3E7B886456BB32E3E74516BF3FD93D71B257AA8F723E01CE33" + "8015353D3778B02B892AF7#)\n" +" (q #00BFF3F3CC18FA018A5B8155A8695E1E4939660D5E4759322C39D50F3B93E5F68B#)\n" +" (g #6CCFD8219F5FCE8EF2BEF3262929787140847E38674B1EF8DB20255E212CB6330EC4" + "DFE8A26AB7ECC5760DEB9BBF59A2B2821D510F1868172222867558B8D204E889C474" + "7CA30FBF9D8CF41AE5D5BD845174641101593849FF333E6C93A6550931B2B9D56B98" + "9CAB01729D9D736FA6D24A74D2DDE1E9E648D141473E443DD6BBF0B3CAB64F9FE4FC" + "134B2EB57437789F75C744DF1FA67FA8A64603E5441BC7ECE29E00BDF262BDC81E8C" + "7330A18A412DE38E7546D342B89A0AF675A89E6BEF00540EB107A2FE74EA402B0D89" + "F5C02918DEEEAF8B8737AC866B09B50810AB8D8668834A1B9E1E53866E2B0A926FAB" + "120A0CDE5B3715FFFE6ACD1AB73588DCC1EC4CE9392FE57F8D1D35811200CB07A0E6" + "374E2C4B0AEB7E3D077B8545C0E438DCC0F1AE81E186930E99EBC5B91B77E92803E0" + "21602887851A4FFDB3A7896AC655A0901218C121C5CBB0931E7D5EAC243F37711B5F" + "D5A62B1B38A83F03D8F6703D8B98DF367FC8A76990335F62173A5391836F0F2413EC" + "4997AF9EB55C6660B01A#)\n" +" (y #2320B22434C5DB832B4EC267CC52E78DD5CCFA911E8F0804E7E7F32B186B2D4167AE" + "4AA6869822E76400492D6A193B0535322C72B0B7AA4A87E33044FDC84BE24C64A053" + "A37655EE9EABDCDC1FDF63F3F1C677CEB41595DF7DEFE9178D85A3D621B4E4775492" + "8C0A58D2458D06F9562E4DE2FE6129A64063A99E88E54485B97484A28188C4D33F15" + "DDC903B6CEA0135E3E3D27B4EA39319696305CE93D7BA7BE00367DBE3AAF43491E71" + "CBF254744A5567F5D70090D6139E0C990239627B3A1C5B20B6F9F6374B8D8D8A8997" + "437265BE1E3B4810D4B09254400DE287A0DFFBAEF339E48D422B1D41A37E642BC026" + "73314701C8FA9792845C129351A87A945A03E6C895860E51D6FB8B7340A94D1A8A7B" + "FA85AC83B4B14E73AB86CB96C236C8BFB0978B61B2367A7FE4F7891070F56C78D5DD" + "F5576BFE5BE4F333A4E2664E79528B3294907AADD63F4F2E7AA8147B928D8CD69765" + "3DB98C4297CB678046ED55C0DBE60BF7142C594603E4D705DC3D17270F9F086EC561" + "2703D518D8D49FF0EBE6#)\n" +" (x #00A9FFFC88E67D6F7B810E291C050BAFEA7FC4A75E8D2F16CFED3416FD77607232#)\n" +"))\n"; + +static const char sample_public_dsa_key_3072[] = +"(public-key\n" +" (dsa\n" +" (p #00BA73E148AEA5E8B64878AF5BE712B8302B9671C5F3EEB7722A9D0D9868D048C938" + "877C91C335C7819292E69C7D34264F1578E32EC2DA8408DF75D0EB76E0D3030B84B5" + "62D8EF93AB53BAB6B8A5DE464F5CA87AEA43BDCF0FB0B7815AA3114CFC84FD916A83" + "B3D5FD78390189332232E9D037D215313FD002FF46C048B66703F87FAE092AAA0988" + "AC745336EBE672A01DEDBD52395783579B67CF3AE1D6F1602CCCB12154FA0E00AE46" + "0D9B289CF709194625BCB919B11038DEFC50ADBBA20C3F320078E4E9529B4F6848E2" + "AB5E6278DB961FE226F2EEBD201E071C48C5BEF98B4D9BEE42C1C7102D893EBF8902" + "D7A91266340AFD6CE1D09E52282FFF5B97EAFA3886A3FCF84FF76D1E06538D0D8E60" + "B3332145785E07D29A5965382DE3470D1D888447FA9C00A2373378FC3FA7B9F7D17E" + "95A6A5AE1397BE46D976EF2C96E89913AC4A09351CA661BF6F67E30407DA846946C7" + "62D9BAA6B77825097D3E7B886456BB32E3E74516BF3FD93D71B257AA8F723E01CE33" + "8015353D3778B02B892AF7#)\n" +" (q #00BFF3F3CC18FA018A5B8155A8695E1E4939660D5E4759322C39D50F3B93E5F68B#)\n" +" (g #6CCFD8219F5FCE8EF2BEF3262929787140847E38674B1EF8DB20255E212CB6330EC4" + "DFE8A26AB7ECC5760DEB9BBF59A2B2821D510F1868172222867558B8D204E889C474" + "7CA30FBF9D8CF41AE5D5BD845174641101593849FF333E6C93A6550931B2B9D56B98" + "9CAB01729D9D736FA6D24A74D2DDE1E9E648D141473E443DD6BBF0B3CAB64F9FE4FC" + "134B2EB57437789F75C744DF1FA67FA8A64603E5441BC7ECE29E00BDF262BDC81E8C" + "7330A18A412DE38E7546D342B89A0AF675A89E6BEF00540EB107A2FE74EA402B0D89" + "F5C02918DEEEAF8B8737AC866B09B50810AB8D8668834A1B9E1E53866E2B0A926FAB" + "120A0CDE5B3715FFFE6ACD1AB73588DCC1EC4CE9392FE57F8D1D35811200CB07A0E6" + "374E2C4B0AEB7E3D077B8545C0E438DCC0F1AE81E186930E99EBC5B91B77E92803E0" + "21602887851A4FFDB3A7896AC655A0901218C121C5CBB0931E7D5EAC243F37711B5F" + "D5A62B1B38A83F03D8F6703D8B98DF367FC8A76990335F62173A5391836F0F2413EC" + "4997AF9EB55C6660B01A#)\n" +" (y #2320B22434C5DB832B4EC267CC52E78DD5CCFA911E8F0804E7E7F32B186B2D4167AE" + "4AA6869822E76400492D6A193B0535322C72B0B7AA4A87E33044FDC84BE24C64A053" + "A37655EE9EABDCDC1FDF63F3F1C677CEB41595DF7DEFE9178D85A3D621B4E4775492" + "8C0A58D2458D06F9562E4DE2FE6129A64063A99E88E54485B97484A28188C4D33F15" + "DDC903B6CEA0135E3E3D27B4EA39319696305CE93D7BA7BE00367DBE3AAF43491E71" + "CBF254744A5567F5D70090D6139E0C990239627B3A1C5B20B6F9F6374B8D8D8A8997" + "437265BE1E3B4810D4B09254400DE287A0DFFBAEF339E48D422B1D41A37E642BC026" + "73314701C8FA9792845C129351A87A945A03E6C895860E51D6FB8B7340A94D1A8A7B" + "FA85AC83B4B14E73AB86CB96C236C8BFB0978B61B2367A7FE4F7891070F56C78D5DD" + "F5576BFE5BE4F333A4E2664E79528B3294907AADD63F4F2E7AA8147B928D8CD69765" + "3DB98C4297CB678046ED55C0DBE60BF7142C594603E4D705DC3D17270F9F086EC561" + "2703D518D8D49FF0EBE6#)\n" +"))\n"; + + +#define DIM(v) (sizeof(v)/sizeof((v)[0])) +#define DIMof(type,member) DIM(((type *)0)->member) #define BUG() do {fprintf ( stderr, "Ooops at %s:%d\n", __FILE__ , __LINE__ );\ exit(2);} while(0) @@ -313,7 +503,106 @@ } + static void +dsa_bench (void) +{ + gpg_error_t err; + gcry_sexp_t pub_key[3], sec_key[3]; + int p_sizes[3] = { 1024, 2048, 3072 }; + int q_sizes[3] = { 160, 224, 256 }; + gcry_sexp_t data; + gcry_sexp_t sig; + int i, j; + + err = gcry_sexp_sscan (pub_key+0, NULL, sample_public_dsa_key_1024, + strlen (sample_public_dsa_key_1024)); + if (!err) + err = gcry_sexp_sscan (sec_key+0, NULL, sample_private_dsa_key_1024, + strlen (sample_private_dsa_key_1024)); + if (!err) + err = gcry_sexp_sscan (pub_key+1, NULL, sample_public_dsa_key_2048, + strlen (sample_public_dsa_key_2048)); + if (!err) + err = gcry_sexp_sscan (sec_key+1, NULL, sample_private_dsa_key_2048, + strlen (sample_private_dsa_key_2048)); + if (!err) + err = gcry_sexp_sscan (pub_key+2, NULL, sample_public_dsa_key_3072, + strlen (sample_public_dsa_key_3072)); + if (!err) + err = gcry_sexp_sscan (sec_key+2, NULL, sample_private_dsa_key_3072, + strlen (sample_private_dsa_key_3072)); + if (err) + { + fprintf (stderr, PGM ": converting sample keys failed: %s\n", + gcry_strerror (err)); + exit (1); + } + + + fputs ("DSA 100 times sign verify\n" + "-----------------------------\n", stdout); + for (i=0; i < DIM (q_sizes); i++) + { + gcry_mpi_t x; + + x = gcry_mpi_new (q_sizes[i]); + gcry_mpi_randomize (x, q_sizes[i], GCRY_WEAK_RANDOM); + err = gcry_sexp_build (&data, NULL, "(data (flags raw) (value %m))", x); + gcry_mpi_release (x); + if (err) + { + fprintf (stderr, PGM ": converting data failed: %s\n", + gcry_strerror (err)); + exit (1); + } + + printf ("DSA %d/%d ", p_sizes[i], q_sizes[i]); + start_timer (); + for (j=0; j < 100; j++) + { + err = gcry_pk_sign (&sig, data, sec_key[i]); + if (err) + { + putchar ('\n'); + fprintf (stderr, PGM ": signing failed: %s\n", + gpg_strerror (err)); + exit (1); + } + } + stop_timer (); + printf (" %s", elapsed_time ()); + + start_timer (); + for (j=0; j < 100; j++) + { + err = gcry_pk_verify (sig, data, pub_key[i]); + if (err) + { + putchar ('\n'); + fprintf (stderr, PGM ": verify failed: %s\n", + gpg_strerror (err)); + exit (1); + } + } + stop_timer (); + printf (" %s\n", elapsed_time ()); + + gcry_sexp_release (sig); + gcry_sexp_release (data); + } + + + for (i=0; i < DIM (q_sizes); i++) + { + gcry_sexp_release (sec_key[i]); + gcry_sexp_release (pub_key[i]); + } +} + + + +static void do_powm ( const char *n_str, const char *e_str, const char *m_str) { gcry_mpi_t e, n, msg, cip; @@ -382,6 +671,14 @@ if (argc) { argc--; argv++; } + gcry_control (GCRYCTL_DISABLE_SECMEM, 0); + if (!gcry_check_version (GCRYPT_VERSION)) + { + fprintf (stderr, PGM ": version mismatch\n"); + exit (1); + } + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + if ( !argc ) { md_bench (NULL); @@ -393,7 +690,8 @@ random_bench (); } else if ( !strcmp (*argv, "--help")) - fputs ("usage: benchmark [md|cipher|random|mpi [algonames]]\n", stdout); + fputs ("usage: benchmark [md|cipher|random|mpi|dsa [algonames]]\n", + stdout); else if ( !strcmp (*argv, "random")) { random_bench (); @@ -418,6 +716,10 @@ { mpi_bench (); } + else if ( !strcmp (*argv, "dsa")) + { + dsa_bench (); + } else { fprintf (stderr, PGM ": bad arguments\n"); Modified: trunk/tests/keygen.c =================================================================== --- trunk/tests/keygen.c 2005-12-08 15:28:08 UTC (rev 1141) +++ trunk/tests/keygen.c 2005-12-08 15:34:16 UTC (rev 1142) @@ -124,6 +124,28 @@ int rc; if (verbose) + fprintf (stderr, "creating 2048 bit DSA key using old interface\n"); + rc = gcry_sexp_new (&keyparm, + "(genkey\n" + " (dsa\n" + " (nbits 4:2048)\n" + " ))", 0, 1); + if (rc) + die ("error creating S-expression: %s\n", gpg_strerror (rc)); + rc = gcry_pk_genkey (&key, keyparm); + gcry_sexp_release (keyparm); + if (rc) + die ("error generating DSA key: %s\n", gpg_strerror (rc)); + { + char buffer[20000]; + gcry_sexp_sprint (key, GCRYSEXP_FMT_ADVANCED, buffer, sizeof buffer); + printf ("=============================\n%s\n" + "=============================\n", buffer); + } + gcry_sexp_release (key); + exit (0); + + if (verbose) fprintf (stderr, "creating 1024 bit RSA key using old interface\n"); rc = gcry_sexp_new (&keyparm, "(genkey\n" @@ -140,6 +162,7 @@ check_generated_rsa_key (key, 65537); gcry_sexp_release (key); + if (verbose) fprintf (stderr, "creating 512 bit RSA key with e=257\n"); rc = gcry_sexp_new (&keyparm, From cvs at cvs.gnupg.org Thu Dec 8 16:37:28 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Dec 8 16:02:22 2005 Subject: [svn] GnuPG - r3961 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-08 16:37:26 +0100 (Thu, 08 Dec 2005) New Revision: 3961 Modified: trunk/g10/ChangeLog trunk/g10/keyserver.c Log: * keyserver.c (keyserver_fetch): Switch on fast-import before we --fetch-keys so we don't rebuild the trustdb after each fetch. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-08 07:42:41 UTC (rev 3960) +++ trunk/g10/ChangeLog 2005-12-08 15:37:26 UTC (rev 3961) @@ -1,3 +1,8 @@ +2005-12-08 David Shaw + + * keyserver.c (keyserver_fetch): Switch on fast-import before we + --fetch-keys so we don't rebuild the trustdb after each fetch. + 2005-12-08 Werner Koch * keyserver.c (keyserver_fetch): Made strings translatable. Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-08 07:42:41 UTC (rev 3960) +++ trunk/g10/keyserver.c 2005-12-08 15:37:26 UTC (rev 3961) @@ -1822,7 +1822,13 @@ { KEYDB_SEARCH_DESC desc; STRLIST sl; + unsigned int options=opt.keyserver_options.import_options; + /* Switch on fast-import, since fetch can handle more than one + import and we don't want each set to rebuild the trustdb. + Instead we do it once at the end. */ + opt.keyserver_options.import_options|=IMPORT_FAST; + /* A dummy desc since we're not actually fetching a particular key ID */ memset(&desc,0,sizeof(desc)); @@ -1857,5 +1863,12 @@ log_info (_("WARNING: unable to parse URI %s\n"),sl->d); } + opt.keyserver_options.import_options=options; + + /* If the original options didn't have fast import, and the trustdb + is dirty, rebuild. */ + if(!(opt.keyserver_options.import_options&IMPORT_FAST)) + trustdb_check_or_update(); + return 0; } From cvs at cvs.gnupg.org Thu Dec 8 20:40:01 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Thu Dec 8 20:04:52 2005 Subject: [svn] GnuPG - r3962 - trunk/doc Message-ID: Author: dshaw Date: 2005-12-08 20:39:59 +0100 (Thu, 08 Dec 2005) New Revision: 3962 Modified: trunk/doc/ChangeLog trunk/doc/gpg.sgml Log: * gpg.sgml: Document --fetch-keys. Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2005-12-08 15:37:26 UTC (rev 3961) +++ trunk/doc/ChangeLog 2005-12-08 19:39:59 UTC (rev 3962) @@ -1,3 +1,7 @@ +2005-12-08 David Shaw + + * gpg.sgml: Document --fetch-keys. + 2005-12-07 David Shaw * gpg.sgml: Document -d. Add [file] to a few options. Modified: trunk/doc/gpg.sgml =================================================================== --- trunk/doc/gpg.sgml 2005-12-08 15:37:26 UTC (rev 3961) +++ trunk/doc/gpg.sgml 2005-12-08 19:39:59 UTC (rev 3962) @@ -44,6 +44,7 @@ n"> flags"> string"> +URIs"> value"> name=value"> name=value1 value2 value3 ..."> @@ -741,7 +742,7 @@ ---search-keys &OptParmNames; +--search-keys &ParmNames; Search the keyserver for the given names. Multiple names given here will be joined together to create the search string for the keyserver. @@ -753,6 +754,14 @@ +--fetch-keys &ParmURIs; + +Retrieve keys located at the specified URIs. Note that different +installations of GnuPG may support different protocols (HTTP, FTP, +LDAP, etc.) + + + --update-trustdb Do trust database maintenance. This command iterates over all keys From cvs at cvs.gnupg.org Fri Dec 9 00:35:48 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 9 00:00:40 2005 Subject: [svn] GnuPG - r3963 - trunk Message-ID: Author: dshaw Date: 2005-12-09 00:35:47 +0100 (Fri, 09 Dec 2005) New Revision: 3963 Modified: trunk/ChangeLog trunk/NEWS Log: * NEWS: Note --fetch-keys. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-08 19:39:59 UTC (rev 3962) +++ trunk/ChangeLog 2005-12-08 23:35:47 UTC (rev 3963) @@ -1,3 +1,7 @@ +2005-12-08 David Shaw + + * NEWS: Note --fetch-keys. + 2005-12-06 David Shaw * configure.ac: UINT64_C test needs #include . Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-12-08 19:39:59 UTC (rev 3962) +++ trunk/NEWS 2005-12-08 23:35:47 UTC (rev 3963) @@ -42,7 +42,13 @@ "import-minimal" commands for --export-options and --import-options. + * New --fetch-keys command to retrieve keys by specifying a URI. + This allows direct key retrieval from a web page or other + location that can be specified in a URI. Available protocols + are HTTP and finger, plus anything that cURL supplies, if built + with cURL support. + Noteworthy changes in version 1.4.2 (2005-07-26) ------------------------------------------------ From cvs at cvs.gnupg.org Mon Dec 12 04:56:01 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon Dec 12 04:20:33 2005 Subject: [svn] GnuPG - r3964 - trunk/util Message-ID: Author: dshaw Date: 2005-12-12 04:56:01 +0100 (Mon, 12 Dec 2005) New Revision: 3964 Modified: trunk/util/ChangeLog trunk/util/ttyio.c Log: * ttyio.c (tty_enable_completion, tty_disable_completion): Add checks for no_terminal so we don't try to open("/dev/tty") when invoked with --no-tty. Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-08 23:35:47 UTC (rev 3963) +++ trunk/util/ChangeLog 2005-12-12 03:56:01 UTC (rev 3964) @@ -1,3 +1,9 @@ +2005-12-10 Ryan Lortie (dshaw) + + * ttyio.c (tty_enable_completion, tty_disable_completion): Add + checks for no_terminal so we don't try to open("/dev/tty") when + invoked with --no-tty. + 2005-12-06 David Shaw * Makefile.am: Some cleanup so we don't build files that are Modified: trunk/util/ttyio.c =================================================================== --- trunk/util/ttyio.c 2005-12-08 23:35:47 UTC (rev 3963) +++ trunk/util/ttyio.c 2005-12-12 03:56:01 UTC (rev 3964) @@ -179,8 +179,12 @@ void tty_enable_completion(rl_completion_func_t *completer) { + if( no_terminal ) + return; + if( !initialized ) init_ttyfp(); + rl_attempted_completion_function=completer; rl_inhibit_completion=0; } @@ -188,8 +192,12 @@ void tty_disable_completion(void) { + if( no_terminal ) + return; + if( !initialized ) init_ttyfp(); + rl_inhibit_completion=1; } #endif /*HAVE_LIBREADLINE*/ From cvs at cvs.gnupg.org Wed Dec 14 10:55:41 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Wed Dec 14 10:20:02 2005 Subject: [svn] GnuPG - r3965 - branches/GNUPG-1-9-BRANCH/tools Message-ID: Author: wk Date: 2005-12-14 10:55:40 +0100 (Wed, 14 Dec 2005) New Revision: 3965 Modified: branches/GNUPG-1-9-BRANCH/tools/ChangeLog branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c Log: Add support for direct pkcs#7 signatures Modified: branches/GNUPG-1-9-BRANCH/tools/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-12-12 03:56:01 UTC (rev 3964) +++ branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-12-14 09:55:40 UTC (rev 3965) @@ -1,3 +1,8 @@ +2005-12-14 Werner Koch + + * gpgparsemail.c (pkcs7_begin): New. + (parse_message, message_cb): Add support of direct pkcs signatures. + 2005-10-19 Werner Koch * gpgconf-comp.c (gc_options_scdaemon): New option --disable-keypad. Modified: branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c 2005-12-12 03:56:01 UTC (rev 3964) +++ branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c 2005-12-14 09:55:40 UTC (rev 3965) @@ -60,13 +60,17 @@ int show_boundary; int nesting_level; + int is_pkcs7; /* Old style S/MIME message. */ + int gpgsm_mime; /* gpgsm shall be used from S/MIME. */ char *signing_protocol; int hashing_level; /* The nesting level we are hashing. */ int hashing; FILE *hash_file; - FILE *sig_file; - int verify_now; /* Falg set when all signature data is + + FILE *sig_file; /* Signature part with MIME or full + pkcs7 data if IS_PCKS7 is set. */ + int verify_now; /* Flag set when all signature data is available. */ }; @@ -183,7 +187,10 @@ } /* Keep our data fd and format it for gpg/gpgsm use. */ - sprintf (data_fd_buf, "-&%d", data_fd); + if (data_fd == -1) + *data_fd_buf = 0; + else + sprintf (data_fd_buf, "-&%d", data_fd); /* Send stdout to the bit bucket. */ fd = open ("/dev/null", O_WRONLY); @@ -214,7 +221,7 @@ "--assume-base64", "--verify", "--", - "-", data_fd_buf, + "-", data_fd == -1? NULL : data_fd_buf, NULL); die ("failed to exec the crypto command: %s", strerror (errno)); @@ -287,10 +294,19 @@ { int close_list[10]; - assert (info->hash_file); - assert (info->sig_file); - rewind (info->hash_file); - rewind (info->sig_file); + if (info->is_pkcs7) + { + assert (!info->hash_file); + assert (info->sig_file); + rewind (info->sig_file); + } + else + { + assert (info->hash_file); + assert (info->sig_file); + rewind (info->hash_file); + rewind (info->sig_file); + } /* printf ("# Begin hashed data\n"); */ /* while ( (c=getc (info->hash_file)) != EOF) */ @@ -304,7 +320,8 @@ /* rewind (info->sig_file); */ close_list[0] = -1; - run_gnupg (1, fileno (info->sig_file), fileno (info->hash_file), close_list); + run_gnupg (1, fileno (info->sig_file), + info->hash_file ? fileno (info->hash_file) : -1, close_list); } @@ -353,7 +370,31 @@ } +/* Prepare for old-style pkcs7 messages. */ +static void +pkcs7_begin (struct parse_info_s *info, rfc822parse_t msg, + rfc822parse_field_t field_ctx) +{ + const char *s; + s = rfc822parse_query_parameter (field_ctx, "name", 0); + if (s) + printf ("h pkcs7.name: %s\n", s); + if (info->is_pkcs7) + err ("note: ignoring nested pkcs7 data"); + else + { + info->is_pkcs7 = 1; + if (opt_crypto) + { + assert (!info->sig_file); + info->sig_file = tmpfile (); + if (!info->sig_file) + die ("error creating temp file: %s", strerror (errno)); + } + } +} + /* Print the event received by the parser for debugging as comment line. */ static void @@ -439,6 +480,10 @@ else if (!strcmp (s2, "encrypted")) mime_encrypted_begin (info, msg, ctx); } + else if (!strcmp (s1, "application") + && (!strcmp (s2, "pkcs7-mime") + || !strcmp (s2, "x-pkcs7-mime"))) + pkcs7_begin (info, msg, ctx); } else printf ("h media: %*s none\n", info->nesting_level*2, ""); @@ -581,11 +626,13 @@ if (info.verify_now) { verify_signature (&info); - fclose (info.hash_file); + if (info.hash_file) + fclose (info.hash_file); info.hash_file = NULL; fclose (info.sig_file); info.sig_file = NULL; info.gpgsm_mime = 0; + info.is_pkcs7 = 0; } else { @@ -621,6 +668,14 @@ } + if (info.sig_file && opt_crypto && info.is_pkcs7) + { + verify_signature (&info); + fclose (info.sig_file); + info.sig_file = NULL; + info.is_pkcs7 = 0; + } + rfc822parse_close (msg); } From cvs at cvs.gnupg.org Wed Dec 14 15:52:05 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Wed Dec 14 15:16:40 2005 Subject: [svn] GnuPG - r3966 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-14 15:52:04 +0100 (Wed, 14 Dec 2005) New Revision: 3966 Modified: trunk/g10/ChangeLog trunk/g10/gpg.c Log: * gpg.c (main): Don't default to import-options convert-sk-to-pk. It causes confusing warning messages when importing a PGP-exported key that contains a secret key without selfsigs followed by the public key. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-14 09:55:40 UTC (rev 3965) +++ trunk/g10/ChangeLog 2005-12-14 14:52:04 UTC (rev 3966) @@ -1,3 +1,10 @@ +2005-12-14 David Shaw + + * gpg.c (main): Don't default to import-options convert-sk-to-pk. + It causes confusing warning messages when importing a PGP-exported + key that contains a secret key without selfsigs followed by the + public key. + 2005-12-08 David Shaw * keyserver.c (keyserver_fetch): Switch on fast-import before we Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2005-12-14 09:55:40 UTC (rev 3965) +++ trunk/g10/gpg.c 2005-12-14 14:52:04 UTC (rev 3966) @@ -1693,7 +1693,6 @@ opt.pgp2_workarounds = 1; opt.force_v3_sigs = 1; opt.escape_from = 1; - opt.import_options=IMPORT_SK2PK; opt.export_options=EXPORT_ATTRIBUTES; opt.keyserver_options.import_options=IMPORT_REPAIR_PKS_SUBKEY_BUG; opt.keyserver_options.export_options=EXPORT_ATTRIBUTES; From cvs at cvs.gnupg.org Fri Dec 16 16:52:49 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Fri Dec 16 16:16:53 2005 Subject: [svn] GnuPG - r3967 - in branches/GNUPG-1-9-BRANCH: . agent doc tools Message-ID: Author: wk Date: 2005-12-16 16:52:48 +0100 (Fri, 16 Dec 2005) New Revision: 3967 Modified: branches/GNUPG-1-9-BRANCH/NEWS branches/GNUPG-1-9-BRANCH/TODO branches/GNUPG-1-9-BRANCH/agent/ChangeLog branches/GNUPG-1-9-BRANCH/agent/minip12.c branches/GNUPG-1-9-BRANCH/doc/tools.texi branches/GNUPG-1-9-BRANCH/tools/ChangeLog branches/GNUPG-1-9-BRANCH/tools/Makefile.am branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c Log: Fixed importing certs created by newer versions of Mozilla. Modified: branches/GNUPG-1-9-BRANCH/NEWS =================================================================== --- branches/GNUPG-1-9-BRANCH/NEWS 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/NEWS 2005-12-16 15:52:48 UTC (rev 3967) @@ -4,7 +4,12 @@ * [scdaemon] Support for keypads of some readers. Tested only with SPR532. New option --disable-keypad. + * New debug tool gpgparsemail. + * Importing pkcs#12 files created be recent versions of Mozilla works + again. + + Noteworthy changes in version 1.9.19 (2005-09-12) ------------------------------------------------- Modified: branches/GNUPG-1-9-BRANCH/TODO =================================================================== --- branches/GNUPG-1-9-BRANCH/TODO 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/TODO 2005-12-16 15:52:48 UTC (rev 3967) @@ -94,3 +94,7 @@ * sm/ ** --include-certs is as of now still a dummy command line option +** check that we issue NO_SECKEY xxx if a -u key was not found + +* gpg/ +** issue a NO_SECKEY xxxx if a -u key was not found. Modified: branches/GNUPG-1-9-BRANCH/agent/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/agent/ChangeLog 2005-12-16 15:52:48 UTC (rev 3967) @@ -1,3 +1,13 @@ +2005-12-16 Werner Koch + + * minip12.c (cram_octet_string): New + (p12_parse): Use it for NDEFed bags. + (parse_bag_data): Ditto. + (string_to_key, set_key_iv, crypt_block): New arg SALTLEN. + (p12_build): Use old value 8 for new arg. + (parse_bag_encrypted_data, parse_bag_data): Allow for salts of 8 + to 16 bytes. Add new arg R_CONSUMED. + 2005-11-24 Werner Koch * minip12.c (p12_parse): Fixed for case that the key object comes Modified: branches/GNUPG-1-9-BRANCH/agent/minip12.c =================================================================== --- branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/agent/minip12.c 2005-12-16 15:52:48 UTC (rev 3967) @@ -141,7 +141,8 @@ /* Parse the buffer at the address BUFFER which is of SIZE and return the tag and the length part from the TLV triplet. Update BUFFER - and SIZE on success. */ + and SIZE on success. Checks that the encoded length does not + exhaust the length of the provided buffer. */ static int parse_tag (unsigned char const **buffer, size_t *size, struct tag_info *ti) { @@ -221,8 +222,76 @@ } +/* Given an ASN.1 chunk of a structure like: + + 24 NDEF: OCTET STRING -- This is not passed to us + 04 1: OCTET STRING -- INPUT point s to here + : 30 + 04 1: OCTET STRING + : 80 + [...] + 04 2: OCTET STRING + : 00 00 + : } -- This denotes a Null tag and are the last + -- two bytes in INPUT. + + Create a new buffer with the content of that octet string. INPUT + is the orginal buffer with a length as stored at LENGTH. Returns + NULL on error or a new malloced buffer with the length of this new + buffer stored at LENGTH and the number of bytes parsed from input + are added to the value stored at INPUT_CONSUMED. INPUT_CONSUMED is + allowed to be passed as NULL if the caller is not interested in + this value. */ +static unsigned char * +cram_octet_string (const unsigned char *input, size_t *length, + size_t *input_consumed) +{ + const unsigned char *s = input; + size_t n = *length; + unsigned char *output, *d; + struct tag_info ti; + + /* Allocate output buf. We know that it won't be longer than the + input buffer. */ + d = output = gcry_malloc (n); + if (!output) + goto bailout; + + for (;;) + { + if (parse_tag (&s, &n, &ti)) + goto bailout; + if (ti.class == UNIVERSAL && ti.tag == TAG_OCTET_STRING + && !ti.ndef && !ti.is_constructed) + { + memcpy (d, s, ti.length); + s += ti.length; + d += ti.length; + n -= ti.length; + } + else if (ti.class == UNIVERSAL && !ti.tag && !ti.is_constructed) + break; /* Ready */ + else + goto bailout; + } + + + *length = d - output; + if (input_consumed) + *input_consumed += s - input; + return output; + + bailout: + if (input_consumed) + *input_consumed += s - input; + gcry_free (output); + return NULL; +} + + + static int -string_to_key (int id, char *salt, int iter, const char *pw, +string_to_key (int id, char *salt, size_t saltlen, int iter, const char *pw, int req_keylen, unsigned char *keybuf) { int rc, i, j; @@ -241,10 +310,16 @@ return -1; } + if (saltlen < 8) + { + log_error ("salt too short\n"); + return -1; + } + /* Store salt and password in BUF_I */ p = buf_i; for(i=0; i < 64; i++) - *p++ = salt [i%8]; + *p++ = salt [i%saltlen]; for(i=j=0; i < 64; i += 2) { *p++ = 0; @@ -314,14 +389,14 @@ static int -set_key_iv (gcry_cipher_hd_t chd, char *salt, int iter, const char *pw, - int keybytes) +set_key_iv (gcry_cipher_hd_t chd, char *salt, size_t saltlen, int iter, + const char *pw, int keybytes) { unsigned char keybuf[24]; int rc; assert (keybytes == 5 || keybytes == 24); - if (string_to_key (1, salt, iter, pw, keybytes, keybuf)) + if (string_to_key (1, salt, saltlen, iter, pw, keybytes, keybuf)) return -1; rc = gcry_cipher_setkey (chd, keybuf, keybytes); if (rc) @@ -330,7 +405,7 @@ return -1; } - if (string_to_key (2, salt, iter, pw, 8, keybuf)) + if (string_to_key (2, salt, saltlen, iter, pw, 8, keybuf)) return -1; rc = gcry_cipher_setiv (chd, keybuf, 8); if (rc) @@ -343,8 +418,8 @@ static void -crypt_block (unsigned char *buffer, size_t length, char *salt, int iter, - const char *pw, int cipher_algo, int encrypt) +crypt_block (unsigned char *buffer, size_t length, char *salt, size_t saltlen, + int iter, const char *pw, int cipher_algo, int encrypt) { gcry_cipher_hd_t chd; int rc; @@ -356,7 +431,7 @@ wipememory (buffer, length); return; } - if (set_key_iv (chd, salt, iter, pw, + if (set_key_iv (chd, salt, saltlen, iter, pw, cipher_algo == GCRY_CIPHER_RFC2268_40? 5:24)) { wipememory (buffer, length); @@ -381,18 +456,22 @@ static int parse_bag_encrypted_data (const unsigned char *buffer, size_t length, - int startoffset, const char *pw, + int startoffset, size_t *r_consumed, const char *pw, void (*certcb)(void*, const unsigned char*, size_t), void *certcbarg) { struct tag_info ti; const unsigned char *p = buffer; + const unsigned char *p_start = buffer; size_t n = length; const char *where; - char salt[8]; + char salt[16]; + size_t saltlen; unsigned int iter; unsigned char *plain = NULL; int bad_pass = 0; + unsigned char *cram_buffer = NULL; + size_t consumed = 0; /* Number of bytes consumed from the orginal buffer. */ where = "start"; if (parse_tag (&p, &n, &ti)) @@ -449,11 +528,13 @@ goto bailout; if (parse_tag (&p, &n, &ti)) goto bailout; - if (ti.class || ti.tag != TAG_OCTET_STRING || ti.length != 8 ) + if (ti.class || ti.tag != TAG_OCTET_STRING + || ti.length < 8 || ti.length > 16 ) goto bailout; - memcpy (salt, p, 8); - p += 8; - n -= 8; + saltlen = ti.length; + memcpy (salt, p, saltlen); + p += saltlen; + n -= saltlen; if (parse_tag (&p, &n, &ti)) goto bailout; if (ti.class || ti.tag != TAG_INTEGER || !ti.length ) @@ -468,7 +549,25 @@ where = "rc2-ciphertext"; if (parse_tag (&p, &n, &ti)) goto bailout; - if (ti.class != CONTEXT || ti.tag != 0 || !ti.length ) + + consumed = p - p_start; + if (ti.class == CONTEXT && ti.tag == 0 && ti.is_constructed && ti.ndef) + { + /* Mozilla exported certs now come with single byte chunks of + octect strings. (Mozilla Firefox 1.0.4). Arghh. */ + where = "cram-rc2-ciphertext"; + cram_buffer = cram_octet_string ( p, &n, &consumed); + if (!cram_buffer) + goto bailout; + p = p_start = cram_buffer; + if (r_consumed) + *r_consumed = consumed; + r_consumed = NULL; /* Ugly hack to not update that value any further. */ + ti.length = n; + } + else if (ti.class == CONTEXT && ti.tag == 0 && ti.length ) + ; + else goto bailout; log_info ("%lu bytes of RC2 encrypted text\n", ti.length); @@ -480,10 +579,11 @@ goto bailout; } memcpy (plain, p, ti.length); - crypt_block (plain, ti.length, salt, iter, pw, GCRY_CIPHER_RFC2268_40, 0); + crypt_block (plain, ti.length, salt, saltlen, + iter, pw, GCRY_CIPHER_RFC2268_40, 0); n = ti.length; startoffset = 0; - buffer = p = plain; + p_start = p = plain; /* { */ /* # warning debug code is enabled */ @@ -615,13 +715,19 @@ } } + if (r_consumed) + *r_consumed = consumed; gcry_free (plain); + gcry_free (cram_buffer); + return 0; - return 0; bailout: + if (r_consumed) + *r_consumed = consumed; gcry_free (plain); + gcry_free (cram_buffer); log_error ("encryptedData error at \"%s\", offset %u\n", - where, (p - buffer)+startoffset); + where, (p - p_start)+startoffset); if (bad_pass) { /* Note, that the following string might be used by other programs @@ -634,19 +740,23 @@ static gcry_mpi_t * parse_bag_data (const unsigned char *buffer, size_t length, int startoffset, - const char *pw) + size_t *r_consumed, const char *pw) { int rc; struct tag_info ti; const unsigned char *p = buffer; + const unsigned char *p_start = buffer; size_t n = length; const char *where; - char salt[8]; + char salt[16]; + size_t saltlen; unsigned int iter; int len; unsigned char *plain = NULL; gcry_mpi_t *result = NULL; int result_count, i; + unsigned char *cram_buffer = NULL; + size_t consumed = 0; /* Number of bytes consumed from the orginal buffer. */ where = "start"; if (parse_tag (&p, &n, &ti)) @@ -658,6 +768,22 @@ if (ti.class || ti.tag != TAG_OCTET_STRING) goto bailout; + consumed = p - p_start; + if (ti.is_constructed && ti.ndef) + { + /* Mozilla exported certs now come with single byte chunks of + octect strings. (Mozilla Firefox 1.0.4). Arghh. */ + where = "cram-data.outersegs"; + cram_buffer = cram_octet_string ( p, &n, &consumed); + if (!cram_buffer) + goto bailout; + p = p_start = cram_buffer; + if (r_consumed) + *r_consumed = consumed; + r_consumed = NULL; /* Ugly hack to not update that value any further. */ + } + + where = "data.outerseqs"; if (parse_tag (&p, &n, &ti)) goto bailout; @@ -709,11 +835,13 @@ goto bailout; if (parse_tag (&p, &n, &ti)) goto bailout; - if (ti.class || ti.tag != TAG_OCTET_STRING || ti.length != 8 ) + if (ti.class || ti.tag != TAG_OCTET_STRING + || ti.length < 8 || ti.length > 16) goto bailout; - memcpy (salt, p, 8); - p += 8; - n -= 8; + saltlen = ti.length; + memcpy (salt, p, saltlen); + p += saltlen; + n -= saltlen; if (parse_tag (&p, &n, &ti)) goto bailout; if (ti.class || ti.tag != TAG_INTEGER || !ti.length ) @@ -740,10 +868,11 @@ goto bailout; } memcpy (plain, p, ti.length); - crypt_block (plain, ti.length, salt, iter, pw, GCRY_CIPHER_3DES, 0); + consumed += p - p_start + ti.length; + crypt_block (plain, ti.length, salt, saltlen, iter, pw, GCRY_CIPHER_3DES, 0); n = ti.length; startoffset = 0; - buffer = p = plain; + p_start = p = plain; /* { */ /* # warning debug code is enabled */ @@ -828,6 +957,9 @@ if (len) goto bailout; + gcry_free (cram_buffer); + if (r_consumed) + *r_consumed = consumed; return result; bailout: @@ -838,8 +970,11 @@ gcry_mpi_release (result[i]); gcry_free (result); } + gcry_free (cram_buffer); log_error ( "data error at \"%s\", offset %u\n", where, (p - buffer) + startoffset); + if (r_consumed) + *r_consumed = consumed; return NULL; } @@ -857,10 +992,13 @@ { struct tag_info ti; const unsigned char *p = buffer; + const unsigned char *p_start = buffer; size_t n = length; const char *where; int bagseqlength, len; + int bagseqndef, lenndef; gcry_mpi_t *result = NULL; + unsigned char *cram_buffer = NULL; where = "pfx"; if (parse_tag (&p, &n, &ti)) @@ -897,71 +1035,121 @@ if (ti.class != UNIVERSAL || ti.tag != TAG_OCTET_STRING) goto bailout; + if (ti.is_constructed && ti.ndef) + { + /* Mozilla exported certs now come with single byte chunks of + octect strings. (Mozilla Firefox 1.0.4). Arghh. */ + where = "cram-bags"; + cram_buffer = cram_octet_string ( p, &n, NULL); + if (!cram_buffer) + goto bailout; + p = p_start = cram_buffer; + } + where = "bags"; if (parse_tag (&p, &n, &ti)) goto bailout; if (ti.class != UNIVERSAL || ti.tag != TAG_SEQUENCE) goto bailout; + bagseqndef = ti.ndef; bagseqlength = ti.length; - while (bagseqlength) + while (bagseqlength || bagseqndef) { - /*log_debug ( "at offset %u\n", (p - buffer));*/ + log_debug ( "at offset %u\n", (p - p_start)); where = "bag-sequence"; if (parse_tag (&p, &n, &ti)) goto bailout; + if (bagseqndef && ti.class == UNIVERSAL && !ti.tag && !ti.is_constructed) + break; /* Ready */ if (ti.class != UNIVERSAL || ti.tag != TAG_SEQUENCE) goto bailout; - if (bagseqlength < ti.nhdr) - goto bailout; - bagseqlength -= ti.nhdr; - if (bagseqlength < ti.length) - goto bailout; - bagseqlength -= ti.length; + if (!bagseqndef) + { + if (bagseqlength < ti.nhdr) + goto bailout; + bagseqlength -= ti.nhdr; + if (bagseqlength < ti.length) + goto bailout; + bagseqlength -= ti.length; + } + lenndef = ti.ndef; len = ti.length; if (parse_tag (&p, &n, &ti)) goto bailout; - len -= ti.nhdr; + if (lenndef) + len = ti.nhdr; + else + len -= ti.nhdr; + if (ti.tag == TAG_OBJECT_ID && ti.length == DIM(oid_encryptedData) && !memcmp (p, oid_encryptedData, DIM(oid_encryptedData))) { + size_t consumed = 0; + p += DIM(oid_encryptedData); n -= DIM(oid_encryptedData); - len -= DIM(oid_encryptedData); + if (!lenndef) + len -= DIM(oid_encryptedData); where = "bag.encryptedData"; - if (parse_bag_encrypted_data (p, n, (p - buffer), pw, + if (parse_bag_encrypted_data (p, n, (p - p_start), &consumed, pw, certcb, certcbarg)) goto bailout; + if (lenndef) + len += consumed; } else if (ti.tag == TAG_OBJECT_ID && ti.length == DIM(oid_data) - && !memcmp (p, oid_data, DIM(oid_data))) + && !memcmp (p, oid_data, DIM(oid_data))) { if (result) - log_info ("already got an data object, skipping next one\n"); + { + log_info ("already got an data object, skipping next one\n"); + p += ti.length; + n -= ti.length; + } else { + size_t consumed = 0; + p += DIM(oid_data); n -= DIM(oid_data); - len -= DIM(oid_data); - result = parse_bag_data (p, n, (p-buffer), pw); + if (!lenndef) + len -= DIM(oid_data); + result = parse_bag_data (p, n, (p - p_start), &consumed, pw); if (!result) goto bailout; + if (lenndef) + len += consumed; } } else - log_info ( "unknown bag type - skipped\n"); + { + log_info ("unknown bag type - skipped\n"); + p += ti.length; + n -= ti.length; + } if (len < 0 || len > n) goto bailout; p += len; n -= len; + if (lenndef) + { + /* Need to skip the Null Tag. */ + if (parse_tag (&p, &n, &ti)) + goto bailout; + if (!(ti.class == UNIVERSAL && !ti.tag && !ti.is_constructed)) + goto bailout; + } } + gcry_free (cram_buffer); return result; bailout: - log_error ("error at \"%s\", offset %u\n", where, (p - buffer)); + log_error ("error at \"%s\", offset %u\n", where, (p - p_start)); /* fixme: need to release RESULT. */ + gcry_free (cram_buffer); return NULL; } @@ -1586,7 +1774,8 @@ /* Encrypt it. */ gcry_randomize (salt, 8, GCRY_STRONG_RANDOM); - crypt_block (buffer, buflen, salt, 2048, pw, GCRY_CIPHER_RFC2268_40, 1); + crypt_block (buffer, buflen, salt, 8, 2048, pw, + GCRY_CIPHER_RFC2268_40, 1); /* Encode the encrypted stuff into a bag. */ seqlist[seqlistidx].buffer = build_cert_bag (buffer, buflen, salt, &n); @@ -1607,7 +1796,7 @@ /* Encrypt it. */ gcry_randomize (salt, 8, GCRY_STRONG_RANDOM); - crypt_block (buffer, buflen, salt, 2048, pw, GCRY_CIPHER_3DES, 1); + crypt_block (buffer, buflen, salt, 8, 2048, pw, GCRY_CIPHER_3DES, 1); /* Encode the encrypted stuff into a bag. */ seqlist[seqlistidx].buffer = build_key_bag (buffer, buflen, salt, &n); Modified: branches/GNUPG-1-9-BRANCH/doc/tools.texi =================================================================== --- branches/GNUPG-1-9-BRANCH/doc/tools.texi 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/doc/tools.texi 2005-12-16 15:52:48 UTC (rev 3967) @@ -14,6 +14,7 @@ * gpgsm-gencert.sh:: Generate an X.509 certificate request. * gpg-preset-passphrase:: Put a passphrase into the cache. * gpg-connect-agent:: Communicate with a running agent. +* gpgparsemail:: Parse a mail message into an annotated format * symcryptrun:: Call a simple symmetric encryption tool. @end menu @@ -774,6 +775,17 @@ @end table @c +@c GPGPARSEMAIL +@c +@node gpgparsemail +@section Parse a mail message into an annotated format + +The @command{gpgparsemail} is a utility currentlu only useful for +debugging. Run it with @code{--help} for usage information. + + + +@c @c SYMCRYPTRUN @c @node symcryptrun Modified: branches/GNUPG-1-9-BRANCH/tools/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/tools/ChangeLog 2005-12-16 15:52:48 UTC (rev 3967) @@ -1,5 +1,7 @@ 2005-12-14 Werner Koch + * Makefile.am (bin_PROGRAMS): Build gpgparsemail. + * gpgparsemail.c (pkcs7_begin): New. (parse_message, message_cb): Add support of direct pkcs signatures. Modified: branches/GNUPG-1-9-BRANCH/tools/Makefile.am =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/Makefile.am 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/tools/Makefile.am 2005-12-16 15:52:48 UTC (rev 3967) @@ -18,7 +18,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA EXTRA_DIST = Manifest watchgnupg.c \ - rfc822parse.c rfc822parse.h gpgparsemail.c \ addgnupghome gpgsm-gencert.sh AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/common @@ -36,7 +35,7 @@ symcryptrun = endif -bin_PROGRAMS = gpgconf gpg-connect-agent gpgkey2ssh ${symcryptrun} +bin_PROGRAMS = gpgconf gpg-connect-agent gpgkey2ssh ${symcryptrun} gpgparsemail if !HAVE_W32_SYSTEM bin_PROGRAMS += watchgnupg endif @@ -46,6 +45,9 @@ gpgconf_LDADD = ../jnlib/libjnlib.a \ ../common/libcommon.a ../gl/libgnu.a @LIBINTL@ +gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h +gpgparsemail_LDADD = + symcryptrun_SOURCES = symcryptrun.c symcryptrun_LDADD = $(LIBUTIL_LIBS) ../jnlib/libjnlib.a \ ../common/libcommon.a ../gl/libgnu.a \ Modified: branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/tools/gpgparsemail.c 2005-12-16 15:52:48 UTC (rev 3967) @@ -21,8 +21,8 @@ /* This utility prints an RFC8222, possible MIME structured, message in an annotated format with the first column having an indicator - for the content of the line.. Several options are available to - scrutinize the message. S/MIME and OpenPGP suuport is included. */ + for the content of the line. Several options are available to + scrutinize the message. S/MIME and OpenPGP support is included. */ #include @@ -708,6 +708,8 @@ " --debug enable additional debug output\n" " --help display this help and exit\n\n" "With no FILE, or when FILE is -, read standard input.\n\n" + "WARNING: This tool is under development.\n" + " The semantics may change without notice\n\n" "Report bugs to ."); exit (0); } Modified: branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c =================================================================== --- branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c 2005-12-14 14:52:04 UTC (rev 3966) +++ branches/GNUPG-1-9-BRANCH/tools/rfc822parse.c 2005-12-16 15:52:48 UTC (rev 3967) @@ -155,7 +155,7 @@ *name = *name - 'A' + 'a'; } - +#ifndef HAVE_STPCPY static char * stpcpy (char *a,const char *b) { @@ -165,6 +165,7 @@ return (char*)a; } +#endif /* If a callback has been registerd, call it for the event of type @@ -474,7 +475,7 @@ msg->boundary = NULL; /* No current boundary anymore. */ set_current_part_to_parent (msg); - /* Fixme: The next should acctually be sent right before the + /* Fixme: The next should actually be send right before the next boundary, so that we can mark the epilogue. */ if (!rc) rc = do_callback (msg, RFC822PARSE_LEVEL_UP); @@ -523,7 +524,8 @@ * available. * * If VALUEOFF is not NULL it will receive the offset of the first non - * space character in th value of the line. + * space character in the value part of the line (i.e. after the first + * colon). */ char * rfc822parse_get_field (rfc822parse_t msg, const char *name, int which, @@ -758,7 +760,8 @@ static const char specials[] = "<>@.,;:\\[]\"()"; static const char specials2[] = "<>@.,;:"; static const char tspecials[] = "/?=<>@,;:\\[]\"()"; - static const char tspecials2[] = "/?=<>@.,;:"; + static const char tspecials2[] = "/?=<>@.,;:"; /* FIXME: really + include '.'?*/ static struct { const unsigned char *name; From cvs at cvs.gnupg.org Mon Dec 19 02:51:32 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon Dec 19 02:15:21 2005 Subject: [svn] GnuPG - r3968 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-19 02:51:31 +0100 (Mon, 19 Dec 2005) New Revision: 3968 Modified: trunk/g10/ChangeLog trunk/g10/gpg.c trunk/g10/keyid.c Log: * gpg.c (main): Restore convert-sk-to-pk as programs rely on it. * keyid.c (usagestr_from_pk): Remove special PUBKEY_USAGE_CERT flag. It's no longer needed. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-16 15:52:48 UTC (rev 3967) +++ trunk/g10/ChangeLog 2005-12-19 01:51:31 UTC (rev 3968) @@ -1,3 +1,10 @@ +2005-12-18 David Shaw + + * gpg.c (main): Restore convert-sk-to-pk as programs rely on it. + + * keyid.c (usagestr_from_pk): Remove special PUBKEY_USAGE_CERT + flag. It's no longer needed. + 2005-12-14 David Shaw * gpg.c (main): Don't default to import-options convert-sk-to-pk. Modified: trunk/g10/gpg.c =================================================================== --- trunk/g10/gpg.c 2005-12-16 15:52:48 UTC (rev 3967) +++ trunk/g10/gpg.c 2005-12-19 01:51:31 UTC (rev 3968) @@ -1693,6 +1693,7 @@ opt.pgp2_workarounds = 1; opt.force_v3_sigs = 1; opt.escape_from = 1; + opt.import_options=IMPORT_SK2PK; opt.export_options=EXPORT_ATTRIBUTES; opt.keyserver_options.import_options=IMPORT_REPAIR_PKS_SUBKEY_BUG; opt.keyserver_options.export_options=EXPORT_ATTRIBUTES; Modified: trunk/g10/keyid.c =================================================================== --- trunk/g10/keyid.c 2005-12-16 15:52:48 UTC (rev 3967) +++ trunk/g10/keyid.c 2005-12-19 01:51:31 UTC (rev 3968) @@ -543,13 +543,9 @@ static char buffer[10]; int i = 0; unsigned int use = pk->pubkey_usage; - + if ( use & PUBKEY_USAGE_SIG ) - { - if (pk->is_primary) - use|=PUBKEY_USAGE_CERT; - buffer[i++] = 'S'; - } + buffer[i++] = 'S'; if ( use & PUBKEY_USAGE_CERT ) buffer[i++] = 'C'; From cvs at cvs.gnupg.org Mon Dec 19 20:39:35 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon Dec 19 20:03:26 2005 Subject: [svn] GnuPG - r3969 - trunk/keyserver Message-ID: Author: dshaw Date: 2005-12-19 20:39:32 +0100 (Mon, 19 Dec 2005) New Revision: 3969 Modified: trunk/keyserver/ChangeLog trunk/keyserver/gpgkeys_curl.c trunk/keyserver/gpgkeys_hkp.c trunk/keyserver/ksutil.c trunk/keyserver/ksutil.h Log: * ksutil.h, ksutil.c (curl_armor_writer, curl_writer, curl_writer_finalize): New functionality to handle binary format keys by armoring them for input to GPG. * gpgkeys_curl.c (get_key), gpgkeys_hkp.c (get_key): Call it here. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2005-12-19 01:51:31 UTC (rev 3968) +++ trunk/keyserver/ChangeLog 2005-12-19 19:39:32 UTC (rev 3969) @@ -1,3 +1,11 @@ +2005-12-19 David Shaw + + * ksutil.h, ksutil.c (curl_armor_writer, curl_writer, + curl_writer_finalize): New functionality to handle binary format + keys by armoring them for input to GPG. + + * gpgkeys_curl.c (get_key), gpgkeys_hkp.c (get_key): Call it here. + 2005-12-07 David Shaw * gpgkeys_finger.c (get_key), gpgkeys_curl.c (get_key): Better Modified: trunk/keyserver/gpgkeys_curl.c =================================================================== --- trunk/keyserver/gpgkeys_curl.c 2005-12-19 01:51:31 UTC (rev 3968) +++ trunk/keyserver/gpgkeys_curl.c 2005-12-19 19:39:32 UTC (rev 3969) @@ -74,13 +74,18 @@ res,errorbuffer); fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); } - else if(!ctx.done) + else { - fprintf(console,"gpgkeys: no key data found for %s\n",request); - fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,KEYSERVER_KEY_NOT_FOUND); + curl_writer_finalize(&ctx); + if(!ctx.flags.done) + { + fprintf(console,"gpgkeys: no key data found for %s\n",request); + fprintf(output,"\nKEY 0x%s FAILED %d\n", + getkey,KEYSERVER_KEY_NOT_FOUND); + } + else + fprintf(output,"\nKEY 0x%s END\n",getkey); } - else - fprintf(output,"\nKEY 0x%s END\n",getkey); return curl_err_to_gpg_err(res); } Modified: trunk/keyserver/gpgkeys_hkp.c =================================================================== --- trunk/keyserver/gpgkeys_hkp.c 2005-12-19 01:51:31 UTC (rev 3968) +++ trunk/keyserver/gpgkeys_hkp.c 2005-12-19 19:39:32 UTC (rev 3969) @@ -263,21 +263,22 @@ curl_easy_setopt(curl,CURLOPT_FILE,&ctx); res=curl_easy_perform(curl); - if(res!=0) + if(res!=CURLE_OK) { fprintf(console,"gpgkeys: HTTP fetch error %d: %s\n",res,errorbuffer); fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); } else { - if(ctx.done) - fprintf(output,"\nKEY 0x%s END\n",getkey); - else + curl_writer_finalize(&ctx); + if(!ctx.flags.done) { fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey); - fprintf(output,"KEY 0x%s FAILED %d\n", + fprintf(output,"\nKEY 0x%s FAILED %d\n", getkey,KEYSERVER_KEY_NOT_FOUND); } + else + fprintf(output,"\nKEY 0x%s END\n",getkey); } return KEYSERVER_OK; Modified: trunk/keyserver/ksutil.c =================================================================== --- trunk/keyserver/ksutil.c 2005-12-19 01:51:31 UTC (rev 3968) +++ trunk/keyserver/ksutil.c 2005-12-19 19:39:32 UTC (rev 3969) @@ -371,6 +371,47 @@ } } +#define B64 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + +static void +curl_armor_writer(const unsigned char *buf,size_t size,void *cw_ctx) +{ + struct curl_writer_ctx *ctx=cw_ctx; + size_t idx=0; + + while(idxarmor_remaining<3 && idxarmor_remaining++,idx++) + ctx->armor_ctx[ctx->armor_remaining]=buf[idx]; + + if(ctx->armor_remaining==3) + { + /* Top 6 bytes of ctx->armor_ctx[0] */ + fputc(B64[(ctx->armor_ctx[0]>>2)&0x3F],ctx->stream); + /* Bottom 2 bytes of ctx->armor_ctx[0] and top 4 bytes of + ctx->armor_ctx[1] */ + fputc(B64[(((ctx->armor_ctx[0]<<4)&0x30) + |((ctx->armor_ctx[1]>>4)&0x0F))&0x3F],ctx->stream); + /* Bottom 4 bytes of ctx->armor_ctx[1] and top 2 bytes of + ctx->armor_ctx[2] */ + fputc(B64[(((ctx->armor_ctx[1]<<2)&0x3C) + |((ctx->armor_ctx[2]>>6)&0x03))&0x3F],ctx->stream); + /* Bottom 6 bytes of ctx->armor_ctx[2] */ + fputc(B64[(ctx->armor_ctx[2]&0x3F)],ctx->stream); + + ctx->linelen+=4; + if(ctx->linelen>=70) + { + fputc('\n',ctx->stream); + ctx->linelen=0; + } + + ctx->armor_remaining=0; + } + } + +} + size_t curl_writer(const void *ptr,size_t size,size_t nmemb,void *cw_ctx) { @@ -378,52 +419,103 @@ const char *buf=ptr; size_t i; - if(!ctx->initialized) + if(!ctx->flags.initialized) { - ctx->marker=BEGIN; - ctx->initialized=1; + if(size*nmemb==0) + return 0; + + /* The object we're fetching is in binary form */ + if(*buf&0x80) + { + ctx->flags.armor=1; + fprintf(ctx->stream,BEGIN"\n\n"); + } + else + ctx->marker=BEGIN; + + ctx->flags.initialized=1; } - /* scan the incoming data for our marker */ - for(i=0;!ctx->done && i<(size*nmemb);i++) + if(ctx->flags.armor) + curl_armor_writer(ptr,size*nmemb,cw_ctx); + else { - if(buf[i]==ctx->marker[ctx->markeridx]) + /* scan the incoming data for our marker */ + for(i=0;!ctx->flags.done && i<(size*nmemb);i++) { - ctx->markeridx++; - if(ctx->marker[ctx->markeridx]=='\0') + if(buf[i]==ctx->marker[ctx->markeridx]) { - if(ctx->begun) - ctx->done=1; - else + ctx->markeridx++; + if(ctx->marker[ctx->markeridx]=='\0') { - /* We've found the BEGIN marker, so now we're looking - for the END marker. */ - ctx->begun=1; - ctx->marker=END; - ctx->markeridx=0; - fprintf(ctx->stream,BEGIN); - continue; + if(ctx->flags.begun) + ctx->flags.done=1; + else + { + /* We've found the BEGIN marker, so now we're + looking for the END marker. */ + ctx->flags.begun=1; + ctx->marker=END; + ctx->markeridx=0; + fprintf(ctx->stream,BEGIN); + continue; + } } } - } - else - ctx->markeridx=0; + else + ctx->markeridx=0; - if(ctx->begun) - { - /* Canonicalize CRLF to just LF by stripping CRs. This - actually makes sense, since on Unix-like machines LF is - correct, and on win32-like machines, our output buffer is - opened in textmode and will re-canonicalize line endings - back to CRLF. Since we only need to handle armored keys, - we don't have to worry about odd cases like CRCRCR and - the like. */ + if(ctx->flags.begun) + { + /* Canonicalize CRLF to just LF by stripping CRs. This + actually makes sense, since on Unix-like machines LF + is correct, and on win32-like machines, our output + buffer is opened in textmode and will re-canonicalize + line endings back to CRLF. Since this code is just + for handling armored keys, we don't have to worry + about odd cases like CRCRCR and the like. */ - if(buf[i]!='\r') - fputc(buf[i],ctx->stream); + if(buf[i]!='\r') + fputc(buf[i],ctx->stream); + } } } return size*nmemb; } + +void +curl_writer_finalize(struct curl_writer_ctx *ctx) +{ + if(ctx->flags.armor) + { + if(ctx->armor_remaining==2) + { + /* Top 6 bytes of ctx->armorctx[0] */ + fputc(B64[(ctx->armor_ctx[0]>>2)&0x3F],ctx->stream); + /* Bottom 2 bytes of ctx->armor_ctx[0] and top 4 bytes of + ctx->armor_ctx[1] */ + fputc(B64[(((ctx->armor_ctx[0]<<4)&0x30) + |((ctx->armor_ctx[1]>>4)&0x0F))&0x3F],ctx->stream); + /* Bottom 4 bytes of ctx->armor_ctx[1] */ + fputc(B64[((ctx->armor_ctx[1]<<2)&0x3C)],ctx->stream); + /* Pad */ + fputc('=',ctx->stream); + } + else if(ctx->armor_remaining==1) + { + /* Top 6 bytes of ctx->armor_ctx[0] */ + fputc(B64[(ctx->armor_ctx[0]>>2)&0x3F],ctx->stream); + /* Bottom 2 bytes of ctx->armor_ctx[0] */ + fputc(B64[((ctx->armor_ctx[0]<<4)&0x30)],ctx->stream); + /* Pad */ + fputc('=',ctx->stream); + /* Pad */ + fputc('=',ctx->stream); + } + + fprintf(ctx->stream,"\n"END); + ctx->flags.done=1; + } +} #endif Modified: trunk/keyserver/ksutil.h =================================================================== --- trunk/keyserver/ksutil.h 2005-12-19 01:51:31 UTC (rev 3968) +++ trunk/keyserver/ksutil.h 2005-12-19 19:39:32 UTC (rev 3969) @@ -111,12 +111,24 @@ struct curl_writer_ctx { - int initialized,markeridx,begun,done; + struct + { + unsigned int initialized:1; + unsigned int begun:1; + unsigned int done:1; + unsigned int armor:1; + } flags; + + int armor_remaining; + unsigned char armor_ctx[3]; + int markeridx,linelen; const char *marker; FILE *stream; }; size_t curl_writer(const void *ptr,size_t size,size_t nmemb,void *cw_ctx); +void curl_writer_finalize(struct curl_writer_ctx *ctx); + #endif #endif /* !_KSUTIL_H_ */ From cvs at cvs.gnupg.org Mon Dec 19 23:10:22 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Mon Dec 19 22:34:07 2005 Subject: [svn] GnuPG - r3970 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-19 23:10:20 +0100 (Mon, 19 Dec 2005) New Revision: 3970 Modified: trunk/g10/ChangeLog trunk/g10/getkey.c Log: * getkey.c (merge_selfsigs_main): All primary keys can certify. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-19 19:39:32 UTC (rev 3969) +++ trunk/g10/ChangeLog 2005-12-19 22:10:20 UTC (rev 3970) @@ -1,3 +1,7 @@ +2005-12-19 David Shaw + + * getkey.c (merge_selfsigs_main): All primary keys can certify. + 2005-12-18 David Shaw * gpg.c (main): Restore convert-sk-to-pk as programs rely on it. Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2005-12-19 19:39:32 UTC (rev 3969) +++ trunk/g10/getkey.c 2005-12-19 22:10:20 UTC (rev 3970) @@ -1812,8 +1812,10 @@ if ( x ) /* mask it down to the actual allowed usage */ key_usage &= x; } - pk->pubkey_usage = key_usage; + /* Whatever happens, it's a primary key, so it can certify. */ + pk->pubkey_usage = key_usage|PUBKEY_USAGE_CERT; + if ( !key_expire_seen ) { /* find the latest valid user ID with a key expiration set * Note, that this may be a different one from the above because From cvs at cvs.gnupg.org Tue Dec 20 11:26:33 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 20 10:50:18 2005 Subject: [svn] GnuPG - r3971 - branches/GNUPG-1-9-BRANCH Message-ID: Author: wk Date: 2005-12-20 11:26:32 +0100 (Tue, 20 Dec 2005) New Revision: 3971 Modified: branches/GNUPG-1-9-BRANCH/ChangeLog branches/GNUPG-1-9-BRANCH/NEWS branches/GNUPG-1-9-BRANCH/configure.ac Log: Preparing a released Modified: branches/GNUPG-1-9-BRANCH/ChangeLog =================================================================== --- branches/GNUPG-1-9-BRANCH/ChangeLog 2005-12-19 22:10:20 UTC (rev 3970) +++ branches/GNUPG-1-9-BRANCH/ChangeLog 2005-12-20 10:26:32 UTC (rev 3971) @@ -1,3 +1,7 @@ +2005-12-20 Werner Koch + + Released 1.9.20. + 2005-11-28 Werner Koch * configure.ac: Append the revision to the version string. Modified: branches/GNUPG-1-9-BRANCH/NEWS =================================================================== --- branches/GNUPG-1-9-BRANCH/NEWS 2005-12-19 22:10:20 UTC (rev 3970) +++ branches/GNUPG-1-9-BRANCH/NEWS 2005-12-20 10:26:32 UTC (rev 3971) @@ -1,15 +1,14 @@ -Noteworthy changes in version 1.9.20 +Noteworthy changes in version 1.9.20 (2005-12-20) ------------------------------------------------- - * [scdaemon] Support for keypads of some readers. Tested only with - SPR532. New option --disable-keypad. - - * New debug tool gpgparsemail. - * Importing pkcs#12 files created be recent versions of Mozilla works again. + * Basic support for qualified signatures. + * New debug tool gpgparsemail. + + Noteworthy changes in version 1.9.19 (2005-09-12) ------------------------------------------------- Modified: branches/GNUPG-1-9-BRANCH/configure.ac =================================================================== --- branches/GNUPG-1-9-BRANCH/configure.ac 2005-12-19 22:10:20 UTC (rev 3970) +++ branches/GNUPG-1-9-BRANCH/configure.ac 2005-12-20 10:26:32 UTC (rev 3971) @@ -25,7 +25,7 @@ # Remember to change the version number immediately *after* a release. # Uncomment the my_iscvs macro for non-released code. m4_define(my_version, [1.9.20]) -m4_define(my_iscvs, yes) +#m4_define(my_iscvs, yes) AC_INIT([gnupg], my_version[]m4_ifdef([my_iscvs], [-cvs[]m4_translit( [$Revision$],[Ra-z $:])]), [gnupg-devel@gnupg.org]) # Set development_version to yes if the minor number is odd or you From cvs at cvs.gnupg.org Tue Dec 20 11:56:30 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 20 11:20:11 2005 Subject: [svn] GnuPG - r3972 - tags Message-ID: Author: wk Date: 2005-12-20 11:56:30 +0100 (Tue, 20 Dec 2005) New Revision: 3972 Added: tags/gnupg-1.9.20/ Log: Tagged release Copied: tags/gnupg-1.9.20 (from rev 3971, branches/GNUPG-1-9-BRANCH) From cvs at cvs.gnupg.org Tue Dec 20 12:12:17 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 20 11:35:57 2005 Subject: [svn] GnuPG - r3973 - branches/GNUPG-1-9-BRANCH Message-ID: Author: wk Date: 2005-12-20 12:12:16 +0100 (Tue, 20 Dec 2005) New Revision: 3973 Modified: branches/GNUPG-1-9-BRANCH/NEWS branches/GNUPG-1-9-BRANCH/configure.ac Log: post release preparations Modified: branches/GNUPG-1-9-BRANCH/NEWS =================================================================== --- branches/GNUPG-1-9-BRANCH/NEWS 2005-12-20 10:56:30 UTC (rev 3972) +++ branches/GNUPG-1-9-BRANCH/NEWS 2005-12-20 11:12:16 UTC (rev 3973) @@ -1,3 +1,10 @@ +Noteworthy changes in version 1.9.21 +------------------------------------------------- + + * [scdaemon] Support for keypads of some readers. Tested only with + SPR532. New option --disable-keypad. + + Noteworthy changes in version 1.9.20 (2005-12-20) ------------------------------------------------- Modified: branches/GNUPG-1-9-BRANCH/configure.ac =================================================================== --- branches/GNUPG-1-9-BRANCH/configure.ac 2005-12-20 10:56:30 UTC (rev 3972) +++ branches/GNUPG-1-9-BRANCH/configure.ac 2005-12-20 11:12:16 UTC (rev 3973) @@ -24,8 +24,8 @@ # Remember to change the version number immediately *after* a release. # Uncomment the my_iscvs macro for non-released code. -m4_define(my_version, [1.9.20]) -#m4_define(my_iscvs, yes) +m4_define(my_version, [1.9.21]) +m4_define(my_iscvs, yes) AC_INIT([gnupg], my_version[]m4_ifdef([my_iscvs], [-cvs[]m4_translit( [$Revision$],[Ra-z $:])]), [gnupg-devel@gnupg.org]) # Set development_version to yes if the minor number is odd or you From cvs at cvs.gnupg.org Tue Dec 20 21:22:21 2005 From: cvs at cvs.gnupg.org (svn author wk) Date: Tue Dec 20 20:46:01 2005 Subject: [svn] gpgme - r1144 - in trunk: . doc gpgme tests/gpgsm Message-ID: Author: wk Date: 2005-12-20 21:22:19 +0100 (Tue, 20 Dec 2005) New Revision: 1144 Modified: trunk/NEWS trunk/doc/ChangeLog trunk/doc/gpgme.texi trunk/gpgme/ChangeLog trunk/gpgme/gpgme.h trunk/gpgme/verify.c trunk/tests/gpgsm/t-keylist.c Log: Basic PKA support. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/NEWS 2005-12-20 20:22:19 UTC (rev 1144) @@ -19,11 +19,19 @@ compatibility is provided. In other words: If free() worked for you before, it will keep working. + * New status codes GPGME_PKA_TRUST_GOOD and GPGME_PKA_TRUST_BAD. + They are analyzed by the verify handlers and made available in the + new PKA_TRUST field of the signature result structure. + + * Interface changes relative to the 1.1.0 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_key_sig_t EXTENDED: New field notations. GPGME_KEYLIST_MODE_SIG_NOTATIONS NEW gpgme_free NEW +GPGME_STATUS_PKA_TRUST_BAD NEW +GPGME_STATUS_PKA_TRUST_GOOD NEW +gpgme_signature_t EXTENDED: New field pka_trust. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modified: trunk/doc/ChangeLog =================================================================== --- trunk/doc/ChangeLog 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/doc/ChangeLog 2005-12-20 20:22:19 UTC (rev 1144) @@ -1,3 +1,7 @@ +2005-12-20 Werner Koch + + * gpgme.texi (Verify): Document pka_trust. + 2005-12-06 Werner Koch * gpgme.texi (Key Management): Updated to match the fixes for Modified: trunk/doc/gpgme.texi =================================================================== --- trunk/doc/gpgme.texi 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/doc/gpgme.texi 2005-12-20 20:22:19 UTC (rev 1144) @@ -3985,6 +3985,22 @@ @item unsigned int wrong_key_usage : 1 This is true if the key was not used according to its policy. +@item unsigned int pka_trust : 2 +This is set to the trust information gained by means of the PKA system. +Values are: + @table @code + @item 0 + No PKA information available or verification not possible. + @item 1 + PKA verification failed. + @item 2 + PKA verification succeeded. + @item 3 + Reserved for future use. + @end table +Depending on the configuration of the engine, this metric may also be +reflected by the validity of the signature. + @item gpgme_validity_t validity The validity of the signature. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/gpgme/ChangeLog 2005-12-20 20:22:19 UTC (rev 1144) @@ -1,3 +1,10 @@ +2005-12-20 Werner Koch + + * gpgme.h (gpgme_status_code_t): Added GPGME_STATUS_PKA_TRUST_BAD + and GPGME_STATUS_PKA_TRUST_GOOD. + (gpgme_signature_t): New field pka_trust. + * verify.c (_gpgme_verify_status_handler): Set pka_trust. + 2005-12-06 Werner Koch * keylist.c (keylist_colon_handler): Store fingerprints of the Modified: trunk/gpgme/gpgme.h =================================================================== --- trunk/gpgme/gpgme.h 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/gpgme/gpgme.h 2005-12-20 20:22:19 UTC (rev 1144) @@ -445,6 +445,8 @@ GPGME_STATUS_SC_OP_SUCCESS, GPGME_STATUS_CARDCTRL, GPGME_STATUS_BACKUP_KEY_CREATED, + GPGME_STATUS_PKA_TRUST_BAD, + GPGME_STATUS_PKA_TRUST_GOOD, GPGME_STATUS_PLAINTEXT } @@ -1318,8 +1320,11 @@ /* Key should not have been used for signing. */ unsigned int wrong_key_usage : 1; + /* PKA status: 0 = not available, 1 = bad, 2 = okay, 3 = RFU. */ + unsigned int pka_trust : 2; + /* Internal to GPGME, do not use. */ - int _unused : 31; + int _unused : 29; gpgme_validity_t validity; gpgme_error_t validity_reason; Modified: trunk/gpgme/verify.c =================================================================== --- trunk/gpgme/verify.c 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/gpgme/verify.c 2005-12-20 20:22:19 UTC (rev 1144) @@ -651,6 +651,15 @@ return sig ? parse_trust (sig, code, args) : gpg_error (GPG_ERR_INV_ENGINE); + case GPGME_STATUS_PKA_TRUST_BAD: + case GPGME_STATUS_PKA_TRUST_GOOD: + opd->only_newsig_seen = 0; + if (sig && !sig->pka_trust) + sig->pka_trust = code == GPGME_STATUS_PKA_TRUST_GOOD? 2 : 1; + /* FIXME: We should set the mailbox which is the argument to + these status codes into a new field. */ + break; + case GPGME_STATUS_ERROR: opd->only_newsig_seen = 0; /* The error status is informational, so we don't return an Modified: trunk/tests/gpgsm/t-keylist.c =================================================================== --- trunk/tests/gpgsm/t-keylist.c 2005-12-06 16:30:21 UTC (rev 1143) +++ trunk/tests/gpgsm/t-keylist.c 2005-12-20 20:22:19 UTC (rev 1144) @@ -345,8 +345,15 @@ key->uids->next->uid); exit (1); } + if (key->uids->next && strcmp (key->uids->next->uid, keys[i].email)) + { + fprintf (stderr, "Unexpected email in user ID: %s\n", + key->uids->next->uid); + exit (1); + } + gpgme_key_unref (key); i++; } From cvs at cvs.gnupg.org Fri Dec 23 05:58:25 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 23 05:21:50 2005 Subject: [svn] GnuPG - r3975 - trunk Message-ID: Author: dshaw Date: 2005-12-23 05:58:25 +0100 (Fri, 23 Dec 2005) New Revision: 3975 Modified: trunk/ChangeLog trunk/configure.ac Log: * configure.ac: Split PKA checking off from DNS SRV checking. Currently PKA is only enabled if HTTP or HKP is enabled which is not necessary. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-20 20:19:16 UTC (rev 3974) +++ trunk/ChangeLog 2005-12-23 04:58:25 UTC (rev 3975) @@ -1,3 +1,9 @@ +2005-12-22 David Shaw + + * configure.ac: Split PKA checking off from DNS SRV checking. + Currently PKA is only enabled if HTTP or HKP is enabled which is + not necessary. + 2005-12-08 David Shaw * NEWS: Note --fetch-keys. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-20 20:19:16 UTC (rev 3974) +++ trunk/configure.ac 2005-12-23 04:58:25 UTC (rev 3975) @@ -558,12 +558,19 @@ dnl Now try for the resolver functions so we can use DNS SRV and our dnl PKA feature. -AC_ARG_ENABLE(dns-srv, - AC_HELP_STRING([--disable-dns-srv], - [disable the use of DNS SRV in HKP and HTTP]), - use_dns_srv=$enableval,use_dns_srv=yes) +if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then + AC_ARG_ENABLE(dns-srv, + AC_HELP_STRING([--disable-dns-srv], + [disable the use of DNS SRV in HKP and HTTP]), + use_dns_srv=$enableval,use_dns_srv=yes) +fi -if (test x"$try_hkp" = xyes || test x"$try_http" = xyes) && test x"$use_dns_srv" = xyes ; then +AC_ARG_ENABLE(dns-pka, + AC_HELP_STRING([--disable-dns-pka], + [disable the use of PKA records in DNS]), + use_dns_pka=$enableval,use_dns_pka=yes) + +if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes ; then _srv_save_libs=$LIBS LIBS="" # the double underscore thing is a glibc-ism? @@ -574,23 +581,29 @@ AC_SEARCH_LIBS(dn_skipname,resolv bind,, AC_SEARCH_LIBS(__dn_skipname,resolv bind,,use_dns_srv=no)) - if test x"$use_dns_srv" = xyes ; then + # Make sure that the BIND 4 resolver interface is workable before + # enabling any code that calls it. At some point I'll rewrite the + # code to use the BIND 8 resolver API. - # Make sure that the BIND 4 resolver interface is workable before - # enabling SRVs. At some point I'll rewrite the code to use the - # BIND 8 resolver API. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include #include #include #include ], -[[unsigned char answer[PACKETSZ]; res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);]])],,use_dns_srv=no) - fi +[[unsigned char answer[PACKETSZ]; res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);]])],have_resolver=yes) - if test x"$use_dns_srv" = xyes ; then - AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV]) + if test x"$have_resolver" = xyes ; then SRVLIBS=$LIBS - AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA]) + + if test x"$use_dns_srv" = xyes ; then + AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV]) + fi + + if test x"$use_dns_pka" = xyes ; then + AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA]) + fi + else + use_dns_srv=no + use_dns_pka=no fi LIBS=$_srv_save_libs @@ -598,6 +611,8 @@ AC_SUBST(SRVLIBS) +AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes) + # Check for LDAP if test "$try_ldap" = yes ; then From cvs at cvs.gnupg.org Fri Dec 23 06:00:56 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 23 05:24:20 2005 Subject: [svn] GnuPG - r3976 - trunk/util Message-ID: Author: dshaw Date: 2005-12-23 06:00:55 +0100 (Fri, 23 Dec 2005) New Revision: 3976 Modified: trunk/util/ChangeLog trunk/util/Makefile.am trunk/util/srv.c Log: * srv.c, Makefile.am: Only build srv.c if we need to. Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-23 04:58:25 UTC (rev 3975) +++ trunk/util/ChangeLog 2005-12-23 05:00:55 UTC (rev 3976) @@ -1,3 +1,7 @@ +2005-12-22 David Shaw + + * srv.c, Makefile.am: Only build srv.c if we need to. + 2005-12-10 Ryan Lortie (dshaw) * ttyio.c (tty_enable_completion, tty_disable_completion): Add Modified: trunk/util/Makefile.am =================================================================== --- trunk/util/Makefile.am 2005-12-23 04:58:25 UTC (rev 3975) +++ trunk/util/Makefile.am 2005-12-23 05:00:55 UTC (rev 3976) @@ -24,7 +24,7 @@ libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \ ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \ - dotlock.c http.c srv.h srv.c pka.c membuf.c + dotlock.c http.c pka.c membuf.c if USE_SIMPLE_GETTEXT libutil_a_SOURCES+=simple-gettext.c @@ -44,6 +44,10 @@ libutil_a_SOURCES+=regex.c endif +if USE_DNS_SRV +libutil_a_SOURCES+=srv.c srv.h +endif + # The internal regex code #includes these. EXTRA_libutil_a_SOURCES = regcomp.c regexec.c regex_internal.c \ regex_internal.h Modified: trunk/util/srv.c =================================================================== --- trunk/util/srv.c 2005-12-23 04:58:25 UTC (rev 3975) +++ trunk/util/srv.c 2005-12-23 05:00:55 UTC (rev 3976) @@ -20,7 +20,6 @@ */ #include -#ifdef USE_DNS_SRV #include #ifdef _WIN32 #include @@ -226,8 +225,6 @@ return -1; } -#endif /* USE_DNS_SRV */ - #ifdef TEST int main(int argc,char *argv[]) From cvs at cvs.gnupg.org Fri Dec 23 19:15:26 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 23 18:38:50 2005 Subject: [svn] GnuPG - r3977 - in trunk: . include util Message-ID: Author: dshaw Date: 2005-12-23 19:15:24 +0100 (Fri, 23 Dec 2005) New Revision: 3977 Added: trunk/util/cert.c Modified: trunk/ChangeLog trunk/configure.ac trunk/include/ChangeLog trunk/include/util.h trunk/util/ChangeLog trunk/util/Makefile.am Log: New code to do DNS CERT queries. Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/ChangeLog 2005-12-23 18:15:24 UTC (rev 3977) @@ -1,3 +1,7 @@ +2005-12-23 David Shaw + + * configure.ac: Add switch for DNS CERT. + 2005-12-22 David Shaw * configure.ac: Split PKA checking off from DNS SRV checking. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/configure.ac 2005-12-23 18:15:24 UTC (rev 3977) @@ -555,8 +555,8 @@ AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt, [NETLIBS="-lsocket $NETLIBS"])) -dnl Now try for the resolver functions so we can use DNS SRV and our -dnl PKA feature. +dnl Now try for the resolver functions so we can use DNS for SRV, PKA, +dnl and CERT. if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then AC_ARG_ENABLE(dns-srv, @@ -570,7 +570,12 @@ [disable the use of PKA records in DNS]), use_dns_pka=$enableval,use_dns_pka=yes) -if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes ; then +AC_ARG_ENABLE(dns-cert, + AC_HELP_STRING([--disable-dns-cert], + [disable the use of CERT records in DNS]), + use_dns_cert=$enableval,use_dns_cert=yes) + +if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes || test x"$use_dns_cert" = xyes; then _srv_save_libs=$LIBS LIBS="" # the double underscore thing is a glibc-ism? @@ -601,9 +606,14 @@ if test x"$use_dns_pka" = xyes ; then AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA]) fi + + if test x"$use_dns_cert" = xyes ; then + AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT]) + fi else use_dns_srv=no use_dns_pka=no + use_dns_cert=no fi LIBS=$_srv_save_libs Modified: trunk/include/ChangeLog =================================================================== --- trunk/include/ChangeLog 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/include/ChangeLog 2005-12-23 18:15:24 UTC (rev 3977) @@ -1,3 +1,7 @@ +2005-12-23 David Shaw + + * util.h: Prototype get_cert(). + 2005-07-27 Werner Koch * memory.h (m_free, m_alloc, m_realloc, m_strdup): Removed and Modified: trunk/include/util.h =================================================================== --- trunk/include/util.h 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/include/util.h 2005-12-23 18:15:24 UTC (rev 3977) @@ -256,8 +256,9 @@ /*-- pka.c --*/ char *get_pka_info (const char *address, unsigned char *fpr); +/*-- cert.c --*/ +int get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url); - /**** other missing stuff ****/ #ifndef HAVE_ATEXIT /* For SunOS */ #define atexit(a) (on_exit((a),0)) Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/util/ChangeLog 2005-12-23 18:15:24 UTC (rev 3977) @@ -1,3 +1,7 @@ +2005-12-23 David Shaw + + * cert.c, Makefile.am: New code to do DNS CERT queries. + 2005-12-22 David Shaw * srv.c, Makefile.am: Only build srv.c if we need to. Modified: trunk/util/Makefile.am =================================================================== --- trunk/util/Makefile.am 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/util/Makefile.am 2005-12-23 18:15:24 UTC (rev 3977) @@ -24,7 +24,7 @@ libutil_a_SOURCES = logger.c fileutil.c miscutil.c strgutil.c \ ttyio.c argparse.c memory.c secmem.c errors.c iobuf.c \ - dotlock.c http.c pka.c membuf.c + dotlock.c http.c pka.c membuf.c cert.c if USE_SIMPLE_GETTEXT libutil_a_SOURCES+=simple-gettext.c @@ -67,3 +67,7 @@ pka-test: pka.c cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \ -DTEST -o pka-test pka.c libutil.a @LIBINTL@ @SRVLIBS@ @CAPLIBS@ + +cert-test: cert.c + cc -DHAVE_CONFIG_H -I. -I. -I.. $(INCLUDES) $(LDFLAGS) -g -Wall \ + -DTEST -o cert-test cert.c libutil.a @LIBINTL@ @SRVLIBS@ @CAPLIBS@ Added: trunk/util/cert.c =================================================================== --- trunk/util/cert.c 2005-12-23 05:00:55 UTC (rev 3976) +++ trunk/util/cert.c 2005-12-23 18:15:24 UTC (rev 3977) @@ -0,0 +1,200 @@ +/* cert.c - DNS CERT code + * Copyright (C) 2005 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +#include +#include +#ifdef USE_DNS_CERT +#ifdef _WIN32 +#include +#else +#include +#include +#include +#endif +#include +#include "memory.h" +#endif +#include "iobuf.h" + +/* Not every installation has gotten around to supporting CERTs + yet... */ +#ifndef T_CERT +#define T_CERT 37 +#endif + +#ifdef USE_DNS_CERT + +/* Returns -1 on error, 0 for no answer, 1 for PGP provided and 2 for + IPGP provided. */ +int +get_cert(const char *name,size_t max_size,IOBUF *iobuf,char **url) +{ + unsigned char *answer; + int r,ret=-1; + u16 count; + + answer=xmalloc(max_size); + + r=res_query(name,C_IN,T_CERT,answer,max_size); + /* Not too big, not too small, no errors and at least 1 answer. */ + if(r>=sizeof(HEADER) && r<=max_size + && (((HEADER *)answer)->rcode)==NOERROR + && (count=ntohs(((HEADER *)answer)->ancount))) + { + int rc; + unsigned char *pt,*emsg; + + emsg=&answer[r]; + + pt=&answer[sizeof(HEADER)]; + + /* Skip over the query */ + + rc=dn_skipname(pt,emsg); + if(rc==-1) + goto fail; + + pt+=rc+QFIXEDSZ; + + /* There are several possible response types for a CERT request. + We're interested in the PGP (a key) and IPGP (a URI) types. + Skip all others. TODO: A key is better than a URI since + we've gone through all this bother to fetch it, so favor that + if we have both PGP and IPGP? */ + + while(count-->0 && pt Author: dshaw Date: 2005-12-23 21:51:48 +0100 (Fri, 23 Dec 2005) New Revision: 3978 Modified: trunk/keyserver/ChangeLog trunk/keyserver/gpgkeys_hkp.c trunk/keyserver/gpgkeys_ldap.c trunk/keyserver/ksutil.c trunk/keyserver/ksutil.h Log: * ksutil.h, ksutil.c (parse_ks_options): New keyserver command "getname". * gpgkeys_hkp.c (main, get_name), gpgkeys_ldap.c (main, get_name): Use it here to do direct name (rather than key ID) fetches. Modified: trunk/keyserver/ChangeLog =================================================================== --- trunk/keyserver/ChangeLog 2005-12-23 18:15:24 UTC (rev 3977) +++ trunk/keyserver/ChangeLog 2005-12-23 20:51:48 UTC (rev 3978) @@ -1,3 +1,11 @@ +2005-12-23 David Shaw + + * ksutil.h, ksutil.c (parse_ks_options): New keyserver command + "getname". + + * gpgkeys_hkp.c (main, get_name), gpgkeys_ldap.c (main, get_name): + Use it here to do direct name (rather than key ID) fetches. + 2005-12-19 David Shaw * ksutil.h, ksutil.c (curl_armor_writer, curl_writer, Modified: trunk/keyserver/gpgkeys_hkp.c =================================================================== --- trunk/keyserver/gpgkeys_hkp.c 2005-12-23 18:15:24 UTC (rev 3977) +++ trunk/keyserver/gpgkeys_hkp.c 2005-12-23 20:51:48 UTC (rev 3978) @@ -285,11 +285,90 @@ } static int +get_name(const char *getkey) +{ + CURLcode res; + char *request=NULL; + char *searchkey_encoded; + int ret=KEYSERVER_INTERNAL_ERROR; + struct curl_writer_ctx ctx; + + memset(&ctx,0,sizeof(ctx)); + + searchkey_encoded=curl_escape((char *)getkey,0); + if(!searchkey_encoded) + { + fprintf(console,"gpgkeys: out of memory\n"); + ret=KEYSERVER_NO_MEMORY; + goto fail; + } + + request=malloc(MAX_URL+60+strlen(searchkey_encoded)); + if(!request) + { + fprintf(console,"gpgkeys: out of memory\n"); + ret=KEYSERVER_NO_MEMORY; + goto fail; + } + + fprintf(output,"NAME %s BEGIN\n",getkey); + + strcpy(request,"http://"); + strcat(request,opt->host); + strcat(request,":"); + if(opt->port) + strcat(request,opt->port); + else + strcat(request,"11371"); + strcat(request,opt->path); + append_path(request,"/pks/lookup?op=get&options=mr&search="); + strcat(request,searchkey_encoded); + + if(opt->verbose>2) + fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request); + + curl_easy_setopt(curl,CURLOPT_URL,request); + curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curl_writer); + ctx.stream=output; + curl_easy_setopt(curl,CURLOPT_FILE,&ctx); + + res=curl_easy_perform(curl); + if(res!=CURLE_OK) + { + fprintf(console,"gpgkeys: HTTP fetch error %d: %s\n",res,errorbuffer); + ret=curl_err_to_gpg_err(res); + } + else + { + curl_writer_finalize(&ctx); + if(!ctx.flags.done) + { + fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey); + ret=KEYSERVER_KEY_NOT_FOUND; + } + else + { + fprintf(output,"\nNAME %s END\n",getkey); + ret=KEYSERVER_OK; + } + } + + fail: + curl_free(searchkey_encoded); + free(request); + + if(ret!=KEYSERVER_OK) + fprintf(output,"\nNAME %s FAILED %d\n",getkey,ret); + + return ret; +} + +static int search_key(const char *searchkey) { CURLcode res; char *request=NULL; - char *searchkey_encoded=NULL; + char *searchkey_encoded; int ret=KEYSERVER_INTERNAL_ERROR; enum ks_search_type search_type; @@ -570,7 +649,8 @@ if(opt->action==KS_SEND) while(fgets(line,MAX_LINE,input)!=NULL && line[0]!='\n'); - else if(opt->action==KS_GET || opt->action==KS_SEARCH) + else if(opt->action==KS_GET + || opt->action==KS_GETNAME || opt->action==KS_SEARCH) { for(;;) { @@ -645,6 +725,20 @@ keyptr=keyptr->next; } } + else if(opt->action==KS_GETNAME) + { + keyptr=keylist; + + while(keyptr!=NULL) + { + set_timeout(opt->timeout); + + if(get_name(keyptr->str)!=KEYSERVER_OK) + failed++; + + keyptr=keyptr->next; + } + } else if(opt->action==KS_SEND) { int eof=0; Modified: trunk/keyserver/gpgkeys_ldap.c =================================================================== --- trunk/keyserver/gpgkeys_ldap.c 2005-12-23 18:15:24 UTC (rev 3977) +++ trunk/keyserver/gpgkeys_ldap.c 2005-12-23 20:51:48 UTC (rev 3978) @@ -1116,20 +1116,6 @@ return ret; } -static void -printquoted(FILE *stream,char *string,char delim) -{ - while(*string) - { - if(*string==delim || *string=='%') - fprintf(stream,"%%%02x",*string); - else - fputc(*string,stream); - - string++; - } -} - #define LDAP_ESCAPE_CHARS "*()\\" static int @@ -1164,6 +1150,132 @@ return count; } +/* Note that key-not-found is not a fatal error */ +static int +get_name(char *getkey) +{ + LDAPMessage *res,*each; + int ret=KEYSERVER_INTERNAL_ERROR,err,count; + char *expanded_search; + /* The maximum size of the search, including the optional stuff and + the trailing \0 */ + char search[2+11+3+MAX_LINE+2+15+14+1+1+20]; + /* This ordering is significant - specifically, "pgpcertid" needs to + be the second item in the list, since everything after it may be + discarded if the user isn't in verbose mode. */ + char *attrs[]={"replaceme","pgpcertid","pgpuserid","pgpkeyid","pgprevoked", + "pgpdisabled","pgpkeycreatetime","modifytimestamp", + "pgpkeysize","pgpkeytype",NULL}; + attrs[0]=pgpkeystr; /* Some compilers don't like using variables as + array initializers. */ + + expanded_search=malloc(ldap_quote(NULL,getkey)+1); + if(!expanded_search) + { + fprintf(output,"NAME %s FAILED %d\n",getkey,KEYSERVER_NO_MEMORY); + fprintf(console,"Out of memory when quoting LDAP search string\n"); + return KEYSERVER_NO_MEMORY; + } + + ldap_quote(expanded_search,getkey); + + /* Build the search string */ + + sprintf(search,"%s(pgpuserid=*%s*)%s%s%s", + (!(opt->flags.include_disabled&&opt->flags.include_revoked))?"(&":"", + expanded_search, + opt->flags.include_disabled?"":"(pgpdisabled=0)", + opt->flags.include_revoked?"":"(pgprevoked=0)", + !(opt->flags.include_disabled&&opt->flags.include_revoked)?")":""); + + free(expanded_search); + + if(opt->verbose>2) + fprintf(console,"gpgkeys: LDAP fetch for: %s\n",search); + + if(!opt->verbose) + attrs[2]=NULL; /* keep only pgpkey(v2) and pgpcertid */ + + err=ldap_search_s(ldap,basekeyspacedn, + LDAP_SCOPE_SUBTREE,search,attrs,0,&res); + if(err!=0) + { + int errtag=ldap_err_to_gpg_err(err); + + fprintf(console,"gpgkeys: LDAP search error: %s\n",ldap_err2string(err)); + fprintf(output,"NAME %s BEGIN\n",getkey); + fprintf(output,"NAME %s FAILED %d\n",getkey,errtag); + return errtag; + } + + count=ldap_count_entries(ldap,res); + if(count<1) + { + fprintf(console,"gpgkeys: key %s not found on keyserver\n",getkey); + fprintf(output,"NAME %s BEGIN\n",getkey); + fprintf(output,"NAME %s FAILED %d\n",getkey,KEYSERVER_KEY_NOT_FOUND); + } + else + { + /* There may be more than one result, but we return them all. */ + + each=ldap_first_entry(ldap,res); + while(each!=NULL) + { + char **vals,**certid; + + certid=ldap_get_values(ldap,each,"pgpcertid"); + if(certid!=NULL) + { + build_info(certid[0],each); + + fprintf(output,"NAME %s BEGIN\n",getkey); + + vals=ldap_get_values(ldap,each,pgpkeystr); + if(vals==NULL) + { + int errtag=ldap_to_gpg_err(ldap); + + fprintf(console,"gpgkeys: unable to retrieve key %s " + "from keyserver\n",getkey); + fprintf(output,"NAME %s FAILED %d\n",getkey,errtag); + } + else + { + print_nocr(output,vals[0]); + fprintf(output,"\nNAME %s END\n",getkey); + + ldap_value_free(vals); + } + + ldap_value_free(certid); + } + + each=ldap_next_entry(ldap,each); + } + } + + ret=KEYSERVER_OK; + + ldap_msgfree(res); + + return ret; +} + +static void +printquoted(FILE *stream,char *string,char delim) +{ + while(*string) + { + if(*string==delim || *string=='%') + fprintf(stream,"%%%02x",*string); + else + fputc(*string,stream); + + string++; + } +} + /* Returns 0 on success and -1 on error. Note that key-not-found is not an error! */ static int @@ -1173,9 +1285,9 @@ LDAPMessage *res,*each; int err,count=0; struct keylist *dupelist=NULL; + char *expanded_search; /* The maximum size of the search, including the optional stuff and the trailing \0 */ - char *expanded_search; char search[2+11+3+MAX_LINE+2+15+14+1+1+20]; char *attrs[]={"pgpcertid","pgpuserid","pgprevoked","pgpdisabled", "pgpkeycreatetime","pgpkeyexpiretime","modifytimestamp", @@ -1794,7 +1906,8 @@ if(opt->action==KS_SEND) while(fgets(line,MAX_LINE,input)!=NULL && line[0]!='\n'); - else if(opt->action==KS_GET || opt->action==KS_SEARCH) + else if(opt->action==KS_GET + || opt->action==KS_GETNAME || opt->action==KS_SEARCH) { for(;;) { @@ -2018,6 +2131,20 @@ keyptr=keyptr->next; } } + else if(opt->action==KS_GETNAME) + { + keyptr=keylist; + + while(keyptr!=NULL) + { + set_timeout(opt->timeout); + + if(get_name(keyptr->str)!=KEYSERVER_OK) + failed++; + + keyptr=keyptr->next; + } + } else if(opt->action==KS_SEND) { int eof=0; Modified: trunk/keyserver/ksutil.c =================================================================== --- trunk/keyserver/ksutil.c 2005-12-23 18:15:24 UTC (rev 3977) +++ trunk/keyserver/ksutil.c 2005-12-23 20:51:48 UTC (rev 3978) @@ -140,6 +140,8 @@ if(strcasecmp(command,"get")==0) opt->action=KS_GET; + else if(strcasecmp(command,"getname")==0) + opt->action=KS_GETNAME; else if(strcasecmp(command,"send")==0) opt->action=KS_SEND; else if(strcasecmp(command,"search")==0) @@ -311,6 +313,7 @@ { case KS_UNKNOWN: return "UNKNOWN"; case KS_GET: return "GET"; + case KS_GETNAME: return "GETNAME"; case KS_SEND: return "SEND"; case KS_SEARCH: return "SEARCH"; } Modified: trunk/keyserver/ksutil.h =================================================================== --- trunk/keyserver/ksutil.h 2005-12-23 18:15:24 UTC (rev 3977) +++ trunk/keyserver/ksutil.h 2005-12-23 20:51:48 UTC (rev 3978) @@ -36,7 +36,7 @@ strlen("OPAQUE")+1+sizeof_opaque+1 */ #define MAX_LINE (6+1+1024+1) -#define MAX_COMMAND 6 +#define MAX_COMMAND 7 #define MAX_OPTION 256 #define MAX_SCHEME 20 #define MAX_OPAQUE 1024 @@ -72,7 +72,7 @@ unsigned int set_timeout(unsigned int seconds); int register_timeout(void); -enum ks_action {KS_UNKNOWN=0,KS_GET,KS_SEND,KS_SEARCH}; +enum ks_action {KS_UNKNOWN=0,KS_GET,KS_GETNAME,KS_SEND,KS_SEARCH}; enum ks_search_type {KS_SEARCH_SUBSTR,KS_SEARCH_EXACT, KS_SEARCH_MAIL,KS_SEARCH_MAILSUB}; From cvs at cvs.gnupg.org Fri Dec 23 22:33:35 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 23 21:56:55 2005 Subject: [svn] GnuPG - r3979 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-23 22:33:32 +0100 (Fri, 23 Dec 2005) New Revision: 3979 Modified: trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/gpgv.c trunk/g10/keyserver-internal.h trunk/g10/keyserver.c Log: * gpgv.c: Stub. * keyserver-internal.h, keyserver.c (keyserver_spawn, keyserver_work, keygerver_getname): New keyserver_getname function to fetch keys by name. * getkey.c (get_pubkey_byname): Call it here to enable locating keys by full mailbox from a keyserver a la PKA. Try PKA first, though, as it is likely to be faster. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-23 20:51:48 UTC (rev 3978) +++ trunk/g10/ChangeLog 2005-12-23 21:33:32 UTC (rev 3979) @@ -1,3 +1,15 @@ +2005-12-23 David Shaw + + * gpgv.c: Stub. + + * keyserver-internal.h, keyserver.c (keyserver_spawn, + keyserver_work, keygerver_getname): New keyserver_getname function + to fetch keys by name. + + * getkey.c (get_pubkey_byname): Call it here to enable locating + keys by full mailbox from a keyserver a la PKA. Try PKA first, + though, as it is likely to be faster. + 2005-12-20 Werner Koch * gpg.c: New option --allow-pka-lookup. Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2005-12-23 20:51:48 UTC (rev 3978) +++ trunk/g10/getkey.c 2005-12-23 21:33:32 UTC (rev 3979) @@ -905,42 +905,60 @@ KEYDB_HANDLE *ret_kdbhd, int include_unusable ) { int rc; - int again = 0; + int tried_ks=0, tried_pka=0; STRLIST namelist = NULL; add_to_strlist( &namelist, name ); retry: rc = key_byname( NULL, namelist, pk, NULL, 0, include_unusable, ret_keyblock, ret_kdbhd); - if (rc == G10ERR_NO_PUBKEY - && !again - && opt.allow_pka_lookup - && (opt.keyserver_options.options&KEYSERVER_AUTO_PKA_RETRIEVE) - && is_valid_mailbox (name)) + + if (rc == G10ERR_NO_PUBKEY && is_valid_mailbox(name)) { - /* If the requested name resembles a valid mailbox and - automatic retrieval via PKA records has been enabled, we - try to import the key via the URI and try again. */ - unsigned char fpr[MAX_FINGERPRINT_LEN]; - char *uri; - struct keyserver_spec *spec; + if(!tried_pka + && opt.allow_pka_lookup + && (opt.keyserver_options.options&KEYSERVER_AUTO_PKA_RETRIEVE)) + { + /* If the requested name resembles a valid mailbox and + automatic retrieval via PKA records has been enabled, we + try to import the key via the URI and try again. */ + unsigned char fpr[MAX_FINGERPRINT_LEN]; + char *uri; + struct keyserver_spec *spec; + int try=1; + + tried_pka=1; - uri = get_pka_info (name, fpr); - if (uri) - { - spec = parse_keyserver_uri (uri, 0, NULL, 0); - if (spec) - { - glo_ctrl.in_auto_key_retrieve++; - if (!keyserver_import_fprint (fpr, 20, spec)) - again = 1; - glo_ctrl.in_auto_key_retrieve--; - free_keyserver_spec (spec); - } - xfree (uri); - } - if (again) - goto retry; + uri = get_pka_info (name, fpr); + if (uri) + { + spec = parse_keyserver_uri (uri, 0, NULL, 0); + if (spec) + { + glo_ctrl.in_auto_key_retrieve++; + try=keyserver_import_fprint (fpr, 20, spec); + glo_ctrl.in_auto_key_retrieve--; + free_keyserver_spec (spec); + } + xfree (uri); + } + if (try==0) + goto retry; + } + + /* Try keyserver last as it is likely to be the slowest. + Strictly speaking, we don't need to only use a valid mailbox + for the getname search, but it helps cut down on a problem + with searching for something like "john" and getting a lot of + keys back. */ + if(!tried_ks + && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)) + { + tried_ks=1; + + if(keyserver_getname(name)==0) + goto retry; + } } free_strlist( namelist ); Modified: trunk/g10/gpgv.c =================================================================== --- trunk/g10/gpgv.c 2005-12-23 20:51:48 UTC (rev 3978) +++ trunk/g10/gpgv.c 2005-12-23 21:33:32 UTC (rev 3979) @@ -291,6 +291,8 @@ return -1; } +int +keyserver_getname(const char *name) { return -1; } /* Stub: * No encryption here but mainproc links to these functions. Modified: trunk/g10/keyserver-internal.h =================================================================== --- trunk/g10/keyserver-internal.h 2005-12-23 20:51:48 UTC (rev 3978) +++ trunk/g10/keyserver-internal.h 2005-12-23 21:33:32 UTC (rev 3979) @@ -41,5 +41,6 @@ int keyserver_refresh(STRLIST users); int keyserver_search(STRLIST tokens); int keyserver_fetch(STRLIST urilist); +int keyserver_getname(const char *name); #endif /* !_KEYSERVER_INTERNAL_H_ */ Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-23 20:51:48 UTC (rev 3978) +++ trunk/g10/keyserver.c 2005-12-23 21:33:32 UTC (rev 3979) @@ -43,10 +43,6 @@ #include "keyserver-internal.h" #include "util.h" -#define GET 0 -#define SEND 1 -#define SEARCH 2 - #define GPGKEYS_PREFIX "gpgkeys_" #if defined(HAVE_LIBCURL) || defined(FAKE_CURL) @@ -69,6 +65,8 @@ unsigned int lines; }; +enum ks_action {KS_UNKNOWN=0,KS_GET,KS_GETNAME,KS_SEND,KS_SEARCH}; + /* Tell remote processes about these options */ #define REMOTE_TELL (KEYSERVER_INCLUDE_REVOKED|KEYSERVER_INCLUDE_SUBKEYS|KEYSERVER_TRY_DNS_SRV) @@ -96,8 +94,9 @@ {NULL,0,NULL,NULL} }; -static int keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, - int count,struct keyserver_spec *keyserver); +static int keyserver_work(enum ks_action action,STRLIST list, + KEYDB_SEARCH_DESC *desc,int count, + struct keyserver_spec *keyserver); int parse_keyserver_options(char *options) @@ -679,7 +678,7 @@ while((num=strsep(&split," ,"))!=NULL) if(atoi(num)>=1 && atoi(num)<=numdesc) - keyserver_work(GET,NULL,&desc[atoi(num)-1],1,opt.keyserver); + keyserver_work(KS_GET,NULL,&desc[atoi(num)-1],1,opt.keyserver); xfree(answer); return 1; @@ -880,7 +879,7 @@ #define KEYSERVER_ARGS_NOKEEP " -o \"%o\" \"%i\"" static int -keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, +keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc, int count,int *prog,struct keyserver_spec *keyserver) { int ret=0,i,gotversion=0,outofband=0; @@ -1014,7 +1013,7 @@ switch(action) { - case GET: + case KS_GET: { fprintf(spawn->tochild,"COMMAND GET\n\n"); @@ -1080,10 +1079,32 @@ break; } - case SEND: + case KS_GETNAME: { STRLIST key; + fprintf(spawn->tochild,"COMMAND GETNAME\n\n"); + + /* Which names do we want? */ + + for(key=list;key!=NULL;key=key->next) + fprintf(spawn->tochild,"%s\n",key->d); + + fprintf(spawn->tochild,"\n"); + + if(keyserver->host) + log_info(_("searching for names from %s server %s\n"), + keyserver->scheme,keyserver->host); + else + log_info(_("searching for names from %s\n"),keyserver->uri); + + break; + } + + case KS_SEND: + { + STRLIST key; + /* Note the extra \n here to send an empty keylist block */ fprintf(spawn->tochild,"COMMAND SEND\n\n\n"); @@ -1240,7 +1261,7 @@ break; } - case SEARCH: + case KS_SEARCH: { STRLIST key; @@ -1344,7 +1365,8 @@ if(!outofband) switch(action) { - case GET: + case KS_GET: + case KS_GETNAME: { void *stats_handle; @@ -1367,10 +1389,10 @@ } /* Nothing to do here */ - case SEND: + case KS_SEND: break; - case SEARCH: + case KS_SEARCH: keyserver_search_prompt(spawn->fromchild,searchstr); break; @@ -1390,7 +1412,7 @@ } static int -keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc, +keyserver_work(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc, int count,struct keyserver_spec *keyserver) { int rc=0,ret=0; @@ -1422,8 +1444,8 @@ case KEYSERVER_NOT_SUPPORTED: log_error(_("action `%s' not supported with keyserver " "scheme `%s'\n"), - action==GET?"get":action==SEND?"send": - action==SEARCH?"search":"unknown", + action==KS_GET?"get":action==KS_SEND?"send": + action==KS_SEARCH?"search":"unknown", keyserver->scheme); break; @@ -1483,7 +1505,7 @@ if(sl) { - rc=keyserver_work(SEND,sl,NULL,0,opt.keyserver); + rc=keyserver_work(KS_SEND,sl,NULL,0,opt.keyserver); free_strlist(sl); } @@ -1521,7 +1543,7 @@ } if(count>0) - rc=keyserver_work(GET,NULL,desc,count,opt.keyserver); + rc=keyserver_work(KS_GET,NULL,desc,count,opt.keyserver); xfree(desc); @@ -1545,7 +1567,7 @@ memcpy(desc.u.fpr,fprint,fprint_len); - return keyserver_work(GET,NULL,&desc,1,keyserver); + return keyserver_work(KS_GET,NULL,&desc,1,keyserver); } int @@ -1559,7 +1581,7 @@ desc.u.kid[0]=keyid[0]; desc.u.kid[1]=keyid[1]; - return keyserver_work(GET,NULL,&desc,1,keyserver); + return keyserver_work(KS_GET,NULL,&desc,1,keyserver); } /* code mostly stolen from do_export_stream */ @@ -1763,7 +1785,7 @@ Note that a preferred keyserver without a scheme:// will be interpreted as hkp:// */ - rc=keyserver_work(GET,NULL,&desc[i],1,keyserver); + rc=keyserver_work(KS_GET,NULL,&desc[i],1,keyserver); if(rc) log_info(_("WARNING: unable to refresh key %s" " via %s: %s\n"),keystr_from_desc(&desc[i]), @@ -1793,7 +1815,7 @@ count,opt.keyserver->uri); } - rc=keyserver_work(GET,NULL,desc,numdesc,opt.keyserver); + rc=keyserver_work(KS_GET,NULL,desc,numdesc,opt.keyserver); } xfree(desc); @@ -1812,7 +1834,7 @@ keyserver_search(STRLIST tokens) { if(tokens) - return keyserver_work(SEARCH,tokens,NULL,0,opt.keyserver); + return keyserver_work(KS_SEARCH,tokens,NULL,0,opt.keyserver); else return 0; } @@ -1852,7 +1874,7 @@ */ spec->flags.direct_uri=1; - rc=keyserver_work(GET,NULL,&desc,1,spec); + rc=keyserver_work(KS_GET,NULL,&desc,1,spec); if(rc) log_info (_("WARNING: unable to fetch URI %s: %s\n"), sl->d,g10_errstr(rc)); @@ -1872,3 +1894,18 @@ return 0; } + +int +keyserver_getname(const char *name) +{ + STRLIST list=NULL; + int rc; + + append_to_strlist(&list,name); + + rc=keyserver_work(KS_GETNAME,list,NULL,0,opt.keyserver); + + free_strlist(list); + + return rc; +} From cvs at cvs.gnupg.org Fri Dec 23 23:17:13 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Fri Dec 23 22:40:34 2005 Subject: [svn] GnuPG - r3980 - trunk/g10 Message-ID: Author: dshaw Date: 2005-12-23 23:17:11 +0100 (Fri, 23 Dec 2005) New Revision: 3980 Modified: trunk/g10/ChangeLog trunk/g10/getkey.c trunk/g10/gpgv.c trunk/g10/keyserver-internal.h trunk/g10/keyserver.c trunk/g10/options.h Log: * keyserver.c (keyserver_import_pka): New. Moved from getkey.c:get_pubkey_byname which was getting crowded. * keyserver.c (keyserver_import_cert): Import a key found in DNS via CERT records. Can handle both the PGP (actual key) and IPGP (URL) CERT types. * getkey.c (get_pubkey_byname): Call them both here. * options.h, keyserver.c (parse_keyserver_options): Add "auto-cert-retrieve" option with optional max size argument. Modified: trunk/g10/ChangeLog =================================================================== --- trunk/g10/ChangeLog 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/ChangeLog 2005-12-23 22:17:11 UTC (rev 3980) @@ -1,7 +1,19 @@ 2005-12-23 David Shaw - * gpgv.c: Stub. + * keyserver.c (keyserver_import_pka): New. Moved from + getkey.c:get_pubkey_byname which was getting crowded. + * keyserver.c (keyserver_import_cert): Import a key found in DNS + via CERT records. Can handle both the PGP (actual key) and IPGP + (URL) CERT types. + + * getkey.c (get_pubkey_byname): Call them both here. + + * options.h, keyserver.c (parse_keyserver_options): Add + "auto-cert-retrieve" option with optional max size argument. + + * gpgv.c: Stubs. + * keyserver-internal.h, keyserver.c (keyserver_spawn, keyserver_work, keygerver_getname): New keyserver_getname function to fetch keys by name. Modified: trunk/g10/getkey.c =================================================================== --- trunk/g10/getkey.c 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/getkey.c 2005-12-23 22:17:11 UTC (rev 3980) @@ -905,7 +905,7 @@ KEYDB_HANDLE *ret_kdbhd, int include_unusable ) { int rc; - int tried_ks=0, tried_pka=0; + int tried_cert=0, tried_pka=0, tried_ks=0; STRLIST namelist = NULL; add_to_strlist( &namelist, name ); @@ -915,6 +915,25 @@ if (rc == G10ERR_NO_PUBKEY && is_valid_mailbox(name)) { + int res; + + if(!tried_cert + && (opt.keyserver_options.options&KEYSERVER_AUTO_CERT_RETRIEVE)) + { + tried_cert=1; + + glo_ctrl.in_auto_key_retrieve++; + res=keyserver_import_cert(name); + glo_ctrl.in_auto_key_retrieve--; + + if(res==0) + { + log_info(_("Automatically retrieved `%s' via %s\n"), + name,"DNS CERT"); + goto retry; + } + } + if(!tried_pka && opt.allow_pka_lookup && (opt.keyserver_options.options&KEYSERVER_AUTO_PKA_RETRIEVE)) @@ -922,28 +941,19 @@ /* If the requested name resembles a valid mailbox and automatic retrieval via PKA records has been enabled, we try to import the key via the URI and try again. */ - unsigned char fpr[MAX_FINGERPRINT_LEN]; - char *uri; - struct keyserver_spec *spec; - int try=1; tried_pka=1; - - uri = get_pka_info (name, fpr); - if (uri) + + glo_ctrl.in_auto_key_retrieve++; + res=keyserver_import_pka(name); + glo_ctrl.in_auto_key_retrieve--; + + if(res==0) { - spec = parse_keyserver_uri (uri, 0, NULL, 0); - if (spec) - { - glo_ctrl.in_auto_key_retrieve++; - try=keyserver_import_fprint (fpr, 20, spec); - glo_ctrl.in_auto_key_retrieve--; - free_keyserver_spec (spec); - } - xfree (uri); + log_info(_("Automatically retrieved `%s' via %s\n"), + name,"PKA"); + goto retry; } - if (try==0) - goto retry; } /* Try keyserver last as it is likely to be the slowest. @@ -952,12 +962,21 @@ with searching for something like "john" and getting a lot of keys back. */ if(!tried_ks + && opt.keyserver && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)) { tried_ks=1; - if(keyserver_getname(name)==0) - goto retry; + glo_ctrl.in_auto_key_retrieve++; + res=keyserver_import_name(name); + glo_ctrl.in_auto_key_retrieve--; + + if(res==0) + { + log_info(_("Automatically retrieved `%s' via %s\n"), + name,opt.keyserver->uri); + goto retry; + } } } Modified: trunk/g10/gpgv.c =================================================================== --- trunk/g10/gpgv.c 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/gpgv.c 2005-12-23 22:17:11 UTC (rev 3980) @@ -270,7 +270,7 @@ } -/* Stub: +/* Stubs: * Because we only work with trusted keys, it does not make sense to * get them from a keyserver */ @@ -280,20 +280,15 @@ return -1; } -/* Stub: - * Because we only work with trusted keys, it does not make sense to - * get them from a keyserver - */ int -keyserver_import_fprint (const byte *fprint, size_t fprint_len, - struct keyserver_spec *keyserver) -{ - return -1; -} +keyserver_import_cert(const char *name) { return -1; } int -keyserver_getname(const char *name) { return -1; } +keyserver_import_pka(const char *name) { return -1; } +int +keyserver_import_name(const char *name) { return -1; } + /* Stub: * No encryption here but mainproc links to these functions. */ Modified: trunk/g10/keyserver-internal.h =================================================================== --- trunk/g10/keyserver-internal.h 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/keyserver-internal.h 2005-12-23 22:17:11 UTC (rev 3980) @@ -41,6 +41,8 @@ int keyserver_refresh(STRLIST users); int keyserver_search(STRLIST tokens); int keyserver_fetch(STRLIST urilist); -int keyserver_getname(const char *name); +int keyserver_import_cert(const char *name); +int keyserver_import_pka(const char *name); +int keyserver_import_name(const char *name); #endif /* !_KEYSERVER_INTERNAL_H_ */ Modified: trunk/g10/keyserver.c =================================================================== --- trunk/g10/keyserver.c 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/keyserver.c 2005-12-23 22:17:11 UTC (rev 3980) @@ -86,6 +86,8 @@ {"auto-key-retrieve",KEYSERVER_AUTO_KEY_RETRIEVE,NULL, N_("automatically retrieve keys when verifying signatures")}, {"auto-pka-retrieve",KEYSERVER_AUTO_PKA_RETRIEVE,NULL, + N_("automatically retrieve keys from PKA records")}, + {"auto-cert-retrieve",KEYSERVER_AUTO_CERT_RETRIEVE,NULL, N_("automatically retrieve keys from DNS")}, {"try-dns-srv",KEYSERVER_TRY_DNS_SRV,NULL, NULL}, @@ -98,12 +100,20 @@ KEYDB_SEARCH_DESC *desc,int count, struct keyserver_spec *keyserver); +/* Reasonable guess */ +#define DEFAULT_MAX_CERT_SIZE 16384 + +static size_t max_cert_size=DEFAULT_MAX_CERT_SIZE; + int parse_keyserver_options(char *options) { int ret=1; char *tok; + char *max_cert; + keyserver_opts[7].value=&max_cert; + while((tok=optsep(&options))) { if(tok[0]=='\0') @@ -163,6 +173,15 @@ } } + if(opt.keyserver_options.options&KEYSERVER_AUTO_CERT_RETRIEVE) + { + if(max_cert) + max_cert_size=strtoul(max_cert,(char **)NULL,10); + + if(max_cert_size==0) + max_cert_size=DEFAULT_MAX_CERT_SIZE; + } + return ret; } @@ -1895,9 +1914,87 @@ return 0; } +/* Import key in a CERT or pointed to by a CERT */ int -keyserver_getname(const char *name) +keyserver_import_cert(const char *name) { + char *domain,*look,*url; + IOBUF key; + int type,rc=-1; + + look=xstrdup(name); + + domain=strrchr(look,'@'); + if(domain) + *domain='.'; + + type=get_cert(look,max_cert_size,&key,&url); + if(type==1) + { + int armor_status=opt.no_armor; + + /* CERTs are always in binary format */ + opt.no_armor=1; + + rc=import_keys_stream(key,NULL,opt.keyserver_options.import_options); + + opt.no_armor=armor_status; + + iobuf_close(key); + } + else if(type==2) + { + struct keyserver_spec *spec; + + spec=parse_keyserver_uri(url,1,NULL,0); + if(spec) + { + STRLIST list=NULL; + + add_to_strlist(&list,url); + + rc=keyserver_fetch(list); + + free_strlist(list); + free_keyserver_spec(spec); + } + + xfree(url); + } + + xfree(look); + + return rc; +} + +/* Import key pointed to by a PKA record */ +int +keyserver_import_pka(const char *name) +{ + unsigned char fpr[MAX_FINGERPRINT_LEN]; + char *uri; + int rc=-1; + + uri = get_pka_info (name, fpr); + if (uri) + { + struct keyserver_spec *spec; + spec = parse_keyserver_uri (uri, 0, NULL, 0); + if (spec) + { + rc=keyserver_import_fprint (fpr, 20, spec); + free_keyserver_spec (spec); + } + xfree (uri); + } + + return rc; +} + +/* Import all keys that match name */ +int +keyserver_import_name(const char *name) +{ STRLIST list=NULL; int rc; Modified: trunk/g10/options.h =================================================================== --- trunk/g10/options.h 2005-12-23 21:33:32 UTC (rev 3979) +++ trunk/g10/options.h 2005-12-23 22:17:11 UTC (rev 3980) @@ -312,5 +312,6 @@ #define KEYSERVER_TRY_DNS_SRV (1<<6) #define KEYSERVER_HONOR_KEYSERVER_URL (1<<7) #define KEYSERVER_AUTO_PKA_RETRIEVE (1<<8) +#define KEYSERVER_AUTO_CERT_RETRIEVE (1<<9) #endif /*G10_OPTIONS_H*/ From cvs at cvs.gnupg.org Sat Dec 24 16:35:44 2005 From: cvs at cvs.gnupg.org (svn author dshaw) Date: Sat Dec 24 15:59:01 2005 Subject: [svn] GnuPG - r3981 - trunk/util Message-ID: Author: dshaw Date: 2005-12-24 16:35:39 +0100 (Sat, 24 Dec 2005) New Revision: 3981 Modified: trunk/util/ChangeLog trunk/util/cert.c Log: * cert.c (get_cert): Properly chase down CNAMEs pointing to CERTs. Modified: trunk/util/ChangeLog =================================================================== --- trunk/util/ChangeLog 2005-12-23 22:17:11 UTC (rev 3980) +++ trunk/util/ChangeLog 2005-12-24 15:35:39 UTC (rev 3981) @@ -1,3 +1,7 @@ +2005-12-24 David Shaw + + * cert.c (get_cert): Properly chase down CNAMEs pointing to CERTs. + 2005-12-23 David Shaw * cert.c, Makefile.am: New code to do DNS CERT queries. Modified: trunk/util/cert.c =================================================================== --- trunk/util/cert.c 2005-12-23 22:17:11 UTC (rev 3980) +++ trunk/util/cert.c 2005-12-24 15:35:39 UTC (rev 3981) @@ -96,9 +96,6 @@ type=*pt++ << 8; type|=*pt++; - /* We asked for CERT and got something else !? */ - if(type!=T_CERT) - break; class=*pt++ << 8; class|=*pt++; @@ -113,6 +110,14 @@ dlen=*pt++ << 8; dlen|=*pt++; + /* We asked for CERT and got something else - might be a + CNAME, so loop around again. */ + if(type!=T_CERT) + { + pt+=dlen; + continue; + } + /* The CERT type */ ctype=*pt++ << 8; ctype|=*pt++; @@ -125,7 +130,7 @@ if(ctype==3 && iobuf) { /* PGP type */ - *iobuf=iobuf_temp_with_content(pt,dlen); + *iobuf=iobuf_temp_with_content((char *)pt,dlen); ret=1; break; } @@ -136,6 +141,7 @@ *url=xmalloc(dlen+1); memcpy(*url,pt,dlen); + (*url)[dlen]='\0'; ret=2; break; } From cvs at cvs.gnupg.org Sat Dec 31 05:22:15 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Sat Dec 31 04:44:52 2005 Subject: [svn] gpgme - r1145 - trunk/gpgme Message-ID: Author: marcus Date: 2005-12-31 05:22:14 +0100 (Sat, 31 Dec 2005) New Revision: 1145 Modified: trunk/gpgme/ChangeLog trunk/gpgme/w32-glib-io.c Log: 2005-12-31 Marcus Brinkmann * w32-glib-io.c (find_channel): Set channel to unbuffered. (_gpgme_io_select): Fix debug output. Modified: trunk/gpgme/ChangeLog =================================================================== --- trunk/gpgme/ChangeLog 2005-12-20 20:22:19 UTC (rev 1144) +++ trunk/gpgme/ChangeLog 2005-12-31 04:22:14 UTC (rev 1145) @@ -1,3 +1,8 @@ +2005-12-31 Marcus Brinkmann + + * w32-glib-io.c (find_channel): Set channel to unbuffered. + (_gpgme_io_select): Fix debug output. + 2005-12-20 Werner Koch * gpgme.h (gpgme_status_code_t): Added GPGME_STATUS_PKA_TRUST_BAD Modified: trunk/gpgme/w32-glib-io.c =================================================================== --- trunk/gpgme/w32-glib-io.c 2005-12-20 20:22:19 UTC (rev 1144) +++ trunk/gpgme/w32-glib-io.c 2005-12-31 04:22:14 UTC (rev 1145) @@ -81,8 +81,12 @@ return NULL; if (create && !giochannel_table[fd]) - giochannel_table[fd] = g_io_channel_win32_new_fd (fd); - + { + giochannel_table[fd] = g_io_channel_win32_new_fd (fd); + g_io_channel_set_encoding (giochannel_table[fd], NULL, NULL); + g_io_channel_set_buffered (giochannel_table[fd], FALSE); + } + return giochannel_table[fd]; } @@ -587,9 +591,11 @@ for (i = 0; i < npollfds; i++) { if ((pollfds[i].revents & G_IO_IN)) - DEBUG_ADD1 (dbg_help, "r%d ", i); + DEBUG_ADD1 (dbg_help, "r%d ", fds[pollfds_map[i]].fd); if ((pollfds[i].revents & G_IO_OUT)) - DEBUG_ADD1 (dbg_help, "w%d ", i); + DEBUG_ADD1 (dbg_help, "w%d ", fds[pollfds_map[i]].fd); + DEBUG_ADD2 (dbg_help, "x%d(%x) ", fds[pollfds_map[i]].fd, + pollfds[i].revents); } DEBUG_END (dbg_help, "]"); } From cvs at cvs.gnupg.org Sat Dec 31 13:56:50 2005 From: cvs at cvs.gnupg.org (svn author marcus) Date: Sat Dec 31 13:19:28 2005 Subject: [svn] gpgme - r1146 - trunk/gpgme Message-ID: Author: marcus Date: 2005-12-31 13:56:49 +0100 (Sat, 31 Dec 2005) New Revision: 1146 Modified: trunk/gpgme/w32-glib-io.c Log: Fix last change. Modified: trunk/gpgme/w32-glib-io.c =================================================================== --- trunk/gpgme/w32-glib-io.c 2005-12-31 04:22:14 UTC (rev 1145) +++ trunk/gpgme/w32-glib-io.c 2005-12-31 12:56:49 UTC (rev 1146) @@ -594,8 +594,6 @@ DEBUG_ADD1 (dbg_help, "r%d ", fds[pollfds_map[i]].fd); if ((pollfds[i].revents & G_IO_OUT)) DEBUG_ADD1 (dbg_help, "w%d ", fds[pollfds_map[i]].fd); - DEBUG_ADD2 (dbg_help, "x%d(%x) ", fds[pollfds_map[i]].fd, - pollfds[i].revents); } DEBUG_END (dbg_help, "]"); }