6 use lib
$ENV{GL_LIBDIR
};
11 Usage: ssh git@host htpasswd
13 Sets your htpasswd, assuming your admin has enabled it.
15 (Admins: You need to add HTPASSWD_FILE to the rc file, pointing to an
16 existing, writable, but possibly an initially empty, file, as well as adding
17 'htpasswd' to the ENABLE list).
20 # usage and sanity checks
21 usage
() if @ARGV and $ARGV[0] eq '-h';
22 $ENV{GL_USER
} or _die
"GL_USER not set";
23 my $htpasswd_file = $rc{HTPASSWD_FILE
} || '';
24 die "htpasswd not enabled\n" unless $htpasswd_file;
25 die "$htpasswd_file doesn't exist or is not writable\n" unless -w
$htpasswd_file;
30 Please type in your new htpasswd at the prompt. You only have to type it once.
32 NOTE THAT THE PASSWORD WILL BE ECHOED, so please make sure no one is
33 shoulder-surfing, and make sure you clear your screen as well as scrollback
34 history after you're done (or close your terminal instance).
37 print "new htpasswd: ";
39 # get the password and run htpasswd
41 $password =~ s/[\n\r]*$//;
42 die "empty passwords are not allowed\n" unless $password;
43 my $res = system( "htpasswd", "-mb", $htpasswd_file, $ENV{GL_USER
}, $password );
44 die "htpasswd command seems to have failed with return code: $res.\n" if $res;