From ec754b69c1aae9f34a28b413309664d64d66c85e Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 14 Jan 2006 00:02:02 +0000 Subject: [PATCH] - Added new charsys languages: belarussian-w1251 and ukrainian-w1251. Patch provided by Bock (#0002724). - Fixed memory leak in new resolver. [ATTEMPT II] --- src/charsys.c | 25 +++++++++++++++++++++++-- src/list.c | 1 + src/res.c | 8 ++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/charsys.c b/src/charsys.c index 5ec13101c..d53f527b1 100644 --- a/src/charsys.c +++ b/src/charsys.c @@ -90,6 +90,7 @@ struct _langlist /* MUST be alphabetized (first column) */ static LangList langlist[] = { + { "belarussian-w1251", "blr", LANGAV_ASCII|LANGAV_W1251 }, { "catalan", "cat", LANGAV_ASCII|LANGAV_LATIN1 }, { "chinese", "chi-s,chi-t,chi-j", LANGAV_GBK }, { "chinese-simp", "chi-s", LANGAV_GBK }, @@ -117,7 +118,9 @@ static LangList langlist[] = { { "swedish", "swe", LANGAV_ASCII|LANGAV_LATIN1 }, { "swiss-german", "swg", LANGAV_ASCII|LANGAV_LATIN1 }, { "turkish", "tur", LANGAV_ASCII|LANGAV_ISO8859_9 }, + { "ukrainian-w1251", "ukr", LANGAV_ASCII|LANGAV_W1251 }, { "windows-1250", "cze-m,pol-m,rum,slo-m,hun", LANGAV_ASCII|LANGAV_W1250 }, + { "windows-1251", "rus,ukr,blr", LANGAV_ASCII|LANGAV_W1251 }, { NULL, NULL, 0 } }; @@ -472,7 +475,7 @@ char tmp[512], *lang, *p; void charsys_add_language(char *name) { -char latin1=0, latin2=0, w1250=0, chinese=0; +char latin1=0, latin2=0, w1250=0, w1251=0, chinese=0; /** Note: there could well be some characters missing in the lists below. * While I've seen other altnernatives that just allow pretty much @@ -493,6 +496,8 @@ char latin1=0, latin2=0, w1250=0, chinese=0; latin2 = 1; else if (!strcmp(name, "windows-1250")) w1250 = 1; + else if (!strcmp(name, "windows-1251")) + w1251 = 1; else if (!strcmp(name, "chinese") || !strcmp(name, "gbk")) chinese = 1; @@ -603,13 +608,29 @@ char latin1=0, latin2=0, w1250=0, chinese=0; } /* [windows 1251] */ - if (!strcmp(name, "russian-w1251")) + if (w1251 || !strcmp(name, "russian-w1251")) { /* supplied by Roman Parkin: * 128-159 and 223-254 */ charsys_addallowed("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¨¸"); } + + if (w1251 || !strcmp(name, "belarussian-w1251")) + { + /* supplied by Anton Samets & ss: + * 128-159, 161, 162, 178, 179 and 223-254 + */ + charsys_addallowed("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¨¸¡¢²³"); + } + + if (w1251 || !strcmp(name, "ukrainian-w1251")) + { + /* supplied by Anton Samets & ss: + * 128-159, 170, 175, 178, 179, 186, 191 and 223-254 + */ + charsys_addallowed("ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ¨¸²³ªº¯¿"); + } /* [GREEK] */ if (!strcmp(name, "greek")) diff --git a/src/list.c b/src/list.c index 9dd212ec8..6341d4d09 100644 --- a/src/list.c +++ b/src/list.c @@ -162,6 +162,7 @@ void free_client(aClient *cptr) if (cptr->zip) zip_free(cptr); #endif + unreal_free_hostent(cptr->hostp); } MyFree((char *)cptr); } diff --git a/src/res.c b/src/res.c index ff33f9ff9..1c656c791 100644 --- a/src/res.c +++ b/src/res.c @@ -531,6 +531,14 @@ struct hostent *he; return he; } +void unreal_free_hostent(struct hostent *he) +{ + MyFree(he->h_name); + MyFree(he->h_addr_list[0]); + MyFree(he->h_addr_list); + MyFree(he); +} + static void unrealdns_freeandremovereq(DNSReq *r) { if (r->prev)