🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Stan Barber Fri, 13 Jul 1990 01:40
NNTP 1.5.9 (postauth.c)
#573
Author: Stan Barber
Date: Fri, 13 Jul 1990 01:40
82 lines
2324 bytes
Here is postauth.c....sorry it was left out. The patch files on bcm.tmc.edu
will be updated to include this, but they will not be reposted.
---------------------------------------------------------------------------
/* 
 * postauth: do authorization handshake when posting requires it.
 * Originally by Brian Kantor. Some modifications by Stan Barber.
 */
#ifndef lint
static char * rcsid = "$Header: postauth.c,v 1.2 90/07/08 01:00:05 sob Exp $";
#endif
#include <stdio.h>
#include "../common/conf.h"
#include "../common/nntp.h"

#ifdef AUTH

extern FILE *passfile;

postauth(host)
char *host;
	{
	char remote[64], user[16], pass[16];
	char buf[1024];
	int i;

	if (passfile == NULL)
		{
		fprintf(stderr,"Posting is not allowed from this system.\n");
		exit(1);
		}

	while(fgets(buf, sizeof(buf), passfile))
		{
		if (buf[0] == '#')
			continue;
		
		i = sscanf(buf,"%s %s %s", remote, user, pass);
		/* malformed entry? */
		if (i != 3)
			{
			fprintf(stderr,"Posting Authorization Denied. File format error.\n");
			continue;
			}
		
		/* right host? */
		if (!strcasecmp(remote,host))
			break;
		}
	if (feof(passfile))
		{
		fprintf(stderr,"Posting to %s is not allowed from this system\n", host);
		exit(1);
		}
	
	sprintf(buf,"authinfo user %s", user);
	if (converse(buf, sizeof(buf)) != NEED_AUTHDATA)
		{
		fprintf(stderr,"%s\n", buf);
		exit(1);
		}
	
	sprintf(buf,"authinfo pass %s", pass);
	if (converse(buf, sizeof(buf)) != OK_AUTH)
		{
		fprintf(stderr,"%s\n", buf);
		exit(1);
		}
	
	fclose(passfile);
	}

int
converse(buf,buflen)
char *buf;
int buflen;
	{
	put_server(buf,buflen);
	get_server(buf,buflen);
	return(atoi(buf));
	}
#endif AUTH
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