Commit 0d77887c authored by Martin Pitt's avatar Martin Pitt

rename pg_test_hba to pg_hba, add mode parameter

parent 747d3cf6
......@@ -12,11 +12,9 @@ Important features:
Wishlist:
- export environment variables in pg_wrapper (PGCLUSTER, etc.)
- Add pg_conf to change startup and possibly other things
- add programs for web applications, which configure pg_hba.conf:
- add program for web applications, which configure pg_hba.conf:
pg_add_hba [options] yourwebappdb yourwebappuser
pg_test_hba [options] yourwebappdb yourwebappuser
pg_remove_hba [options] yourwebappdb yourwebappuser
pg_hba add|remove|test [options] yourwebappdb yourwebappuser
Options:
......@@ -28,8 +26,8 @@ Wishlist:
--force-ssl: If given, create a "hostssl" entry, otherwise a "host"
entry
For pg_remove_hba, only --cluster is allowed; it will remove all hba
entries that refer to the given db/user pair. pg_test_hba checks whether the
For remove, only --cluster is allowed; it will remove all hba
entries that refer to the given db/user pair. test checks whether the
given connection is allowed; if so, it exits with 0, otherwise it prints the
required pg_hba.conf line to stdout and exits with 1. If pg_hba.conf has a
scrambled format that cannot be parsed by pg_*_hba, the scripts exit with 2.
......
......@@ -17,7 +17,7 @@ my %valid_methods = qw/trust 1 reject 1 md5 1 crypt 1 password 1 krb5 1 ident 1
my $ip = ''; # default to local unix socket
my $force_ssl = 0;
my ($method, $ver_cluster, $db, $user);
my $mode = (split '/', $0)[-1];
my $mode;
my @hba;
# Print an error message to stderr and exit with status 2
......@@ -158,11 +158,11 @@ exit 3 unless GetOptions (
'force-ssl' => \$force_ssl
);
if ($#ARGV != 1) {
print STDERR "Usage: $mode [options] <database> <user>\n";
if ($#ARGV != 2) {
print STDERR "Usage: $0 mode [options] <database> <user>\n";
exit 2;
}
($db, $user) = @ARGV;
($mode, $db, $user) = @ARGV;
error2 '--cluster must be specified' unless $ver_cluster;
my ($version, $cluster) = split ('/', $ver_cluster);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment