Tadashi Okoshi
slash****@users*****
2005年 6月 30日 (木) 16:08:17 JST
Index: affelio/bin/get_content.cgi diff -u affelio/bin/get_content.cgi:1.7 affelio/bin/get_content.cgi:1.8 --- affelio/bin/get_content.cgi:1.7 Thu Jun 30 07:36:35 2005 +++ affelio/bin/get_content.cgi Thu Jun 30 16:08:17 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: get_content.cgi,v 1.7 2005/06/29 22:36:35 slash5234 Exp $ +# $Id: get_content.cgi,v 1.8 2005/06/30 07:08:17 slash5234 Exp $ use strict; @@ -18,6 +18,7 @@ $CGI::POST_MAX = 102_400; use CGI::Session qw(-ip_match); use HTML::Template; +use Error qw(:try); use lib("../lib"); use Affelio; @@ -27,27 +28,29 @@ 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 = ".."; my $af = new Affelio(ConfigDir => $cfg_dir); debug_print("get_content.cgi: AF loaded."); -my $q = new CGI; +my $wi = new Affelio::misc::WebInput(); ############################################################################ #Retrieve args ############################################################################ -my $module = $q->param("module"); +my $module = $wi->PTN_word($q->param("module")); if($module eq "" || !defined($module)){ error($q,"Parameters are not defined.(module)"); } -my $content = $q->param("content"); +my $content = $wi->PTN_getcontent_content($q->param("content")); if($content eq "" || !defined($content)){ error($q,"Parameters are not defined.(content)"); } @@ -106,7 +109,7 @@ && ( $q->param("cfid") ne "" ) ){ - my $referrer = $q->param("referrer"); + 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"); Index: affelio/bin/loginexec.cgi diff -u affelio/bin/loginexec.cgi:1.2 affelio/bin/loginexec.cgi:1.3 --- affelio/bin/loginexec.cgi:1.2 Tue Jun 28 02:50:26 2005 +++ affelio/bin/loginexec.cgi Thu Jun 30 16:08:17 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: loginexec.cgi,v 1.2 2005/06/27 17:50:26 slash5234 Exp $ +# $Id: loginexec.cgi,v 1.3 2005/06/30 07:08:17 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; @@ -24,22 +25,30 @@ 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 = ".."; -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; ############################################################################ #Authentication check ############################################################################ -my $q = new CGI; -my $username = $q->param("username"); -my $password = $q->param("password"); -my $forward_URL = $q->param("forward_URL"); +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"); Index: affelio/bin/logoutexec.cgi diff -u affelio/bin/logoutexec.cgi:1.1.1.1 affelio/bin/logoutexec.cgi:1.2 --- affelio/bin/logoutexec.cgi:1.1.1.1 Tue Jun 14 12:53:29 2005 +++ affelio/bin/logoutexec.cgi Thu Jun 30 16:08:17 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: logoutexec.cgi,v 1.1.1.1 2005/06/14 03:53:29 slash5234 Exp $ +# $Id: logoutexec.cgi,v 1.2 2005/06/30 07:08:17 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; @@ -26,16 +27,23 @@ use Affelio::misc::MyCrypt; use Affelio::misc::Time; +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, Index: affelio/bin/recv_mail_ack.cgi diff -u affelio/bin/recv_mail_ack.cgi:1.3 affelio/bin/recv_mail_ack.cgi:1.4 --- affelio/bin/recv_mail_ack.cgi:1.3 Tue Jun 28 20:51:34 2005 +++ affelio/bin/recv_mail_ack.cgi Thu Jun 30 16:08:17 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: recv_mail_ack.cgi,v 1.3 2005/06/28 11:51:34 slash5234 Exp $ +# $Id: recv_mail_ack.cgi,v 1.4 2005/06/30 07:08:17 slash5234 Exp $ use strict; use lib("../extlib"); @@ -20,7 +20,6 @@ use Crypt::DH; use Error qw(:try); - use lib("../lib/"); use Affelio; use Affelio::misc::CGIError; @@ -30,15 +29,24 @@ 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 = ".."; -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; ############################################################################ #Sesion check (as admin) -my $q = new CGI; my $sid = $q->cookie("affelio-$af->{user__nickname}"); my $session = new CGI::Session(undef, $sid, @@ -67,15 +75,12 @@ ############################################################################ #Read CGI input my $session_id=""; -$session_id = $q->param("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"); -################################################## -#XXX -#Sanitise $session_id ############################################################################ #Read temporarily-saved session @@ -95,7 +100,7 @@ if(!defined(@ret)){ #No such session exists!! debug_print("recv_mail_ack: session not found.\n"); - error($q, "No such session exists!"); + error($q, "Affelio load error.\nNo such session exists!"); }else{ ($dummy, $timestamp, $peer_af_id, $peer_nickname, $peer_DH_pub_key_str) = @ret; @@ -131,18 +136,10 @@ 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, $E->stacktrace); -}catch Affelio::exception::Exception with{ +}catch Error with { my $E = shift; - error($q, $E->stacktrace); + error($q, "HandShake reply output an error!\n$E\n$E->stacktrace"); }; -if($ret->{flerror} == 1){ - #XML-RPC communication was successful. - #But the peer returned error. denyetc... - error($q,"XML-RPC peer denied RPC."); -} debug_print("recv_mail_ack: reply_HandShake finished."); @@ -154,17 +151,27 @@ ############################################################################ #Add peer to my friends list. -$af->{fm}->add_friend($peer_af_id, - $peer_nickname, - $timestamp, - $pass); +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$E->stacktrace"); +} debug_print("recv_mail_ack: added to my friends list."); sleep(2); ############################################################################ #Get peer's friends list. -$ret = get_F2List(dest_uri => "$peer_af_id/bin/xml-rpc-serv.cgi", - timestamp => 0); +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\n$E->stacktrace"); +}; debug_print("recv_mail_ack: get_F2List finished."); debug_print("recv_mail_ack: List I've got is [$ret]"); # @@ -186,8 +193,3 @@ print $af->translate_templateL10N($tmpl->output); - - - - -