fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] Re: directory change

2002-07-05 04:50:54
Quoting from Sunil Shetye's mail on Tue, Jul 02, 2002 at 01:39:00PM +0530:
Quoting from Sunil Shetye's mail on Mon, Jul 01, 2002 at 05:45:41PM +0530:
All this can be traced back to the innocuous looking chdir("/") in the
daemonize() function. There are several possible alternatives:

Here is a solution which is different from the solutions suggested
before:

Two bugs in the previous patch:

1) the ssl cert path could also be relative.

2) the name "-" is taken to be standard input. So, the current
directory should not be prepended to that.

Also, "fetchmail -f /dev/stdin" complains that /dev/stdin is a
symlink. This is also fixed in the same patch.

===========================================================
diff -Naur fetchmail-5.9.13.orig/options.c fetchmail-5.9.13/options.c
--- fetchmail-5.9.13.orig/options.c     Thu Jul  4 11:32:18 2002
+++ fetchmail-5.9.13/options.c  Fri Jul  5 17:03:26 2002
@@ -594,7 +594,7 @@
            break;
 
        case LA_SSLCERTPATH:
-           ctl->sslcertpath = xstrdup(optarg);
+           ctl->sslcertpath = prependdir(optarg, currentwd);
            break;
 
        case LA_SSLFINGERPRINT:
diff -Naur fetchmail-5.9.13.orig/rcfile_y.y fetchmail-5.9.13/rcfile_y.y
--- fetchmail-5.9.13.orig/rcfile_y.y    Thu Jul  4 11:32:18 2002
+++ fetchmail-5.9.13/rcfile_y.y Fri Jul  5 17:03:26 2002
@@ -354,7 +354,7 @@
                | SSLCERT STRING        {current.sslcert = prependdir ($2, 
rcfiledir);}
                | SSLPROTO STRING       {current.sslproto = xstrdup($2);}
                | SSLCERTCK             {current.sslcertck = FLAG_TRUE;}
-               | SSLCERTPATH STRING    {current.sslcertpath = xstrdup($2);}
+               | SSLCERTPATH STRING    {current.sslcertpath = prependdir($2, 
rcfiledir);}
                | SSLFINGERPRINT STRING {current.sslfingerprint = xstrdup($2);}
 
                | NO KEEP               {current.keep        = FLAG_FALSE;}
@@ -410,7 +410,7 @@
        return(PS_SUCCESS);
 
     /* pass through the special name for stdin */
-    if (strcmp("-", pathname) == 0)
+    if (strcmp("-", pathname) == 0 || strcmp("/dev/stdin", pathname) == 0)
        return(PS_SUCCESS);
 
     /* the run control file must have the same uid as the REAL uid of this 
@@ -579,6 +579,7 @@
     char *newfile;
     if (!file[0] ||                    /* null path */
        file[0] == '/' ||               /* absolute path */
+       strcmp(file, "-") == 0 ||       /* stdin */
        !dir[0])                        /* we don't HAVE_GETCWD */
        return xstrdup (file);
     newfile = xmalloc (strlen (dir) + 1 + strlen (file) + 1);
===========================================================

Sunil Shetye.

<Prev in Thread] Current Thread [Next in Thread>