equal
deleted
inserted
replaced
3714 throw new Exception('Server does not support DiffieHellman, denying request'); |
3714 throw new Exception('Server does not support DiffieHellman, denying request'); |
3715 } |
3715 } |
3716 |
3716 |
3717 // Fetch private key |
3717 // Fetch private key |
3718 $dh_public = $_POST['dh_public_key']; |
3718 $dh_public = $_POST['dh_public_key']; |
3719 if ( !preg_match('/^[0-9]+$/', $dh_public) ) |
3719 if ( !ctype_digit($dh_public) ) |
3720 { |
3720 { |
3721 throw new Exception('ERR_DH_KEY_NOT_INTEGER'); |
3721 throw new Exception('ERR_DH_KEY_NOT_INTEGER'); |
3722 } |
3722 } |
3723 $q = $db->sql_query('SELECT private_key, key_id FROM ' . table_prefix . "diffiehellman WHERE public_key = '$dh_public';"); |
3723 $q = $db->sql_query('SELECT private_key, key_id FROM ' . table_prefix . "diffiehellman WHERE public_key = '$dh_public';"); |
3724 if ( !$q ) |
3724 if ( !$q ) |
3886 $userinfo_crypt = $req['userinfo']; |
3886 $userinfo_crypt = $req['userinfo']; |
3887 $dh_public = $req['dh_public_key']; |
3887 $dh_public = $req['dh_public_key']; |
3888 $dh_hash = $req['dh_secret_hash']; |
3888 $dh_hash = $req['dh_secret_hash']; |
3889 |
3889 |
3890 // Check the key |
3890 // Check the key |
3891 if ( !preg_match('/^[0-9]+$/', $dh_public) || !preg_match('/^[0-9]+$/', $req['dh_client_key']) ) |
3891 if ( !ctype_digit($dh_public) || !ctype_digit($req['dh_client_key']) ) |
3892 { |
3892 { |
3893 return array( |
3893 return array( |
3894 'mode' => 'error', |
3894 'mode' => 'error', |
3895 'error' => 'ERR_DH_KEY_NOT_NUMERIC' |
3895 'error' => 'ERR_DH_KEY_NOT_NUMERIC' |
3896 ); |
3896 ); |