OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/lmtp2nntp_main.c versions 1.13 and 1.14
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/lmtp2nntp_main.c 1.13 -> 1.14

--- lmtp2nntp_main.c     2002/01/31 09:03:58     1.13
+++ lmtp2nntp_main.c     2002/01/31 10:14:54     1.14
@@ -431,8 +431,8 @@
     ctx->active_childs = 0;
     ctx->l2_env = NULL;
     ctx->l2 = NULL;
-    ctx->saaAltio = NULL;
-    ctx->saAltio = NULL;
+    ctx->saaServerbind = NULL;
+    ctx->saServerbind = NULL;
     ctx->cpBindh = NULL;
     ctx->cpBindp = NULL;
     ctx->saaBind = NULL;
@@ -482,89 +482,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 'b': /*POD [B<-b> I<addr>[I<:port>]|C<->|I<path>[:perms]] */
-                if (strcmp(optarg, "-") != 0) {
-                    if ((rc = sa_create(&ctx->saAltio)) != SA_OK) {
-                        fprintf(stderr, "%s:Error: Creating TCP socket failed for \"%s\": %s\n", 
-                                ctx->progname, optarg, strerror(errno));
-                        CU(ERR_EXECUTION);
-                    }
-                    if ((rc = sa_addr_create(&ctx->saaAltio)) != SA_OK) {
-                        fprintf(stderr, "%s:Error: Creating address failed for -b option (%d)\n", 
-                                ctx->progname, rc);
-                    }
-                    if (optarg[0] == '/') {
-                        char *cpPath;
-                        char *cpPerm;
-                        int nPerm;
-                        int n;
-
-                        cpPath = strdup(optarg);
-                        cpPerm = NULL;
-                        nPerm  = -1;
-                        if ((cpPerm = strrchr(cpPath, ':')) != NULL) {
-                            *cpPerm++ = '\0';
-                            nPerm = 0;
-                            for (i = 0; i < 4 && cpPerm[i] != '\0'; i++) {
-                                if (!isdigit((int)cpPerm[i])) {
-                                    nPerm = -1;
-                                    break;
-                                }
-                                n = cpPerm[i] - '0';
-                                if (n > 7) {
-                                    nPerm = -1;
-                                    break;
-                                }
-                                nPerm = ((nPerm << 3) | n);
-                            }
-                            if (nPerm == -1 || cpPerm[i] != '\0') {
-                                fprintf(stderr, "%s:Error: Invalid permissions \"%s\"\n", ctx->progname, cpPerm);
-                                CU(ERR_EXECUTION);
-                            }
-                        }
-                        if ((rc = sa_addr_u2a(ctx->saaAltio, "unix:%s", cpPath)) != SA_OK) {
-                            fprintf(stderr, "%s:Error: Parsing alternate IO guessing UNIX domain socket failed for \"%s\" (%d)\n", 
-                                    ctx->progname, cpPath, rc);
-                            CU(ERR_EXECUTION);
-                        }
-                        if ((rc = sa_bind(ctx->saAltio, ctx->saaAltio)) != SA_OK) {
-                            fprintf(stderr, "%s:Error: Bind failed for \"%s\": %s\n", 
-                                    ctx->progname, cpPath, strerror(errno));
-                            CU(ERR_EXECUTION);
-                        }
-                        if (nPerm != -1) {
-                            if (chmod(cpPath, nPerm) == -1) {
-                                fprintf(stderr, "%s:Error: chmod failed for \"%s\": %s\n", ctx->progname, cpPath, strerror(errno));
-                                CU(ERR_EXECUTION);
-                            }
-                        }
-                        if (getuid() == 0 && getuid() != ctx->option_uid) {
-                            if (chown(cpPath, ctx->option_uid, -1) == -1) {
-                                fprintf(stderr, "%s:Error: chown failed for \"%s\": %s\n", ctx->progname, cpPath, strerror(errno));
-                                CU(ERR_EXECUTION);
-                            }
-                        }
-                        free(cpPath);
-                    }
-                    else {
-                        if ((rc = sa_addr_u2a(ctx->saaAltio, "inet://%s", optarg)) != SA_OK) {
-                            fprintf(stderr, "%s:Error: Parsing alternate IO guessing INET socket failed for \"%s\" (%d)\n", 
-                                    ctx->progname, optarg, rc);
-                            CU(ERR_EXECUTION);
-                        }
-                        if ((rc = sa_bind(ctx->saAltio, ctx->saaAltio)) != SA_OK) {
-                            fprintf(stderr, "%s:Error: Bind failed for \"%s\": %s\n", 
-                                    ctx->progname, optarg, strerror(errno));
-                            CU(ERR_EXECUTION);
-                        }
-                    }
-                    if ((rc = sa_listen(ctx->saAltio, -1)) != SA_OK) {
-                        fprintf(stderr, "%s:Error: Listen to failed for \"%s\": %s\n", 
-                                ctx->progname, optarg, strerror(errno));
-                        CU(ERR_EXECUTION);
-                    }
-                }
-                break;
             case 'c': /*POD [B<-c> I<addr>[I<:port>]] */
                 ctx->cpBindh = strdup(optarg);
                 if ((ctx->cpBindp = strrchr(ctx->cpBindh, ':')) != NULL) {
@@ -908,7 +825,7 @@
     signal(SIGUSR2,            SIG_IGN    );
 
     /* loop for LMTP protocol with support for alternate io through daemon */
-    if (ctx->saAltio == NULL) {
+    if (ctx->saServerbind == NULL) {
         /* initialize LMTP context */
         ctx->fdIOi = STDIN_FILENO;
         ctx->fdIOo = STDOUT_FILENO;
@@ -960,17 +877,17 @@
             }
         }
 
-        sa_timeout(ctx->saAltio, SA_TIMEOUT_ALL,    0, 0);
-        sa_timeout(ctx->saAltio, SA_TIMEOUT_ACCEPT, ctx->option_timeout_lmtp_accept, 0);
-        sa_timeout(ctx->saAltio, SA_TIMEOUT_READ,   ctx->option_timeout_lmtp_read,   0);
-        sa_timeout(ctx->saAltio, SA_TIMEOUT_WRITE,  ctx->option_timeout_lmtp_write,  0);
+        sa_timeout(ctx->saServerbind, SA_TIMEOUT_ALL,    0, 0);
+        sa_timeout(ctx->saServerbind, SA_TIMEOUT_ACCEPT, ctx->option_timeout_lmtp_accept, 0);
+        sa_timeout(ctx->saServerbind, SA_TIMEOUT_READ,   ctx->option_timeout_lmtp_read,   0);
+        sa_timeout(ctx->saServerbind, SA_TIMEOUT_WRITE,  ctx->option_timeout_lmtp_write,  0);
         while (1) {
             while (ctx->active_childs >= ctx->option_childsmax) {
                 log1(ctx, ERROR, "maximum number of childs (%d) reached - waiting (1s)", ctx->option_childsmax);
                 sleep(1);
             }
 
-            if ((rc = sa_accept(ctx->saAltio, &ctx->saaIO, &ctx->saIO)) != SA_OK) {
+            if ((rc = sa_accept(ctx->saServerbind, &ctx->saaIO, &ctx->saIO)) != SA_OK) {
                 if (rc == SA_ERR_SYS)
                     log3(ctx, ERROR, "accept failed: %s: (%d) %s", sa_error(rc), errno, strerror(errno));
                 else
@@ -1050,8 +967,8 @@
             log1(ctx, NOTICE, "startup new child process, parent pid[%d]", getppid());
 
             /* child must close listening socket */
-            sa_destroy(ctx->saAltio);
-            ctx->saAltio = NULL; /* prevent cleanup from free'ing this again */
+            sa_destroy(ctx->saServerbind);
+            ctx->saServerbind = NULL; /* prevent cleanup from free'ing this again */
             
             /* initialize LMTP context */
             lmtp_io.ctx    = ctx;
@@ -1097,10 +1014,10 @@
     log0(ctx, NOTICE, "graceful shutdown shortly before exit - no more logging");
     l2_channel_destroy(ctx->l2);
     l2_env_destroy(ctx->l2_env);
-    if (ctx->saAltio)
-        sa_destroy(ctx->saAltio);
-    if (ctx->saaAltio)
-        sa_addr_destroy(ctx->saaAltio);
+    if (ctx->saServerbind)
+        sa_destroy(ctx->saServerbind);
+    if (ctx->saaServerbind)
+        sa_addr_destroy(ctx->saaServerbind);
     if (ctx->option_restrictheader != NULL)
         free(ctx->option_restrictheader);
     if (ctx->azHeaderValuePairs != NULL)

CVSTrac 2.0.1