OSSP CVS Repository

ossp - Check-in [1625]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1625
Date: 2002-Jan-24 13:07:13 (local)
2002-Jan-24 12:07:13 (UTC)
User:thl
Branch:
Comment: master of the FIXMEs! please read comment in fixme.h
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/fixme.h      added-> 1.1
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.7 -> 1.8     11 inserted, 76 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_nntp.h      1.2 -> 1.3     5 inserted, 0 deleted

ossp-pkg/lmtp2nntp/fixme.h -> 1.1

*** /dev/null    Thu Apr 25 11:52:11 2024
--- -    Thu Apr 25 11:54:37 2024
***************
*** 0 ****
--- 1,86 ----
+ 
+ /*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 <val.h>
+ #define MAXACLS 32
+ #include <sa.h>
+ struct acl {
+     char      *acl;
+     int        not;
+     sa_addr_t *saa;
+     size_t     prefixlen;
+ };
+ #define MAXNEWSSERVICES 16
+ struct nntp_st;
+ typedef struct nntp_st nntp_t;
+ #include "lmtp2nntp_nntp.h"
+ struct ns {
+     char           *h;    /* host */
+     char           *p;    /* port */
+     sa_addr_t      *saa;  /* socket address abstraction */
+     sa_t           *sa;   /* socket abstraction */
+     nntp_t         *nntp;
+     nntp_rc_t       rc;
+     l2_channel_t   *l2;
+ };
+ struct session {
+     int     lhlo_seen;
+     char   *lhlo_domain;
+ };
+ #include <sys/utsname.h>
+ typedef struct {
+     l2_context_t    ctx;
+     val_t          *val;
+     char           *progname;
+     char           *option_logfile;
+     int             option_groupmode;
+     int             option_operationmode;
+     char           *option_operationmodefakestatus;
+     char           *option_operationmodefakedsn;
+     int             option_maxmessagesize;
+     char           *azHeaderValuePairs;
+     size_t          asHeaderValuePairs;
+     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_mailfrom;
+     char           *option_restrictheader;
+     unsigned int    option_levelmask;
+     char           *option_pidfile;
+     int             option_killflag;
+     uid_t           option_uid;
+     int             option_daemon;
+     int             option_aclc;
+     struct acl      option_acl[MAXACLS];
+     int             option_veryverbose;
+     int             option_childsmax;
+     int             active_childs;
+     l2_env_t       *l2_env;
+     l2_channel_t   *l2;
+     sa_addr_t      *saaAltio;
+     sa_t           *saAltio;
+     char           *cpBindh;
+     char           *cpBindp;
+     sa_addr_t      *saaBind;
+     sa_t           *saBind;
+     sa_addr_t      *saaIO;
+     sa_t           *saIO;
+     int             fdIOi;
+     int             fdIOo;
+     int             nsc;
+     struct ns       ns[MAXNEWSSERVICES];
+     char           *azGroupargs;
+     size_t          asGroupargs;
+     struct          session session;
+     msg_t          *msg;
+     struct utsname  uname;
+ } lmtp2nntp_t;
+ 
+ #endif /* __FIXME_H__ */


ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.7 -> 1.8

--- lmtp2nntp_main.c     2002/01/22 16:09:47     1.7
+++ lmtp2nntp_main.c     2002/01/24 12:07:13     1.8
@@ -73,10 +73,12 @@
 #if defined(HAVE_DMALLOC_H) && defined(DMALLOC)
 #include "dmalloc.h"
 #endif
+#include "lmtp2nntp_option.h"
 #include "lmtp2nntp_config.h"
 #include "lmtp2nntp_lmtp.h"
 #include "lmtp2nntp_nntp.h"
 #include "lmtp2nntp_msg.h"
+#include "fixme.h"
 #include "sa.h"
 #define _LMTP2NNTP_VERSION_C_AS_HEADER_
 #include "lmtp2nntp_version.c"
@@ -97,8 +99,6 @@
 #define ERR_DELIVERY -2
 
 #define STDSTRLEN 512
-#define MAXNEWSSERVICES 16
-#define MAXACLS 32
 
 static lmtp_rc_t lmtp_cb_lhlo(lmtp_t *lmtp, lmtp_io_t *io, lmtp_req_t *req, void *ctx);
 static lmtp_rc_t lmtp_cb_mail(lmtp_t *lmtp, lmtp_io_t *io, lmtp_req_t *req, void *ctx);
@@ -111,83 +111,11 @@
 static int helo_rfc0821domain(char *msg, char **domain);
 static int helo_rfc1035domain(char *msg, char **domain);
 
-struct session {
-    int     lhlo_seen;
-    char   *lhlo_domain;
-};
-
 static void catchsignal(int sig, ...);
 static void initsession(struct session *session);
 static void resetsession(struct session *session);
 int groupmatch(char *, size_t, char *);
 
-struct ns {
-    char           *h;    /* host */
-    char           *p;    /* port */
-    sa_addr_t      *saa;  /* socket address abstraction */
-    sa_t           *sa;   /* socket abstraction */
-    nntp_t         *nntp;
-    nntp_rc_t       rc;
-    l2_channel_t   *l2;
-};
-
-struct acl {
-    char      *acl;
-    int        not;
-    sa_addr_t *saa;
-    size_t     prefixlen;
-};
-
-typedef struct {
-    l2_context_t    ctx;
-    char           *progname;
-    char           *option_logfile;
-    int             option_groupmode;
-    int             option_operationmode;
-    char           *option_operationmodefakestatus;
-    char           *option_operationmodefakedsn;
-    int             option_maxmessagesize;
-    char           *azHeaderValuePairs;
-    size_t          asHeaderValuePairs;
-    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_mailfrom;
-    char           *option_restrictheader;
-    unsigned int    option_levelmask;
-    char           *option_pidfile;
-    int             option_killflag;
-    uid_t           option_uid;
-    int             option_daemon;
-    int             option_aclc;
-    struct acl      option_acl[MAXACLS];
-    int             option_veryverbose;
-    int             option_childsmax;
-    int             active_childs;
-    l2_env_t       *l2_env;
-    l2_channel_t   *l2;
-    sa_addr_t      *saaAltio;
-    sa_t           *saAltio;
-    char           *cpBindh;
-    char           *cpBindp;
-    sa_addr_t      *saaBind;
-    sa_t           *saBind;
-    sa_addr_t      *saaIO;
-    sa_t           *saIO;
-    int             fdIOi;
-    int             fdIOo;
-    int             nsc;
-    struct ns       ns[MAXNEWSSERVICES];
-    char           *azGroupargs;
-    size_t          asGroupargs;
-    struct          session session;
-    msg_t          *msg;
-    struct utsname  uname;
-} lmtp2nntp_t;
-
 static var_config_t ctx_lookup_cfg = {
     '$',          /* varinit       */ 
     '{',          /* startdelim    */ 
@@ -501,7 +429,8 @@
     if ((ctx = (lmtp2nntp_t *)malloc(sizeof(lmtp2nntp_t))) == NULL)
         CU(ERR_EXECUTION);
     ctx->ctx.vp = ctx;
-    ctx->progname = strdup(argv[0]);
+    ctx->val = NULL;
+    ctx->progname = NULL;
     ctx->option_childsmax = 10;
     ctx->option_logfile = NULL;
     ctx->option_groupmode = GROUPMODE_ARG;
@@ -555,15 +484,21 @@
     ctx->asGroupargs = 0;
     initsession(&ctx->session);
     ctx->msg = NULL;
+    
+    /* fill in application context */
+    if (val_create(&ctx->val) != VAL_OK)
+        CU(ERR_EXECUTION);
     if (uname(&ctx->uname) == -1) {
         fprintf(stderr, "%s:Error: uname failed \"%s\"\n", ctx->progname, strerror(errno));
         CU(ERR_EXECUTION);
     }
+    ctx->progname = strdup(argv[0]);
 
 {
 lmtp2nntp_option_t *o;
-(void)option_create(&o); /* FIXME */
+(void)option_create(&o, ctx->val); /* FIXME */
 (void)option_parse(o, argc, argv);
+(void)config_context(ctx);
 (void)option_destroy(o);
 return 0;
 }


ossp-pkg/lmtp2nntp/lmtp2nntp_nntp.h 1.2 -> 1.3

--- lmtp2nntp_nntp.h     2001/12/31 15:15:36     1.2
+++ lmtp2nntp_nntp.h     2002/01/24 12:07:13     1.3
@@ -34,8 +34,10 @@
 
 #include "lmtp2nntp_msg.h"
 
+/*FIXME see include below
 struct nntp_st;
 typedef struct nntp_st nntp_t;
+*/
 
 typedef struct {
     void    *ctx;
@@ -56,6 +58,9 @@
     NNTP_ERR_UNKNOWN
 } nntp_rc_t;
 
+/*FIXME see fixme above */
+#include "fixme.h"
+
 typedef struct {
     int fd;
 } nntp_fd_t;

CVSTrac 2.0.1