From c4cb47bc53434612c41333695b15350724d60d6a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 22 Mar 2010 05:52:26 +1100 Subject: - djm@cvs.openbsd.org 2010/03/12 01:06:25 [servconf.c] unbreak AuthorizedKeys option with a $HOME-relative path; reported by vinschen AT redhat.com, ok dtucker@ --- servconf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'servconf.c') diff --git a/servconf.c b/servconf.c index f9e2f2dfd..e09e0f1c8 100644 --- a/servconf.c +++ b/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.204 2010/03/04 10:36:03 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.205 2010/03/12 01:06:25 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -1223,7 +1223,17 @@ process_server_config_line(ServerOptions *options, char *line, charptr = (opcode == sAuthorizedKeysFile) ? &options->authorized_keys_file : &options->authorized_keys_file2; - goto parse_filename; + arg = strdelim(&cp); + if (!arg || *arg == '\0') + fatal("%s line %d: missing file name.", + filename, linenum); + if (*activep && *charptr == NULL) { + *charptr = derelativise_path(arg); + /* increase optional counter */ + if (intptr != NULL) + *intptr = *intptr + 1; + } + break; case sClientAliveInterval: intptr = &options->client_alive_interval; -- cgit v1.2.3 From 4a5f0d325b723dcfdcc540f83ae8a3c08a589d7e Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 22 Mar 2010 05:53:04 +1100 Subject: - markus@cvs.openbsd.org 2010/03/12 11:37:40 [servconf.c] do not prepend AuthorizedKeysFile with getcwd(), unbreaks relative paths free() (not xfree()) the buffer returned by getcwd() --- ChangeLog | 4 ++++ servconf.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'servconf.c') diff --git a/ChangeLog b/ChangeLog index 3112f6457..95c87ba26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,10 @@ [servconf.c] unbreak AuthorizedKeys option with a $HOME-relative path; reported by vinschen AT redhat.com, ok dtucker@ + - markus@cvs.openbsd.org 2010/03/12 11:37:40 + [servconf.c] + do not prepend AuthorizedKeysFile with getcwd(), unbreaks relative paths + free() (not xfree()) the buffer returned by getcwd() 20100314 - (djm) [ssh-pkcs11-helper.c] Move #ifdef to after #defines to fix diff --git a/servconf.c b/servconf.c index e09e0f1c8..fa442bcea 100644 --- a/servconf.c +++ b/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.205 2010/03/12 01:06:25 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.206 2010/03/12 11:37:40 markus Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -478,7 +478,7 @@ derelativise_path(const char *path) if ((cwd = getcwd(NULL, 0)) == NULL) fatal("%s: getcwd: %s", __func__, strerror(errno)); xasprintf(&ret, "%s/%s", cwd, expanded); - xfree(cwd); + free(cwd); xfree(expanded); return ret; } @@ -1228,7 +1228,7 @@ process_server_config_line(ServerOptions *options, char *line, fatal("%s line %d: missing file name.", filename, linenum); if (*activep && *charptr == NULL) { - *charptr = derelativise_path(arg); + *charptr = tilde_expand_filename(arg, getuid()); /* increase optional counter */ if (intptr != NULL) *intptr = *intptr + 1; -- cgit v1.2.3 From 44451d0af8ecbec2a17d47d75d3cca02d1239cf8 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 26 Mar 2010 10:40:04 +1100 Subject: - djm@cvs.openbsd.org 2010/03/25 23:38:28 [servconf.c] from portable: getcwd(NULL, 0) doesn't work on all platforms, so use a stack buffer; ok dtucker@ --- ChangeLog | 5 +++++ servconf.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'servconf.c') diff --git a/ChangeLog b/ChangeLog index 30a7ce269..cf3558c00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ for arc4random_buf() and arc4random_uniform(); from Josh Gilkerson - (dtucker) [configure.ac] Bug #1741: Add section for Haiku, patch originally by Ingo Weinhold via Scott McCreary, ok djm@ + - (djm) OpenBSD CVS Sync + - djm@cvs.openbsd.org 2010/03/25 23:38:28 + [servconf.c] + from portable: getcwd(NULL, 0) doesn't work on all platforms, so + use a stack buffer; ok dtucker@ 20100324 - (dtucker) [contrib/cygwin/ssh-host-config] Mount the Windows directory diff --git a/servconf.c b/servconf.c index fa442bcea..7d027ddb9 100644 --- a/servconf.c +++ b/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.206 2010/03/12 11:37:40 markus Exp $ */ +/* $OpenBSD: servconf.c,v 1.207 2010/03/25 23:38:28 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -470,15 +470,14 @@ parse_token(const char *cp, const char *filename, char * derelativise_path(const char *path) { - char *expanded, *ret, *cwd; + char *expanded, *ret, cwd[MAXPATHLEN]; expanded = tilde_expand_filename(path, getuid()); if (*expanded == '/') return expanded; - if ((cwd = getcwd(NULL, 0)) == NULL) + if (getcwd(cwd, sizeof(cwd)) == NULL) fatal("%s: getcwd: %s", __func__, strerror(errno)); xasprintf(&ret, "%s/%s", cwd, expanded); - free(cwd); xfree(expanded); return ret; } -- cgit v1.2.3