BMM <bmm@minder.net> writes: > I'd certainly be interested in a patch for the current version that does > this, if not a repost of the more general patch you mention (as I > mentioned, the searchable archive of the list doesn't seem to be up). > > Thanks, > > -Brian > > On Mon, 15 Nov 1999 kadokev@msg.net wrote: > > > > > > I apologize for what must be a FAQ, but both the FAQ at www.nntpcache.org > > > and the mailing list archives seem to be broken. I'm curious if there is > > > a way to specify a username/password pair which might be required to > > > access an upstream server in nntpcache.servers? > > > > TMK, this feature is not in the current version. I've patched the version I > > run to do this for a single upstream, and posted a more general patch to the > > mailing list a few months back. > > > > If there's interest, I can come up with a patch for the most recent release... > > > > Well here's what I use, it's not pretty but it's effective for me. Basically, it adds two optional parameters (user and password) to the server line in nntpcache.servers No warranties etc. PS: I think that I removed all the local changes.
# This is a patch for nntpcache-2.3.3.orig/src to update it to nntpcache-2.3.3/src. # It was generated by makepatch 1.93 (2.0BETA) on Tue Nov 16 21:23:29 1999. # # To apply this patch, chdir to source directory nntpcache-2.3.3.orig/src and enter # # patch -p1 -N < <this-file> exit # End of preamble. # Patch input follows. __DATA__ Index: ll.h Prereq: 1.2 ####### nntpcache-2.3.3/src/ => src *** src/ll.h Mon Aug 3 06:35:01 1998 --- src/ll.h Thu Oct 14 19:28:30 1999 *************** *** 96,101 **** --- 96,103 ---- int listgroup_timeout; /* listgroup timeout */ int overview_fmt_timeout; /* timeout */ int article_timeout; /* timeout */ + char user[100]; + char pass[100]; bool post_ok; /* posting ok on this server */ }; Index: nnconf.c ####### nntpcache-2.3.3/src/ => src *** src/nnconf.c Fri Aug 21 01:39:00 1998 --- src/nnconf.c Thu Oct 14 21:49:20 1999 *************** *** 7,21 **** struct nnconf nnconf = { ! "/usr/local/etc/nntpcache", "nntpcache.config", "nntpcache.servers", "nntpcache.access", ! "/usr/local/var/nntpcache", ! "usenet@polysynaptic.iq.org", 18, 0, ! 10, 2, 4, 15, --- 7,21 ---- struct nnconf nnconf = { ! "/etc/news/nntpcache", "nntpcache.config", "nntpcache.servers", "nntpcache.access", ! "/var/nntpcache", ! "news@frogdream.com", 18, 0, ! 0, 2, 4, 15, *************** *** 36,42 **** 0, 1, 1, ! 1, 8192, 180, NULL, --- 36,42 ---- 0, 1, 1, ! 0, 8192, 180, NULL, *************** *** 53,59 **** 0, "news", "news", ! "Ye 'Ol Disorganized NNTPCache groupie", 0, "^X-foo:", 1000, --- 53,59 ---- 0, "news", "news", ! "Frogdream Internet", 0, "^X-foo:", 1000, *************** *** 61,70 **** 16777216, 1, 1000, ! 62914560, ! 41943040, 0, ! 1209600, 300, 604800, 1, --- 61,70 ---- 16777216, 1, 1000, ! 31457280, ! 10485760, 0, ! 172800, 300, 604800, 1, *************** *** 85,91 **** "stats@nntpcache", 1, "DEFAULT:9119", ! "/usr/local/etc/nntpcache/http", 600, 86400, 600, --- 85,91 ---- "stats@nntpcache", 1, "DEFAULT:9119", ! "/etc/news/nntpcache/http", 600, 86400, 600, Index: nntpcache.c Prereq: 1.4 ####### nntpcache-2.3.3/src/ => src *** src/nntpcache.c Wed Aug 19 22:55:17 1998 --- src/nntpcache.c Thu Oct 14 22:10:32 1999 *************** *** 743,846 **** static bool load_servers(char *file) { ! FILE *fp; ! char buf[MAX_LINE]; ! int n; ! struct server_cfg *list=NULL; ! int comment_depth=0; ! ! if ((fp = fopen(file, "r")) == NULL) { ! loge(("couldn't load servers file %s", file)); ! return FALSE; ! } ! for (n = 0; fgets(buf, sizeof(buf), fp); ++n) ! { ! char host[MAX_HOST], us[MAX_HOST], active_timeoutS[32], active_times_timeoutS[32], newsgroups_timeoutS[32], group_timeoutS[32], xover_timeoutS[32], article_timeoutS[32]; ! int active_timeout, active_times_timeout, newsgroups_timeout, group_timeout, xover_timeout, article_timeout; ! if (!buf[0] || buf[0] == '\n') ! continue; ! comment_depth = decomment(buf, comment_depth); ! if (!buf[0] || buf[0] == '#' || buf[0] == '\n') ! continue; ! strStripEOL(buf); ! if (!buf[0]) ! continue; ! if (strCaseEq(buf, "%BeginGroups")) ! break; ! if (sscanf(buf, "%127s %127s %31s %31s %31s %31s %31s %31[^\t\r\n ]s", host, us, active_timeoutS, active_times_timeoutS, newsgroups_timeoutS, group_timeoutS, xover_timeoutS, article_timeoutS) != 8) ! { ! loge (("invalid config line %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((active_timeout = nndtoi (active_timeoutS)) < 0) ! { ! loge (("invalid active file timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((active_times_timeout = nndtoi (active_times_timeoutS)) < 0) ! { ! loge (("invalid active.times file timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((newsgroups_timeout = nndtoi (newsgroups_timeoutS)) < 0) ! { ! loge (("invalid newsgroups timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((group_timeout = nndtoi (group_timeoutS)) < 0) ! { ! loge (("invalid group timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((xover_timeout = nndtoi (xover_timeoutS)) < 0) ! { ! loge (("invalid xover timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((article_timeout = nndtoi (article_timeoutS)) < 0) ! { ! loge (("invalid article timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if (!list) ! { ! list = Scalloc (1, sizeof *list); ! list->head = list; ! } else ! { ! struct server_cfg *head = list->head; ! list->next = Scalloc (1, sizeof *list); ! list = list->next; ! list->head = head; ! } ! list->host = Sstrdup (host); ! list->us = Sstrdup (us); ! list->active_timeout = active_timeout; ! list->active_times_timeout = active_times_timeout; ! list->newsgroups_timeout = newsgroups_timeout; ! list->group_timeout = group_timeout; ! list->listgroup_timeout = group_timeout; ! list->xover_timeout = xover_timeout; ! list->article_timeout = article_timeout; ! list->overview_fmt_timeout = con->overviewFmtTimeout; ! list->fd=-1; } ! if (ferror(fp)) { ! loge (("error reading servers config from %s", file)); ! Exit(1); } if (!list) { ! loge (("servers file %s contains no servers!", file)); ! fclose(fp); ! return FALSE; ! } ! ServerList = list->head; ! load_groups(file, fp); ! fclose (fp); ! return TRUE; } EXPORT struct server_cfg *findScfg(char *name) --- 743,869 ---- static bool load_servers(char *file) { + FILE *fp; + char buf[MAX_LINE]; + int n; + struct server_cfg *list=NULL; + int comment_depth=0; + int num; + char user[100]; + char pass[100]; ! /*sleep(60);*/ ! ! if ((fp = fopen(file, "r")) == NULL) { ! loge(("couldn't load servers file %s", file)); ! return FALSE; ! } ! for (n = 0; fgets(buf, sizeof(buf), fp); ++n) ! { ! char host[MAX_HOST], us[MAX_HOST], active_timeoutS[32], active_times_timeoutS[32], newsgroups_timeoutS[32], group_timeoutS[32], xover_timeoutS[32], article_timeoutS[32]; ! int active_timeout, active_times_timeout, newsgroups_timeout, group_timeout, xover_timeout, article_timeout; ! if (!buf[0] || buf[0] == '\n') ! continue; ! comment_depth = decomment(buf, comment_depth); ! if (!buf[0] || buf[0] == '#' || buf[0] == '\n') ! continue; ! strStripEOL(buf); ! if (!buf[0]) ! continue; ! if (strCaseEq(buf, "%BeginGroups")) ! break; ! num = sscanf(buf, "%127s %127s %31s %31s %31s %31s %31s %31s %99s %99[^\t\r\n]s", host, us, active_timeoutS, active_times_timeoutS, newsgroups_timeoutS, group_timeoutS, xover_timeoutS, article_timeoutS, user, pass); ! if (num < 8 || num > 10) ! { ! loge (("invalid config line %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((active_timeout = nndtoi (active_timeoutS)) < 0) ! { ! loge (("invalid active file timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((active_times_timeout = nndtoi (active_times_timeoutS)) < 0) ! { ! loge (("invalid active.times file timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((newsgroups_timeout = nndtoi (newsgroups_timeoutS)) < 0) ! { ! loge (("invalid newsgroups timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((group_timeout = nndtoi (group_timeoutS)) < 0) ! { ! loge (("invalid group timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((xover_timeout = nndtoi (xover_timeoutS)) < 0) ! { ! loge (("invalid xover timeout %s:%d: %s", file, n, buf)); ! continue; ! } ! if ((article_timeout = nndtoi (article_timeoutS)) < 0) ! { ! loge (("invalid article timeout %s:%d: %s", file, n, buf)); ! continue; } ! if (num >= 9 && (!user || strlen(user) < 1)) { ! loge(("invalid user")); ! continue; ! } ! if (num == 10 && (!pass || strlen(pass) < 1)) ! { ! loge(("invalid password")); ! continue; } if (!list) { ! list = Scalloc (1, sizeof *list); ! list->head = list; ! } else ! { ! struct server_cfg *head = list->head; ! list->next = Scalloc (1, sizeof *list); ! list = list->next; ! list->head = head; ! } ! list->host = Sstrdup (host); ! list->us = Sstrdup (us); ! list->active_timeout = active_timeout; ! list->active_times_timeout = active_times_timeout; ! list->newsgroups_timeout = newsgroups_timeout; ! list->group_timeout = group_timeout; ! list->listgroup_timeout = group_timeout; ! list->xover_timeout = xover_timeout; ! list->article_timeout = article_timeout; ! list->overview_fmt_timeout = con->overviewFmtTimeout; ! if (num >= 9) ! strncpy(list->user, user, 50); ! else ! *list->user = '\0'; ! if (num == 10) ! strncpy(list->pass, pass, 50); ! else ! *list->pass = '\0'; ! list->fd=-1; ! } ! if (ferror(fp)) ! { ! loge (("error reading servers config from %s", file)); ! Exit(1); ! } ! if (!list) ! { ! loge (("servers file %s contains no servers!", file)); ! fclose(fp); ! return FALSE; ! } ! ServerList = list->head; ! load_groups(file, fp); ! fclose (fp); ! return TRUE; } EXPORT struct server_cfg *findScfg(char *name) Index: sockets.c Prereq: 1.3 ####### nntpcache-2.3.3/src/ => src *** src/sockets.c Wed Aug 5 06:18:59 1998 --- src/sockets.c Thu Oct 14 22:09:32 1999 *************** *** 194,199 **** --- 194,213 ---- if (!Cfget (scfg, buf, sizeof buf)) goto dropped; } + if (*scfg->user) + { + fprintf(scfg->fh, "authinfo user %s\r\n", scfg->user); + fflush(scfg->fh); + if (!Cfget(scfg, buf, sizeof buf)) + goto dropped; + } + if (*scfg->pass) + { + fprintf(scfg->fh, "authinfo pass %s\r\n", scfg->pass); + fflush(scfg->fh); + if (!Cfget(scfg, buf, sizeof buf)) + goto dropped; + } if (scfg->group_actual) { free(scfg->group_actual); End of Patch.
-- Matt Jackson mjj@frogdream.com http://www.frogdream.com