summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-11 16:42:49 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-11 16:42:49 +0000
commitce0f6342702a660f97b57cbdeb671feb02bae382 (patch)
treef8243804c8a0c71372d6a4fe92759a034e9dce38
parentf9c4884c8effe6dd78ab3ed4e42ed69c4a8652d0 (diff)
- 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
-rw-r--r--ChangeLog6
-rw-r--r--auth-krb4.c6
-rw-r--r--monitor.h4
-rw-r--r--serverloop.c6
-rw-r--r--session.c28
-rw-r--r--ssh-agent.c14
-rw-r--r--sshd.c10
7 files changed, 40 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e0b5159a..eb4ef220d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,10 @@
35 run less code with euid==0 if ssh is installed setuid root 35 run less code with euid==0 if ssh is installed setuid root
36 just switch the euid, don't switch the complete set of groups 36 just switch the euid, don't switch the complete set of groups
37 (this is only needed by sshd). ok provos@ 37 (this is only needed by sshd). ok provos@
38 - mpech@cvs.openbsd.org 2002/06/11 05:46:20
39 [auth-krb4.c monitor.h serverloop.c session.c ssh-agent.c sshd.c]
40 pid_t cleanup. Markus need this now to keep hacking.
41 markus@, millert@ ok
38 42
3920020609 4320020609
40 - (bal) OpenBSD CVS Sync 44 - (bal) OpenBSD CVS Sync
@@ -900,4 +904,4 @@
900 - (stevesk) entropy.c: typo in debug message 904 - (stevesk) entropy.c: typo in debug message
901 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 905 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
902 906
903$Id: ChangeLog,v 1.2208 2002/06/11 16:37:51 mouring Exp $ 907$Id: ChangeLog,v 1.2209 2002/06/11 16:42:49 mouring Exp $
diff --git a/auth-krb4.c b/auth-krb4.c
index 2a3cf5314..1cc528aa0 100644
--- a/auth-krb4.c
+++ b/auth-krb4.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth-krb4.c,v 1.26 2002/03/18 01:30:10 dugsong Exp $"); 26RCSID("$OpenBSD: auth-krb4.c,v 1.27 2002/06/11 05:46:20 mpech Exp $");
27 27
28#include "ssh.h" 28#include "ssh.h"
29#include "ssh1.h" 29#include "ssh1.h"
@@ -57,8 +57,8 @@ krb4_init(void *context)
57 if (lstat("/ticket", &st) != -1) 57 if (lstat("/ticket", &st) != -1)
58 tkt_root = "/ticket/"; 58 tkt_root = "/ticket/";
59#endif /* AFS */ 59#endif /* AFS */
60 snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%d", 60 snprintf(authctxt->krb4_ticket_file, MAXPATHLEN, "%s%u_%ld",
61 tkt_root, authctxt->pw->pw_uid, getpid()); 61 tkt_root, authctxt->pw->pw_uid, (long)getpid());
62 krb_set_tkt_string(authctxt->krb4_ticket_file); 62 krb_set_tkt_string(authctxt->krb4_ticket_file);
63 } 63 }
64 /* Register ticket cleanup in case of fatal error. */ 64 /* Register ticket cleanup in case of fatal error. */
diff --git a/monitor.h b/monitor.h
index c87ad572d..69114b532 100644
--- a/monitor.h
+++ b/monitor.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.h,v 1.5 2002/06/06 01:09:41 stevesk Exp $ */ 1/* $OpenBSD: monitor.h,v 1.6 2002/06/11 05:46:20 mpech Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 4 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
@@ -60,7 +60,7 @@ struct monitor {
60 struct mm_master *m_zback; 60 struct mm_master *m_zback;
61 struct mm_master *m_zlib; 61 struct mm_master *m_zlib;
62 struct Kex **m_pkex; 62 struct Kex **m_pkex;
63 int m_pid; 63 pid_t m_pid;
64}; 64};
65 65
66struct monitor *monitor_init(void); 66struct monitor *monitor_init(void);
diff --git a/serverloop.c b/serverloop.c
index 38b1cf7ba..1a148fcbe 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.101 2002/03/30 18:51:15 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.102 2002/06/11 05:46:20 mpech Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -674,8 +674,8 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
674 if (errno != EINTR) 674 if (errno != EINTR)
675 packet_disconnect("wait: %.100s", strerror(errno)); 675 packet_disconnect("wait: %.100s", strerror(errno));
676 if (wait_pid != pid) 676 if (wait_pid != pid)
677 error("Strange, wait returned pid %d, expected %d", 677 error("Strange, wait returned pid %ld, expected %ld",
678 wait_pid, pid); 678 (long)wait_pid, (long)pid);
679 679
680 /* Check if it exited normally. */ 680 /* Check if it exited normally. */
681 if (WIFEXITED(wait_status)) { 681 if (WIFEXITED(wait_status)) {
diff --git a/session.c b/session.c
index d2a460f89..a2d8a9c43 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.136 2002/06/10 22:28:41 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.137 2002/06/11 05:46:20 mpech Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -162,8 +162,8 @@ auth_input_request_forwarding(struct passwd * pw)
162 auth_sock_dir = NULL; 162 auth_sock_dir = NULL;
163 return 0; 163 return 0;
164 } 164 }
165 snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%d", 165 snprintf(auth_sock_name, MAXPATHLEN, "%s/agent.%ld",
166 auth_sock_dir, (int) getpid()); 166 auth_sock_dir, (long) getpid());
167 167
168 /* delete agent socket on fatal() */ 168 /* delete agent socket on fatal() */
169 fatal_add_cleanup(auth_sock_cleanup_proc, pw); 169 fatal_add_cleanup(auth_sock_cleanup_proc, pw);
@@ -435,7 +435,7 @@ do_authenticated1(Authctxt *authctxt)
435void 435void
436do_exec_no_pty(Session *s, const char *command) 436do_exec_no_pty(Session *s, const char *command)
437{ 437{
438 int pid; 438 pid_t pid;
439 439
440#ifdef USE_PIPES 440#ifdef USE_PIPES
441 int pin[2], pout[2], perr[2]; 441 int pin[2], pout[2], perr[2];
@@ -1430,12 +1430,12 @@ session_dump(void)
1430 int i; 1430 int i;
1431 for (i = 0; i < MAX_SESSIONS; i++) { 1431 for (i = 0; i < MAX_SESSIONS; i++) {
1432 Session *s = &sessions[i]; 1432 Session *s = &sessions[i];
1433 debug("dump: used %d session %d %p channel %d pid %d", 1433 debug("dump: used %d session %d %p channel %d pid %ld",
1434 s->used, 1434 s->used,
1435 s->self, 1435 s->self,
1436 s, 1436 s,
1437 s->chanid, 1437 s->chanid,
1438 s->pid); 1438 (long)s->pid);
1439 } 1439 }
1440} 1440}
1441 1441
@@ -1493,13 +1493,13 @@ static Session *
1493session_by_pid(pid_t pid) 1493session_by_pid(pid_t pid)
1494{ 1494{
1495 int i; 1495 int i;
1496 debug("session_by_pid: pid %d", pid); 1496 debug("session_by_pid: pid %ld", (long)pid);
1497 for (i = 0; i < MAX_SESSIONS; i++) { 1497 for (i = 0; i < MAX_SESSIONS; i++) {
1498 Session *s = &sessions[i]; 1498 Session *s = &sessions[i];
1499 if (s->used && s->pid == pid) 1499 if (s->used && s->pid == pid)
1500 return s; 1500 return s;
1501 } 1501 }
1502 error("session_by_pid: unknown pid %d", pid); 1502 error("session_by_pid: unknown pid %ld", (long)pid);
1503 session_dump(); 1503 session_dump();
1504 return NULL; 1504 return NULL;
1505} 1505}
@@ -1789,8 +1789,8 @@ session_exit_message(Session *s, int status)
1789 if ((c = channel_lookup(s->chanid)) == NULL) 1789 if ((c = channel_lookup(s->chanid)) == NULL)
1790 fatal("session_exit_message: session %d: no channel %d", 1790 fatal("session_exit_message: session %d: no channel %d",
1791 s->self, s->chanid); 1791 s->self, s->chanid);
1792 debug("session_exit_message: session %d channel %d pid %d", 1792 debug("session_exit_message: session %d channel %d pid %ld",
1793 s->self, s->chanid, s->pid); 1793 s->self, s->chanid, (long)s->pid);
1794 1794
1795 if (WIFEXITED(status)) { 1795 if (WIFEXITED(status)) {
1796 channel_request_start(s->chanid, "exit-status", 0); 1796 channel_request_start(s->chanid, "exit-status", 0);
@@ -1829,7 +1829,7 @@ session_exit_message(Session *s, int status)
1829void 1829void
1830session_close(Session *s) 1830session_close(Session *s)
1831{ 1831{
1832 debug("session_close: session %d pid %d", s->self, s->pid); 1832 debug("session_close: session %d pid %ld", s->self, (long)s->pid);
1833 if (s->ttyfd != -1) { 1833 if (s->ttyfd != -1) {
1834 fatal_remove_cleanup(session_pty_cleanup, (void *)s); 1834 fatal_remove_cleanup(session_pty_cleanup, (void *)s);
1835 session_pty_cleanup(s); 1835 session_pty_cleanup(s);
@@ -1853,7 +1853,8 @@ session_close_by_pid(pid_t pid, int status)
1853{ 1853{
1854 Session *s = session_by_pid(pid); 1854 Session *s = session_by_pid(pid);
1855 if (s == NULL) { 1855 if (s == NULL) {
1856 debug("session_close_by_pid: no session for pid %d", pid); 1856 debug("session_close_by_pid: no session for pid %ld",
1857 (long)pid);
1857 return; 1858 return;
1858 } 1859 }
1859 if (s->chanid != -1) 1860 if (s->chanid != -1)
@@ -1873,7 +1874,8 @@ session_close_by_channel(int id, void *arg)
1873 debug("session_close_by_channel: no session for id %d", id); 1874 debug("session_close_by_channel: no session for id %d", id);
1874 return; 1875 return;
1875 } 1876 }
1876 debug("session_close_by_channel: channel %d child %d", id, s->pid); 1877 debug("session_close_by_channel: channel %d child %ld",
1878 id, (long)s->pid);
1877 if (s->pid != 0) { 1879 if (s->pid != 0) {
1878 debug("session_close_by_channel: channel %d: has child", id); 1880 debug("session_close_by_channel: channel %d: has child", id);
1879 /* 1881 /*
diff --git a/ssh-agent.c b/ssh-agent.c
index 948926064..b89ead6e5 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/fake-queue.h" 37#include "openbsd-compat/fake-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.90 2002/06/09 13:32:01 markus Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.91 2002/06/11 05:46:20 mpech Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -1043,7 +1043,7 @@ main(int ac, char **av)
1043 format = c_flag ? "unsetenv %s;\n" : "unset %s;\n"; 1043 format = c_flag ? "unsetenv %s;\n" : "unset %s;\n";
1044 printf(format, SSH_AUTHSOCKET_ENV_NAME); 1044 printf(format, SSH_AUTHSOCKET_ENV_NAME);
1045 printf(format, SSH_AGENTPID_ENV_NAME); 1045 printf(format, SSH_AGENTPID_ENV_NAME);
1046 printf("echo Agent pid %d killed;\n", pid); 1046 printf("echo Agent pid %ld killed;\n", (long)pid);
1047 exit(0); 1047 exit(0);
1048 } 1048 }
1049 parent_pid = getpid(); 1049 parent_pid = getpid();
@@ -1055,8 +1055,8 @@ main(int ac, char **av)
1055 perror("mkdtemp: private socket dir"); 1055 perror("mkdtemp: private socket dir");
1056 exit(1); 1056 exit(1);
1057 } 1057 }
1058 snprintf(socket_name, sizeof socket_name, "%s/agent.%d", socket_dir, 1058 snprintf(socket_name, sizeof socket_name, "%s/agent.%ld", socket_dir,
1059 parent_pid); 1059 (long)parent_pid);
1060 } else { 1060 } else {
1061 /* Try to use specified agent socket */ 1061 /* Try to use specified agent socket */
1062 socket_dir[0] = '\0'; 1062 socket_dir[0] = '\0';
@@ -1102,7 +1102,7 @@ main(int ac, char **av)
1102 format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n"; 1102 format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
1103 printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, 1103 printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
1104 SSH_AUTHSOCKET_ENV_NAME); 1104 SSH_AUTHSOCKET_ENV_NAME);
1105 printf("echo Agent pid %d;\n", parent_pid); 1105 printf("echo Agent pid %ld;\n", (long)parent_pid);
1106 goto skip; 1106 goto skip;
1107 } 1107 }
1108 pid = fork(); 1108 pid = fork();
@@ -1112,14 +1112,14 @@ main(int ac, char **av)
1112 } 1112 }
1113 if (pid != 0) { /* Parent - execute the given command. */ 1113 if (pid != 0) { /* Parent - execute the given command. */
1114 close(sock); 1114 close(sock);
1115 snprintf(pidstrbuf, sizeof pidstrbuf, "%d", pid); 1115 snprintf(pidstrbuf, sizeof pidstrbuf, "%ld", (long)pid);
1116 if (ac == 0) { 1116 if (ac == 0) {
1117 format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n"; 1117 format = c_flag ? "setenv %s %s;\n" : "%s=%s; export %s;\n";
1118 printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, 1118 printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name,
1119 SSH_AUTHSOCKET_ENV_NAME); 1119 SSH_AUTHSOCKET_ENV_NAME);
1120 printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf, 1120 printf(format, SSH_AGENTPID_ENV_NAME, pidstrbuf,
1121 SSH_AGENTPID_ENV_NAME); 1121 SSH_AGENTPID_ENV_NAME);
1122 printf("echo Agent pid %d;\n", pid); 1122 printf("echo Agent pid %ld;\n", (long)pid);
1123 exit(0); 1123 exit(0);
1124 } 1124 }
1125 if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 || 1125 if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 ||
diff --git a/sshd.c b/sshd.c
index 2f810b9c1..705d4768b 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.244 2002/05/29 11:21:57 markus Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.245 2002/06/11 05:46:20 mpech Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -574,7 +574,7 @@ privsep_preauth(void)
574 if (pid == -1) { 574 if (pid == -1) {
575 fatal("fork of unprivileged child failed"); 575 fatal("fork of unprivileged child failed");
576 } else if (pid != 0) { 576 } else if (pid != 0) {
577 debug2("Network child is on pid %d", pid); 577 debug2("Network child is on pid %ld", (long)pid);
578 578
579 close(pmonitor->m_recvfd); 579 close(pmonitor->m_recvfd);
580 authctxt = monitor_child_preauth(pmonitor); 580 authctxt = monitor_child_preauth(pmonitor);
@@ -630,7 +630,7 @@ privsep_postauth(Authctxt *authctxt)
630 if (pmonitor->m_pid == -1) 630 if (pmonitor->m_pid == -1)
631 fatal("fork of unprivileged child failed"); 631 fatal("fork of unprivileged child failed");
632 else if (pmonitor->m_pid != 0) { 632 else if (pmonitor->m_pid != 0) {
633 debug2("User child is on pid %d", pmonitor->m_pid); 633 debug2("User child is on pid %ld", (long)pmonitor->m_pid);
634 close(pmonitor->m_recvfd); 634 close(pmonitor->m_recvfd);
635 monitor_child_postauth(pmonitor); 635 monitor_child_postauth(pmonitor);
636 636
@@ -1173,7 +1173,7 @@ main(int ac, char **av)
1173 */ 1173 */
1174 f = fopen(options.pid_file, "wb"); 1174 f = fopen(options.pid_file, "wb");
1175 if (f) { 1175 if (f) {
1176 fprintf(f, "%u\n", (u_int) getpid()); 1176 fprintf(f, "%ld\n", (long) getpid());
1177 fclose(f); 1177 fclose(f);
1178 } 1178 }
1179 } 1179 }
@@ -1320,7 +1320,7 @@ main(int ac, char **av)
1320 if (pid < 0) 1320 if (pid < 0)
1321 error("fork: %.100s", strerror(errno)); 1321 error("fork: %.100s", strerror(errno));
1322 else 1322 else
1323 debug("Forked child %d.", pid); 1323 debug("Forked child %ld.", (long)pid);
1324 1324
1325 close(startup_p[1]); 1325 close(startup_p[1]);
1326 1326