summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/ssh.c b/ssh.c
index 6080c0c27..e7e15cd65 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.360 2011/05/06 21:38:58 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.361 2011/05/24 07:15:47 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -212,6 +212,20 @@ static void main_sigchld_handler(int);
212void muxclient(const char *); 212void muxclient(const char *);
213void muxserver_listen(void); 213void muxserver_listen(void);
214 214
215/* ~/ expand a list of paths. NB. assumes path[n] is heap-allocated. */
216static void
217tilde_expand_paths(char **paths, u_int num_paths)
218{
219 u_int i;
220 char *cp;
221
222 for (i = 0; i < num_paths; i++) {
223 cp = tilde_expand_filename(paths[i], original_real_uid);
224 xfree(paths[i]);
225 paths[i] = cp;
226 }
227}
228
215/* 229/*
216 * Main program for the ssh client. 230 * Main program for the ssh client.
217 */ 231 */
@@ -869,15 +883,9 @@ main(int ac, char **av)
869 load_public_identity_files(); 883 load_public_identity_files();
870 884
871 /* Expand ~ in known host file names. */ 885 /* Expand ~ in known host file names. */
872 /* XXX mem-leaks: */ 886 tilde_expand_paths(options.system_hostfiles,
873 options.system_hostfile = 887 options.num_system_hostfiles);
874 tilde_expand_filename(options.system_hostfile, original_real_uid); 888 tilde_expand_paths(options.user_hostfiles, options.num_user_hostfiles);
875 options.user_hostfile =
876 tilde_expand_filename(options.user_hostfile, original_real_uid);
877 options.system_hostfile2 =
878 tilde_expand_filename(options.system_hostfile2, original_real_uid);
879 options.user_hostfile2 =
880 tilde_expand_filename(options.user_hostfile2, original_real_uid);
881 889
882 signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ 890 signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */
883 signal(SIGCHLD, main_sigchld_handler); 891 signal(SIGCHLD, main_sigchld_handler);