/usr/bin/sendpage-db is in sendpage-client 1.0.3-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
#
# dbi is the tool that will assist in loading data into a database
#
# $Id: sendpage-db 316 2008-01-03 20:21:19Z keescook $
#
# Copyright (C) 2004 Todd T. Fries
# todd@fries.net, http://FreeDaemonConsulting.com/
#
# 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 the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
=head1 NAME
sendpage-db - manipulate Sendpage recipient database
=head1 SYNOPSIS
sendpage-db [OPTIONS]
=head1 OPTIONS
=over 4
=item -c DB_TYPE
Specify the database connection type (e.g. "dbi:mysql").
=item -U DB_USER
Specify the database user to connect as (e.g. "sendpage").
=item -P DB_PASS
Specify the database password use when connecting.
=item -a
Add an entry to the database, reading from stdin.
=item -d
Delete an entry to the database, reading from stdin.
=item -p
Show all database entries.
=item -v
Run in verbose mode.
=item -h
Display a summary of all the available command line options.
=back
=head1 DESCRIPTION
This tool is used to manipulate the recipient database that can be
optionally used by Sendpage.
=head1 AUTHOR
Todd T. Fries <todd@fries.net>
=head1 COPYRIGHT
sendpage-db is free software; it can be used under the terms of the GNU General
Public License.
=head1 SEE ALSO
perl(1), sendpage(1), snpp(1)
=cut
use Getopt::Std;
use Sendpage::Db;
getopts('hpadvtc:U:P:');
if ($opt_c) {
$dbtype = $opt_c;
} else {
$dbtype = "dbi:mysql:database=test;host=localhost;port=3306";
}
if ($opt_U) {
$dbuser = $opt_U;
}
if ($opt_P) {
$dbpass = $opt_P;
}
my $db = Sendpage::Db->new($dbtype,$dbuser,$dbpass);
sub HELP_MESSAGE {
printf STDERR "Usage: \n";
printf STDERR "-v verbose\n";
printf STDERR "-p show table entries\n";
printf STDERR "-a add an entry\n";
printf STDERR "-d remove an entry\n";
printf STDERR "-c <dbtype> database connection type, e.g. dbi:mysql:\n";
printf STDERR "-U <dbuser> database user (optional)\n";
printf STDERR "-P <dbpass> database password (optional)\n";
exit(0);
}
if ($opt_h) {
HELP_MESSAGE;
exit(0);
}
if ($opt_v) {
# verbose
$debug = 1;
} else {
$debug = 0;
}
if ($opt_p) {
$db->show;
exit(0);
}
if ($opt_a) {
while(<stdin>) {
($recip,$var,$value) = split(/ /,$_);
chomp($value);
if ($var eq "email-cc" or $var eq "dest") {
if($debug) {
print "adding $recip with $var = $value\n";
}
$db->update("$recip:$var",$value);
} else {
print "invalid synatx, parsed: ";
print "recip = $recip, var = $var, val = $value\n";
}
}
if($debug) {
$db->show;
}
exit(0);
}
if ($opt_d) {
while(<stdin>) {
chomp($recip = $_);
if($debug) {
print "deleting $recip info\n";
}
$db->delete("$recip:dest");
$db->delete("$recip:email-cc");
}
exit(0);
}
HELP_MESSAGE;
0;
|