.IR sql_driver ]
.RB [ \-b
.IR database ]
+.RB [ \-f
+.IR file ]
.RB [ \-h
.IR host ]
.RB [ \-u
Driver to use: mysql, pg, oracle.
.IP "\-b \fIdatabase\fP"
Name of the database to use.
+.IP "\-f \fIfile\fP"
+Read password from file, instead of command line.
.IP "\-h \fIhost\fP"
Connect to host.
.IP "\-u \fIuser\fP"
-1 One-shot mode: push the file to database and exit.
-b database Name of the database to use.
-d sql_driver Driver to use: mysql, pg, oracle.
+ -f file Read password from file, instead of command line.
-h host Connect to host.
-P port Port number to use for connection.
-p passord Password to use when connecting to server.
p => 'radius',
u => 'radius',
);
-my $ret = getopts("b:d:fh:P:p:u:x1?", \%args);
+my $ret = getopts("b:d:f:h:P:p:u:x1?", \%args);
if (!$ret or @ARGV != 1) {
usage();
exit 1;
}
$data_source .= ";port=$args{P}" if $args{'P'};
+my $pw;
+if($args{f}) {
+ open(FILE, "< $args{f}") or die "error: Couldn't open $args{f}: $!\n";
+ $pw = <FILE>;
+ chomp($pw);
+ close(FILE);
+} else {
+ # args{p} is always defined.
+ $pw = $args{p};
+}
+
$SIG{INT} = \&got_signal;
$SIG{TERM} = \&got_signal;
my %dbinfo = (
base => $data_source,
user => $args{u},
- pass => $args{p},
+ pass => $pw,
);
connect_wait(\%dbinfo);