Ken,

I discovered that vgetent() wasn't checking for new lines when being 
called by vauth_getall() using the cdb module.  Then, when vauth_setpw 
would add another new line, vmoduser would seg-fault (only when trying 
to run it on an entire domain).  The patch below adds a check for '\n' 
in both the quota and clear passwd fields (the only ones that occur at 
the  end of the line) to vgetent() in vpopmail.c.

Also, vmoduser wasn't written to handle crypted passwords correctly (or 
clear passwords at all) when running it on an entire domain.  It would 
set the cryped passwd filed with the clear password, and ignore the 
clear password field.  It worked correctly only on single email 
addresses.  The patch below fixes this as well.

Regards,

Bill Shupp


diff -c ../vpopmail-5.0/vmoduser.c ./vmoduser.c
*** ../vpopmail-5.0/vmoduser.c  Mon Oct  8 10:09:12 2001
--- ./vmoduser.c        Mon Nov 19 12:21:17 2001
***************
*** 92,98 ****
                         virgin = 0;

                         if ( Gecos[0] != 0 ) mypw->pw_gecos = Gecos;
!                       if ( Passwd[0] != 0 ) mypw->pw_passwd = Passwd;
                         if ( ClearFlags == 1 ) mypw->pw_gid = 0;
                         if ( GidFlag != 0 ) mypw->pw_gid |= GidFlag;
                         if ( QuotaFlag == 1 ) mypw->pw_shell = Quota;
--- 92,106 ----
                         virgin = 0;

                         if ( Gecos[0] != 0 ) mypw->pw_gecos = Gecos;
!                   if ( Passwd[0] != 0 )  {
!                       mkpasswd3(Passwd,Crypted, 100);
!                           mypw->pw_passwd = Crypted;
! #ifdef CLEAR_PASS
!                           mypw->pw_clear_passwd = Passwd;
! #endif
!                   } else if ( Crypted[0] != 0 ) {
!                           mypw->pw_passwd = Crypted;
!                   }
                         if ( ClearFlags == 1 ) mypw->pw_gid = 0;
                         if ( GidFlag != 0 ) mypw->pw_gid |= GidFlag;
                         if ( QuotaFlag == 1 ) mypw->pw_shell = Quota;
diff -c ../vpopmail-5.0/vpopmail.c ./vpopmail.c
*** ../vpopmail-5.0/vpopmail.c  Tue Oct 23 16:28:02 2001
--- ./vpopmail.c        Mon Nov 19 12:20:06 2001
***************
*** 1385,1396 ****
       *tmpstr = 0; ++tmpstr;

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

   #ifdef CLEAR_PASS
       pwent.pw_clear_passwd  = tmpstr;
!     while (*tmpstr!=0 && *tmpstr!=':') ++tmpstr;
       *tmpstr = 0; ++tmpstr;
   #endif

--- 1385,1396 ----
       *tmpstr = 0; ++tmpstr;

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

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

Reply via email to