comparison svr-authpubkey.c @ 1461:fb90a5ba84e0

Merge pull request #49 from fperrad/20170812_lint Some linting, const parameters
author Matt Johnston <matt@ucc.asn.au>
date Thu, 25 Jan 2018 21:55:25 +0800
parents 15d4b821bcc9 06d52bcb8094
children 35f38af1238b
comparison
equal deleted inserted replaced
1454:ef310db5ccec 1461:fb90a5ba84e0
68 #if DROPBEAR_SVR_PUBKEY_AUTH 68 #if DROPBEAR_SVR_PUBKEY_AUTH
69 69
70 #define MIN_AUTHKEYS_LINE 10 /* "ssh-rsa AB" - short but doesn't matter */ 70 #define MIN_AUTHKEYS_LINE 10 /* "ssh-rsa AB" - short but doesn't matter */
71 #define MAX_AUTHKEYS_LINE 4200 /* max length of a line in authkeys */ 71 #define MAX_AUTHKEYS_LINE 4200 /* max length of a line in authkeys */
72 72
73 static int checkpubkey(char* algo, unsigned int algolen, 73 static int checkpubkey(const char* algo, unsigned int algolen,
74 unsigned char* keyblob, unsigned int keybloblen); 74 const unsigned char* keyblob, unsigned int keybloblen);
75 static int checkpubkeyperms(void); 75 static int checkpubkeyperms(void);
76 static void send_msg_userauth_pk_ok(char* algo, unsigned int algolen, 76 static void send_msg_userauth_pk_ok(const char* algo, unsigned int algolen,
77 unsigned char* keyblob, unsigned int keybloblen); 77 const unsigned char* keyblob, unsigned int keybloblen);
78 static int checkfileperm(char * filename); 78 static int checkfileperm(char * filename);
79 79
80 /* process a pubkey auth request, sending success or failure message as 80 /* process a pubkey auth request, sending success or failure message as
81 * appropriate */ 81 * appropriate */
82 void svr_auth_pubkey() { 82 void svr_auth_pubkey() {
171 } 171 }
172 172
173 /* Reply that the key is valid for auth, this is sent when the user sends 173 /* Reply that the key is valid for auth, this is sent when the user sends
174 * a straight copy of their pubkey to test, to avoid having to perform 174 * a straight copy of their pubkey to test, to avoid having to perform
175 * expensive signing operations with a worthless key */ 175 * expensive signing operations with a worthless key */
176 static void send_msg_userauth_pk_ok(char* algo, unsigned int algolen, 176 static void send_msg_userauth_pk_ok(const char* algo, unsigned int algolen,
177 unsigned char* keyblob, unsigned int keybloblen) { 177 const unsigned char* keyblob, unsigned int keybloblen) {
178 178
179 TRACE(("enter send_msg_userauth_pk_ok")) 179 TRACE(("enter send_msg_userauth_pk_ok"))
180 CHECKCLEARTOWRITE(); 180 CHECKCLEARTOWRITE();
181 181
182 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_PK_OK); 182 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_PK_OK);
186 encrypt_packet(); 186 encrypt_packet();
187 TRACE(("leave send_msg_userauth_pk_ok")) 187 TRACE(("leave send_msg_userauth_pk_ok"))
188 188
189 } 189 }
190 190
191 static int checkpubkey_line(buffer* line, int line_num, char* filename, 191 static int checkpubkey_line(buffer* line, int line_num, const char* filename,
192 const char* algo, unsigned int algolen, 192 const char* algo, unsigned int algolen,
193 const unsigned char* keyblob, unsigned int keybloblen) { 193 const unsigned char* keyblob, unsigned int keybloblen) {
194 buffer *options_buf = NULL; 194 buffer *options_buf = NULL;
195 unsigned int pos, len; 195 unsigned int pos, len;
196 int ret = DROPBEAR_FAILURE; 196 int ret = DROPBEAR_FAILURE;
290 290
291 291
292 /* Checks whether a specified publickey (and associated algorithm) is an 292 /* Checks whether a specified publickey (and associated algorithm) is an
293 * acceptable key for authentication */ 293 * acceptable key for authentication */
294 /* Returns DROPBEAR_SUCCESS if key is ok for auth, DROPBEAR_FAILURE otherwise */ 294 /* Returns DROPBEAR_SUCCESS if key is ok for auth, DROPBEAR_FAILURE otherwise */
295 static int checkpubkey(char* algo, unsigned int algolen, 295 static int checkpubkey(const char* algo, unsigned int algolen,
296 unsigned char* keyblob, unsigned int keybloblen) { 296 const unsigned char* keyblob, unsigned int keybloblen) {
297 297
298 FILE * authfile = NULL; 298 FILE * authfile = NULL;
299 char * filename = NULL; 299 char * filename = NULL;
300 int ret = DROPBEAR_FAILURE; 300 int ret = DROPBEAR_FAILURE;
301 buffer * line = NULL; 301 buffer * line = NULL;