head 1.25; access; symbols LMTP2NNTP_1_2a6:1.24 LMTP2NNTP_1_2a5:1.24 LMTP2NNTP_1_2a4:1.22 LMTP2NNTP_1_2a3:1.20; locks; strict; comment @ * @; 1.25 date 2003.01.30.19.27.29; author rse; state dead; branches; next 1.24; 1.24 date 2002.05.28.12.43.14; author thl; state Exp; branches; next 1.23; 1.23 date 2002.05.27.15.09.50; author thl; state Exp; branches; next 1.22; 1.22 date 2002.03.13.14.41.13; author thl; state Exp; branches; next 1.21; 1.21 date 2002.03.13.13.58.39; author thl; state Exp; branches; next 1.20; 1.20 date 2002.03.04.15.54.28; author thl; state Exp; branches; next 1.19; 1.19 date 2002.02.28.12.57.55; author thl; state Exp; branches; next 1.18; 1.18 date 2002.02.27.09.34.41; author thl; state Exp; branches; next 1.17; 1.17 date 2002.02.20.15.42.26; author thl; state Exp; branches; next 1.16; 1.16 date 2002.02.19.13.00.14; author thl; state Exp; branches; next 1.15; 1.15 date 2002.02.14.11.03.52; author thl; state Exp; branches; next 1.14; 1.14 date 2002.02.13.16.25.38; author thl; state Exp; branches; next 1.13; 1.13 date 2002.02.07.08.59.44; author thl; state Exp; branches; next 1.12; 1.12 date 2002.02.05.10.42.39; author thl; state Exp; branches; next 1.11; 1.11 date 2002.02.05.10.40.51; author thl; state Exp; branches; next 1.10; 1.10 date 2002.02.04.15.43.01; author thl; state Exp; branches; next 1.9; 1.9 date 2002.02.04.13.52.14; author thl; state Exp; branches; next 1.8; 1.8 date 2002.01.31.15.03.23; author thl; state Exp; branches; next 1.7; 1.7 date 2002.01.31.13.54.21; author thl; state Exp; branches; next 1.6; 1.6 date 2002.01.31.13.44.05; author thl; state Exp; branches; next 1.5; 1.5 date 2002.01.31.10.40.07; author thl; state Exp; branches; next 1.4; 1.4 date 2002.01.31.10.14.54; author thl; state Exp; branches; next 1.3; 1.3 date 2002.01.31.09.03.58; author thl; state Exp; branches; next 1.2; 1.2 date 2002.01.30.16.41.02; author thl; state Exp; branches; next 1.1; 1.1 date 2002.01.24.12.07.13; author thl; state Exp; branches; next ; desc @@ 1.25 log @Implement the decision from yesterday evening and finally rename fixme.h to lmtp2nntp_common.h because there is little chance this this stuff ever can be moved into more local source contexts. @ text @ /*FIXME this structure should not be global! This is a temporary fix to allow * code migration from lmtp2nntp_main.c's getopt switch to lmtp2nntp_config.[ch] */ #ifndef __FIXME_H__ #define __FIXME_H__ #include #include #include struct acl { char *acl; int not; size_t prefixlen; sa_addr_t *saa; }; struct nntp_st; typedef struct nntp_st nntp_t; #include "lmtp2nntp_nntp.h" struct ns { sa_addr_t *saa; sa_t *sa; nntp_t *nntp; nntp_rc_t rc; l2_channel_t *l2; }; struct session { int lhlo_seen; char *lhlo_domain; }; #include struct headerrule_st; typedef struct headerrule_st headerrule_t; #include struct headerrule_st { headerrule_t *next; int pri; char *regex; char *name; char *val; pcre *pcreRegex; pcre_extra *pcreExtra; }; headerrule_t *FIXME1; struct headerdata_st; typedef struct headerdata_st headerdata_t; struct headerdata_st { headerdata_t *prev; headerdata_t *next; char *name; int ndata; /* =0 means data is invalid, =1 means use data.s, >1 means use data.m */ union { char *s; char **m; } data; }; headerdata_t *FIXME2; typedef struct { l2_context_t ctx; val_t *prival; val_t *val; char *progname; int option_groupmode; int option_operationmode; char *option_operationmodefakestatus; char *option_operationmodefakedsn; int option_maxmessagesize; headerrule_t *option_firstheaderrule; int option_timeout_lmtp_accept; int option_timeout_lmtp_read; int option_timeout_lmtp_write; int option_timeout_nntp_connect; int option_timeout_nntp_read; int option_timeout_nntp_write; char *option_nodename; char *option_mailfrom; char *option_restrictheader; char *option_pidfile; int option_killflag; uid_t option_uid; int option_daemon; int nacl; /* number of acl structures found at pacl */ struct acl *pacl; /* pointer to an array of acl structures */ int option_childsmax; int active_childs; l2_env_t *l2_env; l2_channel_t *l2; sa_addr_t *saaServerbind; sa_t *saServerbind; sa_addr_t *saaClientbind; sa_t *saClientbind; sa_addr_t *saaIO; sa_t *saIO; int fdIOi; int fdIOo; int nns; /* number of ns structures found at pns */ struct ns *pns; /* pointer to an array of ns structures */ char *azGroupargs; size_t asGroupargs; struct session session; msg_t *msg; var_t *config_varregex; var_t *config_varctx; int msgcount; /* number of messages processed, used for creating unique ids */ } lmtp2nntp_t; #define ERR_EXECUTION 1 #define ERR_DELIVERY -2 enum { GROUPMODE_UNDEF = 0, GROUPMODE_ARG, GROUPMODE_ENVELOPE, GROUPMODE_HEADER }; enum { OPERATIONMODE_UNDEF = 0, OPERATIONMODE_FAKE, OPERATIONMODE_POST, OPERATIONMODE_FEED }; void msg_headermatrixbuildup(msg_t *msg); void msg_headermatrixteardwn(msg_t *msg); void headerrewrite(lmtp2nntp_t *ctx); #include "l2.h" extern l2_handler_t l2_handler_var; extern void logbook(l2_channel_t *, l2_level_t, const char *, ...); #endif /* __FIXME_H__ */ @ 1.24 log @rename @ text @@ 1.23 log @createmessageid now using lib_val; added support for long nodenames @ text @d40 1 a40 1 char *header; @ 1.22 log @move from log macro to logbook function @ text @d63 1 d78 1 a104 1 struct utsname uname; d107 1 @ 1.21 log @implemented var_expand inside l2 @ text @d131 1 @ 1.20 log @Integration done replacing headervalue with new headerrule stuff. This version is v1.2a3 and runs live on visp.engelschall.com @ text @d129 2 @ 1.19 log @integrated new lib_var API; lib_var patch fixed expansion problem @ text @a69 1 a70 5 /* FIXME obsolete */ char *azHeaderValuePairs; size_t asHeaderValuePairs; d124 4 @ 1.18 log @changed semantic of --headerrule to "keep the colon" @ text @d9 1 d110 2 @ 1.17 log @flush work done this week. New structure for headers. Basic loop of desired new header rewriting feature currently supports replacing a header, adding a header and regex matching finds the correct header and calls lib_var. Try ./lmtp2nntp -i 1.conf -h ':Reply-To:New-Reply:${xyz}' -h ::To:bv -h 21::ch:cv @ text @a36 1 char *carve; /* pri, regex, header, val carved out here, so free up only this */ @ 1.16 log @this is dynamic now @ text @d34 1 d42 2 d45 15 @ 1.15 log @Please review! Attempt to use lib_ex for proper cleanup. I discovered some tweaks and quirks regarding the volatile nature of the hrNew structure temporary allocating resources. Two wrappers, strdupex() and mallocex() are used to throw exceptions. It was a pain, or at least a different kind of programming, to always ensure that hrNew resoures are cleaned up completely when they should and to stop the cleanup code from releasing resources in the non-exceptional case. Although, the declaration of a volatile structure requires casting where i do not want to use it. Maybe i did something wrong, and life becomes easier in this particular case when i put the exeptional cleanup code in the catch construct, because in this try-cleanup-catch block i only want cleanup in the exeptional case. However, this would only remove the "hrNew = NULL" line at the buttom of the for() loop. Would this help, should it work? Unsure ... @ text @a15 1 #define MAXNEWSSERVICES 16 @ 1.14 log @new -h option and config @ text @d37 1 @ 1.13 log @throw out a bunch of obsolete stuff @ text @d32 11 d52 3 d57 2 @ 1.12 log @removed obsolete --veryverbose @ text @a8 1 /*FIXME obsolete #define MAXACLS 32 */ d13 1 a14 1 size_t prefixlen; d21 2 a22 4 /*FIXME obsolete char *h; * host */ /*FIXME obsolete char *p; * port */ sa_addr_t *saa; /* socket address abstraction */ sa_t *sa; /* socket abstraction */ a35 1 /*FIXME obsolete char *option_logfile; */ a50 1 /*FIXME obsolete unsigned int option_levelmask; */ a54 5 /* int option_aclc; struct acl option_acl[MAXACLS]; FIXME replaced by following */ a56 2 /*FIXME obsolete int option_veryverbose; */ a60 4 /* sa_addr_t *saaAltio; sa_t *saAltio; FIXME replaced by following */ a62 7 /*FIXME obsolete char *cpBindh; */ /*FIXME obsolete char *cpBindp; */ /* sa_addr_t *saaBind; sa_t *saBind; FIXME replaced by following */ a64 1 a68 5 /* int nsc; struct ns ns[MAXNEWSSERVICES]; FIXME replaced by following */ a70 1 @ 1.11 log @moved --destination from nsc/ns to nns/pns and fixed a copynpaste bug @ text @d68 1 a68 1 int option_veryverbose; @ 1.10 log @merged new --acl option with obsolete post-option processing @ text @d94 1 d97 1 a97 1 /*FIXME replaced by following */ @ 1.9 log @application defaults now set through option_register() @ text @d9 1 a9 1 #define MAXACLS 32 @ 1.8 log @moved --operationmode option @ text @d111 1 d118 1 @ 1.7 log @moved --groupmode option @ text @d116 6 @ 1.6 log @moved --destination option @ text @d110 6 @ 1.5 log @moved --client option @ text @d22 2 a23 2 char *h; /* host */ char *p; /* port */ d93 1 d96 4 @ 1.4 log @moved --bind option @ text @d80 3 a82 2 char *cpBindh; char *cpBindp; d85 3 @ 1.3 log @moved --acl option @ text @d61 1 a61 1 /*FIXME replaced by following d64 3 a66 3 */ int nacl; struct acl *pacl; d73 1 d76 4 d84 1 @ 1.2 log @flush. first options moved. introduced exception handling. @ text @d60 2 d64 4 @ 1.1 log @master of the FIXMEs! please read comment in fixme.h @ text @d39 1 a39 1 char *option_logfile; d55 1 a55 1 unsigned int option_levelmask; d85 3 @