leafnode
1.12.0
About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.
![]() ![]() |
#include "config.h"
#include "critmem.h"
#include <limits.h>
#include <pcre2.h>
#include <stdarg.h>
#include <stdio.h>
#include <setjmp.h>
#include "system.h"
#include <errno.h>
#include <syslog.h>
Go to the source code of this file.
Data Structures | |
struct | newsgroup |
struct | stringlist |
struct | expire_entry |
struct | server |
struct | xoverinfo |
Macros | |
#define | _DEFAULT_SOURCE |
#define | _GNU_SOURCE |
#define | _BSD_SOURCE |
#define | TRUE (1) |
#define | FALSE (0) |
#define | PLURAL(no) (((no) == 1) ? "" : "s") |
#define | PATH_MAX 4096 |
#define | PORTFILENAMECSET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-" |
#define | PCRE2_CODE_UNIT_WIDTH 0 /* let's fail unless explicitly using the _8() functions */ |
#define | snprintf ln_snprintf |
#define | vsnprintf ln_vsnprintf |
#define | LOG_NEWS LOG_DAEMON |
#define | LOG_CONS 0 /* if it isn't supported, make do without */ |
#define | SECONDS_PER_DAY ( 24L * 60 * 60 ) |
#define | BODY_DOWNLOAD_LIMIT 2048 |
#define | LOOKUP_FREE ((const char *)-2) |
#define | SIZE_lineout 1024 /* also used for PCRE2 error strings */ |
#define | SIZE_s (8192) |
#define | FQDNLEN 255 |
#define | SKIPLWS(p) while (*(p) && isspace((unsigned char) *(p))) { (p)++; } |
Typedefs | |
typedef int(* | tmihook) (const char *) |
Functions | |
char * | strdup (const char *) |
int | ln_snprintf (char *str, size_t n, const char *format,...) |
int | ln_vsnprintf (char *str, size_t n, const char *format, va_list ap) |
int | xsnprintf (char *str, size_t n, const char *format,...) |
int | initvars (char *progname) |
const char * | lookup (const char *msgid) |
char * | getaline (FILE *f) |
char * | mgetaline (FILE *f) |
void | mgetaline_settimeout (unsigned int) |
void | timer (int sig) |
int | chdirgroup (const char *group, int creatdir) |
int | isinteresting (const char *groupname) |
void | insertgroup (const char *name, long unsigned first, long unsigned last, time_t date) |
void | changegroupdesc (const char *groupname, const char *description) |
void | newgroupdesc (const char *groupname, const char *description) |
void | mergegroups (void) |
struct newsgroup * | xfindgroup (struct newsgroup *active, const char *name, unsigned long size) |
struct newsgroup * | findgroup (const char *name) |
void | readactive (void) |
int | writeactive (void) |
void | fakeactive (void) |
void | freeactive (struct newsgroup *act) |
char * | activeread (void) |
int | killactiveread (void) |
void | clearidtree (void) |
void | insertmsgid (const char *msgid) |
int | findmsgid (const char *msgid) |
int | traverseidtree (tmihook h) |
void | prependtolist (struct stringlist **list, const char *newentry) |
struct stringlist ** | lfindinlist (struct stringlist **haystack, char *needle, size_t len) |
char * | findinlist (struct stringlist *haystack, char *needle) |
void | freelist (struct stringlist *list) |
void | readfilter (char *filterfile) |
void | freefilter (void) |
int | dofilter (unsigned char *h) |
void | store (const char *filename, FILE *filehandle, const char *newsgroups, const char *msgid) |
char * | getheader (const char *filename, const char *header) |
char * | fgetheader (FILE *f, const char *header) |
int | try_lock (unsigned long) |
int | handover_lock (pid_t) |
void | putaline (void) |
void | retry (void) |
void | readexpire (void) |
int | readconfig (int logtostderr) |
void | freeexpire (void) |
void | freeservers (void) |
void | freeconfig (void) |
void | lowercase (char *string) |
int | ngmatch (const char *pattern, const char *string) |
void | overrun (void) |
void | replaceinlist (struct stringlist **haystack, char *needle, size_t len) |
time_t | lookup_expire (char *group) |
int | lookup_expiredays (char *group) |
int | log_unlink (const char *f, int ignore_enoent) |
int | authenticate (const struct server *) |
char * | lastreply (void) |
int | nntpreply (const struct server *) |
int | nntpconnect (const struct server *upstream) |
void | nntpdisconnect (void) |
void | nntpquit (void) |
void | freelastreply (void) |
const char * | rfctime (void) |
int | safe_mkstemp (char *) |
void | myopenlog (const char *ident) |
int | mkstemp (char *) |
ssize_t | getline (char **, size_t *, FILE *) |
void | freegetaline (void) |
time_t | timegm (struct tm *tm) |
int | wildmat (const char *, const char *) |
char * | getfoldedline (FILE *f, char *(*reader)(FILE *)) |
ssize_t | writes (int fd, const char *string) |
void | fixxover (void) |
struct stringlist * | get_grouplist (void) |
int | checkpeerlocal (int sock) |
int | ln_pcre_extract (const unsigned char *input, const unsigned char *pattern, char **output, size_t num) |
void | ln_pcre_extract_free (char **vec, int count) |
size_t | xstrlcpy (char *dst, const char *src, size_t size) |
int | getxover (void) |
int | legalxoverline (const char *xover, const char **errmsg) |
void | freexover (void) |
int | agetcwd (char **buf, size_t *capa) |
Variables | |
sigjmp_buf | timeout |
size_t | activesize |
struct newsgroup * | active |
size_t | oldactivesize |
struct newsgroup * | oldactive |
const char * | spooldir |
const char * | sysconfdir |
const char * | version |
const char * | lockfile |
int | date_is_evil |
int | stat_is_evil |
time_t | expire |
int | expiredays |
struct expire_entry * | expire_base |
unsigned long | artlimit |
unsigned long | initiallimit |
long | crosspostlimit |
int | delaybody |
int | db_situ |
int | debugmode |
int | create_all_links |
int | maxage |
long | maxlines |
long | minlines |
unsigned long | maxbytes |
int | timeout_short |
int | timeout_long |
int | timeout_active |
int | timeout_client |
int | timeout_fetchnews |
int | clamp_maxage |
int | article_despite_filter |
char * | filterfile |
struct server * | servers |
int | allowstrangers |
int | allow_8bit_headers |
char * | newsadmin |
unsigned long | timeout_lock |
char | last_command [1024+1] |
char | lineout [1024+1] |
FILE * | nntpin |
FILE * | nntpout |
char | fqdn [255+1] |
int | verbose |
int | debug |
struct xoverinfo * | xoverinfo |
unsigned long | xfirst |
unsigned long | xlast |
#define _BSD_SOURCE |
Definition at line 22 of file leafnode.h.
#define _DEFAULT_SOURCE |
Definition at line 15 of file leafnode.h.
#define _GNU_SOURCE |
Definition at line 19 of file leafnode.h.
#define BODY_DOWNLOAD_LIMIT 2048 |
Definition at line 97 of file leafnode.h.
#define FALSE (0) |
Definition at line 32 of file leafnode.h.
#define FQDNLEN 255 |
Definition at line 288 of file leafnode.h.
#define LOG_CONS 0 /* if it isn't supported, make do without */ |
Definition at line 91 of file leafnode.h.
#define LOG_NEWS LOG_DAEMON |
Definition at line 87 of file leafnode.h.
#define LOOKUP_FREE ((const char *)-2) |
Definition at line 104 of file leafnode.h.
#define PATH_MAX 4096 |
Definition at line 43 of file leafnode.h.
#define PCRE2_CODE_UNIT_WIDTH 0 /* let's fail unless explicitly using the _8() functions */ |
Definition at line 48 of file leafnode.h.
#define PLURAL | ( | no | ) | (((no) == 1) ? "" : "s") |
Definition at line 35 of file leafnode.h.
#define PORTFILENAMECSET "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-" |
Definition at line 46 of file leafnode.h.
#define SECONDS_PER_DAY ( 24L * 60 * 60 ) |
Definition at line 94 of file leafnode.h.
#define SIZE_lineout 1024 /* also used for PCRE2 error strings */ |
Definition at line 279 of file leafnode.h.
#define SIZE_s (8192) |
Definition at line 287 of file leafnode.h.
#define SKIPLWS | ( | p | ) | while (*(p) && isspace((unsigned char) *(p))) { (p)++; } |
Definition at line 398 of file leafnode.h.
#define snprintf ln_snprintf |
Definition at line 74 of file leafnode.h.
#define TRUE (1) |
Definition at line 29 of file leafnode.h.
#define vsnprintf ln_vsnprintf |
Definition at line 75 of file leafnode.h.
typedef int(* tmihook) (const char *) |
Definition at line 157 of file leafnode.h.
char * activeread | ( | void | ) |
Definition at line 582 of file activutil.c.
References critmalloc(), and spooldir.
Referenced by checkactive(), killactiveread(), and updateactive().
int agetcwd | ( | char ** | buf, |
size_t * | size | ||
) |
allocates a buffer (stores result into *buf and *size) and fetches the current working directory. *buf must be a malloc()d buffer or NULL on first call. returns success, *buf is free()d when FALSE is returned
Definition at line 10 of file agetcwd.c.
References critmalloc(), FALSE, PATH_MAX, and TRUE.
Referenced by dogroup(), getxover(), and killcwd().
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().
void changegroupdesc | ( | const char * | groupname, |
const char * | description | ||
) |
Definition at line 144 of file activutil.c.
References critstrdup(), newsgroup::desc, and findgroup().
Referenced by nntpactive().
int chdirgroup | ( | const char * | group, |
int | creatdir | ||
) |
Definition at line 446 of file miscutil.c.
References critmalloc(), group, makedir(), mastr_delete(), mastr_len(), mastr_modifyable_str, mastr_new(), mastr_str, mastr_vcat(), migrate(), and spooldir.
Referenced by dogroup(), dolistgroup(), doxhdr(), doxover(), fakeactive(), fixupgroup(), fixxover(), getbody_insitu(), getbody_newno(), is_pseudogroup(), main(), markinterest(), and store().
int checkpeerlocal | ( | int | sock | ) |
extract IPv4 address from IPv6-mapped IPv4 address (::ffff:10.9.8.7) check whether the peer of the socket is local to any of our network interfaces,
Definition at line 276 of file checkpeerlocal.c.
References checkpeerlocal(), critstrdup(), D, debug, main(), mastr_delete(), mastr_modifyable_str, mastr_new(), mastr_resizekill(), mastr_size(), strlcpy(), and verbose.
Referenced by checkpeerlocal(), and main().
void clearidtree | ( | void | ) |
Definition at line 729 of file miscutil.c.
References begone(), and head.
Referenced by dogroup(), and expiremsgid().
int dofilter | ( | unsigned char * | h | ) |
Definition at line 87 of file filterutil.c.
References filterlist::cleartext, debugmode, FALSE, filter, ln_log(), LNLOG_CTOP, LNLOG_SERR, filterlist::next, filterlist::re, and TRUE.
Referenced by getgroup(), and main().
void fakeactive | ( | void | ) |
Definition at line 515 of file activutil.c.
References age(), chdirgroup(), debugmode, dirent, FALSE, insertgroup(), killactiveread(), mergegroups(), SIZE_s, spooldir, and xsnprintf().
Referenced by main(), and rereadactive().
char * fgetheader | ( | FILE * | f, |
const char * | header | ||
) |
find a header in an article and return it, without its name.
Definition at line 27 of file artutil.c.
References critstrdup(), debug, debugmode, getaline(), and getfoldedline().
Referenced by doarticle(), doxhdr(), getheader(), main(), and postarticles().
struct newsgroup * findgroup | ( | const char * | name | ) |
Definition at line 260 of file activutil.c.
References active, activesize, name, and xfindgroup().
Referenced by changegroupdesc(), dogroup(), dolistgroup(), expiregroup(), fixxover(), fopenpseudoart(), insertgroup(), list(), main(), process_input(), processupstream(), rereadactive(), and store().
char * findinlist | ( | struct stringlist * | haystack, |
char * | needle | ||
) |
Definition at line 576 of file miscutil.c.
References stringlist::next, and stringlist::string.
Referenced by processupstream().
int findmsgid | ( | const char * | msgid | ) |
Definition at line 695 of file miscutil.c.
References comparemsgid(), head, msgidtree::left, msgidtree::msgid, and msgidtree::right.
Referenced by dogroup(), and expiremsgid().
void fixxover | ( | void | ) |
Definition at line 687 of file xoverutil.c.
References chdirgroup(), dirent, FALSE, findgroup(), freexover(), getxover(), ln_log(), LNLOG_CGROUP, LNLOG_SERR, SIZE_s, spooldir, and xsnprintf().
Referenced by main().
void freeactive | ( | struct newsgroup * | act | ) |
Definition at line 351 of file activutil.c.
References newsgroup::desc, and newsgroup::name.
Referenced by main(), and readactive().
void freeconfig | ( | void | ) |
Definition at line 722 of file configutil.c.
References filterfile, freeexpire(), freefilter(), freegetaline(), freelastreply(), freeservers(), lookup(), LOOKUP_FREE, and newsadmin.
Referenced by main().
void freeexpire | ( | void | ) |
Definition at line 708 of file configutil.c.
References expire_base, expire_entry::group, and expire_entry::next.
Referenced by freeconfig().
void freefilter | ( | void | ) |
Definition at line 113 of file filterutil.c.
References filterlist::cleartext, filter, filterlist::next, and filterlist::re.
Referenced by freeconfig().
void freegetaline | ( | void | ) |
Definition at line 89 of file getaline.c.
References ygetaline().
Referenced by freeconfig(), and main().
void freelastreply | ( | void | ) |
void freelist | ( | struct stringlist * | list | ) |
Definition at line 626 of file miscutil.c.
References list().
Referenced by addnonexpiring(), expiregroup(), get_grouplist(), nntpactive(), and processupstream().
void freeservers | ( | void | ) |
Definition at line 695 of file configutil.c.
References freeserver(), server::next, and servers.
Referenced by freeconfig(), and main().
void freexover | ( | void | ) |
Definition at line 396 of file xoverutil.c.
References xoverinfo::text, xfirst, and xlast.
Referenced by dogroup(), fixxover(), getxover(), and main().
struct stringlist * get_grouplist | ( | void | ) |
Definition at line 113 of file grouplist.c.
References freelist(), myscandir(), and spooldir.
Referenced by addnonexpiring(), and expiregroup().
char * getaline | ( | FILE * | f | ) |
Definition at line 84 of file getaline.c.
References ygetaline().
Referenced by doarticle(), dopost(), fgetheader(), getbody_newno(), getmarked(), getxoverline(), main(), markdownload(), mgetaline(), postarticles(), process_input(), processupstream(), readconfig(), and readfilter().
char * getfoldedline | ( | FILE * | f, |
char *(*)(FILE *) | reader | ||
) |
Definition at line 13 of file getfoldedline.c.
References critmalloc(), critrealloc(), and len.
Referenced by fgetheader(), and getgroup().
char * getheader | ( | const char * | filename, |
const char * | header | ||
) |
Definition at line 62 of file artutil.c.
References fgetheader().
Referenced by domove(), doxhdr(), and getbody_insitu().
ssize_t getline | ( | char ** | pto, |
size_t * | size, | ||
FILE * | stream | ||
) |
Clean-room reimplementation of getline, API compatible with glibc2.
Definition at line 54 of file getline.c.
References _getline(), critmalloc(), and critrealloc().
Referenced by ygetaline().
int getxover | ( | void | ) |
Definition at line 415 of file xoverutil.c.
References agetcwd(), critmalloc(), critstrdup(), debugmode, dirent, xoverinfo::exists, freexover(), getxoverline(), killcwd(), legalxoverline(), ln_log(), LNLOG_CARTICLE, LNLOG_CGROUP, LNLOG_CTOP, LNLOG_SERR, LNLOG_SINFO, LNLOG_SNOTICE, LNLOG_SWARNING, log_unlink(), mkstemp(), PLURAL, xoverinfo::text, verbose, writes(), xfirst, and xlast.
Referenced by dogroup(), dolistgroup(), doxhdr(), doxover(), fixxover(), and main().
int handover_lock | ( | pid_t | pid | ) |
Tries to hand over lock to the process with the given pid.
Definition at line 327 of file lockfile.c.
References critmalloc(), fqdn, lockfile, and writes().
Referenced by main().
int initvars | ( | char * | progname | ) |
Definition at line 143 of file miscutil.c.
References active, createmsgiddir(), debugmode, default_umask, dirs, dirs_count, expire_base, FALSE, mode, name, PORTFILENAMECSET, servers, SIZE_s, spooldir, suicide(), TRUE, whoami(), xfirst, xlast, and xsnprintf().
Referenced by main().
void insertgroup | ( | const char * | name, |
long unsigned | first, | ||
long unsigned | last, | ||
time_t | date | ||
) |
Definition at line 77 of file activutil.c.
References age(), newsgroup::age, critmalloc(), critstrdup(), newsgroup::desc, nglist::entry, findgroup(), newsgroup::first, newsgroup::last, ln_log(), LNLOG_CTOP, LNLOG_SWARNING, newsgroup::name, name, newgroup, nglist::next, oldactive, oldactivesize, and xfindgroup().
Referenced by addnonexpiring(), fakeactive(), main(), nntpactive(), and process_input().
void insertmsgid | ( | const char * | msgid | ) |
Definition at line 662 of file miscutil.c.
References comparemsgid(), critmalloc(), head, and msgidtree::msgid.
Referenced by dogroup(), and readmids().
int isinteresting | ( | const char * | groupname | ) |
Definition at line 271 of file miscutil.c.
References dirent, FALSE, SIZE_s, spooldir, TRUE, and xsnprintf().
Referenced by doarticle(), dogroup(), list(), and store().
int killactiveread | ( | void | ) |
Definition at line 595 of file activutil.c.
References activeread(), ln_log(), LNLOG_CTOP, LNLOG_SERR, and rc.
Referenced by fakeactive(), and main().
char * lastreply | ( | void | ) |
Definition at line 162 of file nntputil.c.
References llstr.
Referenced by check_date(), getgroup(), ismsgidonserver(), nntpactive(), nntpconnect(), and postarticles().
int legalxoverline | ( | const char * | xover, |
const char ** | errmsg | ||
) |
Definition at line 206 of file xoverutil.c.
Referenced by dogroup(), getxover(), and getxoverline().
struct stringlist ** lfindinlist | ( | struct stringlist ** | haystack, |
char * | needle, | ||
size_t | len | ||
) |
Definition at line 594 of file miscutil.c.
References len, stringlist::next, and stringlist::string.
Referenced by replaceinlist().
int ln_pcre_extract | ( | const unsigned char * | input, |
const unsigned char * | pattern, | ||
char ** | output, | ||
size_t | num | ||
) |
Definition at line 55 of file pcre_extract.c.
References critmalloc(), len, ln_log(), LNLOG_CTOP, LNLOG_SERR, and SIZE_lineout.
Referenced by dopost().
void ln_pcre_extract_free | ( | char ** | vec, |
int | count | ||
) |
Definition at line 108 of file pcre_extract.c.
Referenced by dopost().
int ln_snprintf | ( | char * | str, |
size_t | n, | ||
const char * | format, | ||
... | |||
) |
Definition at line 221 of file snprintf.c.
References ln_vsnprintf().
int ln_vsnprintf | ( | char * | str, |
size_t | n, | ||
const char * | format, | ||
va_list | ap | ||
) |
Definition at line 71 of file snprintf.c.
References fmts(), fmtu(), and len.
Referenced by ln_snprintf().
int log_unlink | ( | const char * | f, |
int | ignore_enoent | ||
) |
Definition at line 13 of file log_unlink.c.
References debugmode, ln_log(), LNLOG_CTOP, LNLOG_SDEBUG, and LNLOG_SERR.
Referenced by cleanmids(), doarticle(), expiremsgid(), getbody_newno(), getxover(), and readmids().
const char * lookup | ( | const char * | msgid | ) |
construct file name for message.id/NNN/ in spooldir from message ID
msgid | if LOOKUP_FREE, release static resources |
Definition at line 306 of file miscutil.c.
References critmalloc(), LOOKUP_FREE, name, and spooldir.
Referenced by dogroup(), expiremsgid(), fopenart(), freeconfig(), getbody_insitu(), getbody_newno(), getgroup(), is_articlepresent(), main(), and th().
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().
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().
void lowercase | ( | char * | string | ) |
void mergegroups | ( | void | ) |
Definition at line 162 of file activutil.c.
References active, activesize, compactive(), critrealloc(), nglist::entry, newsgroup::name, newgroup, newsgroup_copy(), nglist::next, and validateactive().
Referenced by fakeactive(), main(), nntpactive(), and process_input().
char * mgetaline | ( | FILE * | f | ) |
Definition at line 51 of file mgetaline.c.
References debug, getaline(), mysigact(), timeout, timeout_secs, and timer().
Referenced by getbody_insitu(), getbody_newno(), getgroup(), ignore_answer(), nntpactive(), parser(), postarticles(), and xnntpreply().
void mgetaline_settimeout | ( | unsigned int | t | ) |
Definition at line 69 of file mgetaline.c.
References timeout_secs.
int mkstemp | ( | char * | template | ) |
Definition at line 27 of file mkstemp.c.
References ATTEMPTS.
Referenced by getxover(), and safe_mkstemp().
void myopenlog | ( | const char * | ident | ) |
void newgroupdesc | ( | const char * | groupname, |
const char * | description | ||
) |
Definition at line 124 of file activutil.c.
References critstrdup(), newsgroup::desc, nglist::entry, newsgroup::name, newgroup, and nglist::next.
Referenced by process_input().
int ngmatch | ( | const char * | pattern, |
const char * | string | ||
) |
Definition at line 792 of file miscutil.c.
References wildmat().
Referenced by list(), and lookup_expireent().
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 overrun | ( | void | ) |
Definition at line 296 of file miscutil.c.
Referenced by xsnprintf(), and xstrlcpy().
void prependtolist | ( | struct stringlist ** | list, |
const char * | newentry | ||
) |
Definition at line 558 of file miscutil.c.
References critmalloc(), list(), stringlist::next, and stringlist::string.
Referenced by myscandir(), nntpactive(), and replaceinlist().
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().
void readactive | ( | void | ) |
Definition at line 373 of file activutil.c.
References active, activesize, newsgroup::age, compactive(), critmalloc(), critstrdup(), newsgroup::desc, newsgroup::first, freeactive(), newsgroup::last, newsgroup::name, SIZE_s, spooldir, validateactive(), and xsnprintf().
Referenced by main(), and rereadactive().
int readconfig | ( | int | logtostderr | ) |
Definition at line 208 of file configutil.c.
References allow_8bit_headers, allowstrangers, article_despite_filter, artlimit, clamp_maxage, COREFILESIZE, create_all_links, critmalloc(), critstrdup(), crosspostlimit, expire_entry::days, db_situ, debug, debugmode, delaybody, server::descriptions, expire, expire_base, expiredays, filterfile, fqdn, getaline(), expire_entry::group, server::group_pcre, gs_compile(), initiallimit, linebuffer, ln_log(), LNLOG_CTOP, LNLOG_SERR, LNLOG_SWARNING, maxage, maxbytes, maxlines, minlines, server::name, newsadmin, expire_entry::next, server::next, server::nopost, server::noread, server::noxover, server::only_groups_match_all, parse_line(), server::password, PLURAL, server::port, server::post_anygroup, read_timeout_lock(), SECONDS_PER_DAY, servers, SIZE_s, sysconfdir, server::timeout, timeout_active, timeout_client, timeout_fetchnews, timeout_long, timeout_short, TOKENSIZE, TRUE, server::updateactive, server::username, validatefqdn(), verbose, xsnprintf(), xstrlcpy(), and expire_entry::xtime.
Referenced by main().
void readexpire | ( | void | ) |
void readfilter | ( | char * | filterfile | ) |
Definition at line 33 of file filterutil.c.
References filterlist::cleartext, critmalloc(), critstrdup(), debug, debugmode, filter, getaline(), len, filterlist::next, filterlist::re, and SIZE_lineout.
Referenced by main().
void replaceinlist | ( | struct stringlist ** | haystack, |
char * | needle, | ||
size_t | len | ||
) |
Definition at line 607 of file miscutil.c.
References critmalloc(), len, lfindinlist(), stringlist::next, and prependtolist().
Referenced by processupstream().
void retry | ( | void | ) |
const char * rfctime | ( | void | ) |
Definition at line 752 of file miscutil.c.
References now, and xsnprintf().
Referenced by buildpseudoart(), dopost(), doxhdr(), doxover(), and main().
int safe_mkstemp | ( | char * | templ | ) |
Safe mkstemp replacement.
Ensures the file is only read- and writable by its owner; some systems create these with 0777 or 0666 permissions.
templ | template to build filename upon, as for mkstemp |
Definition at line 163 of file lockfile.c.
References mkstemp().
Referenced by buildpseudoart(), and try_lock().
void store | ( | const char * | filename, |
FILE * | filehandle, | ||
const char * | newsgroups, | ||
const char * | msgid | ||
) |
Definition at line 84 of file artutil.c.
References active, chdirgroup(), create_all_links, critstrdup(), FALSE, findgroup(), newsgroup::first, fqdn, isinteresting(), newsgroup::last, ln_log(), LNLOG_CTOP, LNLOG_SERR, mastr_delete(), mastr_new(), mastr_str, mastr_vcat(), newsgroup::name, SKIPLWS, TRUE, and verbose.
Referenced by getbody_newno(), and getgroup().
char * strdup | ( | const char * | s | ) |
Definition at line 5 of file strdup.c.
Referenced by is_validfqdn().
time_t timegm | ( | struct tm * | tm | ) |
Definition at line 50 of file timegm.c.
References is_leap().
Referenced by check_date(), and donewgroups().
void timer | ( | int | sig | ) |
Definition at line 41 of file mgetaline.c.
References timeout.
Referenced by mgetaline(), and nntpconnect().
int traverseidtree | ( | tmihook | h | ) |
Definition at line 747 of file miscutil.c.
References head, and xtraverseidtree().
Referenced by dogroup().
int try_lock | ( | unsigned long | timeout | ) |
Try to set a lockfile, blocking or non-blocking. Checks if the lockfile exists and is active.
requires: atomic link(2) syscall.
features:
timeout | Timeout, if nonzero, wait at most this many seconds. |
Definition at line 200 of file lockfile.c.
References critmalloc(), debugmode, fd_st_nlink(), fqdn, is_validfqdn(), ln_log(), LNLOG_CTOP, LNLOG_SCRIT, LNLOG_SERR, lock_is_stale(), lockfile, quiet, safe_mkstemp(), timeout, verbose, and writes().
Referenced by main().
int wildmat | ( | const char * | text, |
const char * | p | ||
) |
int writeactive | ( | void | ) |
Definition at line 269 of file activutil.c.
References active, newsgroup::age, compactive(), newsgroup::desc, newsgroup::first, newsgroup::last, ln_log(), LNLOG_CTOP, LNLOG_SERR, mastr_delete(), mastr_new(), mastr_str, mastr_vcat(), newsgroup::name, PATH_MAX, PLURAL, spooldir, validateactive(), and verbose.
Referenced by main().
ssize_t writes | ( | int | fd, |
const char * | string | ||
) |
Definition at line 7 of file writes.c.
Referenced by getxover(), handover_lock(), main(), and try_lock().
Definition at line 242 of file activutil.c.
References helpfindgroup(), and name.
Referenced by findgroup(), and insertgroup().
int xsnprintf | ( | char * | str, |
size_t | n, | ||
const char * | format, | ||
... | |||
) |
Definition at line 798 of file miscutil.c.
References overrun(), and vsnprintf.
Referenced by doarticle(), dopost(), expire_interesting(), expiremsgid(), fakeactive(), fixxover(), formatserver(), getbody_insitu(), getbody_newno(), getgroup(), initvars(), isgrouponserver(), isinteresting(), ismsgidonserver(), main(), markdownload(), markinterest(), movetofailed(), nntpactive(), nntpquit(), postarticles(), processupstream(), readactive(), readconfig(), rereadactive(), and rfctime().
size_t xstrlcpy | ( | char * | dst, |
const char * | src, | ||
size_t | size | ||
) |
Definition at line 812 of file miscutil.c.
References overrun(), and strlcpy().
Referenced by main(), readconfig(), and whoami().
|
extern |
Definition at line 40 of file activutil.c.
Referenced by dolist(), donewgroups(), findgroup(), initvars(), main(), mergegroups(), nntpactive(), readactive(), rereadactive(), store(), validateactive(), and writeactive().
|
extern |
Definition at line 39 of file activutil.c.
Referenced by findgroup(), main(), mergegroups(), readactive(), rereadactive(), and validateactive().
|
extern |
Definition at line 90 of file configutil.c.
Referenced by dopost(), and readconfig().
|
extern |
Definition at line 87 of file configutil.c.
Referenced by main(), and readconfig().
|
extern |
Definition at line 69 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 61 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 81 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 64 of file configutil.c.
Referenced by readconfig(), and store().
|
extern |
Definition at line 63 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 60 of file nntputil.c.
Referenced by main(), and nntpconnect().
|
extern |
Definition at line 66 of file configutil.c.
Referenced by getbody(), and readconfig().
|
extern |
Definition at line 30 of file applyfilter.c.
Referenced by checkpeerlocal(), dopost(), fgetheader(), getbody_insitu(), getbody_newno(), getgroup(), getxoverline(), isgrouponserver(), mgetaline(), nntpactive(), parser(), postarticles(), processupstream(), putaline(), readconfig(), readfilter(), xnntpreply(), and ygetaline().
|
extern |
Definition at line 67 of file configutil.c.
Referenced by authenticate(), check_date(), checkactive(), doarticle(), dofilter(), dogroup(), dolist(), dolistgroup(), domove(), donewgroups(), dopost(), doxhdr(), doxover(), expiremsgid(), fakeactive(), fgetheader(), getbody_insitu(), getbody_newno(), getgroup(), getxover(), getxoverline(), initvars(), invalidrange(), log_unlink(), main(), markdownload(), markinterest(), nntpactive(), nogroup(), parser(), postarticles(), processupstream(), read_timeout_lock(), readconfig(), readfilter(), rereadactive(), try_lock(), vln_log_core(), and xnntpreply().
|
extern |
Definition at line 65 of file configutil.c.
Referenced by getgroup(), getmarked(), and readconfig().
|
extern |
Definition at line 58 of file configutil.c.
Referenced by addnonexpiring(), main(), and readconfig().
|
extern |
Definition at line 60 of file configutil.c.
Referenced by freeexpire(), initvars(), lookup_expireent(), main(), and readconfig().
|
extern |
Definition at line 59 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 88 of file configutil.c.
Referenced by freeconfig(), getgroup(), main(), and readconfig().
|
extern |
Definition at line 58 of file miscutil.c.
Referenced by buildpseudoart(), dopost(), doxhdr(), doxover(), fopenpseudoart(), generateMessageID(), getbody_newno(), handover_lock(), is_validfqdn(), lock_is_stale(), main(), readconfig(), store(), try_lock(), validatefqdn(), and whoami().
|
extern |
Definition at line 62 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 53 of file nntputil.c.
Referenced by putaline(), and xnntpreply().
|
extern |
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().
|
extern |
Referenced by handover_lock(), main(), and try_lock().
|
extern |
Definition at line 68 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 72 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 70 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 71 of file configutil.c.
Referenced by getgroup(), and readconfig().
|
extern |
Definition at line 91 of file configutil.c.
Referenced by buildpseudoart(), doxhdr(), doxover(), freeconfig(), printlist(), and readconfig().
|
extern |
Definition at line 56 of file nntputil.c.
Referenced by getbody_insitu(), getbody_newno(), getgroup(), ismsgidonserver(), nntpactive(), nntpconnect(), nntpdisconnect(), postarticles(), and xnntpreply().
|
extern |
Definition at line 57 of file nntputil.c.
Referenced by authenticate(), nntpconnect(), nntpdisconnect(), postarticles(), and putaline().
|
extern |
Definition at line 42 of file activutil.c.
Referenced by insertgroup(), and main().
|
extern |
Definition at line 41 of file activutil.c.
Referenced by insertgroup(), and main().
|
extern |
Definition at line 89 of file configutil.c.
Referenced by freeservers(), initvars(), main(), and readconfig().
|
extern |
Referenced by activeread(), buildpseudoart(), chdirgroup(), cleanmids(), createmsgiddir(), dopost(), expire_interesting(), expiremsgid(), fakeactive(), fixxover(), formatserver(), get_grouplist(), getmarked(), initvars(), isinteresting(), killcwd(), lookup(), main(), markdownload(), markinterest(), migrate(), movetofailed(), postarticles(), processupstream(), readactive(), rereadactive(), and writeactive().
|
extern |
Definition at line 59 of file nntputil.c.
Referenced by ismsgidonserver(), main(), and nntpconnect().
|
extern |
Referenced by main(), and readconfig().
|
extern |
Definition at line 39 of file mgetaline.c.
Referenced by mgetaline(), nntpconnect(), timer(), and try_lock().
|
extern |
Definition at line 78 of file configutil.c.
Referenced by checkactive(), and readconfig().
|
extern |
Definition at line 79 of file configutil.c.
Referenced by parser(), and readconfig().
|
extern |
Definition at line 80 of file configutil.c.
Referenced by main(), and readconfig().
|
extern |
Definition at line 92 of file configutil.c.
Referenced by main(), and read_timeout_lock().
|
extern |
Definition at line 76 of file configutil.c.
Referenced by expire_interesting(), markinterest(), and readconfig().
|
extern |
Definition at line 77 of file configutil.c.
Referenced by expire_interesting(), markinterest(), and readconfig().
|
extern |
Definition at line 31 of file applyfilter.c.
|
extern |
Definition at line 64 of file miscutil.c.
Referenced by dolistgroup(), doxhdr(), doxover(), freexover(), getxover(), and initvars().
|
extern |
Definition at line 64 of file miscutil.c.
Referenced by dolistgroup(), doxhdr(), doxover(), freexover(), getxover(), and initvars().
Definition at line 63 of file miscutil.c.