[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[leafnode-list] leafnode2 - parse problem with newnews/newgroups
Hi,
I have been running leafnode-2 for a couple of months now, mainly
because I needed the possibility of adding local groups.
I have had to patch it a bit, mainly because newnews and newgroups
directives not are similar enough, as assumed by the donew_common
routine.
In addition there some minor cosmetic changes for unused variables etc.
I have attached the patch ...
Keep up the good work!
/Niels
--
Niels Baggesen -- @home -- Århus -- Denmark -- niels@xxxxxxxxxxxx
The purpose of computing is insight, not numbers -- R W Hamming
diff -ru ../leafnode-2.0.0.alpha20050914a/fetchnews.c ./fetchnews.c
--- ../leafnode-2.0.0.alpha20050914a/fetchnews.c 2005-08-10 12:15:49.000000000 +0200
+++ ./fetchnews.c 2005-10-27 22:29:45.099743651 +0200
@@ -2042,8 +2042,10 @@
struct sigaction sa;
static int forceactive; /* if 1, reread complete active file */
struct serverlist *current_server;
+#ifdef COMPILE_BROKEN
unsigned long articles;
char **x;
+#endif
forceactive = 0;
verbose = 0;
diff -ru ../leafnode-2.0.0.alpha20050914a/nntpd.c ./nntpd.c
--- ../leafnode-2.0.0.alpha20050914a/nntpd.c 2005-09-14 10:17:06.000000000 +0200
+++ ./nntpd.c 2005-10-27 22:29:45.111742136 +0200
@@ -918,16 +918,14 @@
}
static time_t
-parsedate_newnews(const struct stringlisthead *l, const int gmt)
+parsedate_newnews(const char *date_str, const char *time_str, const int gmt)
{
struct tm timearray;
- const struct stringlistnode *n = l->head;
time_t age;
long a, b;
- if (stringlistlen(l) < 2) return (time_t)-1;
memset(&timearray, 0, sizeof(timearray));
- a = strtol(n->string, NULL, 10);
+ a = strtol(date_str, NULL, 10);
/* NEWNEWS/NEWGROUPS dates may have the form YYMMDD or YYYYMMDD.
* Distinguish between the two */
b = a / 10000;
@@ -949,7 +947,7 @@
}
timearray.tm_mon = (a % 10000 / 100) - 1;
timearray.tm_mday = a % 100;
- a = strtol(n->next->string, NULL, 10);
+ a = strtol(time_str, NULL, 10);
timearray.tm_hour = a / 10000;
timearray.tm_min = a % 10000 / 100;
timearray.tm_sec = a % 100;
@@ -967,22 +965,26 @@
}
static time_t
-donew_common(const struct stringlisthead *l)
+donew_common(const struct stringlisthead *l, int newnews)
{
struct stringlistnode *n;
+ int newnews_len;
int gmt, len;
time_t age;
- if (!l || (len = stringlistlen(l)) < 2) {
+ newnews_len = 2;
+ if (newnews) newnews_len++;
+ if (!l || (len = stringlistlen(l)) < newnews_len) {
nntpprintf("502 Syntax error");
return -1;
}
n = l->head;
+ if (newnews) n = n->next;
- gmt = (len >= 3 && !strcasecmp(n->next->next->string, "gmt"));
+ gmt = (len >= (newnews_len+1) && !strcasecmp(n->next->next->string, "gmt"));
- age = parsedate_newnews(l, gmt);
+ age = parsedate_newnews(n->string, n->next->string, gmt);
if (age == (time_t)-1) {
nntpprintf("502 Syntax error");
return -1;
@@ -1005,7 +1007,7 @@
nntpprintf("502 Syntax error.");
return;
}
- age = donew_common(l);
+ age = donew_common(l, 1);
if (age == (time_t)-1) {
freelist(l);
return;
@@ -1048,9 +1050,14 @@
free(x);
} else {
/* FIXME: cannot find message ID in XOVER */
+ ln_log(LNLOG_SERR, LNLOG_CTOP,
+ "Cannot find messageID in XOVER: %s",
+ nga->d_name);
}
} else {
/* FIXME: cannot find XOVER for article */
+ ln_log(LNLOG_SERR, LNLOG_CTOP,
+ "Cannot find XOVER for %s", nga->d_name);
}
} /* too old */
} /* if not a number, not an article */
@@ -1073,7 +1080,7 @@
time_t age;
struct newsgroup *ng;
- age = donew_common(l);
+ age = donew_common(l, 0);
if (age == (time_t)-1) {
freelist(l);
return;
diff -ru ../leafnode-2.0.0.alpha20050914a/rnews.c ./rnews.c
--- ../leafnode-2.0.0.alpha20050914a/rnews.c 2005-03-24 13:08:12.000000000 +0100
+++ ./rnews.c 2005-10-27 22:29:45.113741884 +0200
@@ -288,7 +288,7 @@
char *conffile = NULL;
const char *const myname = "rnews";
- ln_log_open(argv[0]);
+ ln_log_open(myname);
if (!initvars(argv[0], 0))
init_failed(myname);
--
_______________________________________________
leafnode-list mailing list
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
https://www.dt.e-technik.uni-dortmund.de/mailman/listinfo/leafnode-list
http://leafnode.sourceforge.net/