leafnode  1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
  Fossies Dox: leafnode-1.12.0.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

configutil.c File Reference
#include "leafnode.h"
#include "validatefqdn.h"
#include "ln_log.h"
#include "strlcpy.h"
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include "groupselect.h"
Include dependency graph for configutil.c:

Go to the source code of this file.

Macros

#define COREFILESIZE   1024*1024*64
 
#define TOKENSIZE   4096
 
#define min(a, b)   ((a < b) ? (a) : (b))
 

Functions

static int parse_line (char *l, char *param, char *value)
 
static int read_timeout_lock (const char *value, const char *source)
 
int readconfig (int logtostderr)
 
static struct expire_entrylookup_expireent (char *group)
 
static void freeserver (struct server *a)
 
void freeservers (void)
 
void freeexpire (void)
 
void freeconfig (void)
 
time_t lookup_expire (char *group)
 
int lookup_expiredays (char *group)
 

Variables

time_t expire = 0
 
int expiredays = 0
 
struct expire_entryexpire_base
 
unsigned long artlimit = 0
 
unsigned long initiallimit = 0
 
long crosspostlimit = 0
 
int create_all_links = 0
 
int delaybody = 0
 
int db_situ = 0
 
int debugmode = 0
 
int maxage = 10
 
int article_despite_filter = 0
 
long maxlines = 0
 
long minlines = 0
 
unsigned long maxbytes = 0
 
static int linebuffer = 0
 
int timeout_long = 7
 
int timeout_short = 2
 
int timeout_active = 90
 
int timeout_client = 15*60
 
int timeout_fetchnews = 5*60
 
int clamp_maxage = 1
 
int allowstrangers = 0
 
char * filterfile
 
struct serverservers = NULL
 
int allow_8bit_headers = 0
 
char * newsadmin
 
unsigned long timeout_lock = 5UL
 

Macro Definition Documentation

◆ COREFILESIZE

#define COREFILESIZE   1024*1024*64

Definition at line 46 of file configutil.c.

◆ min

#define min (   a,
 
)    ((a < b) ? (a) : (b))

Definition at line 52 of file configutil.c.

◆ TOKENSIZE

#define TOKENSIZE   4096

Definition at line 47 of file configutil.c.

Function Documentation

◆ freeconfig()

void freeconfig ( void  )

◆ freeexpire()

void freeexpire ( void  )

Definition at line 708 of file configutil.c.

References expire_base, expire_entry::group, and expire_entry::next.

Referenced by freeconfig().

◆ freeserver()

static void freeserver ( struct server a)
static

Definition at line 686 of file configutil.c.

References server::group_pcre, server::name, server::password, and server::username.

Referenced by freeservers().

◆ freeservers()

void freeservers ( void  )

Definition at line 695 of file configutil.c.

References freeserver(), server::next, and servers.

Referenced by freeconfig(), and main().

◆ lookup_expire()

time_t lookup_expire ( char *  group)

Definition at line 735 of file configutil.c.

References group, lookup_expireent(), and expire_entry::xtime.

Referenced by addnonexpiring(), and expiregroup().

◆ lookup_expiredays()

int lookup_expiredays ( char *  group)

Definition at line 743 of file configutil.c.

References expire_entry::days, group, and lookup_expireent().

Referenced by addnonexpiring(), expiregroup(), and getgroup().

◆ lookup_expireent()

static struct expire_entry * lookup_expireent ( char *  group)
static

Definition at line 672 of file configutil.c.

References expire_base, expire_entry::group, group, expire_entry::next, and ngmatch().

Referenced by lookup_expire(), and lookup_expiredays().

◆ parse_line()

static int parse_line ( char *  l,
char *  param,
char *  value 
)
static

parse the line in l, breaking it into param and value at the "=" delimiter. The right-hand side can be quoted with double quotes, inside these a backslash escapes a quote that is part of the string.

Returns
success
Parameters
linput, will be modified
paramoutput, left-hand side
valueoutput, right-hand side

Definition at line 106 of file configutil.c.

References len, min, mode, SKIPLWS, and TOKENSIZE.

Referenced by readconfig().

◆ read_timeout_lock()

static int read_timeout_lock ( const char *  value,
const char *  source 
)
static

Definition at line 177 of file configutil.c.

References debugmode, ln_log(), LNLOG_CTOP, LNLOG_SERR, PLURAL, and timeout_lock.

Referenced by readconfig().

◆ readconfig()

Variable Documentation

◆ allow_8bit_headers

int allow_8bit_headers = 0

Definition at line 90 of file configutil.c.

Referenced by dopost(), and readconfig().

◆ allowstrangers

int allowstrangers = 0

Definition at line 87 of file configutil.c.

Referenced by main(), and readconfig().

◆ article_despite_filter

int article_despite_filter = 0

Definition at line 69 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ artlimit

unsigned long artlimit = 0

Definition at line 61 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ clamp_maxage

int clamp_maxage = 1

Definition at line 81 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ create_all_links

int create_all_links = 0

Definition at line 64 of file configutil.c.

Referenced by readconfig(), and store().

◆ crosspostlimit

long crosspostlimit = 0

Definition at line 63 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ db_situ

int db_situ = 0

Definition at line 66 of file configutil.c.

Referenced by getbody(), and readconfig().

◆ debugmode

◆ delaybody

int delaybody = 0

Definition at line 65 of file configutil.c.

Referenced by getgroup(), getmarked(), and readconfig().

◆ expire

time_t expire = 0

Definition at line 58 of file configutil.c.

Referenced by addnonexpiring(), main(), and readconfig().

◆ expire_base

struct expire_entry* expire_base

Definition at line 60 of file configutil.c.

Referenced by freeexpire(), initvars(), lookup_expireent(), main(), and readconfig().

◆ expiredays

int expiredays = 0

Definition at line 59 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ filterfile

char* filterfile

Definition at line 88 of file configutil.c.

Referenced by freeconfig(), getgroup(), main(), and readconfig().

◆ initiallimit

unsigned long initiallimit = 0

Definition at line 62 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ linebuffer

int linebuffer = 0
static

Definition at line 73 of file configutil.c.

Referenced by readconfig().

◆ maxage

int maxage = 10

Definition at line 68 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ maxbytes

unsigned long maxbytes = 0

Definition at line 72 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ maxlines

long maxlines = 0

Definition at line 70 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ minlines

long minlines = 0

Definition at line 71 of file configutil.c.

Referenced by getgroup(), and readconfig().

◆ newsadmin

char* newsadmin

Definition at line 91 of file configutil.c.

Referenced by buildpseudoart(), doxhdr(), doxover(), freeconfig(), printlist(), and readconfig().

◆ servers

struct server* servers = NULL

Definition at line 89 of file configutil.c.

Referenced by freeservers(), initvars(), main(), and readconfig().

◆ timeout_active

int timeout_active = 90

Definition at line 78 of file configutil.c.

Referenced by checkactive(), and readconfig().

◆ timeout_client

int timeout_client = 15*60

Definition at line 79 of file configutil.c.

Referenced by parser(), and readconfig().

◆ timeout_fetchnews

int timeout_fetchnews = 5*60

Definition at line 80 of file configutil.c.

Referenced by main(), and readconfig().

◆ timeout_lock

unsigned long timeout_lock = 5UL

Definition at line 92 of file configutil.c.

Referenced by main(), and read_timeout_lock().

◆ timeout_long

int timeout_long = 7

Definition at line 76 of file configutil.c.

Referenced by expire_interesting(), markinterest(), and readconfig().

◆ timeout_short

int timeout_short = 2

Definition at line 77 of file configutil.c.

Referenced by expire_interesting(), markinterest(), and readconfig().