| 12237 | */ |
| 12238 | |
| 12239 | static int sha256_password_authenticate(MYSQL_PLUGIN_VIO *vio, |
| 12240 | MYSQL_SERVER_AUTH_INFO *info) |
| 12241 | { |
| 12242 | uchar *pkt; |
| 12243 | int pkt_len; |
| 12244 | char *user_salt_begin; |
| 12245 | char *user_salt_end; |
| 12246 | char scramble[SCRAMBLE_LENGTH + 1]; |
| 12247 | char stage2[CRYPT_MAX_PASSWORD_SIZE + 1]; |
| 12248 | String scramble_response_packet; |
| 12249 | #if !defined(HAVE_YASSL) |
| 12250 | int cipher_length= 0; |
| 12251 | unsigned char plain_text[MAX_CIPHER_LENGTH]; |
| 12252 | RSA *private_key= NULL; |
| 12253 | RSA *public_key= NULL; |
| 12254 | #endif |
| 12255 | |
| 12256 | DBUG_ENTER("sha256_password_authenticate"); |
| 12257 | |
| 12258 | generate_user_salt(scramble, SCRAMBLE_LENGTH + 1); |
| 12259 | |
| 12260 | /* |
| 12261 | Note: The nonce is split into 8 + 12 bytes according to |
| 12262 | http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeV10 |
| 12263 | Native authentication sent 20 bytes + '\0' character = 21 bytes. |
| 12264 | This plugin must do the same to stay consistent with historical behavior |
| 12265 | if it is set to operate as a default plugin. |
| 12266 | */ |
| 12267 | scramble[SCRAMBLE_LENGTH] = '\0'; |
| 12268 | if (vio->write_packet(vio, (unsigned char *) scramble, SCRAMBLE_LENGTH + 1)) |
| 12269 | DBUG_RETURN(CR_ERROR); |
| 12270 | |
| 12271 | /* |
| 12272 | After the call to read_packet() the user name will appear in |
| 12273 | mpvio->acl_user and info will contain current data. |
| 12274 | */ |
| 12275 | if ((pkt_len= vio->read_packet(vio, &pkt)) == -1) |
| 12276 | DBUG_RETURN(CR_ERROR); |
| 12277 | |
| 12278 | /* |
| 12279 | If first packet is a 0 byte then the client isn't sending any password |
| 12280 | else the client will send a password. |
| 12281 | */ |
| 12282 | if (pkt_len == 1 && *pkt == 0) |
| 12283 | { |
| 12284 | info->password_used= PASSWORD_USED_NO; |
| 12285 | /* |
| 12286 | Send OK signal; the authentication might still be rejected based on |
| 12287 | host mask. |
| 12288 | */ |
| 12289 | if (info->auth_string_length == 0) |
| 12290 | DBUG_RETURN(CR_OK); |
| 12291 | else |
| 12292 | DBUG_RETURN(CR_ERROR); |
| 12293 | } |
| 12294 | else |
| 12295 | info->password_used= PASSWORD_USED_YES; |
| 12296 |
nothing calls this directly
no test coverage detected