- mpech@cvs.openbsd.org 2002/06/11 05:46:20
[auth-krb4.c monitor.h serverloop.c session.c ssh-agent.c sshd.c] pid_t cleanup. Markus need this now to keep hacking. markus@, millert@ ok
This commit is contained in:
parent
f9c4884c8e
commit
ce0f634270
|
@ -35,6 +35,10 @@
|
||||||
run less code with euid==0 if ssh is installed setuid root
|
run less code with euid==0 if ssh is installed setuid root
|
||||||
just switch the euid, don't switch the complete set of groups
|
just switch the euid, don't switch the complete set of groups
|
||||||
(this is only needed by sshd). ok provos@
|
(this is only needed by sshd). ok provos@
|
||||||
|
- mpech@cvs.openbsd.org 2002/06/11 05:46:20
|
||||||
|
[auth-krb4.c monitor.h serverloop.c session.c ssh-agent.c sshd.c]
|
||||||
|
pid_t cleanup. Markus need this now to keep hacking.
|
||||||
|
markus@, millert@ ok
|
||||||
|
|
||||||
20020609
|
20020609
|
||||||
- (bal) OpenBSD CVS Sync
|
- (bal) OpenBSD CVS Sync
|
||||||
|
@ -900,4 +904,4 @@
|
||||||
- (stevesk) entropy.c: typo in debug message
|
- (stevesk) entropy.c: typo in debug message
|
||||||
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
|
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2208 2002/06/11 16:37:51 mouring Exp $
|
$Id: ChangeLog,v 1.2209 2002/06/11 16:42:49 mouring Exp $
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: auth-krb4.c,v 1.26 2002/03/18 01:30:10 dugsong Exp $");
|
RCSID("$OpenBSD: auth-krb4.c,v 1.27 2002/06/11 05:46:20 mpech Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -57,8 +57,8 @@ krb4_init(void *context)
|
||||||
if (lstat("/ticket", &st) != -1)
|
if (lstat("/ticket", &st) != -1)
|
||||||
tkt_root = "/ticket/";
|
tkt_root = "/ticket/";
|
||||||
#endif /* AFS */
|
#endif /* AFS */
|
||||||
snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%d",
|
snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%ld",
|
||||||
tkt_root, authctxt->pw->pw_uid, getpid());
|
tkt_root, authctxt->pw->pw_uid, (long)getpid());
|
||||||
krb_set_tkt_string(authctxt->krb4_ticket_file);
|
krb_set_tkt_string(authctxt->krb4_ticket_file);
|
||||||
}
|
}
|
||||||
/* Register ticket cleanup in case of fatal error. */
|
/* Register ticket cleanup in case of fatal error. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: monitor.h,v 1.5 2002/06/06 01:09:41 stevesk Exp $ */
|
/* $OpenBSD: monitor.h,v 1.6 2002/06/11 05:46:20 mpech Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
||||||
|
@ -60,7 +60,7 @@ struct monitor {
|
||||||
struct mm_master *m_zback;
|
struct mm_master *m_zback;
|
||||||
struct mm_master *m_zlib;
|
struct mm_master *m_zlib;
|
||||||
struct Kex **m_pkex;
|
struct Kex **m_pkex;
|
||||||
int m_pid;
|
pid_t m_pid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct monitor *monitor_init(void);
|
struct monitor *monitor_init(void);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $");
|
RCSID("$OpenBSD: serverloop.c,v 1.102 2002/06/11 05:46:20 mpech Exp $");
|
||||||
|
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
@ -674,8 +674,8 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
packet_disconnect("wait: %.100s", strerror(errno));
|
packet_disconnect("wait: %.100s", strerror(errno));
|
||||||
if (wait_pid != pid)
|
if (wait_pid != pid)
|
||||||
error("Strange, wait returned pid %d, expected %d",
|
error("Strange, wait returned pid %ld, expected %ld",
|
||||||
wait_pid, pid);
|
(long)wait_pid, (long)pid);
|
||||||
|
|
||||||
/* Check if it exited normally. */
|
/* Check if it exited normally. */
|
||||||
if (WIFEXITED(wait_status)) {
|
if (WIFEXITED(wait_status)) {
|
||||||
|
|
28
session.c
28
session.c
|
@ -33,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: session.c,v 1.136 2002/06/10 22:28:41 markus Exp $");
|
RCSID("$OpenBSD: session.c,v 1.137 2002/06/11 05:46:20 mpech Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -162,8 +162,8 @@ auth_input_request_forwarding(struct passwd * pw)
|
||||||
auth_sock_dir = NULL;
|
auth_sock_dir = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%d",
|
snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%ld",
|
||||||
auth_sock_dir, (int) getpid());
|
auth_sock_dir, (long) getpid());
|
||||||
|
|
||||||
/* delete agent socket on fatal() */
|
/* delete agent socket on fatal() */
|
||||||
fatal_add_cleanup(auth_sock_cleanup_proc, pw);
|
fatal_add_cleanup(auth_sock_cleanup_proc, pw);
|
||||||
|
@ -435,7 +435,7 @@ do_authenticated1(Authctxt *authctxt)
|
||||||
void
|
void
|
||||||
do_exec_no_pty(Session *s, const char *command)
|
do_exec_no_pty(Session *s, const char *command)
|
||||||
{
|
{
|
||||||
int pid;
|
pid_t pid;
|
||||||
|
|
||||||
#ifdef USE_PIPES
|
#ifdef USE_PIPES
|
||||||
int pin[2], pout[2], perr[2];
|
int pin[2], pout[2], perr[2];
|
||||||
|
@ -1430,12 +1430,12 @@ session_dump(void)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_SESSIONS; i++) {
|
for (i = 0; i < MAX_SESSIONS; i++) {
|
||||||
Session *s = &sessions[i];
|
Session *s = &sessions[i];
|
||||||
debug("dump: used %d session %d %p channel %d pid %d",
|
debug("dump: used %d session %d %p channel %d pid %ld",
|
||||||
s->used,
|
s->used,
|
||||||
s->self,
|
s->self,
|
||||||
s,
|
s,
|
||||||
s->chanid,
|
s->chanid,
|
||||||
s->pid);
|
(long)s->pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1493,13 +1493,13 @@ static Session *
|
||||||
session_by_pid(pid_t pid)
|
session_by_pid(pid_t pid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
debug("session_by_pid: pid %d", pid);
|
debug("session_by_pid: pid %ld", (long)pid);
|
||||||
for (i = 0; i < MAX_SESSIONS; i++) {
|
for (i = 0; i < MAX_SESSIONS; i++) {
|
||||||
Session *s = &sessions[i];
|
Session *s = &sessions[i];
|
||||||
if (s->used && s->pid == pid)
|
if (s->used && s->pid == pid)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
error("session_by_pid: unknown pid %d", pid);
|
error("session_by_pid: unknown pid %ld", (long)pid);
|
||||||
session_dump();
|
session_dump();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1789,8 +1789,8 @@ session_exit_message(Session *s, int status)
|
||||||
if ((c = channel_lookup(s->chanid)) == NULL)
|
if ((c = channel_lookup(s->chanid)) == NULL)
|
||||||
fatal("session_exit_message: session %d: no channel %d",
|
fatal("session_exit_message: session %d: no channel %d",
|
||||||
s->self, s->chanid);
|
s->self, s->chanid);
|
||||||
debug("session_exit_message: session %d channel %d pid %d",
|
debug("session_exit_message: session %d channel %d pid %ld",
|
||||||
s->self, s->chanid, s->pid);
|
s->self, s->chanid, (long)s->pid);
|
||||||
|
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
channel_request_start(s->chanid, "exit-status", 0);
|
channel_request_start(s->chanid, "exit-status", 0);
|
||||||
|
@ -1829,7 +1829,7 @@ session_exit_message(Session *s, int status)
|
||||||
void
|
void
|
||||||
session_close(Session *s)
|
session_close(Session *s)
|
||||||
{
|
{
|
||||||
debug("session_close: session %d pid %d", s->self, s->pid);
|
debug("session_close: session %d pid %ld", s->self, (long)s->pid);
|
||||||
if (s->ttyfd != -1) {
|
if (s->ttyfd != -1) {
|
||||||
fatal_remove_cleanup(session_pty_cleanup, (void *)s);
|
fatal_remove_cleanup(session_pty_cleanup, (void *)s);
|
||||||
session_pty_cleanup(s);
|
session_pty_cleanup(s);
|
||||||
|
@ -1853,7 +1853,8 @@ session_close_by_pid(pid_t pid, int status)
|
||||||
{
|
{
|
||||||
Session *s = session_by_pid(pid);
|
Session *s = session_by_pid(pid);
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
debug("session_close_by_pid: no session for pid %d", pid);
|
debug("session_close_by_pid: no session for pid %ld",
|
||||||
|
(long)pid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (s->chanid != -1)
|
if (s->chanid != -1)
|
||||||
|
@ -1873,7 +1874,8 @@ session_close_by_channel(int id, void *arg)
|
||||||
debug("session_close_by_channel: no session for id %d", id);
|
debug("session_close_by_channel: no session for id %d", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug("session_close_by_channel: channel %d child %d", id, s->pid);
|
debug("session_close_by_channel: channel %d child %ld",
|
||||||
|
id, (long)s->pid);
|
||||||
if (s->pid != 0) {
|
if (s->pid != 0) {
|
||||||
debug("session_close_by_channel: channel %d: has child", id);
|
debug("session_close_by_channel: channel %d: has child", id);
|
||||||
/*
|
/*
|
||||||
|
|
14
ssh-agent.c
14
ssh-agent.c
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "openbsd-compat/fake-queue.h"
|
#include "openbsd-compat/fake-queue.h"
|
||||||
RCSID("$OpenBSD: ssh-agent.c,v 1.90 2002/06/09 13:32:01 markus Exp $");
|
RCSID("$OpenBSD: ssh-agent.c,v 1.91 2002/06/11 05:46:20 mpech Exp $");
|
||||||
|
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
|
@ -1043,7 +1043,7 @@ main(int ac, char **av)
|
||||||
format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
|
format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
|
||||||
printf(format, SSH_AUTHSOCKET_ENV_NAME);
|
printf(format, SSH_AUTHSOCKET_ENV_NAME);
|
||||||
printf(format, SSH_AGENTPID_ENV_NAME);
|
printf(format, SSH_AGENTPID_ENV_NAME);
|
||||||
printf("echo Agent pid %d killed;\n", pid);
|
printf("echo Agent pid %ld killed;\n", (long)pid);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
parent_pid = getpid();
|
parent_pid = getpid();
|
||||||
|
@ -1055,8 +1055,8 @@ main(int ac, char **av)
|
||||||
perror("mkdtemp: private socket dir");
|
perror("mkdtemp: private socket dir");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir,
|
snprintf(socket_name, sizeof socket_name, "%s/agent.%ld", socket_dir,
|
||||||
parent_pid);
|
(long)parent_pid);
|
||||||
} else {
|
} else {
|
||||||
/* Try to use specified agent socket */
|
/* Try to use specified agent socket */
|
||||||
socket_dir[0] = '\0';
|
socket_dir[0] = '\0';
|
||||||
|
@ -1102,7 +1102,7 @@ main(int ac, char **av)
|
||||||
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
|
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
|
||||||
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
||||||
SSH_AUTHSOCKET_ENV_NAME);
|
SSH_AUTHSOCKET_ENV_NAME);
|
||||||
printf("echo Agent pid %d;\n", parent_pid);
|
printf("echo Agent pid %ld;\n", (long)parent_pid);
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
@ -1112,14 +1112,14 @@ main(int ac, char **av)
|
||||||
}
|
}
|
||||||
if (pid != 0) { /* Parent - execute the given command. */
|
if (pid != 0) { /* Parent - execute the given command. */
|
||||||
close(sock);
|
close(sock);
|
||||||
snprintf(pidstrbuf, sizeof pidstrbuf, "%d", pid);
|
snprintf(pidstrbuf, sizeof pidstrbuf, "%ld", (long)pid);
|
||||||
if (ac == 0) {
|
if (ac == 0) {
|
||||||
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
|
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
|
||||||
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
||||||
SSH_AUTHSOCKET_ENV_NAME);
|
SSH_AUTHSOCKET_ENV_NAME);
|
||||||
printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf,
|
printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf,
|
||||||
SSH_AGENTPID_ENV_NAME);
|
SSH_AGENTPID_ENV_NAME);
|
||||||
printf("echo Agent pid %d;\n", pid);
|
printf("echo Agent pid %ld;\n", (long)pid);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
|
if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
|
||||||
|
|
10
sshd.c
10
sshd.c
|
@ -42,7 +42,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sshd.c,v 1.244 2002/05/29 11:21:57 markus Exp $");
|
RCSID("$OpenBSD: sshd.c,v 1.245 2002/06/11 05:46:20 mpech Exp $");
|
||||||
|
|
||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
|
@ -574,7 +574,7 @@ privsep_preauth(void)
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
fatal("fork of unprivileged child failed");
|
fatal("fork of unprivileged child failed");
|
||||||
} else if (pid != 0) {
|
} else if (pid != 0) {
|
||||||
debug2("Network child is on pid %d", pid);
|
debug2("Network child is on pid %ld", (long)pid);
|
||||||
|
|
||||||
close(pmonitor->m_recvfd);
|
close(pmonitor->m_recvfd);
|
||||||
authctxt = monitor_child_preauth(pmonitor);
|
authctxt = monitor_child_preauth(pmonitor);
|
||||||
|
@ -630,7 +630,7 @@ privsep_postauth(Authctxt *authctxt)
|
||||||
if (pmonitor->m_pid == -1)
|
if (pmonitor->m_pid == -1)
|
||||||
fatal("fork of unprivileged child failed");
|
fatal("fork of unprivileged child failed");
|
||||||
else if (pmonitor->m_pid != 0) {
|
else if (pmonitor->m_pid != 0) {
|
||||||
debug2("User child is on pid %d", pmonitor->m_pid);
|
debug2("User child is on pid %ld", (long)pmonitor->m_pid);
|
||||||
close(pmonitor->m_recvfd);
|
close(pmonitor->m_recvfd);
|
||||||
monitor_child_postauth(pmonitor);
|
monitor_child_postauth(pmonitor);
|
||||||
|
|
||||||
|
@ -1173,7 +1173,7 @@ main(int ac, char **av)
|
||||||
*/
|
*/
|
||||||
f = fopen(options.pid_file, "wb");
|
f = fopen(options.pid_file, "wb");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "%u\n", (u_int) getpid());
|
fprintf(f, "%ld\n", (long) getpid());
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1320,7 @@ main(int ac, char **av)
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
error("fork: %.100s", strerror(errno));
|
error("fork: %.100s", strerror(errno));
|
||||||
else
|
else
|
||||||
debug("Forked child %d.", pid);
|
debug("Forked child %ld.", (long)pid);
|
||||||
|
|
||||||
close(startup_p[1]);
|
close(startup_p[1]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue