X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..e0fe492429aa15be0fe92b431b66506f2906c892:/hook.c?ds=inline diff --git a/hook.c b/hook.c index bee3c48..2e44298 100644 --- a/hook.c +++ b/hook.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2002 Michael R. Elkins , and others + * Copyright (C) 1996-2002,2004,2007 Michael R. Elkins , and others * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,7 +172,6 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) #endif /* M_CRYPTHOOK */ { regerror (rc, rx, err->data, err->dsize); - regfree (rx); FREE (&rx); goto error; } @@ -426,7 +425,7 @@ void mutt_select_fcc (char *path, size_t pathlen, HEADER *hdr) else strfcpy (path, NONULL (Outbox), pathlen); } - mutt_pretty_mailbox (path); + mutt_pretty_mailbox (path, pathlen); } static char *_mutt_string_hook (const char *match, int hook) @@ -460,11 +459,19 @@ char *mutt_crypt_hook (ADDRESS *adr) #ifdef USE_SOCKET void mutt_account_hook (const char* url) { + /* parsing commands with URLs in an account hook can cause a recursive + * call. We just skip processing if this occurs. Typically such commands + * belong in a folder-hook -- perhaps we should warn the user. */ + static int inhook = 0; + HOOK* hook; BUFFER token; BUFFER err; char buf[STRING]; + if (inhook) + return; + err.data = buf; err.dsize = sizeof (buf); memset (&token, 0, sizeof (token)); @@ -476,14 +483,19 @@ void mutt_account_hook (const char* url) if ((regexec (hook->rx.rx, url, 0, NULL, 0) == 0) ^ hook->rx.not) { + inhook = 1; + if (mutt_parse_rc_line (hook->command, &token, &err) == -1) { FREE (&token.data); mutt_error ("%s", err.data); mutt_sleep (1); + inhook = 0; return; } + + inhook = 0; } }