diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-09-23 13:16:22 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-09-23 13:16:22 +0000 |
commit | 6fe6393acb88d0cfdd1e839da8dd98282ef6119b (patch) | |
tree | 8190fb4cf00f2b6ebe8215a83fda7a05f0c2ded6 /svr-chansession.c | |
parent | b98d13effb635f0f0ad76b05c2e7616f3e99305a (diff) | |
parent | 31fa5e605b6d42d670945c1821caf8b887623fa1 (diff) |
propagate from branch 'au.asn.ucc.matt.dropbear.pubkey-options' (head 537a6ebebb46424b967ffe787f0f8560e5f447e8)
to branch 'au.asn.ucc.matt.dropbear' (head 10b2f286b9886364db39dfbb4f8f46e49e345d87)
--HG--
extra : convert_revision : 6fd2597077a4e2421bf45388e058d15606f6dd74
Diffstat (limited to 'svr-chansession.c')
-rw-r--r-- | svr-chansession.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/svr-chansession.c b/svr-chansession.c index 060a235..9b2a412 100644 --- a/svr-chansession.c +++ b/svr-chansession.c @@ -37,6 +37,7 @@ #include "x11fwd.h" #include "agentfwd.h" #include "runopts.h" +#include "auth.h" /* Handles sessions (either shells or programs) requested by the client */ @@ -527,6 +528,12 @@ static int sessionpty(struct ChanSess * chansess) { struct passwd * pw = NULL; TRACE(("enter sessionpty")) + + if (!svr_pubkey_allows_pty()) { + TRACE(("leave sessionpty : pty forbidden by public key option")) + return DROPBEAR_FAILURE; + } + chansess->term = buf_getstring(ses.payload, &termlen); if (termlen > MAX_TERM_LEN) { /* TODO send disconnect ? */ @@ -582,14 +589,19 @@ static int sessioncommand(struct Channel *channel, struct ChanSess *chansess, return DROPBEAR_FAILURE; } + /* take public key option 'command' into account */ + svr_pubkey_set_forced_command(chansess); + if (iscmd) { /* "exec" */ - chansess->cmd = buf_getstring(ses.payload, &cmdlen); + if (chansess->cmd == NULL) { + chansess->cmd = buf_getstring(ses.payload, &cmdlen); - if (cmdlen > MAX_CMD_LEN) { - m_free(chansess->cmd); - /* TODO - send error - too long ? */ - return DROPBEAR_FAILURE; + if (cmdlen > MAX_CMD_LEN) { + m_free(chansess->cmd); + /* TODO - send error - too long ? */ + return DROPBEAR_FAILURE; + } } if (issubsys) { #ifdef SFTPSERVER_PATH |