Index: ossp-pkg/lmtp2nntp/Makefile.in
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Makefile.in,v
rcsdiff -q -kk '-r1.34' '-r1.35' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Makefile.in,v' 2>/dev/null
--- Makefile.in 2002/01/07 13:15:59 1.34
+++ Makefile.in 2002/01/09 13:54:25 1.35
@@ -44,9 +44,9 @@
POD2MAN = pod2man
PROG = lmtp2nntp
-HDRS = lmtp2nntp_global.h lmtp2nntp_daemon.h lmtp2nntp_lmtp.h lmtp2nntp_nntp.h lmtp2nntp_argz.h lmtp2nntp_shpat.h lmtp2nntp_msg.h lmtp2nntp_popt.h
-SRCS = lmtp2nntp_main.c lmtp2nntp_daemon.c lmtp2nntp_lmtp.c lmtp2nntp_nntp.c lmtp2nntp_argz.c lmtp2nntp_shpat.c lmtp2nntp_msg.c lmtp2nntp_popt.c lmtp2nntp_version.c
-OBJS = lmtp2nntp_main.o lmtp2nntp_daemon.o lmtp2nntp_lmtp.o lmtp2nntp_nntp.o lmtp2nntp_argz.o lmtp2nntp_shpat.o lmtp2nntp_msg.o lmtp2nntp_popt.o lmtp2nntp_version.o
+HDRS = lmtp2nntp_global.h lmtp2nntp_daemon.h lmtp2nntp_lmtp.h lmtp2nntp_nntp.h lmtp2nntp_argz.h lmtp2nntp_shpat.h lmtp2nntp_msg.h lmtp2nntp_popt.h lmtp2nntp_dotconf.h lmtp2nntp_config.h
+SRCS = lmtp2nntp_main.c lmtp2nntp_daemon.c lmtp2nntp_lmtp.c lmtp2nntp_nntp.c lmtp2nntp_argz.c lmtp2nntp_shpat.c lmtp2nntp_msg.c lmtp2nntp_popt.c lmtp2nntp_dotconf.c lmtp2nntp_config.c lmtp2nntp_version.c
+OBJS = lmtp2nntp_main.o lmtp2nntp_daemon.o lmtp2nntp_lmtp.o lmtp2nntp_nntp.o lmtp2nntp_argz.o lmtp2nntp_shpat.o lmtp2nntp_msg.o lmtp2nntp_popt.o lmtp2nntp_dotconf.o lmtp2nntp_config.o lmtp2nntp_version.o
SUBDIRS = @SUBDIR_STR@ @SUBDIR_L2@ @SUBDIR_SA@ @SUBDIR_VAR@
Index: ossp-pkg/lmtp2nntp/example.conf
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/example.conf,v
rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/example.conf,v' 2>/dev/null
--- example.conf 2002/01/09 07:42:29 1.1
+++ example.conf 2002/01/09 13:54:25 1.2
@@ -1,49 +1,63 @@
#
-# LMTP2NNTP exsample.conf
+# LMTP2NNTP example.conf
#
- ### DAEMON ###
+# include "sampleconfig.two" # -i aka --include
-childsmax 10 #see -C aka --childsmax
-daemonize yes #see -D aka --daemonize
- # -K aka --kill is not available in the configfile
-pidfile "/tmp/pid" #see -P aka --pidfile
- # -V is obsolete since v1.2; remove the "buffer" channel from l2spec
-acl 10/8 #see -a aka --acl
-acl 172.16/12
-acl 192.168/16
-acl 127.0.0.1/32
-bind 127.0.0.1:12345 #see -b aka --bind, use IPv4:port
-#bind "/tmp/uds:600" # UNIX domain socket path:permissions
-
- ### GATEWAY ###
-
-client 127.0.0.2 #see -c aka --client
-destination news.example.com #see -d aka --destination
-groupmode envelope #see -g aka --groupmode
-headervalue X-gateway "lmtp2nntp gateway" #see -h aka --headervalue
-include "sampleconfig.two" # -i aka --include
- # -l is obsolete since v1.2, see l2spec
-
-l2spec prefix(prefix="%%b %%d %%H:%%M:%%S <%%L> lmtp2nntp[%%P]: ",timezone=local) \
- -> buffer(size=65536) \
- -> file(path=%s,append=1,perm=%d) \
- # -l aka --l2spec
-
-mailfrom "any.*@example\.org" #see -m aka --mailfrom
-nodename "gateway.example.com" #see -n aka --nodename
-operationmode post #see -o aka --operationmode
-restrictheader "Cc: j\.doe@example\.org" #see -r aka --restrictheader
-size 555000 #see -s aka --size
-timeout lmtp:accept 0 #see -t aka --timeout
-timeout lmtp:read 10
-timeout lmtp:write 10
-timeout nntp:connect 360
-timeout nntp:read 60
-timeout nntp:write 60
-uid gate #see -u aka --uid
- # -v aka --version is not available in the configfile
-newsgroup "test"
-newsgroup "alt.test" #see man page for information about newsgroup
+
+ childsmax 10 #see -C aka --childsmax
+ daemonize yes #see -D aka --daemonize
+ # -K aka --kill is not available in the configfile
+ pidfile "/tmp/pid" #see -P aka --pidfile
+ acl 10/8 #see -a aka --acl
+ acl 172.16/12
+ acl 192.168/16
+ acl 127.0.0.1/32
+ bind 127.0.0.1:12345 #see -b aka --bind, use IPv4:port
+ #bind "/tmp/uds:600" # UNIX domain socket path:permissions
+
+
+ #LMTP
+ timeoutaccept 0 #see -t aka --timeout
+ timeoutread 10
+ timeoutwrite 10
+ size 555000 #see -s aka --size
+ mailfrom "any.*@example\.org" #see -m aka --mailfrom
+ nodename "gateway.example.com" #see -n aka --nodename
+
+
+ #NNTP, multiple sections allowed
+ client 127.0.0.2 #see -c aka --client
+ destination news.example.com #see -d aka --destination
+ operationmode post #see -o aka --operationmode
+ timeoutconnect 360
+ timeoutread 60
+ timeoutwrite 60
+
+
+ #main and globals
+ groupmode envelope #see -g aka --groupmode
+
+ # -l is obsolete since v1.2, see l2spec
+ # -V is obsolete since v1.2; remove the "buffer" channel from l2spec
+ l2spec prefix(prefix="%%b %%d %%H:%%M:%%S <%%L> lmtp2nntp[%%P]: ",timezone=local) \
+ -> buffer(size=65536) \
+ -> file(path=%s,append=1,perm=%d) \
+ # -l aka --l2spec
+
+ uid gate #see -u aka --uid
+ # -v aka --version is not available in the configfile
+ newsgroup "test"
+ newsgroup "alt.test" #see man page for information about newsgroup
+
+
+
+ headervalue X-gateway "lmtp2nntp gateway" #see -h aka --headervalue
+ restrictheader "Cc: j\.doe@example\.org" #see -r aka --restrictheader
+
+
+
+ client 1.2.3.4 #must produce an error
+
Index: ossp-pkg/lmtp2nntp/lmtp2nntp_config.c
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v
co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.c,v' | diff -u /dev/null - -L'ossp-pkg/lmtp2nntp/lmtp2nntp_config.c' 2>/dev/null
--- ossp-pkg/lmtp2nntp/lmtp2nntp_config.c
+++ - 2024-03-28 18:33:04.757624286 +0100
@@ -0,0 +1,195 @@
+/*
+** Copyright (c) 2001-2002 The OSSP Project
+** Copyright (c) 2001-2002 Cable & Wireless Deutschland
+**
+** This file is part of OSSP lmtp2nntp, an LMTP speaking local
+** mailer which forwards mails as Usenet news articles via NNTP.
+** It can be found at http://www.ossp.org/pkg/lmtp2nntp/.
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version
+** 2.0 of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this file; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+** USA, or contact the OSSP project .
+**
+** lmtp2nntp.c: LMTP to NNTP configuration parsing
+*/
+
+#include
+#include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+// #include
+
+/* third party (included) */
+// #include "lmtp2nntp_argz.h"
+// #include "lmtp2nntp_shpat.h"
+// #include "lmtp2nntp_daemon.h"
+// #include "lmtp2nntp_popt.h"
+#include "lmtp2nntp_dotconf.h"
+
+/* third party (linked in) */
+// #include "str.h"
+// #include "l2.h"
+// #include "var.h"
+
+/* library version check (compile-time) */
+#define L2_VERSION_HEX_REQ 0x001200
+#define L2_VERSION_STR_REQ "0.1.0"
+#define STR_VERSION_HEX_REQ 0x009206
+#define STR_VERSION_STR_REQ "0.9.6"
+#ifdef L2_VERSION_HEX
+#if L2_VERSION_HEX < L2_VERSION_HEX_REQ
+#error "require a newer version of OSSP L2"
+#endif
+#endif
+#ifdef STR_VERSION_HEX
+#if STR_VERSION_HEX < STR_VERSION_HEX_REQ
+#error "require a newer version of OSSP Str"
+#endif
+#endif
+
+/* own headers */
+#include "lmtp2nntp_global.h"
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#if defined(HAVE_DMALLOC_H) && defined(DMALLOC)
+#include "dmalloc.h"
+#endif
+#include "lmtp2nntp_lmtp.h"
+#include "lmtp2nntp_nntp.h"
+#include "lmtp2nntp_msg.h"
+#include "sa.h"
+#define _LMTP2NNTP_VERSION_C_AS_HEADER_
+#include "lmtp2nntp_version.c"
+#undef _LMTP2NNTP_VERSION_C_AS_HEADER_
+
+#ifndef FALSE
+#define FALSE (1 != 1)
+#endif
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+#ifndef NUL
+#define NUL '\0'
+#endif
+
+const char *foo(command_t *, context_t *);
+int bar(configfile_t *, int, long, const char *);
+const char *quux(command_t *, unsigned long);
+
+const char *foo(command_t *cmd, context_t *_ctx)
+{
+ int *foodata = (int *)_ctx;
+ int i;
+ printf("DEBUG: callbck %s:%ld: %s:", cmd->configfile->filename, cmd->configfile->line, cmd->name);
+ for (i = 0; i < cmd->arg_count; i++)
+ ;//printf("[%d=***%s***] ", i, cmd->data.list[i]);
+ printf("---%lx---%d---", foodata, (*foodata)++);
+ printf("\n");
+ return NULL;
+}
+
+int bar(configfile_t *configfile, int type, long dc_errno, const char *msg)
+{
+ printf("DEBUG: handler type=%d, dc_errno=%ld, msg=***%s***\n", type, dc_errno, msg);
+ return 0; /* 0=continue, 1=abort */
+}
+
+const char *quux(command_t *cmd, unsigned long mask)
+{
+ printf("DEBUG: checker %s:%ld: %s: ", cmd->configfile->filename, cmd->configfile->line, cmd->name);
+ printf("[mask=%lx]", mask);
+ printf("\n");
+ if ((strcmp(cmd->name, "client") == 0) && (mask = 4))
+ return "Nasenbaer!";
+ return NULL;
+}
+
+enum configcontext
+{
+ CTX_DAEMON = 1<<0,
+ CTX_SERVER = 1<<1,
+ CTX_CLIENT = 1<<2,
+ CTX_GATEWAY = 1<<3,
+ CTX_MESSAGE = 1<<4
+};
+
+
+void dotconftest(void)
+{
+ configfile_t *configfile;
+ static int foodata;
+ static const configoption_t options[] = {
+ { "", ARG_NONE, foo, NULL, CTX_ALL },
+ { "childsmax", ARG_STR, foo, NULL, CTX_DAEMON },
+ { "daemonize", ARG_STR, foo, NULL, CTX_DAEMON },
+ { "pidfile", ARG_STR, foo, NULL, CTX_DAEMON },
+ { "acl", ARG_STR, foo, NULL, CTX_DAEMON },
+ { "bind", ARG_STR, foo, NULL, CTX_DAEMON },
+ { "", ARG_NONE, foo, NULL, CTX_DAEMON },
+ { "", ARG_NONE, foo, NULL, CTX_ALL },
+ { "timeoutaccept", ARG_STR, foo, NULL, CTX_SERVER },
+ { "timeoutread", ARG_STR, foo, NULL, CTX_SERVER },
+ { "timeoutwrite", ARG_STR, foo, NULL, CTX_SERVER },
+ { "size", ARG_STR, foo, NULL, CTX_SERVER },
+ { "mailfrom", ARG_STR, foo, NULL, CTX_SERVER },
+ { "nodename", ARG_STR, foo, NULL, CTX_SERVER },
+ { "", ARG_NONE, foo, NULL, CTX_SERVER },
+ { "", ARG_NONE, foo, NULL, CTX_ALL },
+ { "client", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "destination", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "operationmode", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "timeoutconnect", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "timeoutread", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "timeoutwrite", ARG_STR, foo, NULL, CTX_CLIENT },
+ { "", ARG_NONE, foo, NULL, CTX_CLIENT },
+ { "", ARG_NONE, foo, NULL, CTX_ALL },
+ { "groupmode", ARG_STR, foo, NULL, CTX_GATEWAY },
+ { "l2spec", ARG_STR, foo, NULL, CTX_GATEWAY },
+ { "uid", ARG_STR, foo, NULL, CTX_GATEWAY },
+ { "newsgroup", ARG_STR, foo, NULL, CTX_GATEWAY },
+ { "", ARG_NONE, foo, NULL, CTX_GATEWAY },
+ { "", ARG_NONE, foo, NULL, CTX_ALL },
+ { "headervalue", ARG_STR, foo, NULL, CTX_MESSAGE },
+ { "restrictheader", ARG_STR, foo, NULL, CTX_MESSAGE },
+ { "", ARG_NONE, foo, NULL, CTX_MESSAGE },
+ LAST_OPTION
+ };
+
+ foodata = 1000;
+ printf("---%lx---%d---", &foodata, foodata);
+
+ configfile = dotconf_create("example.conf", options, &foodata, CASE_INSENSITIVE);
+ if (!configfile) {
+ fprintf(stderr, "Error opening config file\n");
+ return;
+ }
+ configfile->errorhandler = (dotconf_errorhandler_t)bar;
+ configfile->contextchecker = (dotconf_contextchecker_t)quux;
+
+ if (dotconf_command_loop(configfile) == 0)
+ fprintf(stderr, "Error reading config file\n");
+
+ dotconf_cleanup(configfile);
+}
+
Index: ossp-pkg/lmtp2nntp/lmtp2nntp_config.h
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.h,v
co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_config.h,v' | diff -u /dev/null - -L'ossp-pkg/lmtp2nntp/lmtp2nntp_config.h' 2>/dev/null
--- ossp-pkg/lmtp2nntp/lmtp2nntp_config.h
+++ - 2024-03-28 18:33:04.762188622 +0100
@@ -0,0 +1,28 @@
+/*
+** Copyright (c) 2001-2002 The OSSP Project
+** Copyright (c) 2001-2002 Cable & Wireless Deutschland
+**
+** This file is part of OSSP lmtp2nntp, an LMTP speaking local
+** mailer which forwards mails as Usenet news articles via NNTP.
+** It can be found at http://www.ossp.org/pkg/lmtp2nntp/.
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version
+** 2.0 of the License, or (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this file; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+** USA, or contact the OSSP project .
+**
+** lmtp2nntp.c: LMTP to NNTP configuration parsing
+*/
+
+void dotconftest(void);
+
Index: ossp-pkg/lmtp2nntp/lmtp2nntp_dotconf.c
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp_dotconf.c,v
rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp_dotconf.c,v' 2>/dev/null
--- lmtp2nntp_dotconf.c 2001/12/31 11:09:53 1.1
+++ lmtp2nntp_dotconf.c 2002/01/09 13:54:25 1.2
@@ -63,7 +63,7 @@
#endif /* !WIN32 */
#include
-#include "./dotconf.h"
+#include "lmtp2nntp_dotconf.h"
static char name[CFG_MAX_OPTION + 1]; /* option name */
Index: ossp-pkg/lmtp2nntp/lmtp2nntp_dotconf.h
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp_dotconf.h,v
rcsdiff -q -kk '-r1.1' '-r1.2' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/Attic/lmtp2nntp_dotconf.h,v' 2>/dev/null
--- lmtp2nntp_dotconf.h 2001/12/31 11:09:53 1.1
+++ lmtp2nntp_dotconf.h 2002/01/09 13:54:25 1.2
@@ -105,7 +105,7 @@
enum callback_types
{
ERROR_HANDLER = 1,
- CONTEXT_CHECKER,
+ CONTEXT_CHECKER
};
typedef enum callback_types callback_types;
Index: ossp-pkg/lmtp2nntp/lmtp2nntp_main.c
RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_main.c,v
rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/lmtp2nntp_main.c,v' 2>/dev/null
--- lmtp2nntp_main.c 2002/01/07 13:15:59 1.3
+++ lmtp2nntp_main.c 2002/01/09 13:54:25 1.4
@@ -43,6 +43,7 @@
#include "lmtp2nntp_shpat.h"
#include "lmtp2nntp_daemon.h"
#include "lmtp2nntp_popt.h"
+#include "lmtp2nntp_config.h"
/* third party (linked in) */
#include "str.h"
@@ -293,6 +294,7 @@
"[-b addr[:port]|-|path[:perms]] "
"[-c addr[:port]] "
"[-d addr[:port][,addr[:port], ...]] "
+ "[-f configfile] "
"[-g groupmode] "
"[-h header:value] "
"[-l level[:logfile]] "
@@ -482,6 +484,8 @@
char *cpHeadername;
char *cpHeadervalue;
+dotconftest(); return 0; /*FIXME*/
+
/* drop effective uid/gid priviledges */
seteuid(getuid());
setegid(getgid());