Mercurial > dropbear
comparison svr-authpubkeyoptions.c @ 1733:d529a52b2f7c coverity coverity
merge coverity from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 Jun 2020 21:07:34 +0800 |
parents | 2f5d797d9811 |
children | 587c76726b5f |
comparison
equal
deleted
inserted
replaced
1643:b59623a64678 | 1733:d529a52b2f7c |
---|---|
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 { |
144 if (match_option(options_buf, "no-port-forwarding") == DROPBEAR_SUCCESS) { | 145 if (match_option(options_buf, "no-port-forwarding") == DROPBEAR_SUCCESS) { |
145 dropbear_log(LOG_WARNING, "Port forwarding disabled."); | 146 dropbear_log(LOG_WARNING, "Port forwarding disabled."); |
146 ses.authstate.pubkey_options->no_port_forwarding_flag = 1; | 147 ses.authstate.pubkey_options->no_port_forwarding_flag = 1; |
147 goto next_option; | 148 goto next_option; |
148 } | 149 } |
150 if (match_option(options_buf, "no-agent-forwarding") == DROPBEAR_SUCCESS) { | |
149 #if DROPBEAR_SVR_AGENTFWD | 151 #if DROPBEAR_SVR_AGENTFWD |
150 if (match_option(options_buf, "no-agent-forwarding") == DROPBEAR_SUCCESS) { | |
151 dropbear_log(LOG_WARNING, "Agent forwarding disabled."); | 152 dropbear_log(LOG_WARNING, "Agent forwarding disabled."); |
152 ses.authstate.pubkey_options->no_agent_forwarding_flag = 1; | 153 ses.authstate.pubkey_options->no_agent_forwarding_flag = 1; |
153 goto next_option; | 154 #endif |
154 } | 155 goto next_option; |
155 #endif | 156 } |
157 if (match_option(options_buf, "no-X11-forwarding") == DROPBEAR_SUCCESS) { | |
156 #if DROPBEAR_X11FWD | 158 #if DROPBEAR_X11FWD |
157 if (match_option(options_buf, "no-X11-forwarding") == DROPBEAR_SUCCESS) { | |
158 dropbear_log(LOG_WARNING, "X11 forwarding disabled."); | 159 dropbear_log(LOG_WARNING, "X11 forwarding disabled."); |
159 ses.authstate.pubkey_options->no_x11_forwarding_flag = 1; | 160 ses.authstate.pubkey_options->no_x11_forwarding_flag = 1; |
160 goto next_option; | 161 #endif |
161 } | 162 goto next_option; |
162 #endif | 163 } |
163 if (match_option(options_buf, "no-pty") == DROPBEAR_SUCCESS) { | 164 if (match_option(options_buf, "no-pty") == DROPBEAR_SUCCESS) { |
164 dropbear_log(LOG_WARNING, "Pty allocation disabled."); | 165 dropbear_log(LOG_WARNING, "Pty allocation disabled."); |
165 ses.authstate.pubkey_options->no_pty_flag = 1; | 166 ses.authstate.pubkey_options->no_pty_flag = 1; |
166 goto next_option; | 167 goto next_option; |
167 } | 168 } |
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"); |