comparison svr-authpubkeyoptions.c @ 1661:6a6a0bac52f4

Don't log authorized_keys command= every time
author Matt Johnston <matt@ucc.asn.au>
date Sat, 14 Mar 2020 23:26:37 +0800
parents e37f98ea4f24
children 2f5d797d9811
comparison
equal deleted inserted replaced
1660:26e07f7f682a 1661:6a6a0bac52f4
90 90
91 /* Set chansession command to the one forced 91 /* Set chansession command to the one forced
92 * by any 'command' public key option. */ 92 * by any 'command' public key option. */
93 void svr_pubkey_set_forced_command(struct ChanSess *chansess) { 93 void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
94 if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) { 94 if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) {
95 TRACE(("Forced command '%s'", ses.authstate.pubkey_options->forced_command))
95 if (chansess->cmd) { 96 if (chansess->cmd) {
96 /* original_command takes ownership */ 97 /* original_command takes ownership */
97 chansess->original_command = chansess->cmd; 98 chansess->original_command = chansess->cmd;
98 chansess->cmd = NULL; 99 chansess->cmd = NULL;
99 } else { 100 } else {
180 const int command_len = buf_getptr(options_buf, 0) - command_start; 181 const int command_len = buf_getptr(options_buf, 0) - command_start;
181 ses.authstate.pubkey_options->forced_command = m_malloc(command_len); 182 ses.authstate.pubkey_options->forced_command = m_malloc(command_len);
182 memcpy(ses.authstate.pubkey_options->forced_command, 183 memcpy(ses.authstate.pubkey_options->forced_command,
183 command_start, command_len-1); 184 command_start, command_len-1);
184 ses.authstate.pubkey_options->forced_command[command_len-1] = '\0'; 185 ses.authstate.pubkey_options->forced_command[command_len-1] = '\0';
185 dropbear_log(LOG_WARNING, "Forced command '%s'",
186 ses.authstate.pubkey_options->forced_command);
187 goto next_option; 186 goto next_option;
188 } 187 }
189 escaped = (!escaped && c == '\\'); 188 escaped = (!escaped && c == '\\');
190 } 189 }
191 dropbear_log(LOG_WARNING, "Badly formatted command= authorized_keys option"); 190 dropbear_log(LOG_WARNING, "Badly formatted command= authorized_keys option");