[tpop3d-discuss] [patch] mailspool index error

Paul Makepeace Paul.Makepeace at realprogrammers.com
Thu, 17 Jul 2003 23:50:58 +0100


[Including the pre-amble as it's a fix I haven't looked at very hard.]

I'm getting the following error,

mailspool_load_index(/var/lib/tpop3d/index/[box]): owner is 1010,
should be 8; mode 0660, should be 0600

(This is a shell user whose uid is indeed 1010, FWIW.)

Yet,

# ls -l /var/lib/tpop3d/index/[box]
-rw-------    1 mail     mail         8463 Jul 17 19:02 [box]
# ls -ald /var/lib/tpop3d/index
drwxrwsr-x    2 mail     mail         4096 Jul 17 18:15 /var/lib/tpop3d/index
#

And,

# ls -l /var/mail/[box]
-rw-rw----    1 nik      mail      7562519 Jul 17 23:03 /var/mail/[box]
#

(I have it that way so he can read it direct off the filesystem.)

How about:

--- mailspool.c 24 Jan 2003 11:31:24 -0000      1.44
+++ mailspool.c 17 Jul 2003 22:38:35 -0000
@@ -690,10 +690,10 @@
     if (fstat(fileno(fp), &st) == -1) {
         log_print(LOG_ERR, "mailspool_load_index(%s): %m", indexfile);
         goto fail;
-    } else if ((st.st_mode & 0777) != 0600 || m->st.st_uid != getuid()) {
+    } else if ((st.st_mode & 0777) != 0600 || st.st_uid != getuid()) {
         log_print(LOG_ERR, _("mailspool_load_index(%s): possible security problem: index exists, but it has the wrong owner or file permissions"), indexfile);
         log_print(LOG_ERR, _("mailspool_load_index(%s): owner is %d, should be %d; mode 0%o, should be 0600"), indexfile,
-                            m->st.st_uid, getuid(), m->st.st_mode & 0777);
+                            st.st_uid, getuid(), st.st_mode & 0777);
         goto fail;
     }

Paul


-- 
Paul Makepeace ....................................... http://paulm.com/

"If Saddam Hussein is really a transvestite, then the goddamn apes have
 won."
   -- http://paulm.com/toys/surrealism/