htpassword: disallow empty passwords

[TODO: allow a callback for a password checking function, such as
"passwd_policy_check".  Question is where the function would go.
~/.gitolite.rc is the only possible place among the current set of files
but I'd rather leave that as a list of simple name=value lines for all
sorts of reasons.  So maybe something like ~/.gitolite.pm (analogous to
the "gitolite.pm" in the sources I supply), which would get "require'd"
if found, and would contain all user-defined functions like this one...
needs some thinking about]
This commit is contained in:
Sitaram Chamarty 2010-02-14 09:51:51 +05:30
parent 690604d79a
commit 83a017f884

View file

@ -457,6 +457,7 @@ EOFhtp
my $password = <>; my $password = <>;
$password =~ s/[\n\r]*$//; $password =~ s/[\n\r]*$//;
die "empty passwords are not allowed\n" unless $password;
my $rc = system("htpasswd", "-b", $HTPASSWD_FILE, $ENV{GL_USER}, $password); my $rc = system("htpasswd", "-b", $HTPASSWD_FILE, $ENV{GL_USER}, $password);
die "htpasswd command seems to have failed with $rc return code...\n" if $rc; die "htpasswd command seems to have failed with $rc return code...\n" if $rc;
} }