Commit 426df179 426df179766b4b144cf746dfc56f4b4a9f80b3ac by Sergey Poznyakoff

Bugfixes.

* libmailutils/url/create.c (_mu_url_create_internal): Fix
parsing of the '|' shortcuts.
* libmailutils/tests/url.at: Fix '|' test. Add 'prog://' test.

* movemail/movemail.c (set_program_id): Call mu_stdstream_strerr_setup
to flush changes.
* frm/common.c: Minor changes
1 parent 43508b45
...@@ -388,19 +388,15 @@ get_personal (mu_header_t hdr, const char *field, char **personal) ...@@ -388,19 +388,15 @@ get_personal (mu_header_t hdr, const char *field, char **personal)
388 if (status == 0) 388 if (status == 0)
389 { 389 {
390 mu_address_t address = NULL; 390 mu_address_t address = NULL;
391 char *s = NULL; 391 const char *s = NULL;
392 392
393 mu_address_create (&address, hfield); 393 mu_address_create (&address, hfield);
394 394
395 mu_address_aget_personal (address, 1, &s); 395 mu_address_sget_personal (address, 1, &s);
396 mu_address_destroy (&address);
397 if (s == NULL) 396 if (s == NULL)
398 s = hfield; 397 s = hfield;
399 else
400 free (hfield);
401
402 *personal = rfc2047_decode_wrapper (s, strlen (s)); 398 *personal = rfc2047_decode_wrapper (s, strlen (s));
403 free (s); 399 mu_address_destroy (&address);
404 } 400 }
405 return status; 401 return status;
406 } 402 }
...@@ -581,7 +577,7 @@ frm_scan (char *mailbox_name, frm_select_t fun, size_t *total) ...@@ -581,7 +577,7 @@ frm_scan (char *mailbox_name, frm_select_t fun, size_t *total)
581 status = mu_mailbox_scan (mbox, 1, total); 577 status = mu_mailbox_scan (mbox, 1, total);
582 if (status != 0) 578 if (status != 0)
583 { 579 {
584 mu_error (_("could not scan mailbox `%s': %s."), 580 mu_error (_("could not scan mailbox `%s': %s"),
585 mu_url_to_string (url), mu_strerror (status)); 581 mu_url_to_string (url), mu_strerror (status));
586 frm_abort (&mbox); 582 frm_abort (&mbox);
587 } 583 }
......
...@@ -804,9 +804,21 @@ auth <> ...@@ -804,9 +804,21 @@ auth <>
804 host <> 804 host <>
805 port 0 805 port 0
806 path </bin/mailman> 806 path </bin/mailman>
807 query[0] </bin/mailman> 807 query[0] <request>
808 query[1] <request> 808 query[1] <list%40dom>
809 query[2] <list%40dom> 809 ]])
810
811 TESTURL([],[],
812 [prog:///bin/mailman?request&list%40dom],
813 [[scheme <prog>
814 user <>
815 passwd <>
816 auth <>
817 host <>
818 port 0
819 path </bin/mailman>
820 query[0] <request>
821 query[1] <list@dom>
810 ]]) 822 ]])
811 823
812 m4_popdef([TESTURL]) 824 m4_popdef([TESTURL])
......
...@@ -378,6 +378,7 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint) ...@@ -378,6 +378,7 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
378 if ((ctx->flags & MU_URL_PARSE_PIPE) && ctx->input[0] == '|') 378 if ((ctx->flags & MU_URL_PARSE_PIPE) && ctx->input[0] == '|')
379 { 379 {
380 struct mu_wordsplit ws; 380 struct mu_wordsplit ws;
381 size_t i;
381 382
382 rc = str_assign (&url->scheme, "prog"); 383 rc = str_assign (&url->scheme, "prog");
383 if (rc) 384 if (rc)
...@@ -386,15 +387,21 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint) ...@@ -386,15 +387,21 @@ _mu_url_create_internal (struct mu_url_ctx *ctx, mu_url_t hint)
386 ctx->flags &= ~MU_URL_PARSE_HEXCODE; 387 ctx->flags &= ~MU_URL_PARSE_HEXCODE;
387 if (mu_wordsplit (ctx->input + 1, &ws, MU_WRDSF_DEFFLAGS)) 388 if (mu_wordsplit (ctx->input + 1, &ws, MU_WRDSF_DEFFLAGS))
388 return errno; 389 return errno;
389 url->qargc = ws.ws_wordc; 390 url->path = ws.ws_wordv[0];
390 url->qargv = ws.ws_wordv; 391 url->flags |= MU_URL_PATH;
392
393 url->qargc = ws.ws_wordc - 1;
394 url->qargv = calloc (url->qargc + 1, sizeof (url->qargv[0]));
395 if (!url->qargv)
396 {
397 mu_wordsplit_free (&ws);
398 return ENOMEM;
399 }
400 for (i = 0; i < url->qargc; i++)
401 url->qargv[i] = ws.ws_wordv[i+1];
391 ws.ws_wordc = 0; 402 ws.ws_wordc = 0;
392 ws.ws_wordv = NULL;
393 mu_wordsplit_free (&ws); 403 mu_wordsplit_free (&ws);
394 url->flags |= MU_URL_QUERY; 404 url->flags |= MU_URL_QUERY;
395 rc = str_assign (&url->path, url->qargv[0]);
396 if (rc == 0)
397 url->flags |= MU_URL_PATH;
398 } 405 }
399 else if ((ctx->flags & MU_URL_PARSE_SLASH) && ctx->input[0] == '/') 406 else if ((ctx->flags & MU_URL_PARSE_SLASH) && ctx->input[0] == '/')
400 { 407 {
......
...@@ -828,6 +828,7 @@ set_program_id (const char *source_name, const char *dest_name) ...@@ -828,6 +828,7 @@ set_program_id (const char *source_name, const char *dest_name)
828 ws.ws_wordv[0] = NULL; 828 ws.ws_wordv[0] = NULL;
829 ws.ws_wordc = 0; 829 ws.ws_wordc = 0;
830 mu_wordsplit_free (&ws); 830 mu_wordsplit_free (&ws);
831 mu_stdstream_strerr_setup (MU_STRERR_STDERR);
831 } 832 }
832 833
833 834
......