Just in case anyone else runs into this, I wrote a little Perl script that parses out /var/qmail/users/assign to fetch a list of domains that are active on the mail server. Then, for each domain it goes out and fetches the vpasswd file and feeds its contents into a SQL database. It works quite nicely.
Matt #!/usr/bin/perl use strict; use DBI; my $host = 'localhost'; my $user = 'vpopmail'; my $password = 'secret'; my $db = 'vpopmail'; my $domainfile="/var/qmail/users/assign"; my @connect = ("dbi:mysql:database=$db:host=$host", $user, $password); my $dbh = DBI->connect(@connect); warn "@connect" unless $dbh; my @domainlist = get_domainlist( $domainfile ); foreach my $file ( @domainlist ) { #print "$file->{'dom'} \t $file->{'dir'} \n"; add_users( $file->{'dir'}, $file->{'dom'} ); }; $dbh->disconnect; print "All done.\n\n"; ###### ## Subdomains ###### sub get_domainlist { my @domainlist; print "Reading in the file $_[0]..."; open ( DOMAINLIST, $_[0] ) || die "couldn't open $_[0]: $!\n"; my @lines = <DOMAINLIST>; close (DOMAINLIST) || die "couldn't close $_[0]: $!\n"; print "done.\n\n"; print "Extracting the list of domains..."; my $row = "0"; foreach my $line ( @lines ) { my @fields = split(":", $line); my %domain = ( dir => "$fields[4]/vpasswd", dom => "$fields[1]" ); $domainlist[$row] = \%domain; $row++; }; print "done.\n\n."; return @domainlist; } sub add_users { if ( -e $_[0] ) { open ( USERLIST, $_[0] ) || warn "couldn't open $_[0]: $!\n"; my @users = <USERLIST>; close (USERLIST); foreach my $user (@users) { chomp $user; my @f = split(":", $user); print "$user\n"; my $query = "INSERT INTO vpopmail SET pw_name=\"$f[0]\", pw_domain=\"$_[1]\", pw_passwd=\"$f[1]\", pw_uid=\"$f[2]\", pw_gid=\"$f[3]\", pw_gecos=\"$f[4]\", pw_dir=\"$f[5]\", pw_shell=\"$f[6]\""; my $sth = $dbh->prepare($query); $sth->execute; my $x = $DBI::errstr; if ($x) { print "Error running $query\n"; }; $sth->finish; }; }; } On Tuesday, September 24, 2002, at 04:03 PM, Matt Simerson wrote: > I'm rebuilding a dinosaur mail server that I built a couple years ago. > It's running vpopmail 4.9.10 using cdb authentication. I'm upgrading > to 5.3.8 with MySQL authentication. > > I've build out the new 5.3.8 system and cluster of machines. It's all > up, running and happy. I've NFS mounted all the home directories from > the old cluster onto the new system so that I have ready access to the > vpasswd and vpasswd.cdb files. They are mounted onto the local > filesystem so that the paths in /var/qmail/users/assign are correct. > > I run vconvert -c -m test.domain.com and it exits quietly indicating > success: > > mail8# ~vpopmail/bin/vconvert -c -m -v -d test.simerson.net > version: 5.3.8 > converting test.simerson.net done > > However, when I check the MySQL server, there's no entries in the > vpopmail table that correspond to that domain. :-( > > I've tested this one step further. I've manually added a valid user > ([EMAIL PROTECTED]) into the new mail system by manually adding > it into the MySQL table. It works fine, authenticates, etc. That > basically makes it work with my new mail system and the old one at the > same time. Cool. Anyway, if I run vconvert again, it'll actually > delete that entry from the vpopmail table. Is that supposed to > happen? > > Everything on the new system works just fine except the vconvert > function. Can anyone verify that vconvert actually does work? Can you > sanitize a copy of a newer vpasswd file and send it my way so I can > compare it to my ancient system to see if the format is still the > same? > > Matt >