version 1.22, 2010/10/03 19:36:35 |
version 1.23, 2012/10/28 14:37:23 |
Line 10 if 0; # not running under some shell |
|
Line 10 if 0; # not running under some shell |
|
# Author: Dirk-Jan C. Binnema <djcb AT djcbsoftware.nl> |
# Author: Dirk-Jan C. Binnema <djcb AT djcbsoftware.nl> |
# Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> |
# Maintainer: Lubomir Host 'rajo' <rajo AT platon.sk> |
# Copyright (c) 2004 - 2005 Dirk-Jan C. Binnema |
# Copyright (c) 2004 - 2005 Dirk-Jan C. Binnema |
# Copyright (c) 2006 - 2009 Lubomir Host 'rajo' |
# Copyright (c) 2006 - 2012 Lubomir Host 'rajo' |
# |
# |
# Homepage: http://sendxmpp.platon.sk |
# Homepage: http://sendxmpp.hostname.sk |
# |
# |
# Released under the terms of the GNU General Public License v2 |
# Released under the terms of the GNU General Public License v2 |
# |
# |
# $Platon: sendxmpp/sendxmpp,v 1.21 2010-10-03 18:39:16 rajo Exp $ |
|
# $Id$ |
|
|
|
use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed |
use Authen::SASL qw(Perl); # authentication broken if Authen::SASL::Cyrus module installed |
use Net::XMPP; |
use Net::XMPP; |
Line 28 use open ':utf8'; |
|
Line 26 use open ':utf8'; |
|
use open ':std'; |
use open ':std'; |
|
|
# subroutines decls |
# subroutines decls |
sub xmpp_login($$$$$$$$$); |
sub xmpp_login($$$$$$$$$$$); |
sub xmpp_send ($$$$); |
sub xmpp_send ($$$$); |
sub xmpp_send_raw_xml($$); |
sub xmpp_send_raw_xml($$); |
sub xmpp_send_message($$$$$$); |
sub xmpp_send_message($$$$$$); |
|
|
$$cmdline{'username'} || $$config{'username'}, |
$$cmdline{'username'} || $$config{'username'}, |
$$cmdline{'password'} || $$config{'password'}, |
$$cmdline{'password'} || $$config{'password'}, |
$$cmdline{'component'}|| $$config{'component'}, |
$$cmdline{'component'}|| $$config{'component'}, |
$$cmdline{'resource'}, |
$$cmdline{'resource'}, |
$$cmdline{'tls'}, |
$$cmdline{'tls'} || $$config{'tls'}, |
|
$$cmdline{'no-tls-verify'} || $$config{'no-tls-verify'}, |
|
$$cmdline{'tls-ca-path'} || $$config{'tls-ca-path'} || '', |
$$cmdline{'ssl'}, |
$$cmdline{'ssl'}, |
$$cmdline{'debug'}) |
$$cmdline{'debug'}) |
or error_exit("cannot login: $!"); |
or error_exit("cannot login: $!"); |
Line 207 sub parse_cmdline () { |
|
Line 207 sub parse_cmdline () { |
|
usage() unless (scalar(@ARGV)); |
usage() unless (scalar(@ARGV)); |
|
|
my ($subject,$file,$resource,$jserver,$port,$username,$password,$component, |
my ($subject,$file,$resource,$jserver,$port,$username,$password,$component, |
$message, $chatroom, $headline, $debug, $tls, $ssl, $interactive, $help, $raw, $verbose); |
$message, $chatroom, $headline, $debug, $tls, $ssl, |
|
$no_tls_verify, $tls_ca_path, |
|
$interactive, $help, $raw, $verbose); |
my $res = GetOptions ('subject|s=s' => \$subject, |
my $res = GetOptions ('subject|s=s' => \$subject, |
'file|f=s' => \$file, |
'file|f=s' => \$file, |
'resource|r=s' => \$resource, |
'resource|r=s' => \$resource, |
Line 220 sub parse_cmdline () { |
|
Line 222 sub parse_cmdline () { |
|
'message-type=s' => \$message_type, |
'message-type=s' => \$message_type, |
'chatroom|c' => \$chatroom, |
'chatroom|c' => \$chatroom, |
'tls|t' => \$tls, |
'tls|t' => \$tls, |
|
'no-tls-verify|n' => \$no_tls_verify, |
|
'tls-ca-path|a=s' => \$tls_ca_path, |
'ssl|e' => \$ssl, |
'ssl|e' => \$ssl, |
'interactive|i' => \$interactive, |
'interactive|i' => \$interactive, |
'help|usage|h' => \$help, |
'help|usage|h' => \$help, |
Line 279 sub parse_cmdline () { |
|
Line 283 sub parse_cmdline () { |
|
'message-type' => $message_type, |
'message-type' => $message_type, |
'interactive' => ($interactive or 0), |
'interactive' => ($interactive or 0), |
'tls' => ($tls or 0), |
'tls' => ($tls or 0), |
|
'no-tls-verify' => ($no_tls_verify or 0), |
|
'tls-ca-path' => ($tls_ca_path or ''), |
'ssl' => ($ssl or 0), |
'ssl' => ($ssl or 0), |
'debug' => ($debug or 0), |
'debug' => ($debug or 0), |
'verbose' => ($verbose or 0), |
'verbose' => ($verbose or 0), |
Line 301 sub parse_cmdline () { |
|
Line 307 sub parse_cmdline () { |
|
# input: hostname,port,username,password,resource,tls,ssl,debug |
# input: hostname,port,username,password,resource,tls,ssl,debug |
# output: an XMPP connection object |
# output: an XMPP connection object |
# |
# |
sub xmpp_login ($$$$$$$$$) { |
sub xmpp_login ($$$$$$$$$$$) { |
|
|
my ($host, $port, $user, $pw, $comp, $res, $tls, $ssl, $debug) = @_; |
my ($host, $port, $user, $pw, $comp, $res, $tls, $no_tls_verify, $tls_ca_path, $ssl, $debug) = @_; |
my $cnx = new Net::XMPP::Client(debuglevel=>($debug?2:0)); |
my $cnx = new Net::XMPP::Client(debuglevel=>($debug?2:0)); |
error_exit "could not create XMPP client object: $!" |
error_exit "could not create XMPP client object: $!" |
unless ($cnx); |
unless ($cnx); |
|
|
|
my $ssl_verify = 0x01; |
|
if ($no_tls_verify) { $ssl_verify = 0x00; } |
|
debug_print "ssl_verify: $ssl_verify"; |
|
|
|
debug_print "tls_ca_path: $tls_ca_path"; |
|
|
my @res; |
my @res; |
my $arghash = { |
my $arghash = { |
hostname => $host, |
hostname => $host, |
port => $port, |
port => $port, |
tls => $tls, |
tls => $tls, |
|
ssl_verify => $ssl_verify, |
|
ssl_ca_path => $tls_ca_path, |
ssl => $ssl, |
ssl => $ssl, |
connectiontype => 'tcpip', |
connectiontype => 'tcpip', |
componentname => $comp |
componentname => $comp |
Line 595 Connect securely, using TLS |
|
Line 609 Connect securely, using TLS |
|
|
|
Connect securely, using SSL |
Connect securely, using SSL |
|
|
|
=item B<-n>,B<--no-tls-verify> |
|
|
|
Deactivate the verification of SSL certificates. Better way is to use parameter B<--tls-ca-path> with the needed path to CA certificates. |
|
|
|
=item B<-a>,B<--tls-ca-path> |
|
|
|
Path to your custom CA certificates, so you can verificate SSL certificates during connecting. |
|
|
=item B<-l>,B<--headline> |
=item B<-l>,B<--headline> |
|
|
Backward compatibility option. You should use B<--message-type=headline> instead. Send a headline type message (not stored in offline messages) |
Backward compatibility option. You should use B<--message-type=headline> instead. Send a headline type message (not stored in offline messages) |
Line 691 Documentation for the L<Net::XMPP> modul |
|
Line 713 Documentation for the L<Net::XMPP> modul |
|
|
|
The jabber homepage: L<http://www.jabber.org/> |
The jabber homepage: L<http://www.jabber.org/> |
|
|
The sendxmpp homepage: L<http://sendxmpp.platon.sk> |
The sendxmpp homepage: L<http://sendxmpp.hostname.sk> |
|
|
=head1 AUTHOR |
=head1 AUTHOR |
|
|
sendxmpp has been written by Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>, and uses |
sendxmpp has been written by Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>, and uses |
the L<Net::XMPP> modules written by Ryan Eatmon. Current maintainer is |
the L<Net::XMPP> modules written by Ryan Eatmon. Current maintainer is |
Lubomir Host 'rajo' <rajo AT platon.sk>, L<http://rajo.platon.sk> |
Lubomir Host 'rajo' <rajo AT platon.sk>, L<http://blog.hostname.sk> |
|
|
=cut |
=cut |