|
Lines 1-4
Link Here
|
| 1 |
/*- |
1 |
/*- |
| 2 |
* Copyright (c) 1999 Andrew J. Korty |
2 |
* Copyright (c) 1999, 2000 Andrew J. Korty |
| 3 |
* All rights reserved. |
3 |
* All rights reserved. |
| 4 |
* |
4 |
* |
|
Lines 31-34
Link Here
|
| 31 |
#include <sys/param.h> |
31 |
#include <sys/param.h> |
| 32 |
#include <sys/queue.h> |
32 |
#include <sys/queue.h> |
|
|
33 |
#include <sys/stat.h> |
| 33 |
|
34 |
|
| 34 |
#include <fcntl.h> |
35 |
#include <fcntl.h> |
|
Lines 121-125
Link Here
|
| 121 |
|
122 |
|
| 122 |
static int |
123 |
static int |
| 123 |
env_put(ENV *self, char *s) |
124 |
env_put(ENV *self, const char *s) |
| 124 |
{ |
125 |
{ |
| 125 |
struct env_entry *env; |
126 |
struct env_entry *env; |
|
Lines 137-141
Link Here
|
| 137 |
|
138 |
|
| 138 |
static void |
139 |
static void |
| 139 |
env_swap(ENV *self, int which) |
140 |
env_swap(const ENV *self, int which) |
| 140 |
{ |
141 |
{ |
| 141 |
environ = which ? self->e_environ_new : self->e_environ_orig; |
142 |
environ = which ? self->e_environ_new : self->e_environ_orig; |
|
Lines 174-180
Link Here
|
| 174 |
|
175 |
|
| 175 |
env_swap(self, 0); |
176 |
env_swap(self, 0); |
| 176 |
SLIST_FOREACH(p, &self->e_head, ee_entries) { |
177 |
while ((p = SLIST_FIRST(&self->e_head))) { |
| 177 |
free(p->ee_env); |
178 |
free(p->ee_env); |
| 178 |
free(p); |
179 |
free(p); |
|
|
180 |
SLIST_REMOVE_HEAD(&self->e_head, ee_entries); |
| 179 |
} |
181 |
} |
| 180 |
if (self->e_committed) |
182 |
if (self->e_committed) |
|
Lines 366-370
Link Here
|
| 366 |
saved_uid = geteuid(); |
368 |
saved_uid = geteuid(); |
| 367 |
(void)seteuid(pwent->pw_uid); |
369 |
(void)seteuid(pwent->pw_uid); |
| 368 |
env_fp = fopen(env_file, "w"); |
370 |
if ((env_fp = fopen(env_file, "w"))) |
|
|
371 |
(void)chmod(env_file, S_IRUSR); |
| 369 |
pipe = popen(PATH_SSH_AGENT, "r"); |
372 |
pipe = popen(PATH_SSH_AGENT, "r"); |
| 370 |
(void)seteuid(saved_uid); |
373 |
(void)seteuid(saved_uid); |