comparison svr-authpubkeyoptions.c @ 579:8c737cd7c1af

merge of '48fdaa8706d1acda35e9d564adc9a1fbc96c18c8' and '658fd03abd21e0da7c4c89b9fff9dc693c72daae'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 27 Feb 2010 11:53:18 +0000
parents b321aeb57c64
children a98a2138364a
comparison
equal deleted inserted replaced
577:69e98c45db7c 579:8c737cd7c1af
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.");