diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-09-24 14:46:45 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-09-24 14:47:09 +0300 |
commit | dd13dedfe0580e391e2a082ff9d1ac842292a4eb (patch) | |
tree | 86b069ee5df16dcefea963819597f557e32499e2 | |
parent | 81cd471c86dafffd89d517e5b9dcf2be3c16b1e5 (diff) | |
download | mailutils-dd13dedfe0580e391e2a082ff9d1ac842292a4eb.tar.gz mailutils-dd13dedfe0580e391e2a082ff9d1ac842292a4eb.tar.bz2 |
Fix hex (%XX) expansion in URLs.
* mailbox/url.c (url_parse0): Take three arguments. Return in the
third one a boolean indicating whether to expand %XX notations in
the URL. Do not decode absolute file names and pipes.
(mu_url_parse): Use this value to decide.
* movemail/movemail.c (main): In emacs mode: force UNIX mbox
format as a default. Send debugging output to stderr.
-rw-r--r-- | mailbox/url.c | 35 | ||||
-rw-r--r-- | movemail/movemail.c | 8 |
2 files changed, 28 insertions, 15 deletions
diff --git a/mailbox/url.c b/mailbox/url.c index 1b833bf3f..f46fbc14f 100644 --- a/mailbox/url.c +++ b/mailbox/url.c | |||
@@ -42,3 +42,3 @@ | |||
42 | 42 | ||
43 | static int url_parse0 (mu_url_t, char *, size_t *poff); | 43 | static int url_parse0 (mu_url_t, char *, size_t *poff, int *decode); |
44 | 44 | ||
@@ -288,3 +288,4 @@ mu_url_parse (mu_url_t url) | |||
288 | mu_secret_t newsec; | 288 | mu_secret_t newsec; |
289 | 289 | int want_decode; | |
290 | |||
290 | if (!url || !url->name) | 291 | if (!url || !url->name) |
@@ -303,3 +304,3 @@ mu_url_parse (mu_url_t url) | |||
303 | 304 | ||
304 | err = url_parse0 (&u, n, &pstart); | 305 | err = url_parse0 (&u, n, &pstart, &want_decode); |
305 | 306 | ||
@@ -333,13 +334,14 @@ mu_url_parse (mu_url_t url) | |||
333 | 334 | ||
334 | #define UALLOC(X) \ | 335 | #define UALLOC(X) \ |
335 | if (u.X && u.X[0] && (url->X = mu_url_decode(u.X)) == 0) \ | 336 | if (u.X && u.X[0] && \ |
336 | { \ | 337 | !(url->X = (want_decode ? mu_url_decode (u.X) : strdup (u.X)))) \ |
337 | err = ENOMEM; \ | 338 | { \ |
338 | goto CLEANUP; \ | 339 | err = ENOMEM; \ |
339 | } \ | 340 | goto CLEANUP; \ |
340 | else \ | 341 | } \ |
341 | { \ | 342 | else \ |
342 | /* Set zero-length strings to NULL. */ \ | 343 | { \ |
343 | u.X = NULL; \ | 344 | /* Set zero-length strings to NULL. */ \ |
344 | } | 345 | u.X = NULL; \ |
346 | } | ||
345 | 347 | ||
@@ -422,3 +424,3 @@ Is this required to be % quoted, though? I hope so! | |||
422 | static int | 424 | static int |
423 | url_parse0 (mu_url_t u, char *name, size_t *poff) | 425 | url_parse0 (mu_url_t u, char *name, size_t *poff, int *decode) |
424 | { | 426 | { |
@@ -434,2 +436,3 @@ url_parse0 (mu_url_t u, char *name, size_t *poff) | |||
434 | u->scheme = "file"; | 436 | u->scheme = "file"; |
437 | *decode = 0; | ||
435 | } | 438 | } |
@@ -439,2 +442,3 @@ url_parse0 (mu_url_t u, char *name, size_t *poff) | |||
439 | u->scheme = "prog"; | 442 | u->scheme = "prog"; |
443 | *decode = 0; | ||
440 | rc = mu_argcv_get (name + 1, NULL, NULL, &u->qargc, &u->qargv); | 444 | rc = mu_argcv_get (name + 1, NULL, NULL, &u->qargc, &u->qargv); |
@@ -450,2 +454,3 @@ url_parse0 (mu_url_t u, char *name, size_t *poff) | |||
450 | { | 454 | { |
455 | *decode = 1; | ||
451 | /* Parse out the SCHEME. */ | 456 | /* Parse out the SCHEME. */ |
diff --git a/movemail/movemail.c b/movemail/movemail.c index afb83e8ae..4e7bdb986 100644 --- a/movemail/movemail.c +++ b/movemail/movemail.c | |||
@@ -762,2 +762,10 @@ main (int argc, char **argv) | |||
762 | 762 | ||
763 | if (emacs_mode) | ||
764 | { | ||
765 | /* Undo the effect of configuration options that may affect | ||
766 | the interaction with Emacs. */ | ||
767 | mu_registrar_set_default_record (mu_mbox_record); | ||
768 | mu_debug_default_printer = mu_debug_stderr_printer; | ||
769 | } | ||
770 | |||
763 | atexit (close_mailboxes); | 771 | atexit (close_mailboxes); |