]> andersk Git - openssh.git/blobdiff - servconf.c
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / servconf.c
index af940cac2c6677c01f66aba0dac11d57aad86790..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)
@@ -343,7 +343,7 @@ static struct {
        { "hostbasedusesnamefrompacketonly", sHostbasedUsesNameFromPacketOnly, SSHCFG_GLOBAL },
        { "rsaauthentication", sRSAAuthentication, SSHCFG_ALL },
        { "pubkeyauthentication", sPubkeyAuthentication, SSHCFG_ALL },
-       { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL },  /* alias */
+       { "dsaauthentication", sPubkeyAuthentication, SSHCFG_GLOBAL }, /* alias */
 #ifdef KRB5
        { "kerberosauthentication", sKerberosAuthentication, SSHCFG_ALL },
        { "kerberosorlocalpasswd", sKerberosOrLocalPasswd, SSHCFG_GLOBAL },
@@ -417,10 +417,10 @@ static struct {
        { "clientalivecountmax", sClientAliveCountMax, SSHCFG_GLOBAL },
        { "authorizedkeysfile", sAuthorizedKeysFile, SSHCFG_GLOBAL },
        { "authorizedkeysfile2", sAuthorizedKeysFile2, SSHCFG_GLOBAL },
-       { "useprivilegeseparation", sUsePrivilegeSeparation, SSHCFG_GLOBAL },
+       { "useprivilegeseparation", sUsePrivilegeSeparation, SSHCFG_GLOBAL},
        { "acceptenv", sAcceptEnv, SSHCFG_GLOBAL },
        { "permittunnel", sPermitTunnel, SSHCFG_GLOBAL },
-       { "match", sMatch, SSHCFG_ALL },
+       { "match", sMatch, SSHCFG_ALL },
        { "permitopen", sPermitOpen, SSHCFG_ALL },
        { "forcecommand", sForceCommand, SSHCFG_ALL },
        { "chrootdirectory", sChrootDirectory, SSHCFG_ALL },
@@ -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 0.926949 seconds and 4 git commands to generate.