Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2005-04-24 00:17:49 UTC
Modified files:
ChangeLog include/patchlevel.h ircd/ircd_lexer.l
ircd/ircd_parser.y
Log message:
Fix sporadic spurious (and mysterious) config file parsing failures.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.610 ircu2.10/ChangeLog:1.611
--- ircu2.10/ChangeLog:1.610 Sat Apr 23 06:49:39 2005
+++ ircu2.10/ChangeLog Sat Apr 23 17:17:38 2005
@@ -1,5 +1,15 @@
2005-04-23 Michael Poole <[EMAIL PROTECTED]>
+ * include/patchlevel.h: Bump to being a beta.
+
+ * ircd/ircd_lexer.l (QSTRING): Return a copy of the string so that
+ parser actions don't have to be immediately after a QSTRING.
+
+ * ircd/ircd_parser.y (FNAME): Remove unused token.
+ (QSTRING): Adjust for QSTRING being an already-copied version.
+
+2005-04-23 Michael Poole <[EMAIL PROTECTED]>
+
* doc/example.conf (UWorld): Illustrate new config extension.
* ircd/ircd_parser.y (uworldblock): Do the expected thing when
Index: ircu2.10/include/patchlevel.h
diff -u ircu2.10/include/patchlevel.h:1.20 ircu2.10/include/patchlevel.h:1.21
--- ircu2.10/include/patchlevel.h:1.20 Tue Jan 7 02:17:50 2003
+++ ircu2.10/include/patchlevel.h Sat Apr 23 17:17:39 2005
@@ -15,12 +15,12 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: patchlevel.h,v 1.20 2003/01/07 10:17:50 a1kmm Exp $
+ * $Id: patchlevel.h,v 1.21 2005/04/24 00:17:39 entrope Exp $
*
*/
-#define PATCHLEVEL "08"
+#define PATCHLEVEL "09"
-#define RELEASE ".12.alpha."
+#define RELEASE ".12.beta."
/*
* Deliberate empty lines
Index: ircu2.10/ircd/ircd_lexer.l
diff -u ircu2.10/ircd/ircd_lexer.l:1.18 ircu2.10/ircd/ircd_lexer.l:1.19
--- ircu2.10/ircd/ircd_lexer.l:1.18 Fri Apr 1 19:32:37 2005
+++ ircu2.10/ircd/ircd_lexer.l Sat Apr 23 17:17:39 2005
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
- * $Id: ircd_lexer.l,v 1.18 2005/04/02 03:32:37 entrope Exp $
+ * $Id: ircd_lexer.l,v 1.19 2005/04/24 00:17:39 entrope Exp $
*/
%{
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include "config.h"
#include "ircd.h"
+#include "ircd_alloc.h"
#include "ircd_string.h"
#include "s_debug.h"
#include "y.tab.h"
@@ -202,7 +203,7 @@
QSTRING \"[^"\n]+[\"\n]
%%
-{QSTRING} {yytext[yyleng-1] = 0; yylval.text = yytext+1; return QSTRING;}
+{QSTRING} {yytext[yyleng-1] = 0; DupString(yylval.text, yytext+1); return
QSTRING;}
{NUMBER} {yylval.num = strtoul(yytext, NULL, 10); return NUMBER;}
{WHITE} ;
{SHCOMMENT} ;
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.48 ircu2.10/ircd/ircd_parser.y:1.49
--- ircu2.10/ircd/ircd_parser.y:1.48 Sat Apr 23 06:49:41 2005
+++ ircu2.10/ircd/ircd_parser.y Sat Apr 23 17:17:39 2005
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
- * $Id: ircd_parser.y,v 1.48 2005/04/23 13:49:41 entrope Exp $
+ * $Id: ircd_parser.y,v 1.49 2005/04/24 00:17:39 entrope Exp $
*/
%{
@@ -91,7 +91,6 @@
%token <text> QSTRING
%token <num> NUMBER
-%token <text> FNAME
%token GENERAL
%token ADMIN
@@ -260,6 +259,7 @@
jupenick: NICK '=' QSTRING
{
addNickJupes($3);
+ MyFree($3);
} ';';
generalblock: GENERAL '{' generalitems '}'
@@ -283,16 +283,19 @@
generalname: NAME '=' QSTRING ';'
{
if (localConf.name == NULL)
- DupString(localConf.name, $3);
- else if (strcmp(localConf.name, $3))
- parse_error("Redefinition of server name %s (%s)", $3,
- localConf.name);
+ localConf.name = $3;
+ else {
+ if (strcmp(localConf.name, $3))
+ parse_error("Redefinition of server name %s (%s)", $3,
+ localConf.name);
+ MyFree($3);
+ }
};
generaldesc: DESCRIPTION '=' QSTRING ';'
{
MyFree(localConf.description);
- DupString(localConf.description, $3);
+ localConf.description = $3;
ircd_strncpy(cli_info(&me), $3, REALLEN);
};
@@ -305,6 +308,7 @@
memcpy(&VirtualHost_v4.addr, &addr, sizeof(addr));
else
memcpy(&VirtualHost_v6.addr, &addr, sizeof(addr));
+ MyFree($3);
};
adminblock: ADMIN '{' adminitems '}'
@@ -320,17 +324,17 @@
adminitem: adminlocation | admincontact | error;
adminlocation: LOCATION '=' QSTRING ';'
{
- if (localConf.location1 == NULL)
- DupString(localConf.location1, $3);
- else if (localConf.location2 == NULL)
- DupString(localConf.location2, $3);
- /* Otherwise just drop it. -A1kmm */
+ if (localConf.location1 == NULL)
+ localConf.location1 = $3;
+ else if (localConf.location2 == NULL)
+ localConf.location2 = $3;
+ else /* Otherwise just drop it. -A1kmm */
+ MyFree($3);
};
admincontact: CONTACT '=' QSTRING ';'
{
- if (localConf.contact != NULL)
- MyFree(localConf.contact);
- DupString(localConf.contact, $3);
+ MyFree(localConf.contact);
+ localConf.contact = $3;
};
classblock: CLASS {
@@ -364,7 +368,7 @@
classname: NAME '=' QSTRING ';'
{
MyFree(name);
- DupString(name, $3);
+ name = $3;
};
classpingfreq: PINGFREQ '=' timespec ';'
{
@@ -385,7 +389,7 @@
classusermode: USERMODE '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
connectblock: CONNECT
@@ -427,12 +431,12 @@
connectname: NAME '=' QSTRING ';'
{
MyFree(name);
- DupString(name, $3);
+ name = $3;
};
connectpass: PASS '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
connectclass: CLASS '=' QSTRING ';'
{
@@ -441,7 +445,7 @@
connecthost: HOST '=' QSTRING ';'
{
MyFree(host);
- DupString(host, $3);
+ host = $3;
};
connectport: PORT '=' NUMBER ';'
{
@@ -450,7 +454,7 @@
connectvhost: VHOST '=' QSTRING ';'
{
MyFree(origin);
- DupString(origin, $3);
+ origin = $3;
};
connectleaf: LEAF ';'
{
@@ -464,7 +468,7 @@
connecthublimit: HUB '=' QSTRING ';'
{
MyFree(hub_limit);
- DupString(hub_limit, $3);
+ hub_limit = $3;
};
connectmaxhops: MAXHOPS '=' expr ';'
{
@@ -476,9 +480,7 @@
uworlditem: uworldname | error;
uworldname: NAME '=' QSTRING ';'
{
- struct ConfItem *aconf;
- aconf = make_conf(CONF_UWORLD);
- DupString(aconf->host, $3);
+ make_conf(CONF_UWORLD)->host = $3;
};
operblock: OPER '{' operitems '}' ';'
@@ -513,12 +515,12 @@
opername: NAME '=' QSTRING ';'
{
MyFree(name);
- DupString(name, $3);
+ name = $3;
};
operpass: PASS '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
operhost: HOST '=' QSTRING ';'
{
@@ -526,16 +528,17 @@
if (!strchr($3, '@'))
{
int uh_len;
- char *b = (char*) MyMalloc((uh_len = strlen($3)+3));
- ircd_snprintf(0, b, uh_len, "[EMAIL PROTECTED]", $3);
- host = b;
+ host = (char*) MyMalloc((uh_len = strlen($3)+3));
+ ircd_snprintf(0, host, uh_len, "[EMAIL PROTECTED]", $3);
+ MyFree($3);
}
else
- DupString(host, $3);
+ host = $3;
};
operclass: CLASS '=' QSTRING ';'
{
c_class = find_class($3);
+ MyFree($3);
};
priv: privtype '=' yesorno ';'
@@ -608,13 +611,13 @@
portvhost: VHOST '=' QSTRING ';'
{
MyFree(host);
- DupString(host, $3);
+ host = $3;
};
portmask: MASK '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
portserver: SERVER '=' YES ';'
@@ -677,38 +680,40 @@
if (sep) {
*sep++ = '\0';
MyFree(username);
- DupString(username, $3);
DupString(host, sep);
+ username = $3;
} else {
- DupString(host, $3);
+ host = $3;
}
};
clientip: IP '=' QSTRING ';'
{
- char *sep = strchr($3, '@');
+ char *sep;
+ sep = strchr($3, '@');
MyFree(ip);
if (sep) {
*sep++ = '\0';
MyFree(username);
- DupString(username, $3);
DupString(ip, sep);
+ username = $3;
} else {
- DupString(ip, $3);
+ ip = $3;
}
};
clientusername: USERNAME '=' QSTRING ';'
{
MyFree(username);
- DupString(username, $3);
+ username = $3;
};
clientclass: CLASS '=' QSTRING ';'
{
c_class = find_class($3);
+ MyFree($3);
};
clientpass: PASS '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
clientmaxlinks: MAXLINKS '=' expr ';'
{
@@ -739,48 +744,47 @@
killitem: killuhost | killreal | killusername | killreasonfile | killreason |
error;
killuhost: HOST '=' QSTRING ';'
{
- char *u, *h;
+ char *h;
MyFree(dconf->hostmask);
MyFree(dconf->usermask);
if ((h = strchr($3, '@')) == NULL)
{
- u = "*";
- h = $3;
+ DupString(dconf->usermask, "*");
+ dconf->hostmask = $3;
}
else
{
- u = $3;
*h++ = '\0';
+ DupString(dconf->hostmask, h);
+ dconf->usermask = $3;
}
- DupString(dconf->hostmask, h);
- DupString(dconf->usermask, u);
ipmask_parse(dconf->hostmask, &dconf->address, &dconf->bits);
};
killusername: USERNAME '=' QSTRING ';'
{
MyFree(dconf->usermask);
- DupString(dconf->usermask, $3);
+ dconf->usermask = $3;
};
killreal: REAL '=' QSTRING ';'
{
MyFree(dconf->realmask);
- DupString(dconf->realmask, $3);
+ dconf->realmask = $3;
};
killreason: REASON '=' QSTRING ';'
{
dconf->flags &= ~DENY_FLAGS_FILE;
MyFree(dconf->message);
- DupString(dconf->message, $3);
+ dconf->message = $3;
};
killreasonfile: TFILE '=' QSTRING ';'
{
dconf->flags |= DENY_FLAGS_FILE;
MyFree(dconf->message);
- DupString(dconf->message, $3);
+ dconf->message = $3;
};
cruleblock: CRULE
@@ -816,13 +820,13 @@
{
MyFree(host);
collapse($3);
- DupString(host, $3);
+ host = $3;
};
crulerule: RULE '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
cruleall: ALL '=' YES ';'
@@ -846,12 +850,12 @@
motditem: motdhost | motdfile | error;
motdhost: HOST '=' QSTRING ';'
{
- DupString(host, $3);
+ host = $3;
};
motdfile: TFILE '=' QSTRING ';'
{
- DupString(pass, $3);
+ pass = $3;
};
featuresblock: FEATURES '{' featureitems '}' ';';
@@ -869,7 +873,10 @@
stringno = 2;
} posextrastrings
{
+ unsigned int ii;
feature_set(NULL, (const char * const *)stringlist, stringno);
+ for (ii = 0; ii < stringno; ++ii)
+ MyFree(stringlist[ii]);
};
posextrastrings: /* empty */ | extrastrings;
extrastrings: extrastrings extrastring | extrastring;
@@ -877,6 +884,8 @@
{
if (stringno < MAX_STRINGS)
stringlist[stringno++] = $1;
+ else
+ MyFree($1);
};
quarantineblock: QUARANTINE '{' quarantineitems '}' ';';
@@ -884,8 +893,8 @@
quarantineitem: QSTRING '=' QSTRING ';'
{
struct qline *qconf = MyCalloc(1, sizeof(*qconf));
- DupString(qconf->chname, $1);
- DupString(qconf->reason, $3);
+ qconf->chname = $1;
+ qconf->reason = $3;
qconf->next = GlobalQuarantineList;
GlobalQuarantineList = qconf;
};
@@ -893,7 +902,7 @@
pseudoblock: PSEUDO QSTRING '{'
{
smap = MyCalloc(1, sizeof(struct s_map));
- DupString(smap->command, $2);
+ smap->command = $2;
}
pseudoitems '}' ';'
{
@@ -927,11 +936,11 @@
pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags | error;
pseudoname: NAME '=' QSTRING ';'
{
- DupString(smap->name, $3);
+ smap->name = $3;
};
pseudoprepend: PREPEND '=' QSTRING ';'
{
- DupString(smap->prepend, $3);
+ smap->prepend = $3;
};
pseudonick: NICK '=' QSTRING ';'
{
@@ -945,6 +954,7 @@
nh->next = smap->services;
smap->services = nh;
}
+ MyFree($3);
};
pseudoflags: FAST ';'
{
@@ -973,12 +983,12 @@
iauthpass: PASS '=' QSTRING ';'
{
MyFree(pass);
- DupString(pass, $3);
+ pass = $3;
};
iauthhost: HOST '=' QSTRING ';'
{
MyFree(host);
- DupString(host, $3);
+ host = $3;
};
iauthport: PORT '=' NUMBER ';'
{
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches