summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/servconf.c b/servconf.c
index b1964e865..09296c9cf 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.c,v 1.201 2010/01/10 03:51:17 dtucker Exp $ */ 1/* $OpenBSD: servconf.c,v 1.202 2010/01/13 03:48:12 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -459,6 +459,22 @@ parse_token(const char *cp, const char *filename,
459 return sBadOption; 459 return sBadOption;
460} 460}
461 461
462char *
463derelativise_path(const char *path)
464{
465 char *expanded, *ret, *cwd;
466
467 expanded = tilde_expand_filename(path, getuid());
468 if (*expanded == '/')
469 return expanded;
470 if ((cwd = getcwd(NULL, 0)) == NULL)
471 fatal("%s: getcwd: %s", __func__, strerror(errno));
472 xasprintf(&ret, "%s/%s", cwd, expanded);
473 xfree(cwd);
474 xfree(expanded);
475 return ret;
476}
477
462static void 478static void
463add_listen_addr(ServerOptions *options, char *addr, int port) 479add_listen_addr(ServerOptions *options, char *addr, int port)
464{ 480{
@@ -793,7 +809,7 @@ process_server_config_line(ServerOptions *options, char *line,
793 fatal("%s line %d: missing file name.", 809 fatal("%s line %d: missing file name.",
794 filename, linenum); 810 filename, linenum);
795 if (*activep && *charptr == NULL) { 811 if (*activep && *charptr == NULL) {
796 *charptr = tilde_expand_filename(arg, getuid()); 812 *charptr = derelativise_path(arg);
797 /* increase optional counter */ 813 /* increase optional counter */
798 if (intptr != NULL) 814 if (intptr != NULL)
799 *intptr = *intptr + 1; 815 *intptr = *intptr + 1;