- djm@cvs.openbsd.org 2010/01/13 03:48:13
[servconf.c servconf.h sshd.c] avoid run-time failures when specifying hostkeys via a relative path by prepending the cwd in these cases; bz#1290; ok dtucker@
This commit is contained in:
parent
2901e2daeb
commit
88b6fb2b55
|
@ -22,6 +22,10 @@
|
|||
[sftp.c sftp-server.c sftp.1 sftp-common.c sftp-common.h]
|
||||
support '-h' (human-readable units) for sftp's ls command, just like
|
||||
ls(1); ok dtucker@
|
||||
- djm@cvs.openbsd.org 2010/01/13 03:48:13
|
||||
[servconf.c servconf.h sshd.c]
|
||||
avoid run-time failures when specifying hostkeys via a relative
|
||||
path by prepending the cwd in these cases; bz#1290; ok dtucker@
|
||||
|
||||
20100112
|
||||
- (dtucker) OpenBSD CVS Sync
|
||||
|
|
20
servconf.c
20
servconf.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: servconf.c,v 1.201 2010/01/10 03:51:17 dtucker 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
|
||||
|
@ -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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: servconf.h,v 1.89 2010/01/09 23:04:13 dtucker Exp $ */
|
||||
/* $OpenBSD: servconf.h,v 1.90 2010/01/13 03:48:13 djm Exp $ */
|
||||
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
|
@ -164,5 +164,6 @@ void parse_server_match_config(ServerOptions *, const char *, const char *,
|
|||
const char *);
|
||||
void copy_set_server_options(ServerOptions *, ServerOptions *, int);
|
||||
void dump_config(ServerOptions *);
|
||||
char *derelativise_path(const char *);
|
||||
|
||||
#endif /* SERVCONF_H */
|
||||
|
|
5
sshd.c
5
sshd.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sshd.c,v 1.370 2010/01/09 23:04:13 dtucker Exp $ */
|
||||
/* $OpenBSD: sshd.c,v 1.371 2010/01/13 03:48:13 djm Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -1351,7 +1351,8 @@ main(int ac, char **av)
|
|||
fprintf(stderr, "too many host keys.\n");
|
||||
exit(1);
|
||||
}
|
||||
options.host_key_files[options.num_host_key_files++] = optarg;
|
||||
options.host_key_files[options.num_host_key_files++] =
|
||||
derelativise_path(optarg);
|
||||
break;
|
||||
case 't':
|
||||
test_flag = 1;
|
||||
|
|
Loading…
Reference in New Issue