summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-06-26 05:42:16 +0000
committerDamien Miller <djm@mindrot.org>2020-06-26 15:44:47 +1000
commit976c4f86286d52a0cb2aadf4a095d379c0da752e (patch)
tree39f721d68c5e000b5943a3d864863cb4dd9b0752
parent32b2502a9dfdfded1ccdc1fd6dc2b3fe41bfc205 (diff)
upstream: avoid spurious error message when ssh-keygen creates files
outside ~/.ssh; with dtucker@ OpenBSD-Commit-ID: ac0c662d44607e00ec78c266ee60752beb1c7e08
-rw-r--r--Makefile.in3
-rw-r--r--configure.ac8
-rw-r--r--hostfile.c10
3 files changed, 8 insertions, 13 deletions
diff --git a/Makefile.in b/Makefile.in
index 99dfdceda..30a7fff2d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -49,7 +49,6 @@ PICFLAG=@PICFLAG@
49LIBS=@LIBS@ 49LIBS=@LIBS@
50K5LIBS=@K5LIBS@ 50K5LIBS=@K5LIBS@
51GSSLIBS=@GSSLIBS@ 51GSSLIBS=@GSSLIBS@
52SSHLIBS=@SSHLIBS@
53SSHDLIBS=@SSHDLIBS@ 52SSHDLIBS=@SSHDLIBS@
54LIBEDIT=@LIBEDIT@ 53LIBEDIT=@LIBEDIT@
55LIBFIDO2=@LIBFIDO2@ 54LIBFIDO2=@LIBFIDO2@
@@ -206,7 +205,7 @@ libssh.a: $(LIBSSH_OBJS)
206 $(RANLIB) $@ 205 $(RANLIB) $@
207 206
208ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS) 207ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
209 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS) $(GSSLIBS) 208 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(GSSLIBS)
210 209
211sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) 210sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
212 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS) 211 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS)
diff --git a/configure.ac b/configure.ac
index 0ea85bed0..d6edb24f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4516,13 +4516,10 @@ AC_ARG_WITH([selinux],
4516 LIBS="$LIBS -lselinux" 4516 LIBS="$LIBS -lselinux"
4517 ], 4517 ],
4518 AC_MSG_ERROR([SELinux support requires libselinux library])) 4518 AC_MSG_ERROR([SELinux support requires libselinux library]))
4519 SSHLIBS="$SSHLIBS $LIBSELINUX"
4520 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
4521 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level]) 4519 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
4522 LIBS="$save_LIBS" 4520 LIBS="$save_LIBS $LIBSELINUX"
4523 fi ] 4521 fi ]
4524) 4522)
4525AC_SUBST([SSHLIBS])
4526AC_SUBST([SSHDLIBS]) 4523AC_SUBST([SSHDLIBS])
4527 4524
4528# Check whether user wants Kerberos 5 support 4525# Check whether user wants Kerberos 5 support
@@ -5483,9 +5480,6 @@ echo " Libraries: ${LIBS}"
5483if test ! -z "${SSHDLIBS}"; then 5480if test ! -z "${SSHDLIBS}"; then
5484echo " +for sshd: ${SSHDLIBS}" 5481echo " +for sshd: ${SSHDLIBS}"
5485fi 5482fi
5486if test ! -z "${SSHLIBS}"; then
5487echo " +for ssh: ${SSHLIBS}"
5488fi
5489 5483
5490echo "" 5484echo ""
5491 5485
diff --git a/hostfile.c b/hostfile.c
index 1cc4dba92..936d8c9be 100644
--- a/hostfile.c
+++ b/hostfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hostfile.c,v 1.81 2020/06/26 05:02:03 dtucker Exp $ */ 1/* $OpenBSD: hostfile.c,v 1.82 2020/06/26 05:42:16 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
@@ -465,9 +465,10 @@ hostfile_create_user_ssh_dir(const char *filename, int notify)
465 return; 465 return;
466 len = p - filename; 466 len = p - filename;
467 dotsshdir = tilde_expand_filename("~/" _PATH_SSH_USER_DIR, getuid()); 467 dotsshdir = tilde_expand_filename("~/" _PATH_SSH_USER_DIR, getuid());
468 if ((strlen(dotsshdir) > len || strncmp(filename, dotsshdir, len) != 0 468 if (strlen(dotsshdir) > len || strncmp(filename, dotsshdir, len) != 0)
469 || stat(dotsshdir, &st)) == 0) 469 goto out; /* not ~/.ssh prefixed */
470 ; /* do nothing, path not in ~/.ssh or dir already exists */ 470 if (stat(dotsshdir, &st) == 0)
471 goto out; /* dir already exists */
471 else if (errno != ENOENT) 472 else if (errno != ENOENT)
472 error("Could not stat %s: %s", dotsshdir, strerror(errno)); 473 error("Could not stat %s: %s", dotsshdir, strerror(errno));
473 else { 474 else {
@@ -483,6 +484,7 @@ hostfile_create_user_ssh_dir(const char *filename, int notify)
483 ssh_selinux_setfscreatecon(NULL); 484 ssh_selinux_setfscreatecon(NULL);
484#endif 485#endif
485 } 486 }
487 out:
486 free(dotsshdir); 488 free(dotsshdir);
487} 489}
488 490