- # remove everything up to next login or EOF
- while ($line = shift @config) {
- last if ($line =~ /^\[/);
- }
-
- # this one is either the next login or EOF
- print CONF $line;
-
- while ($line = shift @config) {
- print CONF $line;
- }
-
- print CONF qq|[$self->{login}]\n|;
-
- if ((($self->{dbpasswd} ne $self->{old_dbpasswd}) || $newmember)
- && $self->{root}) {
- $self->{dbpasswd} = pack 'u', $self->{dbpasswd};
- chop $self->{dbpasswd};
- }
- if (defined($self->{new_password})) {
- if ($self->{new_password} ne $self->{old_password}) {
- $self->{password} = crypt $self->{new_password},
- substr($self->{login}, 0, 2)
- if $self->{new_password};
- }
- } else {
- if ($self->{password} ne $self->{old_password}) {
- $self->{password} = crypt $self->{password}, substr($self->{login}, 0, 2)
- if $self->{password};
- }
- }
-
- if ($self->{'root login'}) {
- @config = ("password");
- } else {
- @config = &config_vars;
- }
-
- # replace \r\n with \n
- map { $self->{$_} =~ s/\r\n/\\n/g } qw(address signature);
- foreach $key (sort @config) {
- print CONF qq|$key=$self->{$key}\n|;
- }
-
- print CONF "\n";
- close CONF;
- unlink "${memberfile}.LCK";
-
- # create conf file
- $self->create_config("$userspath/$self->{login}.conf")
- unless $self->{'root login'};
-