/[BackupPC]/upstream/2.1.0/bin/BackupPC_serverMesg
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/2.1.0/bin/BackupPC_serverMesg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Jun 22 19:12:04 2005 UTC (18 years, 9 months ago) by dpavlin
File size: 2481 byte(s)
import of version 2.1.0

1 #!/bin/perl
2 #============================================================= -*-perl-*-
3 #
4 # BackupPC_serverMesg: Send one or more commands to the BackupPC server.
5 #
6 # DESCRIPTION
7 # As of v1.5.0 the BackupPC server communicates via a unix or internet
8 # domain socket. Every message is protected with an MD5 digest, based
9 # on a shared secret, a sequence number, and a per-connection unique
10 # key. This minimizes the risk of an attacked issuing fake commands
11 # to the BackupPC server.
12 #
13 # Previously, telnet could be used to talk to the BackupPC server.
14 # As of v1.5.0 that is no longer possible.
15 #
16 # This script replaces telnet as a mechanism for sending BackupPC
17 # messages. Usage:
18 #
19 # BackupPC_serverMesg mesg
20 #
21 # Example:
22 # BackupPC_serverMesg status info
23 #
24 # AUTHOR
25 # Craig Barratt <cbarratt@users.sourceforge.net>
26 #
27 # COPYRIGHT
28 # Copyright (C) 2001-2003 Craig Barratt
29 #
30 # This program is free software; you can redistribute it and/or modify
31 # it under the terms of the GNU General Public License as published by
32 # the Free Software Foundation; either version 2 of the License, or
33 # (at your option) any later version.
34 #
35 # This program is distributed in the hope that it will be useful,
36 # but WITHOUT ANY WARRANTY; without even the implied warranty of
37 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 # GNU General Public License for more details.
39 #
40 # You should have received a copy of the GNU General Public License
41 # along with this program; if not, write to the Free Software
42 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
43 #
44 #========================================================================
45 #
46 # Version 2.1.0, released 20 Jun 2004.
47 #
48 # See http://backuppc.sourceforge.net.
49 #
50 #========================================================================
51
52 use strict;
53 no utf8;
54 use lib "__INSTALLDIR__/lib";
55 use BackupPC::Lib;
56 use BackupPC::FileZIO;
57
58 use File::Find;
59 use File::Path;
60 use Data::Dumper;
61
62 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
63 my $TopDir = $bpc->TopDir();
64 my $BinDir = $bpc->BinDir();
65 my %Conf = $bpc->Conf();
66
67 $bpc->ChildInit();
68
69 if ( !@ARGV ) {
70 print("usage: $0 mesg\n");
71 exit(1);
72 }
73
74 my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort});
75 if ( $err ) {
76 print("Can't connect to server ($err)\n");
77 exit(1);
78 }
79 my $reply = $bpc->ServerMesg(join(" ", @ARGV));
80 print("Got reply: $reply");

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26