annotate cli-authinteract.c @ 1122:aaf576b27a10

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:08:50 +0800
parents 506e769ed6d1
children 750ec4ec4cbe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 /*
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 * Dropbear SSH
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 *
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 * Copyright (c) 2005 Matt Johnston
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 * All rights reserved.
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 *
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 * of this software and associated documentation files (the "Software"), to deal
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 * in the Software without restriction, including without limitation the rights
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 * copies of the Software, and to permit persons to whom the Software is
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 * furnished to do so, subject to the following conditions:
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 *
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 * The above copyright notice and this permission notice shall be included in
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 * all copies or substantial portions of the Software.
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 *
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 * SOFTWARE. */
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 #include "includes.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 #include "buffer.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 #include "dbutil.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 #include "session.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 #include "ssh.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 #include "runopts.h"
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 #ifdef ENABLE_CLI_INTERACT_AUTH
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
34 static char* get_response(char* prompt)
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 FILE* tty = NULL;
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
37 char* response = NULL;
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 /* not a password, but a reasonable limit */
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 char buf[DROPBEAR_MAX_CLI_PASS];
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 char* ret = NULL;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 fprintf(stderr, "%s", prompt);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 tty = fopen(_PATH_TTY, "r");
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 if (tty) {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 ret = fgets(buf, sizeof(buf), tty);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 fclose(tty);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 } else {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 ret = fgets(buf, sizeof(buf), stdin);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 if (ret == NULL) {
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
53 response = m_strdup("");
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 } else {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 unsigned int buflen = strlen(buf);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 /* fgets includes newlines */
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 if (buflen > 0 && buf[buflen-1] == '\n')
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 buf[buflen-1] = '\0';
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
59 response = m_strdup(buf);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 m_burn(buf, sizeof(buf));
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 return response;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67 void recv_msg_userauth_info_request() {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68
1118
506e769ed6d1 Turn name and instruction local variables into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1104
diff changeset
69 char *name = NULL;
506e769ed6d1 Turn name and instruction local variables into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1104
diff changeset
70 char *instruction = NULL;
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 unsigned int num_prompts = 0;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 unsigned int i;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
74 char *prompt = NULL;
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
75 unsigned int echo = 0;
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
76 char *response = NULL;
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
77
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78 TRACE(("enter recv_msg_recv_userauth_info_request"))
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79
488
a24139ba08c8 Print "Login for [email protected]" for keyboard interactive, since it probably
Matt Johnston <matt@ucc.asn.au>
parents: 339
diff changeset
80 /* Let the user know what password/host they are authing for */
a24139ba08c8 Print "Login for [email protected]" for keyboard interactive, since it probably
Matt Johnston <matt@ucc.asn.au>
parents: 339
diff changeset
81 if (!cli_ses.interact_request_received) {
a24139ba08c8 Print "Login for [email protected]" for keyboard interactive, since it probably
Matt Johnston <matt@ucc.asn.au>
parents: 339
diff changeset
82 fprintf(stderr, "Login for %[email protected]%s\n", cli_opts.username,
a24139ba08c8 Print "Login for [email protected]" for keyboard interactive, since it probably
Matt Johnston <matt@ucc.asn.au>
parents: 339
diff changeset
83 cli_opts.remotehost);
a24139ba08c8 Print "Login for [email protected]" for keyboard interactive, since it probably
Matt Johnston <matt@ucc.asn.au>
parents: 339
diff changeset
84 }
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 cli_ses.interact_request_received = 1;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
87 name = buf_getstring(ses.payload, NULL);
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
88 instruction = buf_getstring(ses.payload, NULL);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90 /* language tag */
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 buf_eatstring(ses.payload);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 num_prompts = buf_getint(ses.payload);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 if (num_prompts >= DROPBEAR_MAX_CLI_INTERACT_PROMPTS) {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96 dropbear_exit("Too many prompts received for keyboard-interactive");
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99 /* we'll build the response as we go */
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 CHECKCLEARTOWRITE();
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_INFO_RESPONSE);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 buf_putint(ses.writepayload, num_prompts);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104 if (strlen(name) > 0) {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 cleantext(name);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 fprintf(stderr, "%s", name);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 }
339
31743c9bdf78 BUG: The strings 'name' and 'instruction' are always allocated
Matt Johnston <matt@ucc.asn.au>
parents: 268
diff changeset
108 m_free(name);
31743c9bdf78 BUG: The strings 'name' and 'instruction' are always allocated
Matt Johnston <matt@ucc.asn.au>
parents: 268
diff changeset
109
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 if (strlen(instruction) > 0) {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
111 cleantext(instruction);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112 fprintf(stderr, "%s", instruction);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 }
339
31743c9bdf78 BUG: The strings 'name' and 'instruction' are always allocated
Matt Johnston <matt@ucc.asn.au>
parents: 268
diff changeset
114 m_free(instruction);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
115
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116 for (i = 0; i < num_prompts; i++) {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
117 unsigned int response_len = 0;
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
118 prompt = buf_getstring(ses.payload, NULL);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
119 cleantext(prompt);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
120
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
121 echo = buf_getbool(ses.payload);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
122
250
d059b0bb57dd Forgot to revert echo flag
Matt Johnston <matt@ucc.asn.au>
parents: 249
diff changeset
123 if (!echo) {
1104
5806c644469a Turn get_response()'s return type and prompt argument into char *
Gaël PORTAY <gael.portay@gmail.com>
parents: 1094
diff changeset
124 char* p = getpass_or_cancel(prompt);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
125 response = m_strdup(p);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
126 m_burn(p, strlen(p));
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
127 } else {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
128 response = get_response(prompt);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
129 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
130
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
131 response_len = strlen(response);
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
132 buf_putstring(ses.writepayload, response, response_len);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
133 m_burn(response, response_len);
613
8cd04e707171 Fix memory leak found by Klocwork
Matt Johnston <matt@ucc.asn.au>
parents: 488
diff changeset
134 m_free(prompt);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
135 m_free(response);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
136 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
137
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
138 encrypt_packet();
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
139
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
140
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
141 TRACE(("leave recv_msg_recv_userauth_info_request"))
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
142 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
143
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
144 void cli_auth_interactive() {
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
145
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
146 TRACE(("enter cli_auth_interactive"))
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
147 CHECKCLEARTOWRITE();
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
148
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
149 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
150
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
151 /* username */
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
152 buf_putstring(ses.writepayload, cli_opts.username,
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
153 strlen(cli_opts.username));
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
154
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
155 /* service name */
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
156 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION,
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
157 SSH_SERVICE_CONNECTION_LEN);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
158
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
159 /* method */
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
160 buf_putstring(ses.writepayload, AUTH_METHOD_INTERACT,
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
161 AUTH_METHOD_INTERACT_LEN);
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
162
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
163 /* empty language tag */
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
164 buf_putstring(ses.writepayload, "", 0);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
165
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
166 /* empty submethods */
1122
aaf576b27a10 Merge pull request #13 from gazoo74/fix-warnings
Matt Johnston <matt@ucc.asn.au>
parents: 1118
diff changeset
167 buf_putstring(ses.writepayload, "", 0);
249
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 encrypt_packet();
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 cli_ses.interact_request_received = 0;
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 TRACE(("leave cli_auth_interactive"))
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 }
efbaf6b03837 added keyboard-interactive client support
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 #endif /* ENABLE_CLI_INTERACT_AUTH */