summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-15 17:23:34 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-15 17:23:34 +1000
commit25f60a7ee780c2cd4a01e05698149d274821012f (patch)
tree2fbe10fb72d4e1037dbadf1196dfba4062de299d
parent397a2f2612901785d8290a90ae9aa59efb422c92 (diff)
- (dtucker) [Makefile.in ssh-keysign.c ssh.c] Use permanently_set_uid() since
it does the right thing on all platforms. ok djm@
-rw-r--r--ChangeLog6
-rw-r--r--Makefile.in6
-rw-r--r--ssh-keysign.c12
-rw-r--r--ssh.c7
4 files changed, 19 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 00f38b465..d1936ac1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120040815
2 - (dtucker) [Makefile.in ssh-keysign.c ssh.c] Use permanently_set_uid() since
3 it does the right thing on all platforms. ok djm@
4
120040814 520040814
2 - (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c] 6 - (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c]
3 Explicitly set umask for mkstemp; ok djm@ 7 Explicitly set umask for mkstemp; ok djm@
@@ -1631,4 +1635,4 @@
1631 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1635 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1632 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1636 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1633 1637
1634$Id: ChangeLog,v 1.3508 2004/08/14 14:09:11 dtucker Exp $ 1638$Id: ChangeLog,v 1.3509 2004/08/15 07:23:34 dtucker Exp $
diff --git a/Makefile.in b/Makefile.in
index 95b431105..194da9033 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.261 2004/06/23 03:21:54 mouring Exp $ 1# $Id: Makefile.in,v 1.262 2004/08/15 07:23:34 dtucker Exp $
2 2
3# uncomment if you run a non bourne compatable shell. Ie. csh 3# uncomment if you run a non bourne compatable shell. Ie. csh
4#SHELL = @SH@ 4#SHELL = @SH@
@@ -67,7 +67,7 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o buffer.o \
67 compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \ 67 compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
68 log.o match.o moduli.o mpaux.o nchan.o packet.o \ 68 log.o match.o moduli.o mpaux.o nchan.o packet.o \
69 readpass.o rsa.o tildexpand.o ttymodes.o xmalloc.o \ 69 readpass.o rsa.o tildexpand.o ttymodes.o xmalloc.o \
70 atomicio.o key.o dispatch.o kex.o mac.o uuencode.o misc.o \ 70 atomicio.o key.o dispatch.o kex.o mac.o uidswap.c uuencode.o misc.o \
71 monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \ 71 monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \
72 kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \ 72 kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \
73 entropy.o scard-opensc.o gss-genr.o 73 entropy.o scard-opensc.o gss-genr.o
@@ -76,7 +76,7 @@ SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
76 sshconnect.o sshconnect1.o sshconnect2.o 76 sshconnect.o sshconnect1.o sshconnect2.o
77 77
78SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ 78SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
79 sshpty.o sshlogin.o servconf.o serverloop.o uidswap.o \ 79 sshpty.o sshlogin.o servconf.o serverloop.o \
80 auth.o auth1.o auth2.o auth-options.o session.o \ 80 auth.o auth1.o auth2.o auth-options.o session.o \
81 auth-chall.o auth2-chall.o groupaccess.o \ 81 auth-chall.o auth2-chall.o groupaccess.o \
82 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \ 82 auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
diff --git a/ssh-keysign.c b/ssh-keysign.c
index cf8b0c2d2..517655790 100644
--- a/ssh-keysign.c
+++ b/ssh-keysign.c
@@ -41,6 +41,7 @@ RCSID("$OpenBSD: ssh-keysign.c,v 1.16 2004/04/18 23:10:26 djm Exp $");
41#include "canohost.h" 41#include "canohost.h"
42#include "pathnames.h" 42#include "pathnames.h"
43#include "readconf.h" 43#include "readconf.h"
44#include "uidswap.h"
44 45
45/* XXX readconf.c needs these */ 46/* XXX readconf.c needs these */
46uid_t original_real_uid; 47uid_t original_real_uid;
@@ -150,8 +151,11 @@ main(int argc, char **argv)
150 key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY); 151 key_fd[0] = open(_PATH_HOST_RSA_KEY_FILE, O_RDONLY);
151 key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY); 152 key_fd[1] = open(_PATH_HOST_DSA_KEY_FILE, O_RDONLY);
152 153
153 seteuid(getuid()); 154 if ((pw = getpwuid(getuid())) == NULL)
154 setuid(getuid()); 155 fatal("getpwuid failed");
156 pw = pwcopy(pw);
157
158 permanently_set_uid(pw);
155 159
156 init_rng(); 160 init_rng();
157 seed_rng(); 161 seed_rng();
@@ -173,10 +177,6 @@ main(int argc, char **argv)
173 if (key_fd[0] == -1 && key_fd[1] == -1) 177 if (key_fd[0] == -1 && key_fd[1] == -1)
174 fatal("could not open any host key"); 178 fatal("could not open any host key");
175 179
176 if ((pw = getpwuid(getuid())) == NULL)
177 fatal("getpwuid failed");
178 pw = pwcopy(pw);
179
180 SSLeay_add_all_algorithms(); 180 SSLeay_add_all_algorithms();
181 for (i = 0; i < 256; i++) 181 for (i = 0; i < 256; i++)
182 rnd[i] = arc4random(); 182 rnd[i] = arc4random();
diff --git a/ssh.c b/ssh.c
index edf8f2c5e..1419f9874 100644
--- a/ssh.c
+++ b/ssh.c
@@ -71,6 +71,7 @@ RCSID("$OpenBSD: ssh.c,v 1.224 2004/07/28 09:40:29 markus Exp $");
71#include "match.h" 71#include "match.h"
72#include "msg.h" 72#include "msg.h"
73#include "monitor_fdpass.h" 73#include "monitor_fdpass.h"
74#include "uidswap.h"
74 75
75#ifdef SMARTCARD 76#ifdef SMARTCARD
76#include "scard.h" 77#include "scard.h"
@@ -644,8 +645,10 @@ again:
644 * user's home directory if it happens to be on a NFS volume where 645 * user's home directory if it happens to be on a NFS volume where
645 * root is mapped to nobody. 646 * root is mapped to nobody.
646 */ 647 */
647 seteuid(original_real_uid); 648 if (original_effective_uid == 0) {
648 setuid(original_real_uid); 649 PRIV_START;
650 permanently_set_uid(pw);
651 }
649 652
650 /* 653 /*
651 * Now that we are back to our own permissions, create ~/.ssh 654 * Now that we are back to our own permissions, create ~/.ssh