"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "contrib/ftpasswd" between
proftpd-1.3.6b.tar.gz and proftpd-1.3.6c.tar.gz

About: ProFTPD is a highly configurable FTP server software (with FTPS and SFTP support).

ftpasswd  (proftpd-1.3.6b):ftpasswd  (proftpd-1.3.6c)
#!/usr/bin/env perl #!/usr/bin/env perl
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Copyright (C) 2000-2015 TJ Saunders <tj@castaglia.org> # Copyright (C) 2000-2020 TJ Saunders <tj@castaglia.org>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
skipping to change at line 404 skipping to change at line 404
$home = $fields[5]; $home = $fields[5];
$shell = $fields[6]; $shell = $fields[6];
$found = 1; $found = 1;
last; last;
} }
unless ($found) { unless ($found) {
print STDOUT "$program: error: no such user $name in $output_file\n"; print STDOUT "$program: error: no such user $name in $output_file\n";
# Restore the file permissions.
unless (chmod(0440, $output_file)) {
print STDERR "$program: unable to set permissions on $output_file: $!";
}
exit 1; exit 1;
} }
return ($pass, $uid, $gid, $gecos, $home, $shell); return ($pass, $uid, $gid, $gecos, $home, $shell);
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
sub get_salt { sub get_salt {
my $salt; my $salt;
skipping to change at line 522 skipping to change at line 528
} }
if (defined($name) && defined($opts{'change-password'})) { if (defined($name) && defined($opts{'change-password'})) {
# retrieve the user's current password from the file and compare # retrieve the user's current password from the file and compare
my ($curpasswd, @junk) = find_passwd_entry(name => $name); my ($curpasswd, @junk) = find_passwd_entry(name => $name);
my $hash = crypt($passwd, $curpasswd); my $hash = crypt($passwd, $curpasswd);
if ($hash eq $curpasswd) { if ($hash eq $curpasswd) {
if (defined($opts{'stdin'})) { if (defined($opts{'stdin'})) {
# cannot prompt again if automated. Simply print an error message # cannot prompt again if automated. Simply print an error message
# and exit. # and exit.
print STDOUT "$program: error: password matches current password\n"; print STDOUT "$program: error: password matches current password\n";
# Restore the file permissions.
unless (chmod(0440, $output_file)) {
print STDERR "$program: unable to set permissions on $output_file: $!"
;
}
exit 2; exit 2;
} else { } else {
print STDOUT "Please use a password that is different from your current password.\n"; print STDOUT "Please use a password that is different from your current password.\n";
return get_passwd(name => $name); return get_passwd(name => $name);
} }
} }
} }
if (defined($name) && defined($opts{'not-previous-password'})) { if (defined($name) && defined($opts{'not-previous-password'})) {
skipping to change at line 549 skipping to change at line 559
my ($currpasswd) = find_passwd_entry(name => $name); my ($currpasswd) = find_passwd_entry(name => $name);
my $hash = crypt($passwd, $currpasswd); my $hash = crypt($passwd, $currpasswd);
if (($hash && $currpasswd) && $hash eq $currpasswd) { if (($hash && $currpasswd) && $hash eq $currpasswd) {
if (defined($opts{'stdin'})) { if (defined($opts{'stdin'})) {
# cannot prompt again if automated. Simply print an error message # cannot prompt again if automated. Simply print an error message
# and exit. # and exit.
print STDOUT "$program: error: password matches previous password\n"; print STDOUT "$program: error: password matches previous password\n";
# Restore the file permissions.
unless (chmod(0440, $output_file)) {
print STDERR "$program: unable to set permissions on $output_file: $!"
;
}
exit 4; exit 4;
} else { } else {
print STDOUT "Please use a password that is different from your previous password.\n"; print STDOUT "Please use a password that is different from your previous password.\n";
return get_passwd(name => $name); return get_passwd(name => $name);
} }
} }
} }
if (defined($name) && defined($opts{'not-system-password'})) { if (defined($name) && defined($opts{'not-system-password'})) {
# retrieve the user's system passwd (from /etc/shadow) and compare # retrieve the user's system passwd (from /etc/shadow) and compare
my $syspasswd = get_syspasswd(user => $name); my $syspasswd = get_syspasswd(user => $name);
my $hash = crypt($passwd, $syspasswd); my $hash = crypt($passwd, $syspasswd);
if (($hash && $syspasswd) && $hash eq $syspasswd) { if (($hash && $syspasswd) && $hash eq $syspasswd) {
if (defined($opts{'stdin'})) { if (defined($opts{'stdin'})) {
# Cannot prompt again if automated. Simply print an error message
# cannot prompt again if automated. Simply print an error message
# and exit. # and exit.
print STDOUT "$program: error: password matches system password\n"; print STDOUT "$program: error: password matches system password\n";
# Restore the file permissions.
unless (chmod(0440, $output_file)) {
print STDERR "$program: unable to set permissions on $output_file: $!"
;
}
exit 4; exit 4;
} else { } else {
print STDOUT "Please use a password that is different from your system p assword.\n"; print STDOUT "Please use a password that is different from your system p assword.\n";
return get_passwd(name => $name); return get_passwd(name => $name);
} }
} }
} }
return "" if ($args{'allow_blank'} and $passwd eq ""); return "" if ($args{'allow_blank'} and $passwd eq "");
 End of changes. 10 change blocks. 
7 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)