index bb3a305811ab71224ff3ba417d3f8b8ad193e405..002308e537d574d997c2268e4eeaea10f99f5e31 100644 (file)
# RETURNS: nothing
# DESCRIPTION: ????
#===============================================================================
-sub send_msg_hash2address {
+sub send_msg_hash2address ($$$){
my ($msg_hash, $address, $passwd) = @_ ;
# fetch header for logging
close $socket;
daemon_log("send '$header'-msg to $address", 1);
- daemon_log("$msg_xml", 5);
+ daemon_log("message:\n$msg_xml", 8);
return 0;
}
my ($msg, $my_cipher) = @_;
if(not defined $my_cipher) { print "no cipher object\n"; }
$msg = "\0"x(16-length($msg)%16).$msg;
- my $crypted_msg = $my_cipher->encrypt($msg);
- chomp($crypted_msg = &encode_base64($crypted_msg));
- return $crypted_msg;
+ $msg = $my_cipher->encrypt($msg);
+ chomp($msg = &encode_base64($msg));
+ return $msg;
}
# DESCRIPTION: decrypts the incoming message with the Crypt::Rijndael module
#===============================================================================
sub decrypt_msg {
- my ($crypted_msg, $my_cipher) = @_ ;
- $crypted_msg = &decode_base64($crypted_msg);
- my $msg = $my_cipher->decrypt($crypted_msg);
+ my ($msg, $my_cipher) = @_ ;
+ if(defined $msg && defined $my_cipher) {
+ $msg = &decode_base64($msg);
+ }
+ $msg = $my_cipher->decrypt($msg);
$msg =~ s/\0*//g;
return $msg;
}
if(not defined $socket) {
return;
}
- &daemon_log("open_socket:", 7);
- &daemon_log("\t$PeerAddr", 7);
+ &daemon_log("open_socket: $PeerAddr", 7);
return $socket;
}