diff options
author | Matt Johnston <matt@ucc.asn.au> | 2009-08-26 14:09:22 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2009-08-26 14:09:22 +0000 |
commit | 0b8de5c141d341392b691ba421fddc037e6d0a2e (patch) | |
tree | b0cbb9d0796dd6c64513a38df3806e213547cc29 /svr-authpubkeyoptions.c | |
parent | 9c72e1df12c3fbbc58f0261eaeba31c54fb169f4 (diff) | |
download | dropbear-0b8de5c141d341392b691ba421fddc037e6d0a2e.tar.gz |
- set $SSH_ORIGINAL_COMMAND if a command is forced, and log it
if LOG_COMMANDS is set
Diffstat (limited to 'svr-authpubkeyoptions.c')
-rw-r--r-- | svr-authpubkeyoptions.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/svr-authpubkeyoptions.c b/svr-authpubkeyoptions.c index 13a179d..8fa7b3d 100644 --- a/svr-authpubkeyoptions.c +++ b/svr-authpubkeyoptions.c @@ -88,10 +88,20 @@ int svr_pubkey_allows_pty() { return 1; } -/* Set chansession command to the one forced by 'command' public key option */ +/* Set chansession command to the one forced + * by any 'command' public key option. */ void svr_pubkey_set_forced_command(struct ChanSess *chansess) { - if (ses.authstate.pubkey_options) + if (ses.authstate.pubkey_options) { + ses.authstate.pubkey_options->original_command = chansess->cmd; + if (!chansess->cmd) + { + ses.authstate.pubkey_options->original_command = m_strdup(""); + } chansess->cmd = ses.authstate.pubkey_options->forced_command; +#ifdef LOG_COMMANDS + dropbear_log(LOG_INFO, "command forced to '%s'", ses.authstate.pubkey_options->original_command); +#endif + } } /* Free potential public key options */ @@ -124,7 +134,6 @@ int svr_add_pubkey_options(buffer *options_buf, int line_num, const char* filena TRACE(("enter addpubkeyoptions")) ses.authstate.pubkey_options = (struct PubKeyOptions*)m_malloc(sizeof( struct PubKeyOptions )); - memset(ses.authstate.pubkey_options, '\0', sizeof(*ses.authstate.pubkey_options)); buf_setpos(options_buf, 0); while (options_buf->pos < options_buf->len) { |