dovecot-1.2: deliver -p: Expand relative paths before chdir()ing.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 23 20:26:11 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/f1414fa48b4b
changeset: 8770:f1414fa48b4b
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 23 13:18:17 2009 -0500
description:
deliver -p: Expand relative paths before chdir()ing.
diffstat:
1 file changed, 7 insertions(+)
src/deliver/deliver.c | 7 +++++++
diffs (24 lines):
diff -r cc8d4d06ef9f -r f1414fa48b4b src/deliver/deliver.c
--- 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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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) {
More information about the dovecot-cvs
mailing list