Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8770:f1414fa48b4b HEAD
deliver -p: Expand relative paths before chdir()ing.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 23 Feb 2009 13:18:17 -0500 |
parents | cc8d4d06ef9f |
children | 8b6dd6d0f33a |
files | src/deliver/deliver.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/deliver/deliver.c Sat Feb 21 18:47:48 2009 -0500 +++ b/src/deliver/deliver.c Mon Feb 23 13:18:17 2009 -0500 @@ -828,6 +828,7 @@ struct mailbox_transaction_context *t; struct mailbox_header_lookup_ctx *headers_ctx; struct mail *mail; + char cwd[PATH_MAX]; uid_t process_euid; bool stderr_rejection = FALSE; bool keep_environment = FALSE; @@ -893,6 +894,12 @@ if (i == argc) i_fatal_status(EX_USAGE, "Missing -p argument"); path = argv[i]; + if (*path != '/') { + /* expand relative paths before we chdir */ + if (getcwd(cwd, sizeof(cwd)) == NULL) + i_fatal("getcwd() failed: %m"); + path = t_strconcat(cwd, "/", path, NULL); + } } else if (strcmp(argv[i], "-e") == 0) { stderr_rejection = TRUE; } else if (strcmp(argv[i], "-c") == 0) {