summaryrefslogtreecommitdiffstats
path: root/gnupgparse.c
AgeCommit message (Collapse)Author
2021-01-27Convert all mutt_atoX functions to behave strictly.Kevin McCarthy
* Remove the automatic conversion of NULL and '\0' to 0. Add a flag for the cases that require lax evaluation. * Make trailing characters generate an error by default for the mutt_atouX functions. Add a flag for that case. Most of the IMAP code parses numbers out of a stream, so add the flag to those calls. * The mutt_atouX functions were also behaving incorrectly with invalid input, e.g. "ABC", returning and setting 0. Fix them to return an error in those cases. * Add a mutt_atoll() function, to be used in the next commit. * Change converters to store 0 on error. atos, atoi, and atoui were already doing this, but the others were not.
2019-01-04Clean up formatting.Kevin McCarthy
Add spaces after if, else, while, for, switch. Unify the brace placement style. The vast majority of the code uses Allman style so convert the relatively few K&R braces over.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-31Remove trailing whitespace.Kevin McCarthy
The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
2018-12-06Fix classic gpg date parsing in list-keys.Kevin McCarthy
GnuPG changed the format of their --with-colons output in 2.0.10. Dates are now seconds since epoch. Update the parse_pub_line() code to detect the new format. The GnuPG changes also separated pub and the first uid. Since mutt allows an empty uid field, the output is a bit less friendly now, with an initial key without an uid. I think that's acceptable, but eventually we'll want to change the parsing behavior.
2015-02-15Add fingerprint record parsing for pgp list keys. (see #3695)Kevin McCarthy
Modify parse_pub_line to parse fpr records and add the fingerprint to the pgp_key_t's fingerprint field. Add "--with-fingerprint --with-fingerprint" to the pgp_list_pubring_command and pgp_list_secring_command commands in contrib/gpg.rc. The second invocation generates fpr records for subkeys too.
2014-08-12Wrap pgp_uid_t->addr in NONULL(). (closes #3564)Kevin McCarthy
The previous patch introduced the possibility for addr to be null. Mutt is surprisingly robust against null strings, but there are a few places that should be wrapped in NONULL().
2014-08-12Fix parse_pub_line to allow an empty User-ID field for a pub record. (see #3564)Kevin McCarthy
A key whose primary uid record has an empty User-ID will result in the user being unable to use the key to encrypt an email in mutt. This is because the mutt functions for key selection iterate through the address fields of a key for matching against and for displaying to the user. This change allows a pgp_uid_t record to be created for a pub record whose User-ID field is blank. So the key will have one address record, albeit with a null addr field.
2010-08-06Fix comparison signedness warnings.Matthias Andree
2009-06-01Use mutt_atoi() when parsing GnuPG output. Closes #3145Rocco Rutte
2009-03-15Use safe_fclose() instead of fclose(), add fclose() to check_sec.shRocco Rutte
2009-01-04Update copyrights. Closes #3016.Brendan Cully
I went through the logs of each file with a copyright header and updated the years for the authors in the headers for any non-comment changes they introduced. What a pain!
2005-09-17Gah, forgot the zip code when updating the FSF address...Brendan Cully
2005-09-17Update FSF address (via sed, I hope nothing got mangled). Closes: #2071.Brendan Cully
2005-02-03Add config.h to the top of every C file that could possibly want it.Brendan Cully
Remove it from mutt.h
2003-07-22When encrypting a message to a user that has more than one subkey,David Shaw
at least one of which is revoked or expired, mutt treats the entire key as unusable rather than just the subkey(s) in question.
2003-05-29Fix PGP subkey handling when looking at key capabilities. ThisThomas Roessler
should take care of the recent "mutt does not see all keys" problems.
2003-05-13Currently, mutt uses the OpenPGP key algorithm to determine theDavid Shaw
capabilities of the key. For example, in mutt, a key of type 1 (RSA) can both encrypt & sign. This is not correct as per OpenPGP, however, where the capabilities of the key are determined by both the algorithm and key capability flags that are set on the key. This can lead to user confusion when their RSA encrypt-only or sign-only key is listed for both signing and encryption in mutt. GnuPG lists these flags in key listings, so it is easy to take advantage of them. Here is a patch to use the flags, as well as provide the flags in pgpring. Note that the pgp+pgpring users won't see any change since the flags there are based on the key algorithm as they are now, but the GnuPG users will see an improvement.
2003-01-21- To cleanup the pgp/smime code and prepare for other backends.Werner Koch
- Support gpg-agent by not asking for a passphrase - autconf cleanups. This is just a start and probably we need a couple of other things to do. One drawback is that the help menu does always list all crypto realted stuff even when configured for no crypto at all. Same goes for the configure options but I consider thsi a feature: It allows to use the same .muttrc for different versions of mutt - at least during development, this is an advantage. This all might be fixed but requires some changes to the configuration system. Note, the use of the WithCrypto macro - it enables the compiler to do dead-code-elimination depending on the configured backend. This is better readable than all the nested ifdefs. I did some short tests and it seems to work, althoug mutt's size does not change largely when compiled w/o crypto. cryptglue.c is new as a warpper to all crypto calls; some are still in crypt.c but they should eventually also be wrapped. We don't use function pointers to keep a path to use dlopen or runtime configured backends. crypt.h is also new and replaces pgp.h and smime.h in most files (except for the backend). 2003-01-06 Werner Koch <wk@gnupg.org> * crypt.c (crypt_valid_passphrase): Detect gpg-agent and don't ask for the passphrase. * pgp.c (pgp_decrypt_part, pgp_application_pgp_handler) (pgp_sign_message, pgp_encrypt_message) (pgp_traditional_encryptsign): Make sure that we never ever send the passphrase if the gpg-agent has been detected. Likewise. * acconfig.h: Removed all remaining stuff as AC_TEMPLATEs to configure.in. BTW, we should consider to rename configure.in to configure.ac. 2003-01-04 Werner Koch <wk@gnupg.org> Replaced the use of HAVE_PGP and HAVE_SMIME by a more readable and extendable solution. * pgplib.h: Moved enum pgp_ring and KEYFLAGS_* to * crypt.h: here. * smime.c (mutt_is_application_smime): Moved to * crypt.c (mutt_is_application_smime): here. * pgp.c (mutt_is_application_pgp): Moved to * crypt.c (mutt_is_application_pgp): here. * pgp.c (pgp_is_multipart_encrypted): Removed. Merged code with * crypt.c (mutt_is_multipart_encrypted): this. * mutt.h: Protect against double inclusion. * pgplib.h (struct pgp_keyinfo): Remove the typedef to pgp_key_t. * crypt.h (pgp_key_t): Declare the typedef here. NOTE: This is now a pointer. Changed all usages accordingly. * configure.in: Replace HAVE_PGP and HAVE_SMIME by the new CRYPT_BACKEND macros. Always include all OPS.*. (LIBOBJ): Replaced by AC_LIBOBJ as required by newer autoconfs. * Makefile.am (EXTRA_mutt_SOURCES): Move crypt.c to mutt_SOURCES. (mutt_SOURCES): Add cryptglue.c (EXTRA_DIST): Add crypt.h * pgp.h, pgplib.h, smime.h: Use the header only when the approriate backend has been configured. * pgp.c, pgpkey.c, smime.c: Build only if the approriate CRYPT_BACKEND_ macro is defined. * pgp.h, smime.h, global.h: Moved all variable declarations to global.h because they are now always defined. * sort.h: Always define PgpSortKey, although it does not belong to here. * keymap.h: Unconditionally include all PGP and SMIME stuff. * mutt.h: Ditto. * protos.h: Ditto. * init.h (HAVE_SMIME): Unconditionally include all crypto related definitions. Mark the doc entries with "(Crypto/PGP/SMIME only)". * globals.h: Replace gpg.h and smime.h by crypt.h. * functions.h: Always include all crypto commands. * copy.h: Unconditionally define the crypto related M_CM_ * pgplib.h: Move APPLICATION_PGP and PGP* to crypt.h and include it. * smime.h: Move APPLICATION_SMIME and SMIME* to crypt.h and include it. * mutt_crypt.h (ENCRYPT,SIGN,GOODSIGN, BADSIGN): Move to crypt.h. * crypt.c: Replaced pgp.h and smime.h header by crypt.h. Always include all functions but shortcut them depending on WITHCRYPTO. All over the place use WITHCRYPTO instead of ifdefs. Replaced all direct calls of the backend fucntions by twrapper functions defined in cryptglue.c (crypt_get_keys): Removed prototypes. * pgp.h (pgp_findKeys): New prototype. * smime.h (smime_findKeys): New prototype. * cryptglue.c: New. * crypt.h: New. * mutt_crypt.h: Moved all crypt_* prototypes to gcrypt.h. Unconditionally use this file. * init.c: Replaced pgp.h and smime.h header by crypt.h. (parse_set): Use WITHCRYPTO instead of ifdefs. (mutt_var_value_complete): Ditto. * sendlib.c: Replaced pgp.h and smime.h header by crypt.h. (write_as_text_part): Now one macro using WITHCRYPTO. (mutt_write_mime_body): Use WITHCRYPTO instead of ifdefs. (mutt_make_message_attach): Ditto. (mutt_write_fcc): Ditto. * send.c: Replaced pgp.h and smime.h header by crypt.h. (include_forward): Use WITHCRYPTO and validate passphrases for pgp and smime. (include_reply): Ditto. (generate_body): Use WITHCRYPTO instead of ifdefs. (ci_send_message): Ditto. * recvattach.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_gen_attach_list): Use WITHCRYPTO instead of ifdefs. (mutt_attach_display_loop): Ditto (mutt_view_attachments): Ditto. * postpone.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_get_postponed): Use WITHCRYPTO instead of ifdefs. (mutt_parse_crypt_hdr): Always include and use WITHCRYPTO instead of ifdefs. (mutt_prepare_template): Use WITHCRYPTO instead of ifdefs. * pop.c: Removed pgp.h and smime.h. (pop_fetch_message): Use WITHCRYPTO instead of ifdefs. * pattern.c: Replaced pgp.h and smime.h header by crypt.h. (Flags): Always include the crypto flags. (msg_search): Use WITHCRYPTO instead of ifdefs. (mutt_pattern_exec): Ditto. * parse.c: Removed pgp.h and smime.h. (mutt_parse_mime_message): Use WITHCRYPTO instead of ifdefs. * pager.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_pager): Use WITHCRYPTO instead of ifdefs. * mx.c: Removed smime.h and pgp.h. (mx_update_context): Use WITHCRYPTO instead of ifdefs. * muttlib.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_needs_mailcap): Use WITHCRYPTO. Note, that there used to be an error when PGP was not configured so that TYPEAPPLICATION was not recognized for SMIME. (mutt_is_text_part): Use WITHCRYPTO instead of ifdefs. * main.c: Include crypt.h. (show_version): Remove HAVE_PGP and HAVE_SMIME. Add CRYPT_BACKEND_CLASSIC_PGP, CRYPT_BACKEND_CLASSIC_SMIME. * keymap.c: Include crypt.h so that we can test WITHCRYPTO. (Menus): Always include pgp and smime. (km_init): Create smime and pgp bindings depending on WITHCRYPTO. (km_get_table): Return OpPgp depending on WITHCRYPTO. * hook.c (mutt_parse_hook): Use WITHCRYPTO instead of ifdefs. (mutt_crypt_hook): Always include. * headers.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_edit_headers): Use WITHCRYPTO instead of ifdefs * hdrline.c: Replaced pgp.h and smime.h header by crypt.h. (hdr_format_str): Use WITHCRYPTO. * handler.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_can_decode): Use WITHCRYPTO instead of ifdefs. (mutt_can_decode): Application/smime is now also checked when PGP support is not configured. (mutt_body_handler): Use WITHCRYPTO * curs_main.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_index_menu): Shortcut crypto only operations depending on WITHCRYPTO. * copy.c: Replaced pgp.h and smime.h header by crypt.h. (_mutt_copy_message): * compose.c: Replaced pgp.h and smime.h header by crypt.h. (enum): Always include HDR_CRYPT and HDR_CRYPTINFO. (redraw_crypt_lines): Always include this fnc but shortcut it depending on WITHCRYPT. Draw lines depending on the configured crypto support. (pgp_send_menu): Always include this one. Call wrapper functions. (smime_send_menu): Likewise. (draw_envelope): Use WITHCRYPTO instead of ifdefs. (mutt_compose_menu): Allow pgp/smime commands only when configured. * commands.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_display_message,pipe_msg, _mutt_pipe_message) (set_copy_flags, mutt_save_message, mutt_edit_content_type) (_mutt_check_traditional_pgp): Use pgp wrapper. * attach.c (mutt_view_attachment): Removed HAVE_GPG and HAVE_SMIME and replaced by global variable WITHCRYPTO. Replaced pgp and smime header by crypt.h.x
2003-01-09The latest GnuPG has new abilities to work with disabled keys. PartDavid Shaw
of this change will eventually involve moving the 'd' that indicates a disabled key to a different part of the key listing. To smooth this transition, as of version 1.2.2, GnuPG will start giving the 'd' in both places (and will do this for a good long time). Here is a patch so mutt will accept either the old or new syntax.
2002-12-11Fix Mike's and my e-mail addresses in copyright lines.Thomas Roessler
2002-12-10Replace safe_free calls by the FREE macro.Thomas Roessler
2002-03-26Fix iconv warnings; from Edmund Grimley Evans.Thomas Roessler
2002-02-14Iconv patch from Lars Hecking. MAY NEED TO BE BACKPORTED.Thomas Roessler
2001-08-01Signed fixes. Noted by Vincent Lefevre's compiler.Thomas Roessler
2001-03-28Make mutt compatible with GnuPG's latest features. As requested byThomas Roessler
Werner Koch.
2001-02-13Change charset-hook's behaviour.Thomas Roessler
2001-02-12Auto-detect the micalg used with PGP/MIME signatures.Thomas Roessler
2001-01-08Let check_sec.sh check for use of the unsafe malloc, realloc, free,Thomas Roessler
and strdup routines. While we are on it, plug some memory leaks and make some code understandable.
2000-12-06Fix pgp_ignore_subkeys.Thomas Roessler
2000-11-13Add the pgp_ignore_subkeys option. Unset it to get the traditionalThomas Roessler
listing with all the subkeys. (Experimental, may introduce new bugs.)
2000-05-24Make charset-hook work with an external iconv implementation.Thomas Roessler
2000-05-09Edmund Grimley Evans' UTF-8 patch.Thomas Roessler
2000-04-22Comment cosmetics. From Martin Michlmayer.Thomas Roessler
2000-03-03The FSF apparently has moved.Thomas Roessler
2000-01-10More copyright cosmetics - noted by Martin Michlmayr <tbm@cyrius.com>.Thomas Roessler
2000-01-10Fix PGP uid parsing. Noted by Edmund GRIMLEY EVANSThomas Roessler
<edmundo@rano.demon.co.uk>.
2000-01-06Update copyright notices for unstable.Thomas Roessler
1999-07-01Various patches from last week, including:Thomas Roessler
- new mh/maildir access code. - subscribe/unsubscribe - various fixes.
1999-06-03Experimental: New PGP invocation interface. The invocations are doneThomas Roessler
through formats, so all this should fit more cleanly into mutt now.
1999-05-03gnupg gives reasonable trust values now.Thomas Roessler
1999-03-22PGP key creation time fix by Roland Rosenfeld.Thomas Roessler
1999-02-09browser.h: re-insert the "tagged" component.Thomas Roessler
pgp support: fix handling of PGP 5 subkeys, algorithm 20.
1999-01-27Add $pgp_show_unusable.Thomas Roessler
1999-01-22Heavy hacking on mutt's pgp support. We no longer read the completeThomas Roessler
key ring into memory. For gpg, performance is heavily improved due to the fact that we are passing a couple of key hints to the key ring parsing back-end.
1999-01-07Get rid of RCS ids in source files. They are getting in our wayThomas Roessler
when merging changes.
1998-11-10Introduce or rewrite mutt_{str*cmp,strlen} and use them all over theThomas Roessler
place. If there are still segmentation faults due to missing NONULLs over, they are gone now.
1998-10-21Make gpg's output look a little bit cleaner.Thomas Roessler
1998-10-15Change "static char rcsid[]" to "static const char rcsid[]" to makemutt-0-94-13-relThomas Roessler
gcc shut up about this.
1998-10-13Add RCS $Id$ strings to (hopefully) all source files.Thomas Roessler