diff -Nrpu vpopmail-5.4.4.debian/debian/changelog vpopmail-5.4.4/debian/changelog
--- vpopmail-5.4.4.debian/debian/changelog	2004-06-12 21:47:19.000000000 -0700
+++ vpopmail-5.4.4/debian/changelog	2004-06-12 21:49:35.000000000 -0700
@@ -1,3 +1,10 @@
+vpopmail (5.4.4-1.dg1) unstable; urgency=low
+
+  * add rcs support to vpopmail.c
+  * my tentative fix for #254134: var/lib/vpopmail/include mismatch
+
+ -- dean gaudet <dean@arctic.org>  Sat, 12 Jun 2004 20:54:14 -0700
+
 vpopmail (5.4.4-1) unstable; urgency=low
 
   * New upstream version (closes: #238336, #242323)
diff -Nrpu vpopmail-5.4.4.debian/debian/rules vpopmail-5.4.4/debian/rules
--- vpopmail-5.4.4.debian/debian/rules	2004-06-12 21:47:19.000000000 -0700
+++ vpopmail-5.4.4/debian/rules	2004-06-12 21:23:09.000000000 -0700
@@ -75,6 +75,7 @@ install-stamp: build
 	dh_installdirs
 	# Add here commands to install the package into debian/tmp.
 	$(MAKE) install DESTDIR=`pwd`/debian/tmp
+	rmdir `pwd`/debian/tmp/var/lib/vpopmail/include
 	mkdir -p `pwd`/debian/tmp/etc/vpopmail/
 	chown 64020.64020 `pwd`/debian/tmp/etc/vpopmail/
 	chmod 755 `pwd`/debian/tmp/etc/vpopmail/
diff -Nrpu vpopmail-5.4.4.debian/vpopmail.c vpopmail-5.4.4/vpopmail.c
--- vpopmail-5.4.4.debian/vpopmail.c	2004-06-12 21:47:18.000000000 -0700
+++ vpopmail-5.4.4/vpopmail.c	2004-06-12 21:44:43.000000000 -0700
@@ -75,6 +75,105 @@ static char ok_env_chars[] = "abcdefghij
                             "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
                             "1234567890_-.@";
 
+#define USE_RCS 1
+#ifdef USE_RCS
+/************************************************************************/
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <alloca.h>
+
+
+static int rcs_spawn(char *argv[])
+{
+	pid_t child;
+	int status;
+
+	child = fork();
+	if (child == -1) {
+		return -1;
+	}
+	if (child == 0) {
+		/* replace stdin with /dev/null ... just to be certain
+		 * no rcs tool can ask any question.
+		 */
+		close(0);
+		if (open("/dev/null", O_RDONLY) != 0) {
+			fprintf(stderr, "rcs_spawn: unable to replace stdin: %s\n", strerror(errno));
+			exit(1);
+		}
+		execvp(argv[0], argv);
+		fprintf(stderr, "rcs_spawn: unable to execvp(%s): %s\n", argv[0], strerror(errno));
+		exit(1);
+	}
+
+	while (waitpid(child, &status, 0) == -1) {
+		if (errno != EINTR) {
+			fprintf(stderr, "rcs_spawn: waitpid error: %s\n", strerror(errno));
+			return -1;
+		}
+	}
+
+	return WIFEXITED(status) && WEXITSTATUS(status) == 0 ? 0 : -1;
+}
+
+
+static int rcs_co(char *file)
+{
+	char *argv[5];
+
+	/* test for uncomitted changes -- in case someone editted the
+	 * files outside of rcs control.
+	 */
+	argv[0] = "rcsdiff";
+	argv[1] = "-q";
+	argv[2] = "-u";
+	argv[3] = file;
+	argv[4] = NULL;
+	if (rcs_spawn(argv) == -1) {
+		fprintf(stderr, "\nthere are uncommitted changes in %s!\n", file);
+		return -1;
+	}
+
+	argv[0] = "co";
+	argv[1] = "-l";
+	argv[2] = file;
+	argv[3] = NULL;
+	return rcs_spawn(argv);
+}
+
+
+static int rcs_ci(char *file, char *comment1, char *comment2)
+{
+	char *argv[5];
+	char *dashm;
+	size_t len;
+
+	len = strlen("-mlibvpopmail: ") + strlen(comment1) + strlen(comment2) + 1;
+	dashm = alloca(len);
+	snprintf(dashm, len, "-mlibvpopmail: %s%s", comment1, comment2);
+
+	argv[0] = "ci";
+	argv[1] = "-u";
+	argv[2] = dashm;
+	argv[3] = file;
+	argv[4] = NULL;
+	return rcs_spawn(argv);
+}
+#else
+static int rcs_co(const char *file)
+{
+	return 0;
+}
+
+
+static int rcs_ci(const char *file, const char *comment1, const char *comment2)
+{
+	return 0;
+}
+#endif
+
 /************************************************************************/
 
 /* 
@@ -779,8 +878,14 @@ int add_domain_assign( char *alias_domai
  struct stat mystat;
  char tmpstr1[MAX_BUFF];
  char tmpstr2[MAX_BUFF];
+ char rcs_message[MAX_BUFF];
 
   vconfig();
+
+  snprintf(rcs_message, sizeof(rcs_message),
+    "add_domain_assign(%s, %s, %s, %lu, %lu)",
+    alias_domain, real_domain, dir,
+    (long unsigned)uid, (long unsigned)gid);
  
   snprintf(tmpstr1, sizeof(tmpstr1), "%s/users/assign", QMAILDIR);
 
@@ -793,19 +898,24 @@ int add_domain_assign( char *alias_domai
     }
     fputs(".\n", fs1);
     fclose(fs1);
+    chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+    if (rcs_ci(tmpstr1, rcs_message, ": created")) return -1;
   }
 
   snprintf(tmpstr2, sizeof(tmpstr2), "+%s-:%s:%lu:%lu:%s:-::",
     alias_domain, real_domain, (long unsigned)uid, (long unsigned)gid, dir);
 
   /* update the file and add the above line and remove duplicates */
+  if (rcs_co(tmpstr1)) return -1;
   if (update_file(tmpstr1, tmpstr2) !=0 ) {
+   rcs_ci(tmpstr1, rcs_message, ": update_file failure");
    fprintf (stderr, "Failed while attempting to update_file() the assign file\n");
    return (-1);
   }
 
   /* set the mode in case we are running with a strange mask */
   chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+  if (rcs_ci(tmpstr1, rcs_message, ": success")) return -1;
 
   /* compile the assign file */
   /* as of the 5.4 builds, we always need an updated assign file since
@@ -820,42 +930,54 @@ int add_domain_assign( char *alias_domai
    */
   if ( count_rcpthosts() >= 50 ) {
     snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/morercpthosts", QMAILDIR);
+    if (rcs_co(tmpstr1)) return -1;
     if (update_file(tmpstr1, alias_domain) !=0) {
+      rcs_ci(tmpstr1, rcs_message, ": update_file failure");
       fprintf (stderr, "Failed while attempting to update_file() the morercpthosts file\n");
       return (-1);
     }
     snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/morercpthosts", QMAILDIR);
     chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+    if (rcs_ci(tmpstr1, rcs_message, ": success")) return -1;
 
     if ( OptimizeAddDomain == 0 ) compile_morercpthosts();
 
   /* or just add to rcpthosts */
   } else {
     snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/rcpthosts", QMAILDIR);
+    if (rcs_co(tmpstr1)) return -1;
     if (update_file(tmpstr1, alias_domain) != 0) {
+      rcs_ci(tmpstr1, rcs_message, ": update_file failure");
       fprintf (stderr, "Failed while attempting to update_file() the rcpthosts file\n");
       return (-1);
     }
     snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/rcpthosts", QMAILDIR);
     chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+    if (rcs_ci(tmpstr1, rcs_message, ": success")) return -1;
   }
     
   /* Add to virtualdomains file and remove duplicates  and set mode */
   snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/virtualdomains", QMAILDIR );
   snprintf(tmpstr2, sizeof(tmpstr2), "%s:%s", alias_domain, alias_domain );
+  if (rcs_co(tmpstr1)) return -1;
   if (update_file(tmpstr1, tmpstr2) !=0 ) {
+    rcs_ci(tmpstr1, rcs_message, ": update_file failure");
     fprintf (stderr, "Failed while attempting to update_file() the virtualdomains file\n");
     return (-1);
   };
   chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+  if (rcs_ci(tmpstr1, rcs_message, ": success")) return -1;
 
   /* make sure it's not in locals and set mode */
   snprintf(tmpstr1, sizeof(tmpstr1), "%s/control/locals", QMAILDIR);
+  if (rcs_co(tmpstr1)) return -1;
   if (remove_line( alias_domain, tmpstr1) < 0) {
+    rcs_ci(tmpstr1, rcs_message, ": remove_line failure");
     fprintf (stderr, "Failure while attempting to remove_line() the locals file\n");
     return(-1);
   }
   chmod(tmpstr1, VPOPMAIL_QMAIL_MODE ); 
+  if (rcs_ci(tmpstr1, rcs_message, ": success")) return -1;
 
   return(0);
 }
@@ -873,22 +995,29 @@ int del_control(char *domain ) 
  char tmpbuf1[MAX_BUFF];
  char tmpbuf2[MAX_BUFF];
  struct stat statbuf;
+ char rcs_message[MAX_BUFF];
 
  int problem_occurred = 0;
 
+  snprintf(rcs_message, sizeof(rcs_message), "del_control(%s)", domain);
+
   /* delete entry from control/rcpthosts (if it is found) */
   snprintf(tmpbuf1, sizeof(tmpbuf1), "%s/control/rcpthosts", QMAILDIR);
+  if (rcs_co(tmpbuf1)) return -1;
   switch ( remove_line( domain, tmpbuf1) ) {
 
     case -1 :
       /* error ocurred in remove line */
+      rcs_ci(tmpbuf1, rcs_message, ": remove_line failure");
       fprintf (stderr, "Failed while attempting to remove_line() the rcpthosts file\n");
       problem_occurred = 1;
       break;
 
     case 0 :
       /* not found in rcpthosts, so try morercpthosts */
+      rcs_ci(tmpbuf1, rcs_message, ": not found");
       snprintf(tmpbuf1, sizeof(tmpbuf1), "%s/control/morercpthosts", QMAILDIR);
+      if (rcs_co(tmpbuf1)) return -1;
   
       switch (remove_line( domain, tmpbuf1) ) {
 
@@ -897,10 +1026,12 @@ int del_control(char *domain ) 
            * but this is normal enough as on smaller servers, the morercpthosts
            * file wont exist. So ignore this 'error' condition.
            */
+	  rcs_ci(tmpbuf1, rcs_message, ": remove_line failure");
           break; 
 
         case 0 :
          /* not found in morercpthosts */
+	  rcs_ci(tmpbuf1, rcs_message, ": not found");
           break;
 
         case 1 :
@@ -909,6 +1040,7 @@ int del_control(char *domain ) 
           if ( stat( tmpbuf1, &statbuf) == 0 ) {
             /* morercpthosts exists. Now check to see if its empty */
             if ( statbuf.st_size == 0 ) {
+	      rcs_ci(tmpbuf1, rcs_message, ": success");
               /* is empty. So delete it */
               unlink(tmpbuf1);
               /* also delete the morercpthosts.cdb */
@@ -919,6 +1051,7 @@ int del_control(char *domain ) 
               compile_morercpthosts();
               /* make sure correct permissions are set on morercpthosts */
               chmod(tmpbuf1, VPOPMAIL_QMAIL_MODE ); 
+	      if (rcs_ci(tmpbuf1, rcs_message, ": success")) return -1;
             }
           }
           break; 
@@ -929,19 +1062,24 @@ int del_control(char *domain ) 
     case 1 : /* we removed the line successfully */
       /* make sure correct permissions are set on rcpthosts */
       chmod(tmpbuf1, VPOPMAIL_QMAIL_MODE );
+      if (rcs_ci(tmpbuf1, rcs_message, ": success")) return -1;
       break; 
   } /* switch for rcpthosts */
 
   /* delete entry from control/virtualdomains (if it exists) */
   snprintf(tmpbuf1, sizeof(tmpbuf1), "%s:%s", domain, domain);
   snprintf(tmpbuf2, sizeof(tmpbuf2), "%s/control/virtualdomains", QMAILDIR);
+  if (rcs_co(tmpbuf2)) return -1;
   if (remove_line( tmpbuf1, tmpbuf2) < 0 ) {
+    rcs_ci(tmpbuf2, rcs_message, ": remove_line failure");
     fprintf(stderr, "Failed while attempting to remove_line() the virtualdomains file\n"); 
     problem_occurred = 1; 
   }
-
-  /* make sure correct permissions are set on virtualdomains */
-  chmod(tmpbuf2, VPOPMAIL_QMAIL_MODE ); 
+  else {
+    /* make sure correct permissions are set on virtualdomains */
+    chmod(tmpbuf2, VPOPMAIL_QMAIL_MODE ); 
+    if (rcs_ci(tmpbuf2, rcs_message, ": success")) return -1;
+  }
   
   if (problem_occurred == 1) {
     return (-1);
@@ -964,6 +1102,10 @@ int del_domain_assign( char *alias_domai
 {
  char search_string[MAX_BUFF];
  char assign_file[MAX_BUFF];
+ char rcs_message[MAX_BUFF];
+
+  snprintf(rcs_message, sizeof(rcs_message), "del_domain_assign(%s,%s,%s,%lu,%lu)",
+    alias_domain, real_domain, dir, (long unsigned)uid, (long unsigned)gid);
 
   /* format the removal string */ 
   snprintf(search_string, sizeof(search_string), "+%s-:%s:%lu:%lu:%s:-::",
@@ -972,14 +1114,18 @@ int del_domain_assign( char *alias_domai
   /* format the assign file name */
   snprintf(assign_file, sizeof(assign_file), "%s/users/assign", QMAILDIR);
 
+  if (rcs_co(assign_file)) return -1;
+
   /* remove the formatted string from the file */
   if (remove_line( search_string, assign_file) < 0) {
+    rcs_ci(assign_file, rcs_message, ": remove_line failure");
     fprintf(stderr, "Failed while attempting to remove_line the assign file\n");
     return (-1);
   }
 
   /* force the permission on the file */
   chmod(assign_file, VPOPMAIL_QMAIL_MODE ); 
+  rcs_ci(assign_file, rcs_message, ": success");
 
   /* compile assign file */
   update_newu();
