Thread View: news.software.nntp
4 messages
4 total messages
Started by Etian
Tue, 12 May 2009 22:12
help debug this nntpcache section
Author: Etian
Date: Tue, 12 May 2009 22:12
Date: Tue, 12 May 2009 22:12
31 lines
2286 bytes
2286 bytes
I'm not a C programmer, but I got nntpcache (3.0.2) to work when I
replaced this code segment with simple assignment to list->user and
list->pass and skipped parsing it from the config file. Otherwise, it
crashes whenever you try to assign a username and password to the host
from the config file. It works if you are using a host that doesn't
require login (e.g. host="news.xxxxx.com"). It crashes when you specify
a username and password (e.g. host="myusername:mypassword@news.xxxxx.com")
Here is the code segment from nntpcache.c
/* if there's a @ in host there's a user and password */
hostname = username = password = NULL;
if (strchr(host, '@') != NULL)
{
if ((password = strrchr(host, ':')) != NULL)
*(password++) = '\0';
else
{
loge (("missing password in %s:%d: %s", file, n, buf));
continue;
}
if ((hostname = strrchr(password-2, '@')) != NULL) {
*(hostname++) = '\0';
username = host;
list->user = Sstrdup (username);
list->pass = Sstrdup (password);
}
} else {
hostname = host;
}
Re: help debug this nntpcache section
Author: D. Stussy
Date: Tue, 12 May 2009 22:41
Date: Tue, 12 May 2009 22:41
38 lines
2339 bytes
2339 bytes
"Etian" <54698212@sonic-news.com> wrote in message
news:ovmOl.56299$ew.39243@newsfe24.iad...
> I'm not a C programmer, but I got nntpcache (3.0.2) to work when I
> replaced this code segment with simple assignment to list->user and
> list->pass and skipped parsing it from the config file. Otherwise, it
> crashes whenever you try to assign a username and password to the host
> from the config file. It works if you are using a host that doesn't
> require login (e.g. host="news.xxxxx.com"). It crashes when you specify
> a username and password (e.g.
host="myusername:mypassword@news.xxxxx.com")
>
> Here is the code segment from nntpcache.c
>
> /* if there's a @ in host there's a user and password */
> hostname = username = password = NULL;
> if (strchr(host, '@') != NULL)
> {
> if ((password = strrchr(host, ':')) != NULL)
> *(password++) = '\0';
> else
> {
> loge (("missing password in %s:%d: %s", file, n, buf));
> continue;
> }
> if ((hostname = strrchr(password-2, '@')) != NULL) {
> *(hostname++) = '\0';
> username = host;
> list->user = Sstrdup (username);
> list->pass = Sstrdup (password);
> }
> } else {
> hostname = host;
> }
Note: If the host is specified as an IPv6 address literal, this code could
fail.
Re: help debug this nntpcache section
Author: Wolfgang Schelongowski
Date: Fri, 15 May 2009 18:50
Date: Fri, 15 May 2009 18:50
25 lines
1741 bytes
1741 bytes
Etian <54698212@sonic-news.com> writes:
...
>require login (e.g. host="news.xxxxx.com"). It crashes when you specify
>a username and password (e.g. host="myusername:mypassword@news.xxxxx.com")
...
> if ((password = strrchr(host, ':')) != NULL)
> *(password++) = '\0';
> else
> {
> loge (("missing password in %s:%d: %s", file, n, buf));
> continue;
It is unclear what happens when 'continue' is executed. A 'goto' by
any other name is still a 'goto' ...
> }
> if ((hostname = strrchr(password-2, '@')) != NULL) {
Shouldn't that be password+2? Assuming that a password is at least
one char long, of course. Best just use passwd, without - or + anything.
--
The first entry of Sin into the mind occurs when, out of cowardice or
conformity or vanity, the Real is replaced by a comforting lie.
-- Integritas, Consonantia, Claritas
Re: help debug this nntpcache section
Author: Etian
Date: Sat, 16 May 2009 17:03
Date: Sat, 16 May 2009 17:03
30 lines
2267 bytes
2267 bytes
Wolfgang Schelongowski wrote:
> Etian <54698212@sonic-news.com> writes:
>
> ...
>> require login (e.g. host="news.xxxxx.com"). It crashes when you specify
>> a username and password (e.g. host="myusername:mypassword@news.xxxxx.com")
> ...
>> if ((password = strrchr(host, ':')) != NULL)
>> *(password++) = '\0';
>> else
>> {
>> loge (("missing password in %s:%d: %s", file, n, buf));
>> continue;
>
> It is unclear what happens when 'continue' is executed. A 'goto' by
> any other name is still a 'goto' ...
>
>> }
>> if ((hostname = strrchr(password-2, '@')) != NULL) {
>
> Shouldn't that be password+2? Assuming that a password is at least
> one char long, of course. Best just use passwd, without - or + anything.
That is it! (password+2). Thank you. It works now.
This is a great program (compared to leafnode or newscache). It appears
to be orphanware now. I wish somebody would adopt it.
Etian
sonic-news
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads