hi..
after trying to find the cause for my cdb to mysql converting troubles
i came up with this conclusion:
replace the function
int cdb_to_sql(char *domain, int site_size)
with my version:
--------
int cdb_to_sql( char *domain, int site_size )
{
#ifdef USE_SQL
FILE *fs;
char tmpbuf[200];
struct vqpasswd *pw;
vauth_deldomain_size(domain, site_size);
vauth_adddomain_size(domain, site_size);
sprintf(tmpbuf, "%s/domains/%s/vpasswd", VPOPMAILDIR, domain);
fs = fopen(tmpbuf,"r");
if ( fs == NULL ) {
return(-1);
}
while( (pw=vgetent(fs)) != NULL ) {
vauth_adduser_size(pw->pw_name, domain, pw->pw_passwd,
pw->pw_gecos, NULL, pw->pw_uid, site_size);
vauth_setpw_size (pw, domain, site_size);
}
#endif
return(0);
}
-------
what does it different than the original version ?
- after vauth_adduser_size () (which basically INSERTS the user into
the sql table) it calls vauth_setpw_size (which basically UPDATES the
user information in the sql table)
the thing is:
vauth_adduser_size ALWAYS encrypts the password. however in the cdb
file, the pop3 passwords ARE already encrypted, and therefor are
encrypted twice.
so no user could log in with his true password anymore.
this is, why i call vauth_setpw_size() right after. it does not
encrypt the password, and updates the password field with the true
value: the encrypted password which was in the cdb file before.
(oh.. and i removed some of the code which tried to set the correct
maildir path for every added user.. the vauth_setpw_size () does it
correctly.)
as i'm by no means into c, please don't expect it to run or even work
:)
regards, justin