- 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
|
||||
just switch the euid, don't switch the complete set of groups
|
||||
(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
|
||||
- (bal) OpenBSD CVS Sync
|
||||
|
@ -900,4 +904,4 @@
|
|||
- (stevesk) entropy.c: typo in debug message
|
||||
- (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"
|
||||
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 "ssh1.h"
|
||||
|
@ -57,8 +57,8 @@ krb4_init(void *context)
|
|||
if (lstat("/ticket", &st) != -1)
|
||||
tkt_root = "/ticket/";
|
||||
#endif /* AFS */
|
||||
snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%d",
|
||||
tkt_root, authctxt->pw->pw_uid, getpid());
|
||||
snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%ld",
|
||||
tkt_root, authctxt->pw->pw_uid, (long)getpid());
|
||||
krb_set_tkt_string(authctxt->krb4_ticket_file);
|
||||
}
|
||||
/* 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>
|
||||
|
@ -60,7 +60,7 @@ struct monitor {
|
|||
struct mm_master *m_zback;
|
||||
struct mm_master *m_zlib;
|
||||
struct Kex **m_pkex;
|
||||
int m_pid;
|
||||
pid_t m_pid;
|
||||
};
|
||||
|
||||
struct monitor *monitor_init(void);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#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 "packet.h"
|
||||
|
@ -674,8 +674,8 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
|
|||
if (errno != EINTR)
|
||||
packet_disconnect("wait: %.100s", strerror(errno));
|
||||
if (wait_pid != pid)
|
||||
error("Strange, wait returned pid %d, expected %d",
|
||||
wait_pid, pid);
|
||||
error("Strange, wait returned pid %ld, expected %ld",
|
||||
(long)wait_pid, (long)pid);
|
||||
|
||||
/* Check if it exited normally. */
|
||||
if (WIFEXITED(wait_status)) {
|
||||
|
|
28
session.c
28
session.c
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
|
||||
#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 "ssh1.h"
|
||||
|
@ -162,8 +162,8 @@ auth_input_request_forwarding(struct passwd * pw)
|
|||
auth_sock_dir = NULL;
|
||||
return 0;
|
||||
}
|
||||
snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%d",
|
||||
auth_sock_dir, (int) getpid());
|
||||
snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%ld",
|
||||
auth_sock_dir, (long) getpid());
|
||||
|
||||
/* delete agent socket on fatal() */
|
||||
fatal_add_cleanup(auth_sock_cleanup_proc, pw);
|
||||
|
@ -435,7 +435,7 @@ do_authenticated1(Authctxt *authctxt)
|
|||
void
|
||||
do_exec_no_pty(Session *s, const char *command)
|
||||
{
|
||||
int pid;
|
||||
pid_t pid;
|
||||
|
||||
#ifdef USE_PIPES
|
||||
int pin[2], pout[2], perr[2];
|
||||
|
@ -1430,12 +1430,12 @@ session_dump(void)
|
|||
int i;
|
||||
for (i = 0; i < MAX_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->self,
|
||||
s,
|
||||
s->chanid,
|
||||
s->pid);
|
||||
(long)s->pid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1493,13 +1493,13 @@ static Session *
|
|||
session_by_pid(pid_t pid)
|
||||
{
|
||||
int i;
|
||||
debug("session_by_pid: pid %d", pid);
|
||||
debug("session_by_pid: pid %ld", (long)pid);
|
||||
for (i = 0; i < MAX_SESSIONS; i++) {
|
||||
Session *s = &sessions[i];
|
||||
if (s->used && s->pid == pid)
|
||||
return s;
|
||||
}
|
||||
error("session_by_pid: unknown pid %d", pid);
|
||||
error("session_by_pid: unknown pid %ld", (long)pid);
|
||||
session_dump();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1789,8 +1789,8 @@ session_exit_message(Session *s, int status)
|
|||
if ((c = channel_lookup(s->chanid)) == NULL)
|
||||
fatal("session_exit_message: session %d: no channel %d",
|
||||
s->self, s->chanid);
|
||||
debug("session_exit_message: session %d channel %d pid %d",
|
||||
s->self, s->chanid, s->pid);
|
||||
debug("session_exit_message: session %d channel %d pid %ld",
|
||||
s->self, s->chanid, (long)s->pid);
|
||||
|
||||
if (WIFEXITED(status)) {
|
||||
channel_request_start(s->chanid, "exit-status", 0);
|
||||
|
@ -1829,7 +1829,7 @@ session_exit_message(Session *s, int status)
|
|||
void
|
||||
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) {
|
||||
fatal_remove_cleanup(session_pty_cleanup, (void *)s);
|
||||
session_pty_cleanup(s);
|
||||
|
@ -1853,7 +1853,8 @@ session_close_by_pid(pid_t pid, int status)
|
|||
{
|
||||
Session *s = session_by_pid(pid);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
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) {
|
||||
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 "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/md5.h>
|
||||
|
@ -1043,7 +1043,7 @@ main(int ac, char **av)
|
|||
format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
|
||||
printf(format, SSH_AUTHSOCKET_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);
|
||||
}
|
||||
parent_pid = getpid();
|
||||
|
@ -1055,8 +1055,8 @@ main(int ac, char **av)
|
|||
perror("mkdtemp: private socket dir");
|
||||
exit(1);
|
||||
}
|
||||
snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir,
|
||||
parent_pid);
|
||||
snprintf(socket_name, sizeof socket_name, "%s/agent.%ld", socket_dir,
|
||||
(long)parent_pid);
|
||||
} else {
|
||||
/* Try to use specified agent socket */
|
||||
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";
|
||||
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
||||
SSH_AUTHSOCKET_ENV_NAME);
|
||||
printf("echo Agent pid %d;\n", parent_pid);
|
||||
printf("echo Agent pid %ld;\n", (long)parent_pid);
|
||||
goto skip;
|
||||
}
|
||||
pid = fork();
|
||||
|
@ -1112,14 +1112,14 @@ main(int ac, char **av)
|
|||
}
|
||||
if (pid != 0) { /* Parent - execute the given command. */
|
||||
close(sock);
|
||||
snprintf(pidstrbuf, sizeof pidstrbuf, "%d", pid);
|
||||
snprintf(pidstrbuf, sizeof pidstrbuf, "%ld", (long)pid);
|
||||
if (ac == 0) {
|
||||
format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
|
||||
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
|
||||
SSH_AUTHSOCKET_ENV_NAME);
|
||||
printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf,
|
||||
SSH_AGENTPID_ENV_NAME);
|
||||
printf("echo Agent pid %d;\n", pid);
|
||||
printf("echo Agent pid %ld;\n", (long)pid);
|
||||
exit(0);
|
||||
}
|
||||
if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
|
||||
|
|
10
sshd.c
10
sshd.c
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
#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/bn.h>
|
||||
|
@ -574,7 +574,7 @@ privsep_preauth(void)
|
|||
if (pid == -1) {
|
||||
fatal("fork of unprivileged child failed");
|
||||
} 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);
|
||||
authctxt = monitor_child_preauth(pmonitor);
|
||||
|
@ -630,7 +630,7 @@ privsep_postauth(Authctxt *authctxt)
|
|||
if (pmonitor->m_pid == -1)
|
||||
fatal("fork of unprivileged child failed");
|
||||
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);
|
||||
monitor_child_postauth(pmonitor);
|
||||
|
||||
|
@ -1173,7 +1173,7 @@ main(int ac, char **av)
|
|||
*/
|
||||
f = fopen(options.pid_file, "wb");
|
||||
if (f) {
|
||||
fprintf(f, "%u\n", (u_int) getpid());
|
||||
fprintf(f, "%ld\n", (long) getpid());
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ main(int ac, char **av)
|
|||
if (pid < 0)
|
||||
error("fork: %.100s", strerror(errno));
|
||||
else
|
||||
debug("Forked child %d.", pid);
|
||||
debug("Forked child %ld.", (long)pid);
|
||||
|
||||
close(startup_p[1]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue