bmh10 / rpms / openssh

Forked from rpms/openssh 2 days ago
Clone
d1c05f
Index: b/session.c
d1c05f
===================================================================
d1c05f
--- b.orig/session.c
d1c05f
+++ b/session.c
d1c05f
@@ -2049,6 +2049,8 @@ session_pty_req(struct ssh *ssh, Session
d1c05f
 		return 0;
d1c05f
 	}
d1c05f
 	debug("session_pty_req: session %d alloc %s", s->self, s->tty);
d1c05f
+	verbose("Allocated pty %s for user %s session %d",
d1c05f
+					s->tty, s->pw->pw_name, s->self);
d1c05f
 
d1c05f
 	ssh_tty_parse_modes(ssh, s->ttyfd);
d1c05f
 
d1c05f
@@ -2148,6 +2150,7 @@ session_shell_req(struct ssh *ssh, Sessi
d1c05f
 
d1c05f
 	if ((r = sshpkt_get_end(ssh)) != 0)
d1c05f
 		sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
d1c05f
+	verbose("Shell Request for user %s", s->pw->pw_name);
d1c05f
 	return do_exec(ssh, s, NULL) == 0;
d1c05f
 }
d1c05f
 
d1c05f
@@ -2163,6 +2166,7 @@ session_exec_req(struct ssh *ssh, Sessio
d1c05f
 		sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
d1c05f
 
d1c05f
 	slog_set_command(command);
d1c05f
+	verbose("Exec Request for user %s with command %s", s->pw->pw_name, command);
d1c05f
 	success = do_exec(ssh, s, command) == 0;
d1c05f
 	free(command);
d1c05f
 	return success;
d1c05f
Index: b/regress/session-req.sh
d1c05f
===================================================================
d1c05f
--- /dev/null
d1c05f
+++ b/regress/session-req.sh
d1c05f
@@ -0,0 +1,39 @@
d1c05f
+tid="session req"
d1c05f
+
d1c05f
+start_sshd
d1c05f
+
d1c05f
+test_user_shell_exec_req() {
d1c05f
+  session_shell_req_expected="Exec Request for user $USER with command true"
d1c05f
+  cnt=$(grep -c "$session_shell_req_expected" "$TEST_SSHD_LOGFILE")
d1c05f
+  if [ $cnt == "0" ]; then
d1c05f
+  	fail "No exec request for user log lines found"
d1c05f
+  fi
d1c05f
+}
d1c05f
+
d1c05f
+test_user_pty() {
d1c05f
+  session_pty_req_expected="Allocated pty .* for user $USER session .*"
d1c05f
+  line_count=$(grep -c "$session_req_expected" "$TEST_SSHD_LOGFILE")
d1c05f
+  if [ $line_count == "0" ]; then
d1c05f
+  	fail "No Allocated pty for user session found in log lines"
d1c05f
+  fi
d1c05f
+}
d1c05f
+
d1c05f
+test_user_shell_req() {
d1c05f
+  exit | ${SSH} -F $OBJ/ssh_config somehost
d1c05f
+  if [ $? -ne 0 ]; then
d1c05f
+  	fail "ssh connect with failed"
d1c05f
+  fi
d1c05f
+  session_shell_req_expected="Shell Request for user $USER"
d1c05f
+  line_count=$(grep -c "$session_shell_req_expected" "$TEST_SSHD_LOGFILE")
d1c05f
+  if [ $line_count == "0" ]; then
d1c05f
+  	fail "No session request for user log lines found"
d1c05f
+  fi
d1c05f
+}
d1c05f
+
d1c05f
+${SSH} -F $OBJ/ssh_config somehost true
d1c05f
+if [ $? -ne 0 ]; then
d1c05f
+	fail "ssh connect with failed"
d1c05f
+fi
d1c05f
+test_user_shell_exec_req
d1c05f
+test_user_pty
d1c05f
+test_user_shell_req