comparison svr-authpubkeyoptions.c @ 566:b321aeb57c64

- set $SSH_ORIGINAL_COMMAND if a command is forced, and log it if LOG_COMMANDS is set
author Matt Johnston <matt@ucc.asn.au>
date Wed, 26 Aug 2009 14:09:22 +0000
parents 43bbe17d6ba0
children a98a2138364a
comparison
equal deleted inserted replaced
565:1929bbe3fa84 566:b321aeb57c64
86 return 0; 86 return 0;
87 } 87 }
88 return 1; 88 return 1;
89 } 89 }
90 90
91 /* Set chansession command to the one forced by 'command' public key option */ 91 /* Set chansession command to the one forced
92 * by any 'command' public key option. */
92 void svr_pubkey_set_forced_command(struct ChanSess *chansess) { 93 void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
93 if (ses.authstate.pubkey_options) 94 if (ses.authstate.pubkey_options) {
95 ses.authstate.pubkey_options->original_command = chansess->cmd;
96 if (!chansess->cmd)
97 {
98 ses.authstate.pubkey_options->original_command = m_strdup("");
99 }
94 chansess->cmd = ses.authstate.pubkey_options->forced_command; 100 chansess->cmd = ses.authstate.pubkey_options->forced_command;
101 #ifdef LOG_COMMANDS
102 dropbear_log(LOG_INFO, "command forced to '%s'", ses.authstate.pubkey_options->original_command);
103 #endif
104 }
95 } 105 }
96 106
97 /* Free potential public key options */ 107 /* Free potential public key options */
98 void svr_pubkey_options_cleanup() { 108 void svr_pubkey_options_cleanup() {
99 if (ses.authstate.pubkey_options) { 109 if (ses.authstate.pubkey_options) {
122 int ret = DROPBEAR_FAILURE; 132 int ret = DROPBEAR_FAILURE;
123 133
124 TRACE(("enter addpubkeyoptions")) 134 TRACE(("enter addpubkeyoptions"))
125 135
126 ses.authstate.pubkey_options = (struct PubKeyOptions*)m_malloc(sizeof( struct PubKeyOptions )); 136 ses.authstate.pubkey_options = (struct PubKeyOptions*)m_malloc(sizeof( struct PubKeyOptions ));
127 memset(ses.authstate.pubkey_options, '\0', sizeof(*ses.authstate.pubkey_options));
128 137
129 buf_setpos(options_buf, 0); 138 buf_setpos(options_buf, 0);
130 while (options_buf->pos < options_buf->len) { 139 while (options_buf->pos < options_buf->len) {
131 if (match_option(options_buf, "no-port-forwarding") == DROPBEAR_SUCCESS) { 140 if (match_option(options_buf, "no-port-forwarding") == DROPBEAR_SUCCESS) {
132 dropbear_log(LOG_WARNING, "Port forwarding disabled."); 141 dropbear_log(LOG_WARNING, "Port forwarding disabled.");