On Wednesday, July 23, 2003, at 08:26 AM, John Simpson wrote:
it seems to me that the newer versions of vpopmail should automatically add
this extra : to the end of lines which are missing it, if there was a file
format change from one version to another.

The current 5.3 series does that, and I'm back-porting some of the bugfixes from 5.3 for a 5.2.2 release. So far, 5.2.2 includes this patch, and the missing-backslash fix to mysql.h. If anyone else knows of outstanding problems with 5.2 (that were hopefully fixed in 5.3), please let me know.


Here's the patch:

--- vpopmail.c  Fri May 17 23:25:49 2002
+++ ../vpopmail-5.3.22/vpopmail.c       Sun Jul 20 09:07:51 2003
@@ -1408,13 +1404,7 @@
     if (fgets(line,sizeof(line),pw) == NULL) return NULL;

     for (i=0; line[i] != 0; i++) if (line[i] == ':') j++;
-
-#ifdef CLEAR_PASS
-    /* Must count the clear password field */
-    if ( j != 7) return NULL;
-#else
-    if ( j != 6) return NULL;
-#endif
+    if (j < 6) return NULL;

     tmpstr = line;
     pwent.pw_name   = line;
@@ -1435,23 +1425,22 @@
     *tmpstr = 0; ++tmpstr;
     pwent.pw_gid = atoi(tmpstr1);

-
     pwent.pw_gecos  = tmpstr;
     while (*tmpstr!=0 && *tmpstr!=':') ++tmpstr;
     *tmpstr = 0; ++tmpstr;

     pwent.pw_dir    = tmpstr;
     while (*tmpstr!=0 && *tmpstr!=':') ++tmpstr;
-    *tmpstr = 0; ++tmpstr;
+    if (*tmpstr) { *tmpstr = 0; ++tmpstr; }

     pwent.pw_shell  = tmpstr;
     while (*tmpstr!=0 && *tmpstr!=':' && *tmpstr!='\n') ++tmpstr;
-    *tmpstr = 0; ++tmpstr;
+    if (*tmpstr) { *tmpstr = 0; ++tmpstr; }

 #ifdef CLEAR_PASS
     pwent.pw_clear_passwd  = tmpstr;
-    while (*tmpstr!=0 && *tmpstr!=':' && *tmpstr!='\n') ++tmpstr;
-    *tmpstr = 0; ++tmpstr;
+    while (*tmpstr!=0 && *tmpstr!='\n') ++tmpstr;
+    if (*tmpstr) { *tmpstr = 0; ++tmpstr; }
 #endif

return &pwent;




Reply via email to