From 5cbb54ed6ad1934875b080286b9933400c817e85 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 24 Jul 2007 11:33:39 +0000 Subject: major task: made sure no selector_t is created for selector lines that can not be successfully loaded. That forced me to change a lot of code, with potential for trouble. --- omusrmsg.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'omusrmsg.c') diff --git a/omusrmsg.c b/omusrmsg.c index da545f73..ecfc5862 100644 --- a/omusrmsg.c +++ b/omusrmsg.c @@ -233,6 +233,7 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) uchar *p, *q; int i; char szTemplateName[128]; + rsRetVal iRet = RS_RET_CONFLINE_PROCESSED; assert(pp != NULL); assert(f != NULL); @@ -249,19 +250,15 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) if(*(p+1) == ';') { /* we have a template specifier! */ p += 2; /* eat "*;" */ - cflineParseTemplateName(&p, szTemplateName, - sizeof(szTemplateName) / sizeof(uchar)); + if((iRet = cflineParseTemplateName(&p, szTemplateName, + sizeof(szTemplateName) / sizeof(uchar))) != RS_RET_OK) + return iRet; } else /* assign default format if none given! */ szTemplateName[0] = '\0'; if(szTemplateName[0] == '\0') strcpy(szTemplateName, " WallFmt"); - cflineSetTemplateAndIOV(f, szTemplateName); - if(f->f_type != F_UNUSED) - /* safety measure to make sure we have a valid - * selector line before we continue down below. - * rgerhards 2005-07-29 - */ + if((iRet = cflineSetTemplateAndIOV(f, szTemplateName)) == RS_RET_OK) dprintf(" template '%s'\n", szTemplateName); } else { /* everything else is currently treated as a user name @@ -289,12 +286,13 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) if(*p == ';') { /* we have a template specifier! */ ++p; /* eat ";" */ - cflineParseTemplateName(&p, szTemplateName, - sizeof(szTemplateName) / sizeof(char)); + if((iRet = cflineParseTemplateName(&p, szTemplateName, + sizeof(szTemplateName) / sizeof(char))) != RS_RET_OK) + return iRet; } if(szTemplateName[0] == '\0') strcpy(szTemplateName, " StdUsrMsgFmt"); - cflineSetTemplateAndIOV(f, szTemplateName); + iRet = cflineSetTemplateAndIOV(f, szTemplateName); /* Please note that we would need to check if the template * was found. If not, f->f_type would be F_UNUSED and we * can NOT carry on processing. These checks can be seen @@ -307,8 +305,12 @@ static rsRetVal parseSelectorAct(uchar **pp, selector_t *f) */ } - *pp = p; - return RS_RET_CONFLINE_PROCESSED; + if(iRet == RS_RET_OK) + iRet = RS_RET_CONFLINE_PROCESSED; + + if(iRet == RS_RET_CONFLINE_PROCESSED) + *pp = p; + return iRet; } /* query an entry point -- cgit