Tadashi Okoshi
slash****@users*****
2005年 6月 28日 (火) 20:51:34 JST
Index: affelio/lib/Affelio/App/Admin/FriendsGraph.pm diff -u affelio/lib/Affelio/App/Admin/FriendsGraph.pm:1.5 affelio/lib/Affelio/App/Admin/FriendsGraph.pm:1.6 --- affelio/lib/Affelio/App/Admin/FriendsGraph.pm:1.5 Sun Jun 26 21:41:22 2005 +++ affelio/lib/Affelio/App/Admin/FriendsGraph.pm Tue Jun 28 20:51:34 2005 @@ -4,7 +4,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: FriendsGraph.pm,v 1.5 2005/06/26 12:41:22 slash5234 Exp $ +# $Id: FriendsGraph.pm,v 1.6 2005/06/28 11:51:34 slash5234 Exp $ package Affelio::App::Admin::FriendsGraph; { @@ -47,7 +47,6 @@ #Get peer's friends list. try{ my $ret = get_F2List(dest_uri =>"$peer_af_id/bin/xml-rpc-serv.cgi", - proto_ver => 1, timestamp => $last_updated); debug_print("FriendsGraph::retrieve: \tget_F2List finished."); debug_print("FriendsGraph::retrieve: \t[$ret]"); Index: affelio/lib/Affelio/App/Admin/Messaging.pm diff -u affelio/lib/Affelio/App/Admin/Messaging.pm:1.6 affelio/lib/Affelio/App/Admin/Messaging.pm:1.7 --- affelio/lib/Affelio/App/Admin/Messaging.pm:1.6 Tue Jun 28 16:44:52 2005 +++ affelio/lib/Affelio/App/Admin/Messaging.pm Tue Jun 28 20:51:34 2005 @@ -4,7 +4,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: Messaging.pm,v 1.6 2005/06/28 07:44:52 slash5234 Exp $ +# $Id: Messaging.pm,v 1.7 2005/06/28 11:51:34 slash5234 Exp $ package Affelio::App::Admin::Messaging; { @@ -50,8 +50,7 @@ my $ret=""; try{ - $ret = post_Message(proto_ver => "1", - dest_uri => "$msg_to/bin/xml-rpc-serv.cgi", + $ret = post_Message(dest_uri => "$msg_to/bin/xml-rpc-serv.cgi", src => $af->{site__web_root}, password => $passAB, msg_from => $af->{site__web_root}, @@ -182,8 +181,8 @@ my $reply_body = $msg_body; $reply_body =~ s/\r\n/\n/g; $reply_body =~ s/\r/\n/g; - $reply_body =~ s/\n/>>\n/g; - $reply_body = "\r\n\r\n>>" . $reply_body; + $reply_body =~ s/\n/\n>>/g; + $reply_body = "\r\n>>" . $reply_body; my $reply_to=""; if($msg_from =~ /HREF="(.+)">/){ Index: affelio/lib/Affelio/App/Admin/SendHandshake.pm diff -u /dev/null affelio/lib/Affelio/App/Admin/SendHandshake.pm:1.1 --- /dev/null Tue Jun 28 20:51:34 2005 +++ affelio/lib/Affelio/App/Admin/SendHandshake.pm Tue Jun 28 20:51:34 2005 @@ -0,0 +1,118 @@ +# Affelio: Open social networking software +# Copyright 2004-2005 Fish Grove +# For more information, please refer following web site. +# http://affelio.jp/ (Japan) +# http://affelio.jp/ (USA and other area) +# +# $Id: SendHandshake.pm,v 1.1 2005/06/28 11:51:34 slash5234 Exp $ + +package Affelio::App::Admin::SendHandshake; +{ + use strict; + + use lib("../../../../extlib/"); + use Error qw(:try); + use Crypt::DH; + use lib("../../../"); + use Affelio; + use Affelio::misc::CGIError; + use Affelio::misc::Debug qw(debug_print); + use Affelio::misc::Encoding qw(db_encode db_decode); + use Affelio::misc::Time qw(timestamp2string get_timestamp); + use Affelio::misc::WebInput; + use Affelio::SNS::Handshaker_c; + use Affelio::SNS::Handshaker_tmpDB; + use Affelio::exception::CommunicationException; + + use Exporter; + @Affelio::App::Admin::SendHandshake::ISA = "Exporter"; + @Affelio::App::Admin::SendHandshake::EXPORT = qw (send); + + ####################################################################### + #send + ####################################################################### + sub send{ + my $af = shift; + my $cgi = shift; + my $output_ref = shift; + my $wi = new Affelio::misc::WebInput; + + debug_print("SendHandshake::send: start."); + + my $dest_uri = $wi->PTN_URL($cgi->param("dest_uri")); + my $my_mesg = $cgi->param("my_mesg"); + + debug_print("SendHandshake::send: $dest_uri"); + debug_print("SendHandshake::send: $my_mesg"); + + ###################### + #Remove "/" from the end of $dest_uri + ###################### + $dest_uri =~ s/\/$//; + debug_print("SendHandshake::send: $dest_uri\n"); + my $dest_xml_uri = $dest_uri . "/bin/xml-rpc-serv.cgi"; + debug_print("SendHandshake::send: $dest_xml_uri\n"); + + ########################################### + # Get current time; + my $cur_time = get_timestamp(); + + ########################################### + #DH key generation + my $mydh = Crypt::DH->new; + #RFC 2412 - The OAKLEY Key Determination Protocol + #Group 1: A 768 bit prime + my $DH_g="2"; + my $DH_p="1552518092300708935130918131258481755631334049434514313202351194902966239949102107258669453876591642442910007680288864229150803718918046342632727613031282983744380820890196288509170691316593175367469551763119843371637221007210577919"; + $mydh->g($DH_g); + $mydh->p($DH_p); + + #Step (1): create my public_key + $mydh->generate_keys; + my $my_DH_pub_key_str = $mydh->pub_key->bstr; + my $my_DH_pri_key_str = $mydh->priv_key->bstr; + + debug_print("SendHandshake::send: pri_key = $my_DH_pri_key_str [" . length($my_DH_pri_key_str) . "]digits"); + debug_print("SendHandshake::send: pub_key = $my_DH_pub_key_str [" . length($my_DH_pub_key_str) . "]digits"); + + + ########################################### + # Send HandShake to the URL + ########################################### + my $ret=""; + try{ + $ret = send_HandShake(dest_uri => $dest_xml_uri, + timestamp => $cur_time, + my_nickname => $af->{user__nickname}, + my_AFID => $af->{site__web_root}, + DH_pub_key_str => $my_DH_pub_key_str, + mesg => $my_mesg); + }catch Affelio::exception::NetworkException with{ + my $E = shift; + throw Affelio::exception::CommunicationException($E); + }; + if($ret->{flerror} == 1){ + #XML-RPC communication was successful. + #But the peer returned error. denyetc... + throw Affelio::exception::CommunicationException($@); + } + + ########################################### + # Save peer's info into pending_DB + ########################################### + my $tmpdb= new Affelio::SNS::Handshaker_tmpDB($af); + $tmpdb->add_sent_Handshake($cur_time, + $dest_xml_uri, + "", + $cur_time, + $my_DH_pri_key_str); + debug_print("SendHandshake::send: wrote DB $dest_uri => $cur_time\n"); + + $output_ref->{target_url} = $dest_uri; + $output_ref->{mypage_url} = "$af->{site__web_root}/admin.cgi"; + + return; + } + +} +1;