🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #44018

Re: Q: Wildcard Authentication for Diablo Reader

#44018
From: Russell Vincent
Date: Fri, 11 Feb 2000 00:00
109 lines
3889 bytes
lewcifer999@my-deja.com wrote:
> However, if I want to give authenticated access to
> users on dynamic IP's, how do I do it?  I tried
> the following without success:

As has been pointed out, you can't do it with the current dreaderd,
but with the following patch, you should be able to use an external
file with 'username:password' combinations and use 'pwfile=filename'
in dreader.hosts (like you would use 'user='). You still need to
use the 'a' option, but use pwfile instead of the user=/pass=
combination. e.g:

*	rpa	pwfile=filename

Note that the patch might not apply very easily as I have a very
different dns.c to the original (lots of hacking). It shouldn't
be difficult to manually add it, though. I haven't tested it
completely, so use it at your peril.

 -Russell

*** dns.c.old	Fri Feb 11 10:03:43 2000
--- dns.c	Mon Jan 31 14:08:00 2000
***************
*** 24,29 ****
--- 24,30 ----
  int readtoeof(int fd, void *buf, int bytes, int secs);
  int cidrMatch(const char *c_line, const struct in_addr *c_host);
  void ReadVhosts();
+ int pwfileCheck(char *pwfile, char *druser, char *drpass);
  
  int DFd = -1;
  MemPool	*DnsMemPool;
***************
*** 223,228 ****
--- 224,230 ----
  		char *kt;
  		char *user = NULL;
  		char *pass = NULL;
+ 		char *pwfile = NULL;
  
  		while ((kt = strtok(NULL, " \t\n")) != NULL) {
  		    if (strncmp(kt, "user=", 5) == 0) {
***************
*** 230,240 ****
  		    } else if (strncmp(kt, "pass=", 5) == 0) {
  			if (kt[5])
  			    pass = kt + 5;
  		    }
  		}
  		if (DebugOpt)
  		    printf("USER %s PASS %s DR_USER %s\n", user, pass, dres->dr_User);
! 		if (user == NULL) {
  		    needauth = 1;
  		    logit(LOG_INFO, "No user - need to get it");
  #if DIABLO_AUTH
--- 232,247 ----
  		    } else if (strncmp(kt, "pass=", 5) == 0) {
  			if (kt[5])
  			    pass = kt + 5;
+ 		    } else if (strncmp(kt, "pwfile=", 7) == 0) {
+ 			if (kt[7])
+ 			    pwfile = kt + 7;
  		    }
  		}
  		if (DebugOpt)
  		    printf("USER %s PASS %s DR_USER %s\n", user, pass, dres->dr_User);
! 		if ((pwfile != NULL) && dreq->dr_AuthUser[0] && dreq->dr_AuthPass[0]) {
! 		    needauth = pwfileCheck(pwfile, dreq->dr_AuthUser, dreq->dr_AuthPass);
! 		} else if (user == NULL) {
  		    needauth = 1;
  		    logit(LOG_INFO, "No user - need to get it");
  #if DIABLO_AUTH
***************
*** 807,809 ****
--- 814,844 ----
      return (0);
  }
  
+ int
+ pwfileCheck(char *pwfile, char *druser, char *drpass)
+ {
+     FILE *fi;
+     char buf[256];
+     int found = 0;
+     
+     fi = fopen(pwfile,"r");
+     if (fi == NULL) {
+ 	logit(LOG_ERR, "Unable to open pwfile: %s", pwfile);
+ 	return(1);
+     }
+     while (fgets(buf, sizeof(buf), fi) != NULL) {
+ 	char *user = NULL;
+ 	char *pass = NULL;
+ 	user = strtok(buf, ":");
+ 	pass = strtok(NULL, " \n");
+ 	if (user && pass && (strcmp(druser, user) == 0) && (strcmp(drpass, pass) == 0)) {
+ 	    found = 1;
+ 	    break;
+ 	}
+     }
+     fclose(fi);
+     if (found)
+ 	return(0);
+     return(1);
+ }
+ 

Technical Details
Message-ID: <880nba$fsu$1@wave.pipex.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <87vvl4$dl5$1@nnrp1.deja.com>

Show Full Headers
Complete Article Headers
Message-ID: <880nba$fsu$1@wave.pipex.net>
Subject: Re: Q: Wildcard Authentication for Diablo Reader
Date: Fri, 11 Feb 2000 00:00:00 +0000
From: Russell Vincent <russellv-n@uk.uu.net>
References: <87vvl4$dl5$1@nnrp1.deja.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 584490181
X-Complaints-To: abuse@uk.uu.net
X-Trace: wave.pipex.net 950263978 16286 172.31.3.105 (11 Feb 2000 10:12:58 GMT)
Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom
NNTP-Posting-Date: 11 Feb 2000 10:12:58 GMT
Newsgroups: news.software.nntp