Tadashi Okoshi
slash****@users*****
2005年 6月 30日 (木) 15:48:30 JST
Index: affelio/incoming.cgi diff -u affelio/incoming.cgi:1.1.1.1 affelio/incoming.cgi:1.2 --- affelio/incoming.cgi:1.1.1.1 Tue Jun 14 12:53:29 2005 +++ affelio/incoming.cgi Thu Jun 30 15:48:29 2005 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -T # Affelio: Open social networking software # Copyright 2004-2005 Fish Grove @@ -6,7 +6,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: incoming.cgi,v 1.1.1.1 2005/06/14 03:53:29 slash5234 Exp $ +# $Id: incoming.cgi,v 1.2 2005/06/30 06:48:29 slash5234 Exp $ use strict; @@ -16,6 +16,7 @@ $CGI::POST_MAX = 102_400; use CGI::Session qw(-ip_match); use HTML::Template; +use Error qw(:try); use lib("./lib"); use Affelio; @@ -25,14 +26,23 @@ use Affelio::misc::MyCrypt qw(msg_decrypt url_decode); use Affelio::misc::NetMisc; use Affelio::SNS::Handshaker_c; +use Affelio::misc::WebInput; + +debug_print("incoming.cgi: start."); +my $q = new CGI; ############################################################################ #Load Affelio, CGI ############################################################################ -debug_print("incoming.cgi: start."); my $cfg_dir = "."; -my $af = new Affelio(ConfigDir => $cfg_dir); -my $q = new CGI; +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(); my $sid = $q->cookie("affelio-$af->{user__nickname}"); my $session = new CGI::Session(undef, $sid, @@ -42,20 +52,23 @@ ############################################################################ #Get args ############################################################################ -my $forward_id = $q->url_param("forward_id"); -my $referrer = $q->param("referrer"); +my $forward_id = $wi->PTN_URL($q->url_param("forward_id")); +my $referrer = $wi->PTN_URL($q->param("referrer")); debug_print("incoming.cgi: forward_id =$forward_id"); - ############################################################################ #Load Friend manager and get passAB ############################################################################ -my $passAB = $af->{fm}->get_attribute_by_afid($referrer, "password"); +my $passAB; +try{ + $passAB = $af->{fm}->get_attribute_by_afid($referrer, "password"); +}catch Error with{ + my $e = shift; + error($q, "Error from FriendManager.\n" . $e); +}; debug_print("incoming.cgi: passAB=$passAB\n"); if(!defined($passAB) || $passAB eq ""){ - # I dont' have any password with $referrer URL - # i.e., $dest_URL is not my friend site. - exit(1); + error($q, "Affelio: Invalid forwarding. Shared key not found!"); } @@ -125,7 +138,6 @@ debug_print("incoming.cgi: cookie visitor_nickname = $ck_visitor_nickname"); debug_print("incoming.cgi: cookie visitor_afid = $ck_visitor_afid"); - if($session && ( (($ck_visitor_type eq "self") && ( $FID_visitor_type ne "self") ) || ( ($ck_visitor_type eq "f1") && @@ -147,18 +159,20 @@ ######################### # Startup a new session ######################### - debug_print("incoming.cgi: You don't have a cookie, or you have"); debug_print("incoming.cgi: a cookie with the same or lower rights."); debug_print("incoming.cgi: "); debug_print("incoming.cgi: Let's start up a session with a cooike."); #lookup our friend table with FID_visitorAFID - my $tmp1 = $af->{fm}->get_attribute_by_afid($FID_visitorAFID, "password"); - # - if($tmp1 ne ""){ - $FID_visitor_type="f1"; - } + my $tmp1; + try{ + $tmp1 = $af->{fm}->get_attribute_by_afid($FID_visitorAFID, "password"); + }catch Error with{ + my $e = shift; + error($q, "Error from FriendManager.\n" . $e); + }; + if($tmp1 ne ""){ $FID_visitor_type="f1"; } #Start up a sesion my $ss = new CGI::Session("driver:File", @@ -186,8 +200,6 @@ debug_print("incoming.cgi: new cookie [$session_id]\n"); debug_print("incoming.cgi: new cookie [" . URL2domain($af->{site__web_root}) . "]\n"); debug_print("incoming.cgi: new cookie [" . URL2path($af->{site__web_root}) . "]\n"); - - debug_print("incoming.cgi: New session has been established."); debug_print("incoming.cgi: user_type: " . $ss->param("type") ); debug_print("incoming.cgi: user_afid: " . $ss->param("user_afid") ); @@ -199,6 +211,3 @@ } exit(1); - - - Index: affelio/outgoing.cgi diff -u affelio/outgoing.cgi:1.2 affelio/outgoing.cgi:1.3 --- affelio/outgoing.cgi:1.2 Tue Jun 28 16:44:52 2005 +++ affelio/outgoing.cgi Thu Jun 30 15:48:29 2005 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -T # Affelio: Open social networking software # Copyright 2004-2005 Fish Grove @@ -6,7 +6,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: outgoing.cgi,v 1.2 2005/06/28 07:44:52 slash5234 Exp $ +# $Id: outgoing.cgi,v 1.3 2005/06/30 06:48:29 slash5234 Exp $ use strict; @@ -16,6 +16,7 @@ $CGI::POST_MAX = 102_400; use CGI::Session qw(-ip_match); use HTML::Template; +use Error qw(:try); use lib("./lib"); use Affelio; @@ -25,19 +26,27 @@ use Affelio::misc::Time; use Affelio::misc::MyCrypt; use Affelio::misc::NetMisc; +use Affelio::misc::WebInput; debug_print("outgoing.cgi: start.\n"); +my $q = new CGI; ############################################################################ #Load Affelio ############################################################################ my $cfg_dir = "."; -my $af = new Affelio(ConfigDir => $cfg_dir); +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 $q = new CGI; my $sid = $q->cookie("affelio-$af->{user__nickname}"); my $session = new CGI::Session(undef, $sid, @@ -69,16 +78,21 @@ ######################################### # Retrieve destination URL -my $dest_URL = $q->param("dest_url"); +my $dest_URL = $wi->PTN_URL($q->param("dest_url")); +debug_print("outgoing.cgi: dst_URL=$dest_URL"); ######################################### # retrieve passAB -my $passAB = $af->{fm}->get_attribute_by_afid($dest_URL, "password"); +my $passAB=""; +try{ + $passAB = $af->{fm}->get_attribute_by_afid($dest_URL, "password"); +}catch Error with{ + my $e = shift; + error($q, "Error from FriendManager.\n" . $e); +}; debug_print("outgoing.cgi: passAB=$passAB\n"); if(!defined($passAB) || $passAB eq ""){ - # I dont' have any password with $dest_URL. - # i.e., $dest_URL is not my friend site. - exit(0); + error($q, "Affelio: Invalid forwarding. Shared key not found!"); } ######################################### @@ -86,7 +100,6 @@ # so that we can logout this session in the future. # XXX - ######################################### #Output HTTP reply (Location header). # Index: affelio/index.cgi diff -u affelio/index.cgi:1.7 affelio/index.cgi:1.8 --- affelio/index.cgi:1.7 Thu Jun 30 15:06:35 2005 +++ affelio/index.cgi Thu Jun 30 15:48:29 2005 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -Tw +#!/usr/bin/perl -T # Affelio: Open social networking software # Copyright 2004-2005 Fish Grove @@ -6,7 +6,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: index.cgi,v 1.7 2005/06/30 06:06:35 slash5234 Exp $ +# $Id: index.cgi,v 1.8 2005/06/30 06:48:29 slash5234 Exp $ use strict;