OSSP CVS Repository

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

Check-in Number: 1752
Date: 2002-Jan-31 16:32:51 (local)
2002-Jan-31 15:32:51 (UTC)
User:thl
Branch:
Comment: moved --timeout_XXX options
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/example.conf      1.11 -> 1.12     2 inserted, 0 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_config.c      1.31 -> 1.32     138 inserted, 0 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_main.c      1.24 -> 1.25     0 inserted, 52 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp_option.c      1.5 -> 1.6     4 inserted, 2 deleted

ossp-pkg/lmtp2nntp/example.conf 1.11 -> 1.12

--- example.conf 2002/01/31 14:20:09     1.11
+++ example.conf 2002/01/31 15:32:51     1.12
@@ -41,9 +41,11 @@
 operationmode   post                            #see -o aka --operationmode
 restrictheader  "Cc: j\.doe@example\.org"       #see -r aka --restrictheader
 size            555000                          #see -s aka --size
+timeoutlmtp        0                            #see        --timeoutlmtp, default for accept, read, write
 timeoutlmtpaccept  0                            #see        --timeoutlmtpaccept
 timeoutlmtpread    10                           #see        --timeoutlmtpread
 timeoutlmtpwrite   10                           #see        --timeoutlmtpwrite
+timeoutnntp        30                           #see        --timeoutnntp, default for connect, read, write
 timeoutnntpconnect 360                          #see        --timeoutnntpconnect
 timeoutnntpread    60                           #see        --timeoutnntpread
 timeoutnntpwrite   60                           #see        --timeoutnntpwrite


ossp-pkg/lmtp2nntp/lmtp2nntp_config.c 1.31 -> 1.32

--- lmtp2nntp_config.c   2002/01/31 15:13:16     1.31
+++ lmtp2nntp_config.c   2002/01/31 15:32:51     1.32
@@ -609,6 +609,144 @@
     catch (ex)
         rethrow;
 
+    /* --timeoutlmtp SINGLE */
+    try {
+        int i;
+
+        if (   (val_get(ctx->val, "option.timeoutlmtp", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutlmtp= \"%s\"", ov->data.s);
+
+        if ((i = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutlmtp, number (%d) out of range", i);
+            throw(0,0,0);
+        }
+        ctx->option_timeout_lmtp_accept = i;
+        ctx->option_timeout_lmtp_read = i;
+        ctx->option_timeout_lmtp_write = i;
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutlmtpaccept SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutlmtpaccept", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutlmtpaccept = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_lmtp_accept = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutlmtpaccept, number (%d) out of range", ctx->option_timeout_lmtp_accept);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutlmtpread SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutlmtpread", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutlmtpread = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_lmtp_read = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutlmtpread, number (%d) out of range", ctx->option_timeout_lmtp_read);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutlmtpwrite SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutlmtpwrite", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutlmtpwrite = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_lmtp_write = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutlmtpwrite, number (%d) out of range", ctx->option_timeout_lmtp_write);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutnntp SINGLE */
+    try {
+        int i;
+
+        if (   (val_get(ctx->val, "option.timeoutnntp", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutnntp= \"%s\"", ov->data.s);
+
+        if ((i = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutnntp, number (%d) out of range", i);
+            throw(0,0,0);
+        }
+        ctx->option_timeout_nntp_connect = i;
+        ctx->option_timeout_nntp_read = i;
+        ctx->option_timeout_nntp_write = i;
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutnntpconnect SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutnntpconnect", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutnntpconnect = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_nntp_connect = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutnntpconnect, number (%d) out of range", ctx->option_timeout_nntp_connect);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutnntpread SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutnntpread", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutnntpread = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_nntp_read = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutnntpread, number (%d) out of range", ctx->option_timeout_nntp_read);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
+    /* --timeoutnntpwrite SINGLE */
+    try {
+        if (   (val_get(ctx->val, "option.timeoutnntpwrite", &ov) != VAL_OK)
+            || (ov->ndata != 1)
+            || (ov->data.s == NULL)
+              ) throw(0,0,0);
+        log1(ctx, TRACE, "--timeoutnntpwrite = \"%s\"", ov->data.s);
+
+        if ((ctx->option_timeout_nntp_write = atoi(ov->data.s)) < 0) {
+            log1(ctx, ERROR, "option --timeoutnntpwrite, number (%d) out of range", ctx->option_timeout_nntp_write);
+            throw(0,0,0);
+        }
+    }
+    catch (ex)
+        rethrow;
+
 CUS:
     return;
 }


ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.24 -> 1.25

--- lmtp2nntp_main.c     2002/01/31 15:13:16     1.24
+++ lmtp2nntp_main.c     2002/01/31 15:32:51     1.25
@@ -355,14 +355,8 @@
     lmtp2nntp_t  *ctx = NULL;
     int           bOk;
     int           i;             /* general purpose scratch int, index ... */
-    char         *cp;            /* general purpose character pointer */
-    char         *azTimeout;
-    size_t        asTimeout;
     pid_t         pid;
     FILE         *fd;
-    char         *cpName;
-    char         *cpValue;
-    int           nValue;
     struct passwd *sPasswd;
 
     /* drop effective uid/gid priviledges */
@@ -450,52 +444,6 @@
     /* read in the arguments */
     while ((i = getopt(argc, argv, "C:DKP:Va:b:c:d:g:h:l:m:n:o:r:s:t:u:v")) != -1) {
         switch (i) {
-            case 't': /*POD [B<-t> I<name>=I<sec>[,I<name>=I<sec>[,...]] */
-                if (argz_create_sep(optarg, ',', &azTimeout, &asTimeout) != 0)
-                    CU(ERR_EXECUTION);
-                cp = NULL;
-                while ((cp = argz_next(azTimeout, asTimeout, cp)) != NULL) {
-                    cpName = strdup(cp);
-                    if ((cpValue = strrchr(cpName, '=')) == NULL) {
-                        fprintf(stderr, "%s:Error: comma-seperated argument %s to option -t have to be name=value.\n", ctx->progname, cp);
-                        CU(ERR_EXECUTION);
-                    }
-                    *cpValue++ = NUL;
-                    nValue = atoi(cpValue);
-                    if (nValue < 0) {
-                        fprintf(stderr, "%s:Error: timeout %s=%d to option -t must be a positive integer.\n", ctx->progname, cpName, nValue);
-                        CU(ERR_EXECUTION);
-                    }
-                    if (strcmp(cpName, "lmtp") == 0) {
-                        ctx->option_timeout_lmtp_accept = nValue;
-                        ctx->option_timeout_lmtp_read = nValue;
-                        ctx->option_timeout_lmtp_write = nValue;
-                    }
-                    else if (strcmp(cpName, "lmtp:accept") == 0)
-                        ctx->option_timeout_lmtp_accept = nValue;
-                    else if (strcmp(cpName, "lmtp:read") == 0)
-                        ctx->option_timeout_lmtp_read = nValue;
-                    else if (strcmp(cpName, "lmtp:write") == 0)
-                        ctx->option_timeout_lmtp_write = nValue;
-                    else if (strcmp(cpName, "nntp") == 0) {
-                        ctx->option_timeout_nntp_connect = nValue;
-                        ctx->option_timeout_nntp_read = nValue;
-                        ctx->option_timeout_nntp_write = nValue;
-                    }
-                    else if (strcmp(cpName, "nntp:connect") == 0)
-                        ctx->option_timeout_nntp_connect = nValue;
-                    else if (strcmp(cpName, "nntp:read") == 0)
-                        ctx->option_timeout_nntp_read = nValue;
-                    else if (strcmp(cpName, "nntp:write") == 0)
-                        ctx->option_timeout_nntp_write = nValue;
-                    else {
-                        fprintf(stderr, "%s:Error: unknown timeout %s to option -t.\n", ctx->progname, cpName);
-                        CU(ERR_EXECUTION);
-                    }
-                    free(cpName);
-                }
-                free(azTimeout);
-                break;
             case 'u': /*POD [B<-u> I<uid>] */
                 if (isdigit((int)optarg[0])) {
                     if ((sPasswd = getpwuid((uid_t)atoi(optarg))) == NULL) {


ossp-pkg/lmtp2nntp/lmtp2nntp_option.c 1.5 -> 1.6

--- lmtp2nntp_option.c   2002/01/31 15:09:25     1.5
+++ lmtp2nntp_option.c   2002/01/31 15:32:51     1.6
@@ -614,10 +614,12 @@
     (void)option_register(o, "headervalue",        'h', OPT_MULTI,  &stdsyntax, "m/.*/",     "foo11", "header: value" );
     (void)option_register(o, "include",            'i', OPT_MULTI,  &includeit, "m/.*/",     "foo12", "configfile" );
     (void)option_register(o, "size",               's', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo13", "bytes" );
-    (void)option_register(o, "timeoutlmtpaccept",  NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo14", "sec" );
+    (void)option_register(o, "timeoutlmtp",        NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo14", "sec" );
+    (void)option_register(o, "timeoutlmtpaccept",  NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "fo14a", "sec" );
     (void)option_register(o, "timeoutlmtpread",    NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo15", "sec" );
     (void)option_register(o, "timeoutlmtpwrite",   NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo16", "sec" );
-    (void)option_register(o, "timeoutnntpconnect", NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo17", "sec" );
+    (void)option_register(o, "timeoutnntp",        NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo17", "sec" );
+    (void)option_register(o, "timeoutnntpconnect", NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "fo17a", "sec" );
     (void)option_register(o, "timeoutnntpread",    NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo18", "sec" );
     (void)option_register(o, "timeoutnntpwrite",   NUL, OPT_SINGLE, &stdsyntax, "m/.*/",     "foo19", "sec" );
     (void)option_register(o, "mailfrom",           'm', OPT_SINGLE, &stdsyntax, "m/.*/",     "foo20", "regex" );

CVSTrac 2.0.1