INN commit: trunk (11 files)
INN Commit
rra at isc.org
Sun Dec 27 20:49:17 UTC 2009
Date: Sunday, December 27, 2009 @ 12:49:16
Author: iulius
Revision: 8868
Use case-insensitive matches for:
- distributions,
- path identities,
- message-IDs (except for history hashes),
- IMAP commands,
- header names,
- control commands.
Note that newsgroups are still matched case-sensitively.
Modified:
trunk/backends/innxmit.c
trunk/backends/ninpaths.c
trunk/frontends/feedone.c
trunk/frontends/getlist.c
trunk/frontends/inews.c
trunk/frontends/sys2nf.c
trunk/innd/art.c
trunk/innfeed/imap_connection.c
trunk/nnrpd/article.c
trunk/nnrpd/perm.c
trunk/nnrpd/post.c
---------------------------+
backends/innxmit.c | 12 +++++++-----
backends/ninpaths.c | 2 +-
frontends/feedone.c | 4 ++--
frontends/getlist.c | 2 +-
frontends/inews.c | 16 ++++++++--------
frontends/sys2nf.c | 4 ++--
innd/art.c | 16 ++++++++--------
innfeed/imap_connection.c | 14 +++++++-------
nnrpd/article.c | 4 ++--
nnrpd/perm.c | 4 ++--
nnrpd/post.c | 16 ++++++++--------
11 files changed, 48 insertions(+), 46 deletions(-)
Modified: backends/innxmit.c
===================================================================
--- backends/innxmit.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ backends/innxmit.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -184,12 +184,14 @@
&& (stbuf[i].st_hash == hash)) {
int n;
- if (strcasecmp(MessageID, stbuf[i].st_id)) continue;
+ if (strcmp(MessageID, stbuf[i].st_id))
+ continue;
- /* left of '@' is case sensitive */
for (n = 0; (MessageID[n] != '@') && (MessageID[n] != '\0'); n++) ;
- if (strncmp(MessageID, stbuf[i].st_id, n)) continue;
- else break; /* found a match */
+ if (strncmp(MessageID, stbuf[i].st_id, n))
+ continue;
+ else
+ break; /* found a match */
}
}
if (i >= STNBUF) i = -1; /* no match found ? */
@@ -574,7 +576,7 @@
p--;
break;
}
- if (*(p + 1) == 'C' && strncasecmp(p + 1, "Control: ", 9) == 0)
+ if ((*(p + 1) == 'C' || *(p + 1) == 'c') && strncasecmp(p + 1, "Control: ", 9) == 0)
*iscmsg = 1;
}
lastchar = *p;
Modified: backends/ninpaths.c
===================================================================
--- backends/ninpaths.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ backends/ninpaths.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -368,7 +368,7 @@
while (fgets(buf, sizeof(buf), f)) {
c=buf;
- if (!strncmp(c, "Path: ", 6))
+ if (!strncasecmp(c, "Path: ", 6))
c+=6;
/* find end of line. Some broken newsreaders preload Path with
a name containing spaces. Chop off those entries. */
Modified: frontends/feedone.c
===================================================================
--- frontends/feedone.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ frontends/feedone.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -122,7 +122,7 @@
/* Scan for the message-id. */
if (mesgid == NULL) {
while (fgets(buff, sizeof buff, F) != NULL)
- if (strncasecmp(buff, MESGIDHDR, strlen(MESGIDHDR)) == 0) {
+ if (strncmp(buff, MESGIDHDR, strlen(MESGIDHDR)) == 0) {
if ((p = strchr(buff, '<')) == NULL
|| (q = strchr(p, '>')) == NULL)
die("bad message ID line");
@@ -163,7 +163,7 @@
/* Send the file over. */
fseeko(F, 0, SEEK_SET);
while (fgets(buff, sizeof buff, F) != NULL) {
- if (strncasecmp(buff, MESGIDHDR, strlen(MESGIDHDR)) == 0) {
+ if (strncmp(buff, MESGIDHDR, strlen(MESGIDHDR)) == 0) {
fprintf(ToServer, "%s %s\r\n", MESGIDHDR, mesgid);
continue;
}
Modified: frontends/getlist.c
===================================================================
--- frontends/getlist.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ frontends/getlist.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -259,7 +259,7 @@
pattern = argv[1];
if (argc == 3)
types = argv[2];
- if (strcmp(list, "active") != 0 && types != NULL)
+ if (strcasecmp(list, "active") != 0 && types != NULL)
die("group types can only be specified with a list type of active");
/* Connect to the server. */
Modified: frontends/inews.c
===================================================================
--- frontends/inews.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ frontends/inews.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -310,9 +310,9 @@
*p = '\0';
if (buff[0] == '.' && buff[1] == '\0')
break;
- if (strncmp(buff, "Sender:", 7) == 0)
+ if (strncasecmp(buff, "Sender:", 7) == 0)
strlcpy(remotefrom, TrimSpaces(&buff[7]), SMBUF);
- else if (remotefrom[0] == '\0' && strncmp(buff, "From:", 5) == 0)
+ else if (remotefrom[0] == '\0' && strncasecmp(buff, "From:", 5) == 0)
strlcpy(remotefrom, TrimSpaces(&buff[5]), SMBUF);
}
if (remotefrom[0] == '\0') {
@@ -397,7 +397,7 @@
save = *p;
*p = '\0';
- if (strcmp(ctrl, "cancel") == 0) {
+ if (strcasecmp(ctrl, "cancel") == 0) {
for (q = p + 1; ISWHITE(*q); q++)
continue;
if (*q == '\0')
@@ -405,11 +405,11 @@
if (!Spooling)
CheckCancel(q, false);
}
- else if (strcmp(ctrl, "checkgroups") == 0
- || strcmp(ctrl, "ihave") == 0
- || strcmp(ctrl, "sendme") == 0
- || strcmp(ctrl, "newgroup") == 0
- || strcmp(ctrl, "rmgroup") == 0) {
+ else if (strcasecmp(ctrl, "checkgroups") == 0
+ || strcasecmp(ctrl, "ihave") == 0
+ || strcasecmp(ctrl, "sendme") == 0
+ || strcasecmp(ctrl, "newgroup") == 0
+ || strcasecmp(ctrl, "rmgroup") == 0) {
if (!AnAdministrator())
die("ask your news administrator to do the %s for you", ctrl);
}
Modified: frontends/sys2nf.c
===================================================================
--- frontends/sys2nf.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ frontends/sys2nf.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -184,7 +184,7 @@
len = 8 + 1 + 2;
do {
for (matched = false, i = 0; i < ARRAY_SIZE(distributions); i++)
- if (strcmp(s, distributions[i]) == 0) {
+ if (strcasecmp(s, distributions[i]) == 0) {
matched = true;
break;
}
@@ -210,7 +210,7 @@
s++;
}
- SawAll = (strcmp(s, "all") == 0);
+ SawAll = (strcasecmp(s, "all") == 0);
if (SawAll)
s = SawBang ? "*" : "*,!control,!control.*";
len += strlen(s);
Modified: innd/art.c
===================================================================
--- innd/art.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ innd/art.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -1273,7 +1273,7 @@
/* See if it's a cancel message. */
c = *Control;
- if (c == 'c' && strncmp(Control, "cancel", 6) == 0) {
+ if ((c == 'c' || c == 'C') && strncasecmp(Control, "cancel", 6) == 0) {
for (p = &Control[6]; ISWHITE(*p); p++)
continue;
if (*p && IsValidMessageID(p, true))
@@ -1338,9 +1338,9 @@
for (sawbang = false, c = *p; (q = *list) != NULL; list++) {
if (*q == '!') {
sawbang = true;
- if (c == *++q && strcmp(p, q) == 0)
+ if (c == *++q && strcasecmp(p, q) == 0)
return false;
- } else if (c == *q && strcmp(p, q) == 0)
+ } else if (c == *q && strcasecmp(p, q) == 0)
return true;
}
@@ -1989,13 +1989,13 @@
n = strlen(hops[0]);
if (n == Path.used - 1 &&
- strncmp(Path.data, hops[0], Path.used - 1) == 0)
+ strncasecmp(Path.data, hops[0], Path.used - 1) == 0)
data->Hassamepath = true;
else
data->Hassamepath = false;
if (Pathcluster.data != NULL &&
n == Pathcluster.used - 1 &&
- strncmp(Pathcluster.data, hops[0], Pathcluster.used - 1) == 0)
+ strncasecmp(Pathcluster.data, hops[0], Pathcluster.used - 1) == 0)
data->Hassamecluster = true;
else
data->Hassamecluster = false;
@@ -2151,8 +2151,8 @@
if (CTYPE(isupper, *p))
*p = tolower(*p);
*p = '\0';
- LikeNewgroup = (strcmp(ControlWord, "newgroup") == 0
- || strcmp(ControlWord, "rmgroup") == 0);
+ LikeNewgroup = (strcasecmp(ControlWord, "newgroup") == 0
+ || strcasecmp(ControlWord, "rmgroup") == 0);
if (innconf->ignorenewsgroups && LikeNewgroup) {
for (p++; *p && ISWHITE(*p); p++);
@@ -2177,7 +2177,7 @@
data->Followcount = data->Groupcount;
}
- LikeNewgroup = (LikeNewgroup || strcmp(ControlWord, "checkgroups") == 0);
+ LikeNewgroup = (LikeNewgroup || strcasecmp(ControlWord, "checkgroups") == 0);
/* Control messages to "foo.ctl" are treated as if they were
* posted to "foo". I should probably apologize for all the
Modified: innfeed/imap_connection.c
===================================================================
--- innfeed/imap_connection.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ innfeed/imap_connection.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -2731,7 +2731,7 @@
(*caps)->imap4 = 1;
} else if (strcasecmp(start,"LOGINDISABLED")==0) {
(*caps)->logindisabled = 1;
- } else if ( strncmp(start, "AUTH=", 5)==0) {
+ } else if ( strncasecmp(start, "AUTH=", 5)==0) {
if ( (*caps)->saslmechs == NULL)
{
@@ -2919,7 +2919,7 @@
- } else if (strncmp(str, cxn->imap_currentTag, IMAP_TAGLENGTH)==0) {
+ } else if (strncasecmp(str, cxn->imap_currentTag, IMAP_TAGLENGTH)==0) {
/* matches our tag */
str += IMAP_TAGLENGTH;
@@ -2933,7 +2933,7 @@
str++;
/* should be OK/NO */
- if (strncmp(str,"OK",2)==0)
+ if (strncasecmp(str,"OK",2)==0)
{
okno = 1;
} else {
@@ -3304,15 +3304,15 @@
}
/* look for one we know about; ignore all others */
- if (strncmp(str+4,"8BITMIME",strlen("8BITMIME"))==0)
+ if (strncasecmp(str+4,"8BITMIME",strlen("8BITMIME"))==0)
{
cxn->lmtp_capabilities->Eightbitmime = 1;
- } else if (strncmp(str+4, "ENHANCEDSTATUSCODES",
+ } else if (strncasecmp(str+4, "ENHANCEDSTATUSCODES",
strlen("ENHANCEDSTATUSCODES"))==0) {
cxn->lmtp_capabilities->EnhancedStatusCodes = 1;
- } else if (strncmp(str+4, "AUTH",4)==0) {
+ } else if (strncasecmp(str+4, "AUTH",4)==0) {
cxn->lmtp_capabilities->saslmechs = xstrdup(str + 4 + 5);
- } else if (strncmp(str+4,"PIPELINING",strlen("PIPELINING"))==0) {
+ } else if (strncasecmp(str+4,"PIPELINING",strlen("PIPELINING"))==0) {
cxn->lmtp_capabilities->pipelining = 1;
} else {
/* don't care; ignore */
Modified: nnrpd/article.c
===================================================================
--- nnrpd/article.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ nnrpd/article.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -411,7 +411,7 @@
s + VirtualPathlen + 1 < endofpath;
lastchar = *s++) {
if ((lastchar != '\0' && lastchar != '!') || *s != *VirtualPath ||
- strncmp(s, VirtualPath, VirtualPathlen - 1) != 0)
+ strncasecmp(s, VirtualPath, VirtualPathlen - 1) != 0)
continue;
if (*(s + VirtualPathlen - 1) != '\0' &&
*(s + VirtualPathlen - 1) != '!')
@@ -552,7 +552,7 @@
prevchar = *s++) {
if ((prevchar != '\0' && prevchar != '!') ||
*s != *VirtualPath ||
- strncmp(s, VirtualPath, VirtualPathlen - 1) != 0)
+ strncasecmp(s, VirtualPath, VirtualPathlen - 1) != 0)
continue;
if (*(s + VirtualPathlen - 1) != '\0' &&
*(s + VirtualPathlen - 1) != '!')
Modified: nnrpd/perm.c
===================================================================
--- nnrpd/perm.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ nnrpd/perm.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -1720,10 +1720,10 @@
}
if (VirtualPath)
free(VirtualPath);
- if (strcmp(innconf->pathhost, PERMaccessconf->pathhost) == 0) {
+ if (strcasecmp(innconf->pathhost, PERMaccessconf->pathhost) == 0) {
/* Use domain, if pathhost in access realm matches one in
* inn.conf to differentiate virtual host. */
- if (innconf->domain != NULL && strcmp(innconf->domain, PERMaccessconf->domain) == 0) {
+ if (innconf->domain != NULL && strcasecmp(innconf->domain, PERMaccessconf->domain) == 0) {
syslog(L_ERROR, "%s domain parameter (%s) in readers.conf must be different from the one in inn.conf.",
Client.host, PERMaccessconf->name);
Reply("%d NNTP server unavailable. Try later!\r\n", NNTP_FAIL_TERMINATING);
Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c 2009-12-27 19:23:42 UTC (rev 8867)
+++ nnrpd/post.c 2009-12-27 20:49:16 UTC (rev 8868)
@@ -264,17 +264,17 @@
save = *p;
*p = '\0';
- if (strcmp(ctrl, "cancel") == 0) {
+ if (strcasecmp(ctrl, "cancel") == 0) {
for (q = p + 1; ISWHITE(*q); q++)
continue;
if (*q == '\0')
return "Message-ID missing in cancel";
}
- else if (strcmp(ctrl, "checkgroups") == 0
- || strcmp(ctrl, "ihave") == 0
- || strcmp(ctrl, "sendme") == 0
- || strcmp(ctrl, "newgroup") == 0
- || strcmp(ctrl, "rmgroup") == 0)
+ else if (strcasecmp(ctrl, "checkgroups") == 0
+ || strcasecmp(ctrl, "ihave") == 0
+ || strcasecmp(ctrl, "sendme") == 0
+ || strcasecmp(ctrl, "newgroup") == 0
+ || strcasecmp(ctrl, "rmgroup") == 0)
;
else {
snprintf(Error, sizeof(Error),
@@ -418,7 +418,7 @@
if ((VirtualPathlen > 0) &&
(p = strchr(HDR(HDR__PATH), '!')) != NULL) {
*p = '\0';
- if (strcmp(HDR(HDR__PATH), PERMaccessconf->pathhost) != 0)
+ if (strcasecmp(HDR(HDR__PATH), PERMaccessconf->pathhost) != 0)
addvirtual = true;
*p = '!';
} else if (VirtualPathlen > 0)
@@ -689,7 +689,7 @@
#endif /* DO_PYTHON */
p = HDR(HDR__CONTROL);
- IsNewgroup = (p && strncmp(p, "newgroup", 8) == 0);
+ IsNewgroup = (p && strncasecmp(p, "newgroup", 8) == 0);
groups = xstrdup(hdr);
if ((p = strtok(groups, NGSEPS)) == NULL) {
free(groups);
More information about the inn-committers
mailing list