]> andersk Git - openssh.git/blobdiff - servconf.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / servconf.c
index b51b86a8f55e2fcd8a4bdc44aec0b6972f19adde..09296c9cfa3a0a4456833374ceeb33b0d58f2aaf 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.195 2009/04/14 21:10:54 jj Exp $ */
+/* $OpenBSD: servconf.c,v 1.202 2010/01/13 03:48:12 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -139,7 +139,7 @@ fill_default_server_options(ServerOptions *options)
 
        /* Standard Options */
        if (options->protocol == SSH_PROTO_UNKNOWN)
-               options->protocol = SSH_PROTO_1|SSH_PROTO_2;
+               options->protocol = SSH_PROTO_2;
        if (options->num_host_key_files == 0) {
                /* fill default hostkeys for protocols */
                if (options->protocol & SSH_PROTO_1)
@@ -459,6 +459,22 @@ parse_token(const char *cp, const char *filename,
        return sBadOption;
 }
 
+char *
+derelativise_path(const char *path)
+{
+       char *expanded, *ret, *cwd;
+
+       expanded = tilde_expand_filename(path, getuid());
+       if (*expanded == '/')
+               return expanded;
+       if ((cwd = getcwd(NULL, 0)) == NULL)
+               fatal("%s: getcwd: %s", __func__, strerror(errno));
+       xasprintf(&ret, "%s/%s", cwd, expanded);
+       xfree(cwd);
+       xfree(expanded);
+       return ret;
+}
+
 static void
 add_listen_addr(ServerOptions *options, char *addr, int port)
 {
@@ -793,7 +809,7 @@ process_server_config_line(ServerOptions *options, char *line,
                        fatal("%s line %d: missing file name.",
                            filename, linenum);
                if (*activep && *charptr == NULL) {
-                       *charptr = tilde_expand_filename(arg, getuid());
+                       *charptr = derelativise_path(arg);
                        /* increase optional counter */
                        if (intptr != NULL)
                                *intptr = *intptr + 1;
@@ -1626,6 +1642,7 @@ dump_config(ServerOptions *o)
        dump_cfg_string(sAuthorizedKeysFile, o->authorized_keys_file);
        dump_cfg_string(sAuthorizedKeysFile2, o->authorized_keys_file2);
        dump_cfg_string(sForceCommand, o->adm_forced_command);
+       dump_cfg_string(sChrootDirectory, o->chroot_directory);
 
        /* string arguments requiring a lookup */
        dump_cfg_string(sLogLevel, log_level_name(o->log_level));
This page took 1.556693 seconds and 4 git commands to generate.