summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/session.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2000-06-18 04:05:03 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2000-06-18 04:05:03 +0000
commitdc325368e83d5ead4a841fb98e2875c0538f5116 (patch)
tree03e410e888bbcdc3c607438c0534fd13bc4a2215 /usr.bin/ssh/session.c
parentf0692cef8da2efb70ad8ab2eb85694990001dee1 (diff)
split auth-rsa option parsing into auth-options
add options support to authorized_keys2
Diffstat (limited to 'usr.bin/ssh/session.c')
-rw-r--r--usr.bin/ssh/session.c73
1 files changed, 44 insertions, 29 deletions
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 6c9b42c2642..a540eb320c4 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -8,7 +8,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: session.c,v 1.18 2000/06/17 22:52:33 jakob Exp $");
+RCSID("$OpenBSD: session.c,v 1.19 2000/06/18 04:05:02 markus Exp $");
#include "xmalloc.h"
#include "ssh.h"
@@ -26,6 +26,7 @@ RCSID("$OpenBSD: session.c,v 1.18 2000/06/17 22:52:33 jakob Exp $");
#include "bufaux.h"
#include "ssh2.h"
#include "auth.h"
+#include "auth-options.h"
/* types */
@@ -79,18 +80,6 @@ static char *xauthfile;
#define MAX_SESSIONS 10
Session sessions[MAX_SESSIONS];
-/* Flags set in auth-rsa from authorized_keys flags. These are set in auth-rsa.c. */
-int no_port_forwarding_flag = 0;
-int no_agent_forwarding_flag = 0;
-int no_x11_forwarding_flag = 0;
-int no_pty_flag = 0;
-
-/* RSA authentication "command=" option. */
-char *forced_command = NULL;
-
-/* RSA authentication "environment=" options. */
-struct envstring *custom_environment = NULL;
-
/*
* Remove local Xauthority file.
*/
@@ -1174,6 +1163,8 @@ session_pty_req(Session *s)
unsigned int len;
char *term_modes; /* encoded terminal modes */
+ if (no_pty_flag)
+ return 0;
if (s->ttyfd != -1)
return 0;
s->term = packet_get_string(&len);
@@ -1244,6 +1235,10 @@ session_subsystem_req(Session *s)
int
session_x11_req(Session *s)
{
+ if (!no_port_forwarding_flag) {
+ debug("X11 forwarding disabled in user configuration file.");
+ return 0;
+ }
if (!options.x11_forwarding) {
debug("X11 forwarding disabled in server configuration file.");
return 0;
@@ -1290,6 +1285,40 @@ session_x11_req(Session *s)
return 1;
}
+int
+session_shell_req(Session *s)
+{
+ /* if forced_command == NULL, the shell is execed */
+ char *shell = forced_command;
+ packet_done();
+ s->extended = 1;
+ if (s->ttyfd == -1)
+ do_exec_no_pty(s, shell, s->pw);
+ else
+ do_exec_pty(s, shell, s->pw);
+ return 1;
+}
+
+int
+session_exec_req(Session *s)
+{
+ char *command = packet_get_string(&len);
+ packet_done();
+ if (forced_command) {
+ xfree(command);
+ command = forced_command;
+ debug("Forced command '%.500s'", forced_command);
+ }
+ s->extended = 1;
+ if (s->ttyfd == -1)
+ do_exec_no_pty(s, command, s->pw);
+ else
+ do_exec_pty(s, command, s->pw);
+ if (forced_command == NULL)
+ xfree(command);
+ return 1;
+}
+
void
session_input_channel_req(int id, void *arg)
{
@@ -1319,23 +1348,9 @@ session_input_channel_req(int id, void *arg)
*/
if (c->type == SSH_CHANNEL_LARVAL) {
if (strcmp(rtype, "shell") == 0) {
- packet_done();
- s->extended = 1;
- if (s->ttyfd == -1)
- do_exec_no_pty(s, NULL, s->pw);
- else
- do_exec_pty(s, NULL, s->pw);
- success = 1;
+ success = session_shell_req(s);
} else if (strcmp(rtype, "exec") == 0) {
- char *command = packet_get_string(&len);
- packet_done();
- s->extended = 1;
- if (s->ttyfd == -1)
- do_exec_no_pty(s, command, s->pw);
- else
- do_exec_pty(s, command, s->pw);
- xfree(command);
- success = 1;
+ success = session_exec_req(s);
} else if (strcmp(rtype, "pty-req") == 0) {
success = session_pty_req(s);
} else if (strcmp(rtype, "x11-req") == 0) {