summaryrefslogtreecommitdiff
path: root/ssh-keysign.c
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 /ssh-keysign.c
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@
Diffstat (limited to 'ssh-keysign.c')
-rw-r--r--ssh-keysign.c12
1 files changed, 6 insertions, 6 deletions
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();