fetchmail-friends
[Top] [All Lists]

[fetchmail] [PATCH] Re: fetchmail initialisation fails on AIX 5.2 on JFS2 filesystem

2003-01-20 06:41:41
Quoting from Benjamin Drieu's mail on Fri, Jan 17, 2003 at 01:00:51PM +0100:
Package: fetchmail
Version: 6.2.1

Operating system: AIX
Version: 5.2

When running fetchmail on the above system, when the home directory of the 
user
is on a JFS2 filesystem, the program fails to run. It reports the error;

"File .fetchmailrc must have no more than -rwx--x--- (0710) permissions."

ls -l shows that the permissions on the file in question are 400, so SHOULD be
OK.

Debugging shows that the statbug.st_mode field contains 32 bits on AIX, and 
the
most significant bits are reserved for system use.

If the filesystem in question is JFS rather than JFS2 it works as expected (ie
the top 16 bits are all zero), but when the filesystem is JFS2 the bit pattern
is 0000 0000 0000 0010.

This causes the line;

if (statbuf.st_mode & ~(S_IFREG | S_IREAD | S_IWRITE | S_IEXEC | S_IXGRP))

to fail, as it does not mask out the most significant 16 bits.

This patch should solve the problem.

==============================================
diff -Naur fetchmail-6.2.0.orig/rcfile_y.y fetchmail-6.2.0/rcfile_y.y
--- fetchmail-6.2.0.orig/rcfile_y.y     Mon Sep  9 13:34:25 2002
+++ fetchmail-6.2.0/rcfile_y.y  Mon Jan 20 18:34:46 2003
@@ -428,14 +428,14 @@
 
     if (!securecheck)  return PS_SUCCESS;
 
-    if ((statbuf.st_mode & S_IFLNK) == S_IFLNK)
+    if (!S_ISREG(statbuf.st_mode))
     {
-       fprintf(stderr, GT_("File %s must not be a symbolic link.\n"), 
pathname);
+       fprintf(stderr, GT_("File %s must be a regular file.\n"), pathname);
        return(PS_IOERR);
     }
 
 #ifndef __BEOS__
-    if (statbuf.st_mode & ~(S_IFREG | S_IREAD | S_IWRITE | S_IEXEC | S_IXGRP))
+    if (statbuf.st_mode & (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH | S_IXOTH))
     {
        fprintf(stderr, GT_("File %s must have no more than -rwx--x--- (0710) 
permissions.\n"), 
                pathname);
==============================================

-- 
Sunil Shetye.

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