[Affelio-cvs 644] CVS update: affelio_farm/admin/skelton/affelio/bin

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 10月 25日 (火) 04:20:47 JST


Index: affelio_farm/admin/skelton/affelio/bin/get_content.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/get_content.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/get_content.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/get_content.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/get_content.cgi	Tue Oct 25 04:20:47 2005
@@ -1,288 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-
-# $Id: get_content.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-
-$| = 1;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-$CGI::DISABLE_UPLOADS = 1;
-$CGI::POST_MAX = 102_400;
-use CGI::Session qw(-ip_match);
-use HTML::Template;
-use Error qw(:try);
-
-use lib("../lib");
-use Affelio;
-use Affelio::App::FriendRoutines qw(get_summed_permission_list);
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug qw(debug_print);
-use Affelio::misc::MyCrypt qw(url_decode msg_decrypt);
-use Affelio::misc::Time qw(get_timestamp);
-use Affelio::misc::NetMisc qw(get_remote_host);
-use Affelio::misc::WebInput;
-
-debug_print("get_content: start.\n");
-
-############################################################################
-#Load Affelio and CGI
-############################################################################
-my $q = new CGI;
-my $cfg_dir = "../config/";
-my $af = new Affelio(ConfigDir => $cfg_dir);
-debug_print("get_content.cgi: AF loaded.");
-my $wi = new Affelio::misc::WebInput(); 
-
-
-############################################################################
-#Retrieve args
-############################################################################
-my $module = $wi->PTN_word($q->param("module"));
-if($module eq "" || !defined($module)){
-	error($q,"Input parameters are not defined.(module)");
-}
-
-my $content = $wi->PTN_getcontent_content($q->param("content"));
-if($content eq "" || !defined($content)){
-	error($q,"Input parameters are not defined.(content)");
-}
-
-
-############################################################################
-#Check session w/ cookie
-############################################################################
-my $q = new CGI;
-my $sid = $q->cookie("affelio-$af->{user__nickname}");
-my $ck_visitor_type=0;
-my $ck_visitor_type_str="pb"; 
-my $ck_visitor_afid = "";
-my $session;
-if($sid ==0 || !defined($sid)){
-}else{
-    $session = new CGI::Session(undef, 
-				$sid, 
-				{Directory=> $af->{site__session_dir}});
-    
-    if(!$session){
-	debug_print("get_content: session not found. [pb]");
-	$ck_visitor_type=0;
-	$ck_visitor_type_str="pb"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }elsif($session->param("type") eq "self"){
-	debug_print("get_content: session found. [self]");
-	$ck_visitor_type=3; 
-	$ck_visitor_type_str="self"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }elsif($session->param("type") eq "f1"){
-	debug_print("get_content: session found. [f1]");
-	$ck_visitor_type=2; 
-	$ck_visitor_type_str="f1"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }elsif($session->param("type") eq "f2"){
-	debug_print("get_content: session found. [f2]");
-	$ck_visitor_type=1; 
-	$ck_visitor_type_str="f2"; 
-	$ck_visitor_afid = $session->param("user_afid");
-    }
-}
-debug_print("get_content: After cookie checking...");
-debug_print("get_content: \t visitor_type =[$ck_visitor_type] [$ck_visitor_type_str]");
-debug_print("get_content: \t visitor_afid =[$ck_visitor_afid]");
-
-
-############################################################################
-#CFID check
-############################################################################
-my $CFID_timestamp;
-my $CFID_expire;
-my $CFID_remotehost;
-my $CFID_visitor_afid;
-my $CFID_visitor_type=0;
-my $CFID_visitor_type_str="pb";
-
-if( ($ck_visitor_type <= 2) 
-    && ( $q->param("referrer") ne "")
-    && ( $q->param("cfid") ne "" )       
-    ){
-
-    my $referrer = $wi->PTN_URL($q->param("referrer"));
-    debug_print("get_content: referrer = $referrer\n");   #referrer URL
-
-    my $passAB = $af->{fm}->get_attribute_by_afid($referrer, "password");
-    if($passAB eq "" || !defined($passAB)){
-	error($q,"Parameters are not defined. (1): Your peer does not have shared password with you...");
-    }
-
-    my $cfid = msg_decrypt( url_decode($q->param("cfid") ) , $passAB) ;
-    if($cfid eq "" || !defined($cfid)){
-	error($q,"Parameters are not defined. (2): Invalid encryption: After decryption, we could not valid your encrypted message...");
-    }
-
-    #######################################################################
-    #Check cfid
-    ($CFID_timestamp, $CFID_expire, $CFID_remotehost, $CFID_visitor_afid, $CFID_visitor_type_str) = split('\*', $cfid);
-
-    #check timestamp
-    #check expire
-    #check remotehost
-    #check visitor_afid
-
-    debug_print("get_content: Information extracted from CFID");
-    debug_print("get_content: \ttimestamp    =$CFID_timestamp\n");
-    debug_print("get_content: \texpire       =$CFID_expire\n");
-    debug_print("get_content: \tremote_host  =$CFID_remotehost\n");
-    debug_print("get_content: \tvisitor_afid =$CFID_visitor_afid\n");
-    debug_print("get_content: \tvisitor_type(original) =$CFID_visitor_type_str\n");
-
-    #check visitor_type_str
-    if($CFID_visitor_type_str eq "self") { 
-	$CFID_visitor_type_str = "f1";
-	$CFID_visitor_type =2;
-    }elsif($CFID_visitor_type_str eq "f1") { 
-	$CFID_visitor_type_str = "f2";
-	$CFID_visitor_type =1;
-    }else{
-	$CFID_visitor_type_str = "pb";
-	$CFID_visitor_type =0;
-    }
-    debug_print("get_content: \tvisitor_type(decreased) =$CFID_visitor_type_str\n");
-
-}
-
-############################################################################
-#Well, after all, who is it?
-############################################################################
-my $visitor_type=0;              #3=self 2=f1 1=f2 0=pb
-my $visitor_type_str="pb";
-my $visitor_afid="";
-
-if($ck_visitor_type == 3){
-
-    $visitor_type = $ck_visitor_type;
-    $visitor_type_str = $ck_visitor_type_str;
-    $visitor_afid = $ck_visitor_afid;
-
-}elsif($ck_visitor_type > $CFID_visitor_type){
-
-    $visitor_type = $ck_visitor_type;
-    $visitor_type_str = $ck_visitor_type_str;
-    $visitor_afid = $ck_visitor_afid;
-
-}else{
-
-    $visitor_type = $CFID_visitor_type;
-    $visitor_type_str = $CFID_visitor_type_str;
-    $visitor_afid = $CFID_visitor_afid;
-}
-
-#######################################
-#Is this visitor a friend of this site?
-
-if($visitor_type < 3){
-    my $tmp1 = $af->{fm}->get_attribute_by_afid($visitor_afid, "password");
-
-    if($tmp1 ne ""){
-	$visitor_type = 2;  
-	$visitor_type_str="f1"; 
-	$visitor_afid = $CFID_visitor_afid;
-    }
-}
-
-debug_print("get_content: Finally...");
-debug_print("get_content: \tvisitor_type = [$visitor_type] [$visitor_type_str]");
-debug_print("get_content: \tvisitor_type = [$visitor_afid]");
-debug_print("get_content: \tmodule    = [$module]\n");
-debug_print("get_content: \tcontent   = [$content]\n");
-
-
-############################################################################
-#Output content
-############################################################################
-if($module eq "core"){
-
-    if($content eq "/profile/profile_face.jpg"){
-
-	#Get summarized permission list for the given user
-	my @list 
-	    =  get_summed_permission_list($af, 
-					  $visitor_afid, 
-					  $visitor_type_str);
-
-	debug_print("get_content: Got summarized permission...");
-	debug_print("get_content: \t[@list]");
-
-	my $permission = $list[5] ;
-	debug_print("get_content: Pic perm: $permission");
-
-	my $actual_file="";
-	if( $permission ==1)
-	{
-	    $actual_file = "$af->{site__user_dir}/profile_face.jpg";
-	}else{
-	    $actual_file = "$af->{site__fs_root}/skins/$af->{userpref__skin}/0_face.jpg";
-	}
-	debug_print("/profile/profile_face.jpg => $actual_file");
-	open(IMG, "< $actual_file");
-	print "Content-type: image/jpeg\n";
-	print "Pragma: no-cache\n\n"; 
-	binmode (IMG);
-	binmode (STDOUT);
-	print <IMG>;
-	close IMG;
-	
-    }
-
-    if($content eq "/profile/mystatus"){
-
-	debug_print("get_content: mystatus!");
-	my $mystatus="&nbsp;";
-	if( $visitor_type >= 2){
-	    $mystatus = $af->{user__currentstatus};
-	}
-	print "Content-type:application/x-javascript\n\n";
-	print "document.write(\"$mystatus\");";
-	print "\n\n";
-	exit(1);
-    }
-
-    if($content eq "/profile/mystatus_iframe"){
-
-	debug_print("get_content: mystatus!");
-	my $mystatus="&nbsp;";
-	if( $visitor_type >= 2){
-	    $mystatus = $af->{user__currentstatus};
-	}
-	print "Content-type: text/html; charset=UTF-8\n";
-	print "Pragma: no-cache\n\n"; 
-
-	# " ni kiwo tsukero!!!! escape! escape! " --> \"
-        print "<HTML><body TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0><div style=\"margin:0px; padding:0px; font-family:sans-serif; font-size:xx-small;\">$mystatus</div></body></HTML>";
-	debug_print("get_content: mystatus!");
-	exit(1);
-    }
-
-    print "Content-type: text/html; charset=UTF-8\n";
-    print "Pragma: no-cache\n\n"; 
-    print "<HTML></HTML>";
-    exit(1);
-
-}
-exit(1);
Index: affelio_farm/admin/skelton/affelio/bin/loginexec.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/loginexec.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/loginexec.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/loginexec.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/loginexec.cgi	Tue Oct 25 04:20:47 2005
@@ -1,136 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-#
-# $Id: loginexec.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-$CGI::DISABLE_UPLOADS = 1;
-$CGI::POST_MAX = 102_400;
-use CGI::Session qw(-ip_match);
-use HTML::Template;
-use Error qw(:try);
-
-use lib("../lib");
-use Affelio;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::Time;
-use Affelio::misc::NetMisc;
-use Affelio::misc::MyCrypt;
-use Affelio::misc::WebInput;
-use Affelio::SNS::Handshaker_c;
-
-my $q = new CGI;
-
-############################################################################
-#Load Affelio
-############################################################################
-my $cfg_dir = "../config/";
-my $af;
-try{
-    $af = new Affelio(ConfigDir => $cfg_dir);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio load error.\n" . $e);
-};
-my $wi = new Affelio::misc::WebInput;
-
-############################################################################
-#Authentication check
-############################################################################
-my $username = $wi->PTN_word($q->param("username"));
-my $password = $wi->PTN_through($q->param("password"));
-my $forward_URL = $wi->PTN_URL($q->param("forward_URL"));
-
-debug_print("  username = $username\n");
-debug_print("  password = $password\n");
-debug_print("  $af->{site__password}\n");
-debug_print("  $forward_URL\n");
-
-if(  (verify_password($password, $af->{site__password}) > 0) 
-     && ($username eq $af->{site__username})                  ){
-
-    debug_print("loginexec.cgi: AUTH Ok.\n");
-    #login OK
-}else{
-
-    #login failed.
-    debug_print("loginexec.cgi: AUTH NG.\n");
-
-    my $TMPL_FILE 
-	= "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/loginfailed.tmpl";
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE);
-    $tmpl->param(web_root => $af->{site__web_root});
-    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-    print "Content-type: text/html; charset=UTF-8\n\n";
-    print $af->translate_templateL10N($tmpl->output);
-
-    debug_print("loginexec.cgi: exit(1).\n");    
-    exit(1);
-}
-
-
-############################################################################
-#Startup session
-############################################################################
-my $ss = new CGI::Session("driver:File", 
-			  undef, 
-			  {Directory=> $af->{site__session_dir}});
-
-#Set values into session
-$ss->param("user_afid", $af->{site__web_root});
-$ss->param("user_nickname", $af->{user__nickname});
-$ss->param("type", "self");
-#current time
-#expire time
-
-$ss->expire('+12h');
-
-debug_print("loginexec.cgi: startup_session finished.\n");    
-
-
-############################################################################
-#Output
-############################################################################
-
-#Retrieve a sesion_id
-my $session_id = $ss->id();
-
-#Prepare a cookie with the session_id
-my $cookie = $q->cookie ( -name => "affelio-$af->{user__nickname}",
-                          -value => $session_id,
-                          -path => URL2path($af->{site__web_root}));
-
-debug_print("loginexec.cgi: new cookie [$session_id]\n");
-debug_print("loginexec.cgi: new cookie [" . URL2domain($af->{site__web_root}) .  "]\n");
-debug_print("loginexec.cgi: new cookie [" . URL2path($af->{site__web_root}) .  "]\n");
-
-
-#Print output
-if($forward_URL ne ""){
-    print $q->redirect( -url => $forward_URL,
-			-cookie => $cookie);
-}else{
-    print $q->redirect( -url => "$af->{site__web_root}/admin.cgi",
-			-cookie => $cookie);
-}
-
-exit(1);
Index: affelio_farm/admin/skelton/affelio/bin/logoutexec.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/logoutexec.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/logoutexec.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/logoutexec.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/logoutexec.cgi	Tue Oct 25 04:20:47 2005
@@ -1,78 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-#
-# $Id: logoutexec.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-
-use lib("../extlib");
-use CGI qw(-unique_headers);
-$CGI::DISABLE_UPLOADS = 1;
-$CGI::POST_MAX = 102_400;
-use CGI::Session qw(-ip_match);
-use HTML::Template;
-use Error qw(:try);
-
-use lib("../lib");
-use Affelio;
-use Affelio::SNS::Handshaker_c;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::NetMisc;
-use Affelio::misc::MyCrypt;
-use Affelio::misc::Time;
-
-my $q = new CGI;
-############################################################################
-#Load Affelio
-############################################################################
-my $cfg_dir = "../config/";
-my $af;
-try{
-    $af = new Affelio(ConfigDir => $cfg_dir);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio load error.\n" . $e);
-};
-my $wi = new Affelio::misc::WebInput;
-
-############################################################################
-#Check session w/ cookie
-############################################################################
-my $sid = $q->cookie("affelio-$af->{user__nickname}");
-my $session = new CGI::Session(undef, 
-			       $sid, 
-			       {Directory=> $af->{site__session_dir}});
-
-
-if($session){
-    #Output expired cookie and redirect the user to index.
-    $session->delete();
-    undef($session);
-
-    #Output expired cookie and redirect the user to index.
-    my $cookie = $q->cookie ( -name => "affelio-$af->{user__nickname}",
-                              -value => $sid,
-                              -path => URL2path($af->{site__web_root}),
-                              -expires => "-1d"
-			      );
-
-    print $q->redirect( -url => $af->{site__web_root},
-                        -cookie => $cookie);
-
-}
Index: affelio_farm/admin/skelton/affelio/bin/recv_mail_ack.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/recv_mail_ack.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/recv_mail_ack.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/recv_mail_ack.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/recv_mail_ack.cgi	Tue Oct 25 04:20:47 2005
@@ -1,205 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-
-# $Id: recv_mail_ack.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-use lib("../extlib");
-use CGI qw(-unique_headers);
-$CGI::DISABLE_UPLOADS = 1;
-$CGI::POST_MAX = 102_400;
-use CGI::Session qw(-ip_match);
-use HTML::Template;
-use File::Copy;
-use Math::BigInt;
-use Crypt::DH;
-use Error qw(:try);
-
-use lib("../lib/");
-use Affelio;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::MyCrypt;
-use Affelio::SNS::Handshaker_c;
-use Affelio::SNS::Handshaker_tmpDB;
-use Affelio::exception::Exception;
-use Affelio::exception::IOException;
-use Affelio::misc::WebInput;
-
-my $q = new CGI;
-
-############################################################################
-#Load Affelio
-my $cfg_dir = "../config/";
-my $af;
-try{
-    $af = new Affelio(ConfigDir => $cfg_dir);
-}catch Error with{
-    my $e = shift;
-    error($q, "Affelio load error.\n" . $e);
-};
-my $wi = new Affelio::misc::WebInput;
-
-############################################################################
-#Sesion check (as admin)
-my $sid = $q->cookie("affelio-$af->{user__nickname}");
-my $session = new CGI::Session(undef, 
-			       $sid, 
-			       {Directory=> $af->{site__session_dir}});
-
-my $TMPL_FILE="";
-if( (!$session) || ($session->param("type") ne "self")  ){
-    # Is the session alive?
-    # Is the user the admin of this site?
-    # if not....
-    debug_print("recv_mail_ack.cgi: login is needed.");
-
-    $TMPL_FILE 
-	= "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/login.tmpl";
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE,
-				   die_on_bad_params => 0);
-    $tmpl->param(reason_msg => "You haven't been authenticated.");
-    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}/owner_side/");
-    print "Content-type: text/html; charset=UTF-8\n\n";
-    print $af->translate_templateL10N($tmpl->output);
-    exit(1);
-}
-debug_print("recv_mail_ack.cgi: Session as the admin is OK.");
-
-
-############################################################################
-#Read CGI input
-my $session_id="";
-$session_id = $wi->PTN_word($q->param("id"));
-if(!$session_id){
-    die "id is not defined. [$session_id]";
-}
-debug_print("recv_mail_ack: $session_id\n");
-
-
-############################################################################
-#Read temporarily-saved session
-my $dummy;
-my $timestamp;
-my $peer_af_id;
-my $peer_name;
-my $peer_nickname;
-my $peer_DH_pub_key_str;
-my $peer_DH_pub_key;
-
-############################################################################
-#remove a record from tmpDB
-my $tmpdb= new Affelio::SNS::Handshaker_tmpDB($af);
-my @ret= $tmpdb->remove_received_Handshake($session_id);
-
-if(!defined(@ret)){
-    #No such session exists!!
-    debug_print("recv_mail_ack: session not found.\n");
-    error($q, "Affelio load error.\nNo such session exists!");
-}else{
-    ($dummy, $timestamp, $peer_af_id, 
-     $peer_nickname, $peer_DH_pub_key_str) = @ret;
-
-    $peer_DH_pub_key = Math::BigInt->new($peer_DH_pub_key_str);
-}
-debug_print("recv_mail_ack: $session_id, $timestamp, $peer_af_id, $peer_nickname, $peer_DH_pub_key_str\n");
-
-############################################################################
-#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 = $mydh->pub_key;
-my $my_DH_pub_key_str = $mydh->pub_key->bstr;
-
-
-############################################################################
-#send FriendshipReply 
-my $ret="";
-try{
-    $ret = reply_HandShake(dest_uri => "$peer_af_id/bin/xml-rpc-serv.cgi",
-			   timestamp => $timestamp,
-			   my_nickname => $af->{user__nickname},
-			   my_domain => $af->{user__domain},
-			   my_AFID => $af->{site__web_root},
-			   DH_pub_key_str => $my_DH_pub_key_str
-			   );
-}catch Error with {
-    my $E = shift;
-    error($q, "HandShake reply output an error!\n$E");
-};
-
-debug_print("recv_mail_ack: reply_HandShake finished.");
-
-############################################################################
-#generate Password
-my $pass = $mydh->compute_key($peer_DH_pub_key)->bstr;
-debug_print("recv_mail_ack: PASSWORD=[$pass]\n");
-
-
-############################################################################
-#Add peer to my friends list.
-try{
-    $af->{fm}->add_friend($peer_af_id, 
-			  $peer_nickname,
-			  $timestamp,
-			  $pass);
-}catch Error with{
-    my $E = shift;
-    error($q, "Error from FriendManager\n$E\n");
-};
-debug_print("recv_mail_ack: added to my friends list.");
-sleep(2);
-
-############################################################################
-#Get peer's friends list.
-try{
-    $ret = get_F2List(dest_uri =>  "$peer_af_id/bin/xml-rpc-serv.cgi",
-		      timestamp => 0);
-}catch Error with {
-    my $E = shift;
-    error($q, "HandShake was successful!\n But, get_F2List reply output an error!\n$E");
-};
-debug_print("recv_mail_ack: get_F2List finished.");
-debug_print("recv_mail_ack: List I've got is [$ret]");
-#
-#
-##################################################
-#Save the F2 list into my DB
-#$af->{fm}->save_F2List($ret, $peer_af_id);
-
-############################################################################
-#print output HTML
-my $TMPL_FILE = "../templates/$af->{site__template}/owner_side/mail_ack_recved.tmpl";
-my $tmpl = new HTML::Template( filename => $TMPL_FILE);
-$tmpl->param(peer_af_id => $peer_af_id);
-$tmpl->param(peer_nickname => $peer_nickname);
-$tmpl->param(home_url => $af->{site__web_root});
-$tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-
-print "Content-type: text/html; charset=UTF-8\n\n";
-print $af->translate_templateL10N($tmpl->output);
-
-
Index: affelio_farm/admin/skelton/affelio/bin/send_handshake.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/send_handshake.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/send_handshake.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/send_handshake.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/send_handshake.cgi	Tue Oct 25 04:20:47 2005
@@ -1,171 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-#
-# $Id: send_handshake.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-use lib("../extlib");
-use CGI qw(-unique_headers);
-$CGI::DISABLE_UPLOADS = 1;
-$CGI::POST_MAX = 102_400;
-use CGI::Session qw(-ip_match);
-use HTML::Template;
-use Fcntl qw( :DEFAULT :flock);
-use Crypt::DH;
-use Error qw(:try);
-
-use lib("../lib");
-use Affelio;
-use Affelio::misc::CGIError;
-use Affelio::misc::Debug;
-use Affelio::misc::Time qw(get_timestamp);
-use Affelio::misc::WebInput;
-use Affelio::SNS::Handshaker_c;
-use Affelio::SNS::Handshaker_tmpDB;
-use Affelio::exception::Exception;
-use Affelio::exception::IOException;
-
-############################################################################
-#Load Affelio
-my $cfg_dir = "../config/";
-my $af = new Affelio(ConfigDir => $cfg_dir);
-
-############################################################################
-#Sesion check (as admin)
-my $q = new CGI;
-my $sid = $q->cookie("affelio-$af->{user__nickname}");
-my $session = new CGI::Session(undef, 
-			       $sid, 
-			       {Directory=> $af->{site__session_dir}});
-
-my $TMPL_FILE="";
-if( (!$session) || ($session->param("type") ne "self")  ){
-    # Is the session alive?
-    # Is the user the admin of this site?
-    # if not....
-    debug_print("send_handshake.cgi: login is needed.");
-
-    $TMPL_FILE 
-	= "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/login.tmpl";
-    my $tmpl = new HTML::Template( filename => $TMPL_FILE,
-				   die_on_bad_params => 0);
-    $tmpl->param(reason_msg => "You haven't been authenticated.");
-    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}/owner_side/");
-    print "Content-type: text/html; charset=UTF-8\n\n";
-    print $af->translate_templateL10N($tmpl->output);
-    exit(1);
-}
-debug_print("send_handshake.cgi: Session as the admin is OK.");
-
-############################################################################
-#Read input
-my $target_url="";
-my $target_xml_url="";
-
-$target_url = $q->param("URL");
-if(!$target_url){
-    error($q,"Target URL is not defined.");
-}
-
-######################
-#Distill valid URL
-######################
-my $wi = new Affelio::misc::WebInput;
-$target_url = $wi->PTN_URL($target_url);
-if($target_url eq ""){
-    error($q,"Target URL is invalid!!");
-}
-
-######################
-#Remove "/" from the end of $target_url
-######################
-$target_url =~ s/\/$//;
-debug_print("send_HandShake: $target_url\n");
-$target_xml_url = $target_url . "/bin/xml-rpc-serv.cgi";
-debug_print("send_HandShake: $target_xml_url\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("send_HandShake: pri_key = $my_DH_pri_key_str [" . length($my_DH_pri_key_str) . "]digits");
-debug_print("send_HandShake: 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 =>  $target_xml_url, 
-			  timestamp => $cur_time,
-			  my_nickname =>  $af->{user__nickname},
-			  my_AFID  =>  $af->{site__web_root},
-			  DH_pub_key_str => $my_DH_pub_key_str
-			  );
-}catch Affelio::exception::IOException with{
-    my $E = shift;
-    error($q, "<PRE>" . $E . "</PRE>");
-}catch Affelio::exception::Exception with{
-    my $E = shift;
-    error($q, "<PRE>" . $E .  "</PRE>");
-};
-if($ret->{flerror} == 1){
-    #XML-RPC communication was successful. 
-    #But the peer returned error. denyetc...
-    error($q, "<PRE>XML-RPC peer denied RPC.</PRE>");
-}
-
-
-###########################################
-# Save peer's info into pending_DB
-my $tmpdb= new Affelio::SNS::Handshaker_tmpDB($af);
-$tmpdb->add_sent_Handshake($cur_time,
-			   $target_xml_url,
-			   "",
-			   $cur_time,
-			   $my_DH_pri_key_str);
-debug_print("send_HandShake: DB(W) $target_url => $cur_time\n");
-
-
-###########################################
-# Print output
-my $TMPL_FILE = "../templates/$af->{site__template}/owner_side/handshake_sent.tmpl";
-my $tmpl = new HTML::Template( filename => $TMPL_FILE);
-$tmpl->param(target_url => $target_url);
-$tmpl->param(mypage_url => "$af->{site__web_root}/admin.cgi");
-$tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-
-print "Content-type: text/html; charset=UTF-8\n\n";
-print $af->translate_templateL10N($tmpl->output);
-
Index: affelio_farm/admin/skelton/affelio/bin/xml-rpc-serv.cgi
diff -u affelio_farm/admin/skelton/affelio/bin/xml-rpc-serv.cgi:1.1.1.1 affelio_farm/admin/skelton/affelio/bin/xml-rpc-serv.cgi:removed
--- affelio_farm/admin/skelton/affelio/bin/xml-rpc-serv.cgi:1.1.1.1	Tue Oct 25 04:14:39 2005
+++ affelio_farm/admin/skelton/affelio/bin/xml-rpc-serv.cgi	Tue Oct 25 04:20:47 2005
@@ -1,48 +0,0 @@
-#!/usr/bin/perl
- 
-# Copyright (C) 2005 FishGrove Inc.
-#
-# 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.
-
-# $Id: xml-rpc-serv.cgi,v 1.1.1.1 2005/10/24 19:14:39 slash5234 Exp $
-
-use strict;
-
-my($AF_DIR);
-
-BEGIN {
-#    if ($0 =~ m!(.*[/\\])!) {
-#        $AF_DIR = $1;
-#    } else {
-        $AF_DIR = '../';
-#    }
-    unshift @INC, $AF_DIR . 'lib/';
-    unshift @INC, $AF_DIR . 'extlib/';
-}
-use XMLRPC::Transport::HTTP;
-use Affelio::SNS::Handshaker_s;
-
-$Affelio::SNS::Handshaker_s::AF_DIR = $AF_DIR;
-
-########################################################################
-{
-    local $SIG{__WARN__} = sub { };
-    my $server = XMLRPC::Transport::HTTP::CGI->new;
-    $server->dispatch_to('affelio');
-    $server->handle;
-}
-
-########################################################################
-


Affelio-cvs メーリングリストの案内
Back to archive index