summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--serverloop.c5
-rw-r--r--session.c12
-rw-r--r--session.h1
4 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1467f9370..8aaa68f02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
120000929
2 - (djm) Fix SSH2 not terminating until all background tasks done problem.
3
120000926 420000926
2 - (djm) Update X11-askpass to 1.0.2 in RPM spec file 5 - (djm) Update X11-askpass to 1.0.2 in RPM spec file
3 - (djm) Define _REENTRANT to pickup strtok_r() on HP/UX 6 - (djm) Define _REENTRANT to pickup strtok_r() on HP/UX
diff --git a/serverloop.c b/serverloop.c
index be9edfafc..50e89aee8 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -110,7 +110,6 @@ sigchld_handler2(int sig)
110 int save_errno = errno; 110 int save_errno = errno;
111 debug("Received SIGCHLD."); 111 debug("Received SIGCHLD.");
112 child_terminated = 1; 112 child_terminated = 1;
113 child_has_selected = 0;
114 errno = save_errno; 113 errno = save_errno;
115} 114}
116 115
@@ -675,10 +674,10 @@ server_loop2(void)
675 session_close_by_pid(pid, status); 674 session_close_by_pid(pid, status);
676 child_terminated = 0; 675 child_terminated = 0;
677 signal(SIGCHLD, sigchld_handler2); 676 signal(SIGCHLD, sigchld_handler2);
677 if (used_sessions() == 0)
678 break;
678 } 679 }
679 channel_after_select(&readset, &writeset); 680 channel_after_select(&readset, &writeset);
680 if (child_terminated && child_has_selected)
681 break;
682 process_input(&readset); 681 process_input(&readset);
683 process_output(&writeset); 682 process_output(&writeset);
684 } 683 }
diff --git a/session.c b/session.c
index 296dfadec..ca12a4f73 100644
--- a/session.c
+++ b/session.c
@@ -150,6 +150,8 @@ char *original_command = NULL;
150/* data */ 150/* data */
151#define MAX_SESSIONS 10 151#define MAX_SESSIONS 10
152Session sessions[MAX_SESSIONS]; 152Session sessions[MAX_SESSIONS];
153static int num_used_sessions;
154
153#ifdef WITH_AIXAUTHENTICATE 155#ifdef WITH_AIXAUTHENTICATE
154/* AIX's lastlogin message, set in auth1.c */ 156/* AIX's lastlogin message, set in auth1.c */
155char *aixloginmsg; 157char *aixloginmsg;
@@ -1422,6 +1424,7 @@ session_new(void)
1422 sessions[i].used = 0; 1424 sessions[i].used = 0;
1423 sessions[i].self = i; 1425 sessions[i].self = i;
1424 } 1426 }
1427 num_used_sessions = 0;
1425 did_init = 1; 1428 did_init = 1;
1426 } 1429 }
1427 for(i = 0; i < MAX_SESSIONS; i++) { 1430 for(i = 0; i < MAX_SESSIONS; i++) {
@@ -1440,7 +1443,8 @@ session_new(void)
1440 s->auth_proto = NULL; 1443 s->auth_proto = NULL;
1441 s->used = 1; 1444 s->used = 1;
1442 s->pw = NULL; 1445 s->pw = NULL;
1443 debug("session_new: session %d", i); 1446 num_used_sessions++;
1447 debug("session_new: session %d (%d used)", i, num_used_sessions);
1444 return s; 1448 return s;
1445 } 1449 }
1446 } 1450 }
@@ -1853,6 +1857,7 @@ session_close(Session *s)
1853 session_pty_cleanup(s); 1857 session_pty_cleanup(s);
1854 session_free(s); 1858 session_free(s);
1855 session_proctitle(s); 1859 session_proctitle(s);
1860 num_used_sessions--;
1856} 1861}
1857 1862
1858void 1863void
@@ -1898,6 +1903,11 @@ session_close_by_channel(int id, void *arg)
1898 } 1903 }
1899} 1904}
1900 1905
1906int used_sessions(void)
1907{
1908 return(num_used_sessions);
1909}
1910
1901char * 1911char *
1902session_tty_list(void) 1912session_tty_list(void)
1903{ 1913{
diff --git a/session.h b/session.h
index bce99f77c..69d3b7dd4 100644
--- a/session.h
+++ b/session.h
@@ -33,5 +33,6 @@ int session_open(int id);
33void session_input_channel_req(int id, void *arg); 33void session_input_channel_req(int id, void *arg);
34void session_close_by_pid(pid_t pid, int status); 34void session_close_by_pid(pid_t pid, int status);
35void session_close_by_channel(int id, void *arg); 35void session_close_by_channel(int id, void *arg);
36int used_sessions(void);
36 37
37#endif 38#endif