leafnode
1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
![]() ![]() |
#include "leafnode.h"
#include "system.h"
#include "mysigact.h"
#include <fcntl.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <netdb.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
#include "ln_log.h"
Go to the source code of this file.
Data Structures | |
struct | versions |
Macros | |
#define | incopy(a) (*((struct in_addr *)a)) |
Functions | |
static int | xnntpreply (const struct server *, int) |
static void | authsucc (const struct server *current_server) |
void | putaline (void) |
int | authenticate (const struct server *current_server) |
void | freelastreply (void) |
char * | lastreply (void) |
int | nntpreply (const struct server *s) |
static int | check_linlist (const char *s, const struct versions *list, int count) |
int | nntpconnect (const struct server *upstream) |
void | nntpdisconnect (void) |
void | nntpquit (void) |
Variables | |
char | last_command [1024+1] |
char | lineout [1024+1] |
FILE * | nntpin = NULL |
FILE * | nntpout = NULL |
int | stat_is_evil = 0 |
int | date_is_evil = 0 |
static size_t | lllen = 0 |
static char * | llstr = NULL |
static struct versions | stat_versions [] |
static const int | stat_count = sizeof(stat_versions)/sizeof(stat_versions[0]) |
static struct versions | date_versions [] |
static const int | date_count = sizeof(date_versions)/sizeof(date_versions[0]) |
#define incopy | ( | a | ) | (*((struct in_addr *)a)) |
Definition at line 309 of file nntputil.c.
int authenticate | ( | const struct server * | current_server | ) |
Definition at line 96 of file nntputil.c.
References authsucc(), debugmode, FALSE, ln_log(), LNLOG_CSERVER, LNLOG_CTOP, LNLOG_SERR, server::name, nntpout, server::password, TRUE, server::username, and xnntpreply().
Referenced by main(), and xnntpreply().
|
static |
Definition at line 64 of file nntputil.c.
References server::name, server::username, and verbose.
Referenced by authenticate().
|
static |
Definition at line 298 of file nntputil.c.
Referenced by nntpconnect().
void freelastreply | ( | void | ) |
char * lastreply | ( | void | ) |
Definition at line 162 of file nntputil.c.
References llstr.
Referenced by check_date(), getgroup(), ismsgidonserver(), nntpactive(), nntpconnect(), and postarticles().
int nntpconnect | ( | const struct server * | upstream | ) |
Definition at line 318 of file nntputil.c.
References check_linlist(), date_count, date_is_evil, date_versions, FALSE, incopy, lastreply(), ln_log(), LNLOG_CSERVER, LNLOG_CTOP, LNLOG_SERR, LNLOG_SINFO, LNLOG_SNOTICE, LNLOG_SWARNING, mysigact(), server::name, nntpdisconnect(), nntpin, nntpout, nntpquit(), nntpreply(), server::port, stat_count, stat_is_evil, stat_versions, timeout, server::timeout, and timer().
Referenced by main().
void nntpdisconnect | ( | void | ) |
Definition at line 547 of file nntputil.c.
References nntpin, and nntpout.
Referenced by nntpconnect(), and nntpquit().
void nntpquit | ( | void | ) |
Definition at line 560 of file nntputil.c.
References lineout, nntpdisconnect(), putaline(), SIZE_lineout, and xsnprintf().
Referenced by main(), and nntpconnect().
int nntpreply | ( | const struct server * | s | ) |
Definition at line 249 of file nntputil.c.
References xnntpreply().
Referenced by check_date(), getbody_insitu(), getbody_newno(), getgroup(), isgrouponserver(), ismsgidonserver(), main(), nntpactive(), nntpconnect(), and postarticles().
void putaline | ( | void | ) |
Definition at line 75 of file nntputil.c.
References debug, last_command, lineout, and nntpout.
Referenced by check_date(), getbody_insitu(), getbody_newno(), getgroup(), isgrouponserver(), ismsgidonserver(), main(), nntpactive(), nntpquit(), postarticles(), and xnntpreply().
|
static |
decode an NNTP reply number reads a line from the server and returns an integer
498 is used to mean "protocol error", like smail, and includes timeout and "server disconnect" (EOF) conditions
the text returned is stored in lllen/llstr for later retrieval by lastreply()
from Tim Sweeney: retry in case of AUTHINFO failure.
may_auth | set this to true to enable authentication after 480 reply |
Definition at line 181 of file nntputil.c.
References authenticate(), critmalloc(), critstrdup(), debug, debugmode, last_command, lineout, lllen, llstr, ln_log(), LNLOG_CTOP, LNLOG_SERR, mgetaline(), server::name, nntpin, putaline(), verbose, and xnntpreply().
Referenced by authenticate(), nntpreply(), and xnntpreply().
|
static |
Definition at line 296 of file nntputil.c.
Referenced by nntpconnect().
int date_is_evil = 0 |
Definition at line 60 of file nntputil.c.
Referenced by main(), and nntpconnect().
|
static |
Definition at line 282 of file nntputil.c.
Referenced by nntpconnect().
char last_command[1024+1] |
Definition at line 53 of file nntputil.c.
Referenced by putaline(), and xnntpreply().
char lineout[1024+1] |
Definition at line 54 of file nntputil.c.
Referenced by check_date(), getbody_insitu(), getbody_newno(), getgroup(), isgrouponserver(), ismsgidonserver(), main(), nntpactive(), nntpquit(), postarticles(), putaline(), and xnntpreply().
|
static |
Definition at line 148 of file nntputil.c.
Referenced by xnntpreply().
|
static |
Definition at line 152 of file nntputil.c.
Referenced by freelastreply(), lastreply(), and xnntpreply().
FILE* nntpin = NULL |
Definition at line 56 of file nntputil.c.
Referenced by getbody_insitu(), getbody_newno(), getgroup(), ismsgidonserver(), nntpactive(), nntpconnect(), nntpdisconnect(), postarticles(), and xnntpreply().
FILE* nntpout = NULL |
Definition at line 57 of file nntputil.c.
Referenced by authenticate(), nntpconnect(), nntpdisconnect(), postarticles(), and putaline().
|
static |
Definition at line 280 of file nntputil.c.
Referenced by nntpconnect().
int stat_is_evil = 0 |
Definition at line 59 of file nntputil.c.
Referenced by ismsgidonserver(), main(), and nntpconnect().
|
static |
Definition at line 263 of file nntputil.c.
Referenced by nntpconnect().