libpurple/tests/test_xmlnode.c

Wed, 05 Oct 2016 15:10:29 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Wed, 05 Oct 2016 15:10:29 -0500
branch
release-2.x.y
changeset 38089
da90fe7312d3
parent 31891
186f61a85ac2
child 32321
ae17a89ef666
child 32438
dc8991868906
permissions
-rw-r--r--

yahoo: Remove protocol plugin from tree

Yahoo has completely reimplemented their protocol, so this version
is no longer operable as of August 5th, 2016:
https://yahoo.tumblr.com/post/145715934739/q2-2016-progress-report-on-our-product

A new prpl has been written to support the new protocol. It can be
found here: https://github.com/EionRobb/funyahoo-plusplus

This also removes support for Yahoo! Japan. According to
http://messenger.yahoo.co.jp/ the service ended March 26th, 2014.

#include <string.h>

#include "tests.h"
#include "../xmlnode.h"

/*
 * If we really wanted to test the billion laughs attack we would
 * need to have more than just 4 ha's.  But as long as this shorter
 * document fails to parse, the longer one should also fail to parse.
 */
START_TEST(test_xmlnode_billion_laughs_attack)
{
	const char *malicious_xml_doc = "<!DOCTYPE root [ <!ENTITY ha \"Ha !\"><!ENTITY ha2 \"&ha; &ha;\"><!ENTITY ha3 \"&ha2; &ha2;\"> ]><root>&ha3;</root>";

	/* Uncomment this line if you want to see the error message given by
	   the parser for the above XML document */
	/* purple_debug_set_enabled(TRUE); */

	fail_if(xmlnode_from_str(malicious_xml_doc, -1),
			"xmlnode_from_str() returned an XML tree, but we didn't want it to");
}
END_TEST

Suite *
xmlnode_suite(void)
{
	Suite *s = suite_create("Utility Functions");

	TCase *tc = tcase_create("xmlnode");
	tcase_add_test(tc, test_xmlnode_billion_laughs_attack);
	suite_add_tcase(s, tc);

	return s;
}

mercurial