From b6c62065fada8ab55f012cb161792718ba823ea8 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Wed, 21 Nov 2012 20:20:55 -0500 Subject: Merged TPS CGI scripts. --- base/tps/CMakeLists.txt | 34 +- base/tps/apache/cgi-bin/demo/enroll.cgi | 183 ++++ base/tps/apache/cgi-bin/demo/index.cgi | 47 + base/tps/apache/cgi-bin/esc.cgi | 1239 ++++++++++++++++++++++++ base/tps/apache/cgi-bin/home.cgi | 40 + base/tps/apache/cgi-bin/home/cachain.cgi | 52 + base/tps/apache/cgi-bin/home/enroll.cgi | 183 ++++ base/tps/apache/cgi-bin/home/index.cgi | 51 + base/tps/apache/cgi-bin/so/enroll.cgi | 193 ++++ base/tps/apache/cgi-bin/so/index.cgi | 48 + base/tps/apache/cgi-bin/sow/ajax-list.cgi | 79 ++ base/tps/apache/cgi-bin/sow/enroll.cgi | 246 +++++ base/tps/apache/cgi-bin/sow/enroll_temp.cgi | 246 +++++ base/tps/apache/cgi-bin/sow/format.cgi | 207 ++++ base/tps/apache/cgi-bin/sow/formatso.cgi | 207 ++++ base/tps/apache/cgi-bin/sow/index.cgi | 42 + base/tps/apache/cgi-bin/sow/is_agent.cgi | 69 ++ base/tps/apache/cgi-bin/sow/is_user.cgi | 71 ++ base/tps/apache/cgi-bin/sow/main.cgi | 70 ++ base/tps/apache/cgi-bin/sow/noaccess.cgi | 56 ++ base/tps/apache/cgi-bin/sow/read.cgi | 128 +++ base/tps/apache/cgi-bin/sow/read_temp.cgi | 125 +++ base/tps/apache/cgi-bin/sow/search.cgi | 70 ++ base/tps/apache/cgi-bin/sow/search_temp.cgi | 70 ++ base/tps/apache/cgi-bin/sow/seturl.cgi | 207 ++++ base/tps/apache/cgi-bin/sow/welcome.cgi | 57 ++ base/tps/apache/docroot/index.cgi | 76 ++ base/tps/apache/docroot/index.html | 22 + base/tps/forms/esc/cgi-bin/demo/enroll.cgi | 183 ---- base/tps/forms/esc/cgi-bin/demo/index.cgi | 47 - base/tps/forms/esc/cgi-bin/home/cachain.cgi | 52 - base/tps/forms/esc/cgi-bin/home/enroll.cgi | 183 ---- base/tps/forms/esc/cgi-bin/home/index.cgi | 51 - base/tps/forms/esc/cgi-bin/so/enroll.cgi | 193 ---- base/tps/forms/esc/cgi-bin/so/index.cgi | 48 - base/tps/forms/esc/cgi-bin/sow/ajax-list.cgi | 79 -- base/tps/forms/esc/cgi-bin/sow/cfg.pl | 174 ---- base/tps/forms/esc/cgi-bin/sow/enroll.cgi | 246 ----- base/tps/forms/esc/cgi-bin/sow/enroll_temp.cgi | 246 ----- base/tps/forms/esc/cgi-bin/sow/format.cgi | 207 ---- base/tps/forms/esc/cgi-bin/sow/formatso.cgi | 207 ---- base/tps/forms/esc/cgi-bin/sow/index.cgi | 42 - base/tps/forms/esc/cgi-bin/sow/is_agent.cgi | 69 -- base/tps/forms/esc/cgi-bin/sow/is_user.cgi | 71 -- base/tps/forms/esc/cgi-bin/sow/main.cgi | 70 -- base/tps/forms/esc/cgi-bin/sow/noaccess.cgi | 56 -- base/tps/forms/esc/cgi-bin/sow/read.cgi | 128 --- base/tps/forms/esc/cgi-bin/sow/read_temp.cgi | 125 --- base/tps/forms/esc/cgi-bin/sow/search.cgi | 70 -- base/tps/forms/esc/cgi-bin/sow/search_temp.cgi | 70 -- base/tps/forms/esc/cgi-bin/sow/seturl.cgi | 207 ---- base/tps/forms/esc/cgi-bin/sow/welcome.cgi | 57 -- base/tps/forms/esc/esc.cgi | 1239 ------------------------ base/tps/forms/esc/home.cgi | 40 - base/tps/forms/index.cgi | 76 -- base/tps/forms/index.html | 22 - 56 files changed, 4094 insertions(+), 4282 deletions(-) create mode 100755 base/tps/apache/cgi-bin/demo/enroll.cgi create mode 100755 base/tps/apache/cgi-bin/demo/index.cgi create mode 100755 base/tps/apache/cgi-bin/esc.cgi create mode 100755 base/tps/apache/cgi-bin/home.cgi create mode 100755 base/tps/apache/cgi-bin/home/cachain.cgi create mode 100755 base/tps/apache/cgi-bin/home/enroll.cgi create mode 100755 base/tps/apache/cgi-bin/home/index.cgi create mode 100755 base/tps/apache/cgi-bin/so/enroll.cgi create mode 100755 base/tps/apache/cgi-bin/so/index.cgi create mode 100755 base/tps/apache/cgi-bin/sow/ajax-list.cgi create mode 100755 base/tps/apache/cgi-bin/sow/enroll.cgi create mode 100755 base/tps/apache/cgi-bin/sow/enroll_temp.cgi create mode 100755 base/tps/apache/cgi-bin/sow/format.cgi create mode 100755 base/tps/apache/cgi-bin/sow/formatso.cgi create mode 100755 base/tps/apache/cgi-bin/sow/index.cgi create mode 100755 base/tps/apache/cgi-bin/sow/is_agent.cgi create mode 100755 base/tps/apache/cgi-bin/sow/is_user.cgi create mode 100755 base/tps/apache/cgi-bin/sow/main.cgi create mode 100755 base/tps/apache/cgi-bin/sow/noaccess.cgi create mode 100755 base/tps/apache/cgi-bin/sow/read.cgi create mode 100755 base/tps/apache/cgi-bin/sow/read_temp.cgi create mode 100755 base/tps/apache/cgi-bin/sow/search.cgi create mode 100755 base/tps/apache/cgi-bin/sow/search_temp.cgi create mode 100755 base/tps/apache/cgi-bin/sow/seturl.cgi create mode 100755 base/tps/apache/cgi-bin/sow/welcome.cgi create mode 100755 base/tps/apache/docroot/index.cgi create mode 100644 base/tps/apache/docroot/index.html delete mode 100755 base/tps/forms/esc/cgi-bin/demo/enroll.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/demo/index.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/home/cachain.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/home/enroll.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/home/index.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/so/enroll.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/so/index.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/ajax-list.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/cfg.pl delete mode 100755 base/tps/forms/esc/cgi-bin/sow/enroll.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/enroll_temp.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/format.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/formatso.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/index.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/is_agent.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/is_user.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/main.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/noaccess.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/read.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/read_temp.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/search.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/search_temp.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/seturl.cgi delete mode 100755 base/tps/forms/esc/cgi-bin/sow/welcome.cgi delete mode 100755 base/tps/forms/esc/esc.cgi delete mode 100755 base/tps/forms/esc/home.cgi delete mode 100755 base/tps/forms/index.cgi delete mode 100644 base/tps/forms/index.html diff --git a/base/tps/CMakeLists.txt b/base/tps/CMakeLists.txt index 4e6a922d2..6044a13c1 100644 --- a/base/tps/CMakeLists.txt +++ b/base/tps/CMakeLists.txt @@ -77,13 +77,6 @@ install( ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME}/applets ) -install( - DIRECTORY - forms/esc/cgi-bin - DESTINATION - ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME} -) - install( DIRECTORY apache/conf @@ -105,23 +98,16 @@ install( ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME} ) -install( - FILES - forms/index.html - DESTINATION - ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME}/docroot -) - -install( - FILES - forms/index.cgi - DESTINATION - ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME}/docroot - PERMISSIONS - OWNER_EXECUTE OWNER_WRITE OWNER_READ - GROUP_EXECUTE GROUP_READ - WORLD_EXECUTE WORLD_READ -) +# install( +# FILES +# apache/docroot/index.cgi +# DESTINATION +# ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}/${PROJECT_NAME}/docroot +# PERMISSIONS +# OWNER_EXECUTE OWNER_WRITE OWNER_READ +# GROUP_EXECUTE GROUP_READ +# WORLD_EXECUTE WORLD_READ +# ) install( DIRECTORY diff --git a/base/tps/apache/cgi-bin/demo/enroll.cgi b/base/tps/apache/cgi-bin/demo/enroll.cgi new file mode 100755 index 000000000..c0f4bcabf --- /dev/null +++ b/base/tps/apache/cgi-bin/demo/enroll.cgi @@ -0,0 +1,183 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +use CGI; + +$gQuery = new CGI; + +$gQueryAction = "default"; +$gQueryOverrideAction = "default"; + +@gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + +$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); + +$gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + +if ($gQueryOverrideAction ne "default") +{ + $gQueryAction = $gQueryOverrideAction; +} + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + +if ($gQueryAction eq "default") +{ + GenerateEnrollmentPage(); + exit 0; +} + + + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(ENROLL_FILE); +} diff --git a/base/tps/apache/cgi-bin/demo/index.cgi b/base/tps/apache/cgi-bin/demo/index.cgi new file mode 100755 index 000000000..c9a1d21dd --- /dev/null +++ b/base/tps/apache/cgi-bin/demo/index.cgi @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print ""; +print ""; +print "Fedora Project"; # Vendor +print "\n"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/nk_service"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/demo/enroll.cgi"; +print ""; +print ""; +print ""; +print ""; +print ""; +print ""; +print "userKey"; +print ""; +print ""; +print ""; diff --git a/base/tps/apache/cgi-bin/esc.cgi b/base/tps/apache/cgi-bin/esc.cgi new file mode 100755 index 000000000..70a93c0a0 --- /dev/null +++ b/base/tps/apache/cgi-bin/esc.cgi @@ -0,0 +1,1239 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +use CGI; + +$gQuery = new CGI; + +$gQueryAction = "default"; +$gQueryOverrideAction = "default"; + +@gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + +$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); + +$gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + +if ($gQueryOverrideAction ne "default") +{ + $gQueryAction = $gQueryOverrideAction; +} + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + +if ($gQueryAction eq "default") +{ + GenerateAdminPage(); + exit 0; +} + +######################################################################## +# +# We aren't doing any admin functions, before proceeding +# on to user specific functions, make sure we have a screen name +# and that they are subscribed to a service. +# +######################################################################## + +#if (!HaveScreenName() || $gQueryAction eq "screennamepage") +#{ +# GenerateScreenNamePage($gQueryAction); +# exit 0; +#} + +LoadUserDatabase("default"); + +######################################################################## +# +# Subscribe? +# +# http://www.foo.com/esc.cgi?action=subscribe +# +######################################################################## + +#if ($gQueryAction eq "subscribe") +#{ +# SaveSubscription(); +# $nextAction = GetNextAction(); +# $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); +# print $gQuery->redirect(-uri=>$redirectLocation); +# exit 0; +#} + +#if (!IsSubscriber() || $gQueryAction eq "subscriptionpage") +#{ +# GenerateTOSPage($gQueryAction); +# exit 0; +#} + +######################################################################## +# +# Show our cookie management page? +# +# http://www.foo.com/esc.cgi?action=cookiepage +# +######################################################################## + +#if ($gQueryAction eq "cookiepage") +#{ +# GenerateCookiesPage(); +# exit 0; +#} + +######################################################################## +# +# Clear cookies? +# +# http://www.foo.com/esc.cgi?action=clearAllCookies +# +######################################################################## + +#if ($gQueryAction eq "removeCookies") +#{ +# @expCookies = (); +# foreach $cookie (@gCookieNames) +# { +# if (defined $gQuery->param($cookie)) +# { +# $expCookies[$cookieCnt++] = CreateExpiredCookie($cookie); +# } +# } +# $redirectLocation = $gQuery->url(-path_info=>1)."?action=cookiepage&screenname=".GetScreenName(); +# print $gQuery->redirect(-uri=>$redirectLocation, +# -cookie=>\@expCookies); +# exit 0; +#} + +######################################################################## +# +# Bind? +# +# +######################################################################## + +if ($gQueryAction eq "bind") +{ + UpdateBindingsForBind(); + $nextAction = GetNextAction(); + + $nextAction = "bindpage" if ($nextAction eq $gQueryAction); + + $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&prevaction=bind&screenname=".GetScreenName()."&keytype=".GetKeyType()."&keyid=".GetKeyID()."&keylabel=".GetKeyLabelArg(); + print $gQuery->redirect(-uri=>$redirectLocation); + exit 0; +} + +######################################################################## +# +# Unbind? +# +# +######################################################################## + +if ($gQueryAction eq "unbind") +{ + UpdateBindingsForUnbind(); + + $nextAction = GetNextAction(); + + $nextAction = "bindpage" if ($nextAction eq $gQueryAction); + + $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&prevaction=unbind&screenname=".GetScreenName()."&keytype=".GetKeyType()."&keyid=".GetKeyID()."&keylabel=".GetKeyLabelArg(); + print $gQuery->redirect(-uri=>$redirectLocation); + exit 0; +} + +######################################################################## +# +# Label? +# +# +######################################################################## + +if ($gQueryAction eq "label") +{ + UpdateBindingsForLabel(); + + $nextAction = GetNextAction(); + + $nextAction = "bindpage" if ($nextAction eq $gQueryAction); + + $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); + print $gQuery->redirect(-uri=>$redirectLocation); + exit 0; +} + +######################################################################## +# +# ScreenName? +# +# +######################################################################## + +#if ($gQueryAction eq "screenname") +#{ +# $nextAction = GetNextAction(); +# $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); +# print $gQuery->redirect(-uri=>$redirectLocation); +# exit 0; +#} + +######################################################################## +# +# Check if we are displaying the label page. +# +# +######################################################################## + +if ($gQueryAction eq "labelpage") +{ + my $nextAction = GetNextAction(); + $nextAction = "bindpage" if ($nextAction eq $gQueryAction); + + my $keyType = GetKeyType(); + my $keyId = GetKeyID(); + + GenerateLabelPage($keyType, $keyId, $nextAction); + exit 0; +} + +######################################################################## +# +# Show our enrollment page? +# +# http://www.foo.com/esc.cgi?action=enrollmentpage +# +######################################################################## + +if ($gQueryAction eq "enrollmentpage") +{ + GenerateEnrollmentPage(); + exit 0; +} + +if ($gQueryAction eq "advancepage") +{ + GenerateAdvancePage(); + exit 0; +} + +if ($gQueryAction eq "tokenmanagerpage") +{ + GenerateTokenManagerPage(); + exit 0; +} + +if($gQueryAction eq "authenticate") +{ + + GenerateAuthenticationPage(); + exit 0; +} + +if ($gQueryAction eq "autoenroll") +{ + GenerateAutoEnrollmentPage(); + exit 0; +} + +######################################################################## +# +# Show our ticket request page? +# +# +######################################################################## + +if ($gQueryAction eq "ticketreqpage") +{ + GenerateTicketRequestPage(); + exit 0; +} + +######################################################################## +# +# Show our load external url page? +# +# http://www.foo.com/esc.cgi?action=loadurlpage +# +######################################################################## + + +if ($gQueryAction eq "loadurl") +{ + $nextAction = GetNextAction(); + $redirectLocation = $gQuery->param('url'); + print $gQuery->redirect(-uri=>$redirectLocation); + exit 0; +} + +if ($gQueryAction eq "loadurlpage") +{ + GenerateLoadURLPage(); + exit 0; +} + +######################################################################## +# +# User is subscribed, check if we are displaying the +# settings page. +# +# +######################################################################## + +if ($gQueryAction eq "settingspage") +{ + GenerateSettingsPage(); + exit 0; +} + +######################################################################## +# +# Check if we are displaying the set label page. +# +# +######################################################################## + +if ($gQueryAction eq "setlabelpage") +{ + GenerateSetLabelPage(); + exit 0; +} + +######################################################################## +# +# Check if we are displaying the bind/unbind progress page! +# +# +######################################################################## + +if ($gQueryAction eq "bindprogresspage") +{ + GenerateBindProgressPage("bind"); + exit 0; +} + +if ($gQueryAction eq "unbindprogresspage") +{ + GenerateBindProgressPage("unbind"); + exit 0; +} + +######################################################################## +# +# Check if we are displaying the bind/unbind success page! +# +# +######################################################################## + +if ($gQueryAction eq "bindsuccesspage") +{ + GenerateBindSuccessPage("bind"); + exit 0; +} + +if ($gQueryAction eq "unbindsuccesspage") +{ + GenerateBindSuccessPage("unbind"); + exit 0; +} + +######################################################################## +# +# XXX: Lose this code! +# User is subscribed, check if we are displaying the +# binding page. +# +# +######################################################################## + +if ($gQueryAction eq "bindpage") +{ + GenerateBindingConfigPage(); + exit 0; +} + +print "

Unknown Query Action "; +print $qQueryAction; +print "

"; +exit 0; + +######################################################################## +# +# +######################################################################## + + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateAdminPage() +{ + my ($l); + + ExitError("Failed to load Admin Page") if (!open(ADMIN_FILE, "< ./AdminEsc.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + } + print $l; + } + close(ADMIN_FILE); +} + +sub GenerateCookiesPage() +{ + my ($nextPage) = @_; + + my ($l); + + ExitError("Failed to load TOS Page") if (!open(COOKIE_FILE, "< Cookies.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_COOKIE_LIST/) + { + my @cookies = $gQuery->cookie(); + if (@cookies < 1) + { + print "No ASC Cookies currently defined!
\n"; + } + else + { + my $cookieName; + foreach $cookieName (@cookies) + { + # + # Display only ASC related cookies! + # + + if ($cookieName =~ /^asc/) + { + print "$cookieName", $gQuery->cookie($cookieName), "\n"; + } + } + print "
\n"; + } + } + elsif ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(COOKIE_FILE); +} + +sub GenerateScreenNamePage +{ + my ($nextPage) = @_; + + my ($l); + + ExitError("Failed to load ScreenName Page") if (!open(SN_FILE, "< ScreenName.html")); + + print $gQuery->header(); + + my $sn = GetScreenName(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) + { + if ($nextPage) + { + print "\n"; + print "\n"; + } + + if ($sn) + { + print "\n"; + } + } + elsif ($l =~ //) + { + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(SN_FILE); +} + +sub GenerateTOSPage +{ + my ($nextPage) = @_; + + my ($l); + + ExitError("Failed to load TOS Page") if (!open(TOS_FILE, "< Subscribe.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) + { + if ($nextPage) + { + print "\n"; + print "\n"; + } + } + elsif ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(TOS_FILE); +} + +sub GenerateSettingsPage +{ + my ($l); + + ExitError("Failed to load settings page!") if (!open(SETTINGS_FILE, "< SettingsEsc.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_BINDINGS_ARRAY/) + { + my(@curBindings) = GetBindings(); + my $arrSize = scalar(@curBindings); + my($i); + + for ($i = 0; $i < $arrSize; $i++) + { + my($keyType, $keyId, $keyLabel) = split(/&/, $curBindings[$i]); + print " [ $keyType, \"$keyId\", \"$keyLabel\" ]"; + print "," if ($arrSize > 1 && $i != $arrSize - 1); + print "\n"; + } + } + elsif ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(SETTINGS_FILE); +} + +sub GenerateSetLabelPage +{ + my ($l); + + ExitError("Failed to open label page!") if (!open(LABEL_PAGE, "< Label.html")); + + my $sn = GetScreenName(); + ExitError("Failed to get a valid screen name!") if (! $sn); + + my $keyType = GetKeyType(); + my $keyID = GetKeyID(); + ExitError("Failed to get a valid keyID!") if (! $keyID); + + $defLabel = $keyID; + $defLabel =~ s/^[0-9a-fA-F]{12}//; + $defLabel = "$sn-$defLabel"; + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + $l =~ s//$sn/g; + } + if ($l =~ //) + { + $l =~ s//$keyType/g; + } + if ($l =~ //) + { + $l =~ s//$keyID/g; + } + if ($l =~ //) + { + $l =~ s//$defLabel/g; + } + print $l; + } + close(LABEL_FILE); +} + +sub GenerateBindProgressPage +{ + my ($action) = @_; + my ($l); + + ExitError("Failed to open progress page!") if (!open(PROG_PAGE, "< Progress.html")); + + my $sn = GetScreenName(); + ExitError("Failed to get a valid screen name!") if (! $sn); + + my $keyType = GetKeyType(); + my $keyID = GetKeyID(); + ExitError("Failed to get a valid keyID!") if (! $keyID); + + my $keyLabel = ""; + + if ($action eq "bind") + { + $keyLabel = GetKeyLabelArg(); + ExitError("Failed to get a valid keyLabel!") if (! $keyLabel); + } + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + $l =~ s//$sn/g; + } + if ($l =~ //) + { + $l =~ s//$keyType/g; + } + if ($l =~ //) + { + $l =~ s//$keyID/g; + } + if ($l =~ //) + { + $l =~ s//$keyLabel/g; + } + if ($l =~ //) + { + $l =~ s//$action/g; + } + if ($l =~ //) + { + $challengeData = ""; + $challengeData = "QVNDIHJvY2tzIHRoZSBwYXJ0eSE=" if ($action eq "bind"); + + $l =~ s//$challengeData/g; + } + print $l; + } + close(PROG_PAGE); +} + +sub GenerateBindSuccessPage +{ + my ($action) = @_; + my ($l); + + ExitError("Failed to open progress page!") if (!open(SUCCESS_PAGE, "< BindSuccess.html")); + + my $sn = GetScreenName(); + ExitError("Failed to get a valid screen name!") if (! $sn); + + my $keyType = GetKeyType(); + my $keyID = GetKeyID(); + ExitError("Failed to get a valid keyID!") if (! $keyID); + + my $keyLabel = ""; + + if ($action eq "bind") + { + $keyLabel = GetKeyLabelArg(); + ExitError("Failed to get a valid keyLabel!") if (! $keyLabel); + } + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + $l =~ s//$sn/g; + } + if ($l =~ //) + { + $l =~ s//$keyType/g; + } + if ($l =~ //) + { + $l =~ s//$keyID/g; + } + if ($l =~ //) + { + $l =~ s//$keyLabel/g; + } + if ($l =~ //) + { + $l =~ s//$action/g; + } + print $l; + } + close(SUCCESS_PAGE); +} + +sub GenerateBindingConfigPage +{ + my ($l); + + ExitError("Failed to load binding page!") if (!open(BINDING_FILE, "< Bindings.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_BINDINGS_ARRAY/) + { + my(@curBindings) = GetBindings(); + my $arrSize = scalar(@curBindings); + my($i); + + for ($i = 0; $i < $arrSize; $i++) + { + my($keyType, $keyId, $keyLabel) = split(/&/, $curBindings[$i]); + print " [ $keyType, \"$keyId\", \"$keyLabel\" ]"; + print "," if ($arrSize > 1 && $i != $arrSize - 1); + print "\n"; + } + } + elsif ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(BINDING_FILE); +} + +sub GetKeyLabel +{ + my($keyType, $keyId) = @_; + + my(@curBindings) = GetBindings(); + my($numBindings) = scalar(@curBindings); + + while($numBindings > 0) + { + --$numBindings; + if ($curBindings[$numBindings] =~ /^$keyType&$keyId&/) + { + my($ktype, $id, $lbl) = split(/&/, $curBindings[$numBindings]); + return $lbl; + } + } + + return ""; +} + +sub GenerateLabelPage +{ + my($keyType, $keyId, $nextAction) = @_; + my($keyLabel) = GetKeyLabel($keyType, $keyId); + + return if ($keyLabel eq ""); + + my ($l); + + ExitError("Failed to load label page!") if (!open(EDIT_LABEL_FILE, "< EditLabel.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) + { + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + } + elsif ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + close(EDIT_LABEL_FILE); +} + +sub GenerateAutoEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< EnrollPopup.html")); + + print $gQuery->header(); + + while ($l = ) + { + print $l; + } + + close(ENROLL_FILE); +} +sub GenerateAuthenticationPage +{ + my ($l); + ExitError("Failed to load enrollment page!") if (!open(AUTH_FILE, "< GenericAuth.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(AUTH_FILE); +} + +sub GenerateEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< EnrollPopup.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(ENROLL_FILE); +} + +sub GenerateAdvancePage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< AdvancePopup.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(ENROLL_FILE); +} + +sub GenerateTokenManagerPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< TokenManager.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(ENROLL_FILE); +} + +sub GenerateTicketRequestPage +{ + my ($l); + + ExitError("Failed to load ticket request page!") if (!open(TICKETREQ_FILE, "< Ticket.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(TICKETREQ_FILE); +} + +sub GenerateLoadURLPage +{ + my ($l); + + ExitError("Failed to load url request page!") if (!open(LOADURL_FILE, "< LoadURL.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(LOADURL_FILE); +} + +sub CreateExpiredCookie +{ + my($cookieName) = @_; + my $cookie = $gQuery->cookie(-name=>$cookieName, + -value=>'', + -expires=>'-2d', + -path=>$gQuery->url(-absolute=>1), + -domain=>$gQuery->server_name()); + return $cookie; + +} + +sub SaveSubscription +{ + + $gUserObj{'SUBSCRIPTION'} = $gQuery->param("subscriptiontype"); + SaveUserDatabase(GetScreenName()); +} + +sub GetBindings +{ + my $bindings = $gUserObj{'BINDINGS'}; + return @$bindings; +} + +sub BindingsArrayToString +{ + my(@bindings) = @_; + my $i; + my $str = ""; + + for ($i = 0; $i < @bindings; $i++) + { + if ($bindings[$i] ne "") + { + $str .= "&" if ($str ne ""); + $str .= ASCUrlEncode($bindings[$i]); + } + } + + return $str; +} + +sub AddItemToBindings +{ + my($keyType, $keyId, $keyLabel) = @_; + + my(@curBindings) = GetBindings(); + my($pos) = scalar(@curBindings); + + # First check to see if the key already exists in + # the cookie! If it does, we'll just overwrite it. + + my($i) = $pos; + while($i > 0) + { + --$i; + if ($curBindings[$i] =~ /^$keyType&$keyId&/) + { + $pos = $i; + last; + } + } + + $curBindings[$pos] = "$keyType&$keyId&$keyLabel"; + + $gUserObj{'BINDINGS'} = \@curBindings; + #SaveUserDatabase(GetScreenName()); +} + +sub RemoveItemFromBindings +{ + my($keyType, $keyId) = @_; + + my(@curBindings) = GetBindings(); + my($numBindings) = scalar(@curBindings); + my @newBindings; + + while($numBindings > 0) + { + --$numBindings; + next if ($curBindings[$numBindings] =~ /^$keyType&$keyId&/); + push @newBindings, $curBindings[$numBindings]; + } + + $gUserObj{'BINDINGS'} = \@newBindings; + #SaveUserDatabase(GetScreenName()); +} + +sub UpdateBindingsForBind +{ + return if (! defined $gQuery->param("keytype")); + my($keyType) = $gQuery->param("keytype"); + + return if (! defined $gQuery->param("keyid")); + my($keyId) = $gQuery->param("keyid"); + + return if (! defined $gQuery->param("keylabel")); + my($keyLabel) = $gQuery->param("keylabel"); + + return AddItemToBindings($keyType, $keyId, $keyLabel); +} + +sub UpdateBindingsForUnbind +{ + return if (! defined $gQuery->param("keytype")); + my($keyType) = $gQuery->param("keytype"); + + return if (! defined $gQuery->param("keyid")); + my($keyId) = $gQuery->param("keyid"); + + return RemoveItemFromBindings($keyType, $keyId,); +} + +sub UpdateBindingsForLabel +{ + return UpdateBindingsForBind(); +} + +sub ASCUrlDecode +{ + my($qstr) = @_; + $qstr =~ s/\+/ /g; + $qstr =~ s/%([0-9A-F]{2})/pack("C", hex($1))/eig; + return $qstr; +} + +sub ASCUrlEncode +{ + my($qstr) = @_; + $qstr =~ s/([^a-zA-Z0-9_ ])/sprintf("%%%.2X", unpack("C", $1))/eig; + $qstr =~ s/ /+/g; + return $qstr; +} + +sub LoadUserDatabase +{ + my($sn) = @_; + + $gUserObj{'SUBSCRIPTION'} = ""; + + $gUserObj{'BINDINGS'} = ""; + return; + +} + +sub SaveUserDatabase +{ + my($sn) = @_; + my($snfile) = "UserDatabase/$sn"; + + return; + +} diff --git a/base/tps/apache/cgi-bin/home.cgi b/base/tps/apache/cgi-bin/home.cgi new file mode 100755 index 000000000..5fdf5ecf8 --- /dev/null +++ b/base/tps/apache/cgi-bin/home.cgi @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print ""; +print ""; +print "Fedora Project"; # Vendor +print "\n"; +print ""; +print ""; +print "http://machine.fedora.redhat.com:7888/nk_service"; +print ""; +print ""; +print "http://machine.fedora.redhat.com:7888/cgi-bin/esc.cgi"; +print ""; +print ""; +print ""; diff --git a/base/tps/apache/cgi-bin/home/cachain.cgi b/base/tps/apache/cgi-bin/home/cachain.cgi new file mode 100755 index 000000000..27dc9cd6c --- /dev/null +++ b/base/tps/apache/cgi-bin/home/cachain.cgi @@ -0,0 +1,52 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# + +use LWP::UserAgent; + +my $cfg = "../../conf/CS.cfg"; +my $cahostport = `grep conn.ca1.hostport $cfg | cut -c19-`; + +chomp($cahostport); + +my $url = "https://$cahostport/ca/ee/ca/getCAChain?op=download&mimeType=application/x-x509-ca-cert"; + +my $agent = LWP::UserAgent->new; +$agent->timeout(30); + +my $request = HTTP::Request->new('GET', $url); +my $response = $agent->request($request); + +if ($response->is_success) { + print "Content-type: application/x-x509-ca-cert\n\n"; + print $response->content; + +} else { + print "Content-type: text/html\n\n"; + print ""; + print ""; + print "

Error Importing CA Chain Information!

"; + print "

Please try again later.

"; + print "" +} diff --git a/base/tps/apache/cgi-bin/home/enroll.cgi b/base/tps/apache/cgi-bin/home/enroll.cgi new file mode 100755 index 000000000..c0f4bcabf --- /dev/null +++ b/base/tps/apache/cgi-bin/home/enroll.cgi @@ -0,0 +1,183 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +use CGI; + +$gQuery = new CGI; + +$gQueryAction = "default"; +$gQueryOverrideAction = "default"; + +@gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + +$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); + +$gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + +if ($gQueryOverrideAction ne "default") +{ + $gQueryAction = $gQueryOverrideAction; +} + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + +if ($gQueryAction eq "default") +{ + GenerateEnrollmentPage(); + exit 0; +} + + + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + print $l; + } + } + + close(ENROLL_FILE); +} diff --git a/base/tps/apache/cgi-bin/home/index.cgi b/base/tps/apache/cgi-bin/home/index.cgi new file mode 100755 index 000000000..1e54a8354 --- /dev/null +++ b/base/tps/apache/cgi-bin/home/index.cgi @@ -0,0 +1,51 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print ""; +print ""; +print "Fedora Project"; # Vendor +print "\n"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/nk_service"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/home/enroll.cgi"; +print ""; +print ""; +print "http://www.fedora.redhat.com"; # Company URL +print ""; +print ""; +print ""; +print ""; +print "userKey"; +print ""; +#print ""; +#print "http://[SERVER_NAME]:[PORT]/cgi-bin/home/cachain.cgi"; +#print ""; +print ""; +print ""; diff --git a/base/tps/apache/cgi-bin/so/enroll.cgi b/base/tps/apache/cgi-bin/so/enroll.cgi new file mode 100755 index 000000000..148cd78c0 --- /dev/null +++ b/base/tps/apache/cgi-bin/so/enroll.cgi @@ -0,0 +1,193 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; + +my $port = get_port(); +my $host = get_host(); +my $secure_port = get_secure_port(); + +$gQuery = new CGI; + +$gQueryAction = "default"; +$gQueryOverrideAction = "default"; + +@gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + +$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); + +$gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + +if ($gQueryOverrideAction ne "default") +{ + $gQueryAction = $gQueryOverrideAction; +} + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + +if ($gQueryAction eq "default") +{ + GenerateEnrollmentPage(); + exit 0; +} + + + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); + + print $gQuery->header(); + + while ($l = ) + { + if ($l =~ //) + { + my $sn = GetScreenName(); + $l =~ s//$sn/g; + print $l; + } + else + { + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + + print $l; + } + } + + close(ENROLL_FILE); +} diff --git a/base/tps/apache/cgi-bin/so/index.cgi b/base/tps/apache/cgi-bin/so/index.cgi new file mode 100755 index 000000000..7b3f2c68d --- /dev/null +++ b/base/tps/apache/cgi-bin/so/index.cgi @@ -0,0 +1,48 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print ""; +print ""; +print "Fedora Project"; # Vendor +print "\n"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/nk_service"; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/so/enroll.cgi"; +print ""; +print ""; +print ""; +print ""; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/sow/welcome.cgi"; +print ""; +print ""; +print "soKey"; +print ""; +print ""; +print ""; diff --git a/base/tps/apache/cgi-bin/sow/ajax-list.cgi b/base/tps/apache/cgi-bin/sow/ajax-list.cgi new file mode 100755 index 000000000..0f4ac094f --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/ajax-list.cgi @@ -0,0 +1,79 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; +use Mozilla::LDAP::Conn; +use PKI::TPS::Common; + +[REQUIRE_CFG_PL] + +sub main() +{ + + my $q = new CGI; + + my $host = get_ldap_host(); + my $port = get_ldap_port(); + my $secureconn = get_ldap_secure(); + my $basedn = get_base_dn(); + my $certdir = get_ldap_certdir(); + + my $letters = $q->param('letters'); + if ($letters eq "") { + # HACK: ajax.js posts parameters into POST URL + $letters = $ENV{'QUERY_STRING'}; + $letters =~ s/.*letters=//g; + $letters =~ s/\+/ /g; + } + + my $result = ""; + + print "Content-Type: text/html\n\n"; + + my $conn = PKI::TPS::Common::make_connection( + {host => $host, port => $port, cert => $certdir}, + $secureconn); + + return if (!$conn); + + my $entry = $conn->search ( { base =>$basedn, + scope => "sub", + filter => "cn=$letters*", + attrsonly => 0, + attrs => qw(cn uid), + sortattrs => qw(cn)} + ); + + while ($entry) { + my $cn = ($entry->getValues("cn"))[0] || ""; + my $uid = ($entry->getValues("uid"))[0] || ""; + $result .= $uid . "###" . $cn . "|"; + $entry $conn->nextEntry(); + } + + $conn->close(); + + print $result; +} + +&main(); diff --git a/base/tps/apache/cgi-bin/sow/enroll.cgi b/base/tps/apache/cgi-bin/sow/enroll.cgi new file mode 100755 index 000000000..8a6431e52 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/enroll.cgi @@ -0,0 +1,246 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; +use Mozilla::LDAP::Conn; +use PKI::TPS::Common; + +$gQuery = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + $gQueryAction = "default"; + $gQueryOverrideAction = "default"; + + @gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + + $gQueryAction = $gQuery->param("action") if + (defined $gQuery->param("action")); + + $gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + + if ($gQueryOverrideAction ne "default") + { + $gQueryAction = $gQueryOverrideAction; + } + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + + if ($gQueryAction eq "default") + { + GenerateEnrollmentPage(); + exit 0; + } +} + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + my $ldap_host = get_ldap_host(); + my $ldap_port = get_ldap_port(); + my $secureconn = get_ldap_secure(); + my $basedn = get_base_dn(); + my $port = get_port(); + my $host = get_host(); + my $secure_port = get_secure_port(); + my $certdir = get_ldap_certdir(); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< enroll.html")); + + print $gQuery->header(); + + my $uid = $gQuery->param("uid"); + + my $conn = PKI::TPS::Common::make_connection( + {host => $ldap_host, port => $ldap_port, cert => $certdir}, + $secureconn); + + ExitError("Failed to connect to the database. $msg") if (!$conn); + + my $entry = $conn->search ( $basedn, + "sub", + "uid=$uid", + 0 + ); + + if (!$entry) { + $conn->close(); + ExitError("User $uid not found"); + } + + my $givenName = ($entry->getValues("givenName"))[0] || "-"; + my $cn = ($entry->getValues("cn"))[0] || "-"; + my $sn = ($entry->getValues("sn"))[0] ||"-"; + $uid = ($entry->getValues("uid"))[0] || "-"; + my $mail = ($entry->getValues("mail"))[0] || "-"; + my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; + my $departmentNumber = ($entry->getValues("departmentNumber"))[0] || ""; + my $employeeNumber = ($entry->getValues("employeeNumber"))[0] || ""; + + while ($l = ) + { + $l =~ s/\$mail/$mail/g; + $l =~ s/\$uid/$uid/g; + $l =~ s/\$givenName/$givenName/g; + $l =~ s/\$sn/$sn/g; + $l =~ s/\$cn/$cn/g; + $l =~ s/\$phone/$phone/g; + $l =~ s/\$departmentNumber/$departmentNumber/g; + $l =~ s/\$employeeNumber/$employeeNumber/g; + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + print $l; + } + + close(ENROLL_FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/enroll_temp.cgi b/base/tps/apache/cgi-bin/sow/enroll_temp.cgi new file mode 100755 index 000000000..5817039a2 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/enroll_temp.cgi @@ -0,0 +1,246 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; +use Mozilla::LDAP::Conn; +use PKI::TPS::Common; + +$gQuery = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + $gQueryAction = "default"; + $gQueryOverrideAction = "default"; + + @gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + + $gQueryAction = $gQuery->param("action") if + (defined $gQuery->param("action")); + + $gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + + if ($gQueryOverrideAction ne "default") + { + $gQueryAction = $gQueryOverrideAction; + } + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + + if ($gQueryAction eq "default") + { + GenerateEnrollmentPage(); + exit 0; + } +} + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + my $ldap_host = get_ldap_host(); + my $ldap_port = get_ldap_port(); + my $secureconn = get_ldap_secure(); + my $basedn = get_base_dn(); + my $port = get_port(); + my $host = get_host(); + my $secure_port = get_secure_port(); + my $certdir = get_ldap_certdir(); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< enroll_temp.html")); + + print $gQuery->header(); + + my $uid = $gQuery->param("uid"); + + my $conn = PKI::TPS::Common::make_connection( + {host => $ldap_host, port => $ldap_port, cert => $certdir}, + $secureconn); + + ExitError("Failed to connect to the database. $msg") if (!$conn); + + my $entry = $conn->search ( $basedn, + "sub", + "uid=$uid", + 0 + ); + + if (!$entry) { + $conn->close(); + ExitError("User $uid not found"); + } + + my $givenName = ($entry->getValues("givenName"))[0] || "-"; + my $cn = ($entry->getValues("cn"))[0] || "-"; + my $sn = ($entry->getValues("sn"))[0] ||"-"; + $uid = ($entry->getValues("uid"))[0] || "-"; + my $mail = ($entry->getValues("mail"))[0] || "-"; + my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; + my $departmentNumber = ($entry->getValues("departmentNumber"))[0] || ""; + my $employeeNumber = ($entry->getValues("employeeNumber"))[0] || ""; + + while ($l = ) + { + $l =~ s/\$mail/$mail/g; + $l =~ s/\$uid/$uid/g; + $l =~ s/\$givenName/$givenName/g; + $l =~ s/\$sn/$sn/g; + $l =~ s/\$cn/$cn/g; + $l =~ s/\$phone/$phone/g; + $l =~ s/\$departmentNumber/$departmentNumber/g; + $l =~ s/\$employeeNumber/$employeeNumber/g; + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + print $l; + } + + close(ENROLL_FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/format.cgi b/base/tps/apache/cgi-bin/sow/format.cgi new file mode 100755 index 000000000..9b310991d --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/format.cgi @@ -0,0 +1,207 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); +my $host = get_host(); +my $port = get_port(); +my $secure_port = get_secure_port(); + +$gQuery = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + $gQueryAction = "default"; + $gQueryOverrideAction = "default"; + + @gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + + $gQueryAction = $gQuery->param("action") if + (defined $gQuery->param("action")); + + $gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + + if ($gQueryOverrideAction ne "default") + { + $gQueryAction = $gQueryOverrideAction; + } + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + + if ($gQueryAction eq "default") + { + GeneratePage(); + exit 0; + } +} + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GeneratePage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< format.html")); + + print $gQuery->header(); + + while ($l = ) + { + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + print $l; + } + + close(ENROLL_FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/formatso.cgi b/base/tps/apache/cgi-bin/sow/formatso.cgi new file mode 100755 index 000000000..d53129139 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/formatso.cgi @@ -0,0 +1,207 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); +my $host = get_host(); +my $port = get_port(); +my $secure_port = get_secure_port(); + +$gQuery = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + $gQueryAction = "default"; + $gQueryOverrideAction = "default"; + + @gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + + $gQueryAction = $gQuery->param("action") if + (defined $gQuery->param("action")); + + $gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + + if ($gQueryOverrideAction ne "default") + { + $gQueryAction = $gQueryOverrideAction; + } + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + + if ($gQueryAction eq "default") + { + GeneratePage(); + exit 0; + } +} + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GeneratePage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< formatso.html")); + + print $gQuery->header(); + + while ($l = ) + { + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + print $l; + } + + close(ENROLL_FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/index.cgi b/base/tps/apache/cgi-bin/sow/index.cgi new file mode 100755 index 000000000..7f7a98869 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/index.cgi @@ -0,0 +1,42 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print ""; +print ""; +print "Fedora Project"; # Vendor +print "\n"; +print ""; +print ""; +print "https://[SERVER_NAME]:[SECURE_PORT]/nk_service"; +print ""; +print ""; +print "https://[SERVER_NAME]:[SECURE_PORT]/cgi-bin/sow/search.cgi"; +print ""; +print ""; +print ""; +print ""; +print ""; diff --git a/base/tps/apache/cgi-bin/sow/is_agent.cgi b/base/tps/apache/cgi-bin/sow/is_agent.cgi new file mode 100755 index 000000000..c6b6a87f7 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/is_agent.cgi @@ -0,0 +1,69 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); + +my $q = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoIsAgent +{ + + print "Content-type: text/xml\n\n"; + + if (!&authorize()) { + return; + } + + my $uid = $q->param('uid'); + + if(&is_agent("uid=$uid")) + { + print "yes\n"; + } + else + { + print "no\n"; + } + +} + +&DoIsAgent(); diff --git a/base/tps/apache/cgi-bin/sow/is_user.cgi b/base/tps/apache/cgi-bin/sow/is_user.cgi new file mode 100755 index 000000000..d7a551421 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/is_user.cgi @@ -0,0 +1,71 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +use CGI::Carp qw(fatalsToBrowser); + +[REQUIRE_CFG_PL] + + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); + +my $q = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoIsUser +{ + + print "Content-type: text/xml\n\n"; + + if (!&authorize()) { + return; + } + + my $uid = $q->param('uid'); + + if(&is_user("uid=$uid")) + { + print "yes\n"; + } + else + { + print "no\n"; + } + +} + +&DoIsUser(); diff --git a/base/tps/apache/cgi-bin/sow/main.cgi b/base/tps/apache/cgi-bin/sow/main.cgi new file mode 100755 index 000000000..c6f65e42e --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/main.cgi @@ -0,0 +1,70 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); + +my $q = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $q->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + my $error = $q->param('error'); + $error = "" if !defined $error; + + open(FILE, "< main.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$error/$error/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/noaccess.cgi b/base/tps/apache/cgi-bin/sow/noaccess.cgi new file mode 100755 index 000000000..17166bcb6 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/noaccess.cgi @@ -0,0 +1,56 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $host = get_host(); +my $secure_port = get_secure_port(); +my $port = get_port(); + +my $q = new CGI; + +sub DoPage +{ + + my $error = $q->param('error'); + + open(FILE, "< noaccess.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$error/$error/g; + $l =~ s/\$host/$host/g; + $l =~ s/\$secure_port/$secure_port/g; + $l =~ s/\$port/$port/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/read.cgi b/base/tps/apache/cgi-bin/sow/read.cgi new file mode 100755 index 000000000..8a5793c2b --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/read.cgi @@ -0,0 +1,128 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; +use Mozilla::LDAP::Conn; +use PKI::TPS::Common; + +[REQUIRE_CFG_PL] + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + my $q = new CGI; + my $host = get_ldap_host(); + my $port = get_ldap_port(); + my $secureconn = get_ldap_secure(); + my $basedn = get_base_dn(); + my $certdir = get_ldap_certdir(); + + if (!&authorize()) { + print $q->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + my $name = $q->param('name'); + my $uid = $q->param('name_ID'); + $name = "" if !defined $name; + + if ($name eq "") { + print $q->redirect("/cgi-bin/sow/search.cgi?error=Name cannot be empty"); + return; + } + + my $conn = PKI::TPS::Common::make_connection( + {host => $host, port => $port, cert => $certdir}, + $secureconn); + + if (!$conn) { + print $q->redirect("/cgi-bin/sow/search.cgi?error=Failed to connect to the database."); + return; + }; + + my $entry = $conn->search ( $basedn, + "sub", + "cn=$name", + 0 + ); + + if (!$entry) { + $conn->close(); + print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); + return; + } + + my $givenName = ($entry->getValues("givenName"))[0] || "-"; + my $cn = ($entry->getValues("cn"))[0] || "-"; + my $sn = ($entry->getValues("sn"))[0] ||"-"; + $uid = ($entry->getValues("uid"))[0] || "-"; + my $mail = ($entry->getValues("mail"))[0] || "-"; + my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; + my $photoLarge = ($entry->getValues("photoLarge"))[0] || ""; # photo (full size) + my $photoSmall = ($entry->getValues("photoSmall"))[0] || ""; # photo (thumb) + my $height = ($entry->getValues("height"))[0] || ""; + my $weight = ($entry->getValues("weight"))[0] || ""; + my $eyecolor = ($entry->getValues("eyeColor"))[0] || ""; + + $conn->close(); + + if ($uid eq "-") { + print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); + return; + } + + open(FILE, "< read.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$mail/$mail/g; + $l =~ s/\$uid/$uid/g; + $l =~ s/\$givenName/$givenName/g; + $l =~ s/\$sn/$sn/g; + $l =~ s/\$cn/$cn/g; + $l =~ s/\$phone/$phone/g; + $l =~ s/\$photoLarge/$photoLarge/g; + $l =~ s/\$photoSmall/$photoSmall/g; + $l =~ s/\$height/$height/g; + $l =~ s/\$weight/$weight/g; + $l =~ s/\$eyecolor/$eyecolor/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/read_temp.cgi b/base/tps/apache/cgi-bin/sow/read_temp.cgi new file mode 100755 index 000000000..31c6fd7e3 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/read_temp.cgi @@ -0,0 +1,125 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; +use Mozilla::LDAP::Conn; +use PKI::TPS::Common; + +[REQUIRE_CFG_PL] + + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + my $q = new CGI; + my $host = get_ldap_host(); + my $port = get_ldap_port(); + my $secureconn = get_ldap_secure(); + my $basedn = get_base_dn(); + my $certdir = get_ldap_certdir(); + + if (!&authorize()) { + print $q->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + my $name = $q->param('name'); + my $uid = $q->param('name_ID'); + $name = "" if !defined $name; + + if ($name eq "") { + print $q->redirect("/cgi-bin/sow/search.cgi?error=Name cannot be empty"); + return; + } + + my $conn = PKI::TPS::Common::make_connection( + {host => $host, port => $port, cert => $certdir}, + $secureconn); + + + my $entry = $conn->search ( $basedn, + "sub", + "cn=$name", + 0 + ); + + if (!$entry) { + $conn->close(); + print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); + return; + } + + my $givenName = ($entry->getValues("givenName"))[0] || "-"; + my $cn = ($entry->getValues("cn"))[0] || "-"; + my $sn = ($entry->getValues("sn"))[0] ||"-"; + $uid = ($entry->getValues("uid"))[0] || "-"; + my $mail = ($entry->getValues("mail"))[0] || "-"; + my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; + my $photoLarge = ($entry->getValues("photoLarge"))[0] || ""; # photo (full size) + my $photoSmall = ($entry->getValues("photoSmall"))[0] || ""; # photo (thumb) + my $height = ($entry->getValues("height"))[0] || ""; + my $weight = ($entry->getValues("weight"))[0] || ""; + my $eyecolor = ($entry->getValues("eyeColor"))[0] || ""; + + $conn->close(); + + if ($uid eq "-") { + print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); + return; + } + + open(FILE, "< read_temp.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$mail/$mail/g; + $l =~ s/\$uid/$uid/g; + $l =~ s/\$givenName/$givenName/g; + $l =~ s/\$sn/$sn/g; + $l =~ s/\$cn/$cn/g; + $l =~ s/\$phone/$phone/g; + $l =~ s/\$photoLarge/$photoLarge/g; + $l =~ s/\$photoSmall/$photoSmall/g; + $l =~ s/\$height/$height/g; + $l =~ s/\$weight/$weight/g; + $l =~ s/\$eyecolor/$eyecolor/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/search.cgi b/base/tps/apache/cgi-bin/sow/search.cgi new file mode 100755 index 000000000..e681ed100 --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/search.cgi @@ -0,0 +1,70 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); + +my $q = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $q->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + my $error = $q->param('error'); + $error = "" if !defined $error; + + open(FILE, "< search.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$error/$error/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/search_temp.cgi b/base/tps/apache/cgi-bin/sow/search_temp.cgi new file mode 100755 index 000000000..5d752a49d --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/search_temp.cgi @@ -0,0 +1,70 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); + +my $q = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $q->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + my $error = $q->param('error'); + $error = "" if !defined $error; + + open(FILE, "< search_temp.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$error/$error/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/seturl.cgi b/base/tps/apache/cgi-bin/sow/seturl.cgi new file mode 100755 index 000000000..dfac46d8f --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/seturl.cgi @@ -0,0 +1,207 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; + +my $ldapHost = get_ldap_host(); +my $ldapPort = get_ldap_port(); +my $basedn = get_base_dn(); +my $host = get_host(); +my $port = get_port(); +my $secure_port = get_secure_port(); + +$gQuery = new CGI; + +sub authorize +{ + my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; + $client_dn =~ tr/A-Z/a-z/; # all lower cases + $client_dn =~ s/\s+//g; # remove all spacing + + if (&is_agent($client_dn)) { + return 1; + } + return 0; +} + +sub DoPage +{ + if (!&authorize()) { + print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); + return; + } + + $gQueryAction = "default"; + $gQueryOverrideAction = "default"; + + @gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + + $gQueryAction = $gQuery->param("action") if + (defined $gQuery->param("action")); + + $gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + + if ($gQueryOverrideAction ne "default") + { + $gQueryAction = $gQueryOverrideAction; + } + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + + if ($gQueryAction eq "default") + { + GeneratePage(); + exit 0; + } +} + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GeneratePage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< seturl.html")); + + print $gQuery->header(); + + while ($l = ) + { + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + print $l; + } + + close(ENROLL_FILE); +} + +&DoPage(); diff --git a/base/tps/apache/cgi-bin/sow/welcome.cgi b/base/tps/apache/cgi-bin/sow/welcome.cgi new file mode 100755 index 000000000..bc76dd3fa --- /dev/null +++ b/base/tps/apache/cgi-bin/sow/welcome.cgi @@ -0,0 +1,57 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# + +use CGI; + +[REQUIRE_CFG_PL] + + +my $host = get_host(); +my $secure_port = get_secure_port(); +my $port = get_port(); + +my $q = new CGI; + +sub DoPage +{ + + my $error = $q->param('error'); + $error = "" if !defined $error; + + open(FILE, "< welcome.html"); + + print $q->header(); + + while ($l = ) + { + $l =~ s/\$error/$error/g; + $l =~ s/\$host/$host/g; + $l =~ s/\$secure_port/$secure_port/g; + $l =~ s/\$port/$port/g; + print $l; + } + + close(FILE); +} + +&DoPage(); diff --git a/base/tps/apache/docroot/index.cgi b/base/tps/apache/docroot/index.cgi new file mode 100755 index 000000000..0e643166b --- /dev/null +++ b/base/tps/apache/docroot/index.cgi @@ -0,0 +1,76 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# 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; version 2 of the License. +# +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# + +package op; + +use lib $ENV{DOCUMENT_ROOT} . "/../lib/perl"; + +use CGI; +use PKI::Service::Op; +use Template::Velocity; +use PKI::Base::Conf; +use PKI::Base::Registry; + +use vars qw (@ISA); +use PKI::Service::Op; +@ISA = qw(PKI::Service::Op); + +sub new { + my $self = {}; + bless ($self); + return $self; +} + +sub process() +{ + my $self = shift; + + my $q = CGI->new(); + + my $docroot = PKI::Base::Registry->get_docroot(); + my $parser = PKI::Base::Registry->get_parser(); + my $cfg = PKI::Base::Registry->get_config(); + + $self->debug_params($cfg, $q); + + $::symbol{machineName} = $cfg->get("service.machineName"); + $::symbol{non_clientauth_securePort} = $cfg->get("service.non_clientauth_securePort"); + $::symbol{securePort} = $cfg->get("service.securePort"); + $::symbol{unsecurePort} = $cfg->get("service.unsecurePort"); + + my $result = $parser->execute_file("index.vm"); + + my $xml = $q->param('xml'); + if ($xml eq "true") { + print "Content-Type: text/xml\n\n"; + print $self->xml_output(\%::symbol); + } else { + print "Content-Type: text/html\n\n"; + print "$result"; + } +} + + +my $op = op->new(); +$op->execute(); diff --git a/base/tps/apache/docroot/index.html b/base/tps/apache/docroot/index.html new file mode 100644 index 000000000..b225251a1 --- /dev/null +++ b/base/tps/apache/docroot/index.html @@ -0,0 +1,22 @@ + + + + diff --git a/base/tps/forms/esc/cgi-bin/demo/enroll.cgi b/base/tps/forms/esc/cgi-bin/demo/enroll.cgi deleted file mode 100755 index c0f4bcabf..000000000 --- a/base/tps/forms/esc/cgi-bin/demo/enroll.cgi +++ /dev/null @@ -1,183 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -use CGI; - -$gQuery = new CGI; - -$gQueryAction = "default"; -$gQueryOverrideAction = "default"; - -@gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - -$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); - -$gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - -if ($gQueryOverrideAction ne "default") -{ - $gQueryAction = $gQueryOverrideAction; -} - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - -if ($gQueryAction eq "default") -{ - GenerateEnrollmentPage(); - exit 0; -} - - - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateEnrollmentPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(ENROLL_FILE); -} diff --git a/base/tps/forms/esc/cgi-bin/demo/index.cgi b/base/tps/forms/esc/cgi-bin/demo/index.cgi deleted file mode 100755 index c9a1d21dd..000000000 --- a/base/tps/forms/esc/cgi-bin/demo/index.cgi +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# -print "Content-type: text/xml\n\n"; -print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; -print ""; -print ""; -print "Fedora Project"; # Vendor -print "\n"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/nk_service"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/cgi-bin/demo/enroll.cgi"; -print ""; -print ""; -print ""; -print ""; -print ""; -print ""; -print "userKey"; -print ""; -print ""; -print ""; diff --git a/base/tps/forms/esc/cgi-bin/home/cachain.cgi b/base/tps/forms/esc/cgi-bin/home/cachain.cgi deleted file mode 100755 index 27dc9cd6c..000000000 --- a/base/tps/forms/esc/cgi-bin/home/cachain.cgi +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# - -use LWP::UserAgent; - -my $cfg = "../../conf/CS.cfg"; -my $cahostport = `grep conn.ca1.hostport $cfg | cut -c19-`; - -chomp($cahostport); - -my $url = "https://$cahostport/ca/ee/ca/getCAChain?op=download&mimeType=application/x-x509-ca-cert"; - -my $agent = LWP::UserAgent->new; -$agent->timeout(30); - -my $request = HTTP::Request->new('GET', $url); -my $response = $agent->request($request); - -if ($response->is_success) { - print "Content-type: application/x-x509-ca-cert\n\n"; - print $response->content; - -} else { - print "Content-type: text/html\n\n"; - print ""; - print ""; - print "

Error Importing CA Chain Information!

"; - print "

Please try again later.

"; - print "" -} diff --git a/base/tps/forms/esc/cgi-bin/home/enroll.cgi b/base/tps/forms/esc/cgi-bin/home/enroll.cgi deleted file mode 100755 index c0f4bcabf..000000000 --- a/base/tps/forms/esc/cgi-bin/home/enroll.cgi +++ /dev/null @@ -1,183 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -use CGI; - -$gQuery = new CGI; - -$gQueryAction = "default"; -$gQueryOverrideAction = "default"; - -@gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - -$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); - -$gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - -if ($gQueryOverrideAction ne "default") -{ - $gQueryAction = $gQueryOverrideAction; -} - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - -if ($gQueryAction eq "default") -{ - GenerateEnrollmentPage(); - exit 0; -} - - - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateEnrollmentPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(ENROLL_FILE); -} diff --git a/base/tps/forms/esc/cgi-bin/home/index.cgi b/base/tps/forms/esc/cgi-bin/home/index.cgi deleted file mode 100755 index 1e54a8354..000000000 --- a/base/tps/forms/esc/cgi-bin/home/index.cgi +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# -print "Content-type: text/xml\n\n"; -print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; -print ""; -print ""; -print "Fedora Project"; # Vendor -print "\n"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/nk_service"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/cgi-bin/home/enroll.cgi"; -print ""; -print ""; -print "http://www.fedora.redhat.com"; # Company URL -print ""; -print ""; -print ""; -print ""; -print "userKey"; -print ""; -#print ""; -#print "http://[SERVER_NAME]:[PORT]/cgi-bin/home/cachain.cgi"; -#print ""; -print ""; -print ""; diff --git a/base/tps/forms/esc/cgi-bin/so/enroll.cgi b/base/tps/forms/esc/cgi-bin/so/enroll.cgi deleted file mode 100755 index 148cd78c0..000000000 --- a/base/tps/forms/esc/cgi-bin/so/enroll.cgi +++ /dev/null @@ -1,193 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; - -my $port = get_port(); -my $host = get_host(); -my $secure_port = get_secure_port(); - -$gQuery = new CGI; - -$gQueryAction = "default"; -$gQueryOverrideAction = "default"; - -@gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - -$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); - -$gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - -if ($gQueryOverrideAction ne "default") -{ - $gQueryAction = $gQueryOverrideAction; -} - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - -if ($gQueryAction eq "default") -{ - GenerateEnrollmentPage(); - exit 0; -} - - - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateEnrollmentPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - - print $l; - } - } - - close(ENROLL_FILE); -} diff --git a/base/tps/forms/esc/cgi-bin/so/index.cgi b/base/tps/forms/esc/cgi-bin/so/index.cgi deleted file mode 100755 index 7b3f2c68d..000000000 --- a/base/tps/forms/esc/cgi-bin/so/index.cgi +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# -print "Content-type: text/xml\n\n"; -print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; -print ""; -print ""; -print "Fedora Project"; # Vendor -print "\n"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/nk_service"; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/cgi-bin/so/enroll.cgi"; -print ""; -print ""; -print ""; -print ""; -print "http://[SERVER_NAME]:[PORT]/cgi-bin/sow/welcome.cgi"; -print ""; -print ""; -print "soKey"; -print ""; -print ""; -print ""; diff --git a/base/tps/forms/esc/cgi-bin/sow/ajax-list.cgi b/base/tps/forms/esc/cgi-bin/sow/ajax-list.cgi deleted file mode 100755 index 0f4ac094f..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/ajax-list.cgi +++ /dev/null @@ -1,79 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -[REQUIRE_CFG_PL] - -sub main() -{ - - my $q = new CGI; - - my $host = get_ldap_host(); - my $port = get_ldap_port(); - my $secureconn = get_ldap_secure(); - my $basedn = get_base_dn(); - my $certdir = get_ldap_certdir(); - - my $letters = $q->param('letters'); - if ($letters eq "") { - # HACK: ajax.js posts parameters into POST URL - $letters = $ENV{'QUERY_STRING'}; - $letters =~ s/.*letters=//g; - $letters =~ s/\+/ /g; - } - - my $result = ""; - - print "Content-Type: text/html\n\n"; - - my $conn = PKI::TPS::Common::make_connection( - {host => $host, port => $port, cert => $certdir}, - $secureconn); - - return if (!$conn); - - my $entry = $conn->search ( { base =>$basedn, - scope => "sub", - filter => "cn=$letters*", - attrsonly => 0, - attrs => qw(cn uid), - sortattrs => qw(cn)} - ); - - while ($entry) { - my $cn = ($entry->getValues("cn"))[0] || ""; - my $uid = ($entry->getValues("uid"))[0] || ""; - $result .= $uid . "###" . $cn . "|"; - $entry $conn->nextEntry(); - } - - $conn->close(); - - print $result; -} - -&main(); diff --git a/base/tps/forms/esc/cgi-bin/sow/cfg.pl b/base/tps/forms/esc/cgi-bin/sow/cfg.pl deleted file mode 100755 index d616fa136..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/cfg.pl +++ /dev/null @@ -1,174 +0,0 @@ -#! /usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -# -# Feel free to modify the following parameters: -# -my $ldapHost = "localhost"; -my $ldapPort = "389"; -my $basedn = "ou=People,dc=sfbay,dc=redhat,dc=com"; -my $port = "7888"; -my $secure_port = "7889"; -my $host = "localhost"; - -my $cfg = "/var/lib/pki-tps/conf/CS.cfg"; - -sub get_ldap_host() -{ - my $ldapport = `grep auth.instance.0.hostport $cfg | cut -c26-`; - chomp($ldapport); - my ($ldapHost, $p) = split(/:/, $ldapport); - return $ldapHost; -} - -sub get_ldap_port() -{ - my $ldapport = `grep auth.instance.0.hostport $cfg | cut -c26-`; - chomp($ldapport); - my ($p, $ldapPort) = split(/:/, $ldapport); - return $ldapPort; -} - -sub get_ldap_secure() -{ - my $ldapsecure = `grep auth.instance.0.ssl $cfg | cut -c21-`; - chomp($ldapsecure); - return $ldapsecure; -} - -sub get_ldap_certdir() -{ - my $ldapcertdir = `grep service.instanceDir $cfg | cut -c21-`; - chomp($ldapcertdir); - return $ldapcertdir . "/alias"; -} - -sub get_base_dn() -{ - my $basedn = `grep auth.instance.0.baseDN $cfg | cut -c24-`; - chomp($basedn); - return $basedn; -} - -sub get_port() -{ - my $port = `grep service.unsecurePort $cfg | cut -c22-`; - chomp($port); - return $port; -} - -sub get_secure_port() -{ - my $secure_port = `grep service.securePort $cfg | cut -c20-`; - chomp($secure_port); - return $secure_port; -} - -sub get_host() -{ - my $host = `grep service.machineName $cfg | cut -c21-`; - chomp($host); - return $host; -} - -sub is_agent() -{ - my ($dn) = @_; - - my $uid = $dn; - # need to map a subject dn into user DN - $uid =~ /uid=([^,]*)/; # retrieve the uid - $uid = $1; - - my $x_hostport = `grep -e "^tokendb.hostport" $cfg | cut -c18-`; - chomp($x_hostport); - my ($x_host, $x_port) = split(/:/, $x_hostport); - - my $x_secureconn = `grep -e "^tokendb.ssl" $cfg | cut -c13-`; - chomp($x_secureconn); - my $x_basedn = `grep -e "^tokendb.userBaseDN" $cfg | cut -c20-`; - chomp($x_basedn); - my $x_binddn = `grep -e "^tokendb.bindDN" $cfg | cut -c16-`; - chomp($x_binddn); - my $x_bindpwdpath = `grep -e "^tokendb.bindPassPath" $cfg | cut -c22-`; - chomp($x_bindpwdpath); - my $x_bindpwd = `grep -e "^tokendbBindPass" $x_bindpwdpath | cut -c17-`; - chomp($x_bindpwd); - - my $ldap = PKI::TPS::Common::make_connection( - {host => $x_host, port => $x_port, pswd => $x_bindpwd, bind => $x_binddn, cert => $x_certdir}, - $x_secureconn); - - return 0 if (! $ldap); - - my $entry = $ldap->search ( "cn=TUS Officers,ou=Groups,$x_basedn", - "sub", - "uid=$uid", - 0 - ); - - $ldap->close(); - - if ($entry) { - return 1; - } - return 0; -} - -sub is_user() -{ - my ($dn) = @_; - - my $uid = $dn; - # need to map a subject dn into user DN - $uid =~ /uid=([^,]*)/; # retrieve the uid - $uid = $1; - - my $x_host = get_ldap_host(); - my $x_port = get_ldap_port(); - my $x_secureconn = get_ldap_secure(); - my $x_basedn = get_base_dn(); - my $x_certdir = get_ldap_certdir(); - - my $ldap = PKI::TPS::Common::make_connection( - {host => $x_host, port => $x_port, cert => $x_certdir}, - $x_secureconn); - - return 0 if (! $ldap); - - my $entry = $ldap->search ( "ou=people,$x_basedn", - "sub", - "uid=$uid", - 0 - ); - - $ldap->close(); - - if ($entry) { - return 1; - } - return 0; -} - diff --git a/base/tps/forms/esc/cgi-bin/sow/enroll.cgi b/base/tps/forms/esc/cgi-bin/sow/enroll.cgi deleted file mode 100755 index 8a6431e52..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/enroll.cgi +++ /dev/null @@ -1,246 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -$gQuery = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - $gQueryAction = "default"; - $gQueryOverrideAction = "default"; - - @gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - - $gQueryAction = $gQuery->param("action") if - (defined $gQuery->param("action")); - - $gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - - if ($gQueryOverrideAction ne "default") - { - $gQueryAction = $gQueryOverrideAction; - } - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - - if ($gQueryAction eq "default") - { - GenerateEnrollmentPage(); - exit 0; - } -} - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateEnrollmentPage -{ - my ($l); - my $ldap_host = get_ldap_host(); - my $ldap_port = get_ldap_port(); - my $secureconn = get_ldap_secure(); - my $basedn = get_base_dn(); - my $port = get_port(); - my $host = get_host(); - my $secure_port = get_secure_port(); - my $certdir = get_ldap_certdir(); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< enroll.html")); - - print $gQuery->header(); - - my $uid = $gQuery->param("uid"); - - my $conn = PKI::TPS::Common::make_connection( - {host => $ldap_host, port => $ldap_port, cert => $certdir}, - $secureconn); - - ExitError("Failed to connect to the database. $msg") if (!$conn); - - my $entry = $conn->search ( $basedn, - "sub", - "uid=$uid", - 0 - ); - - if (!$entry) { - $conn->close(); - ExitError("User $uid not found"); - } - - my $givenName = ($entry->getValues("givenName"))[0] || "-"; - my $cn = ($entry->getValues("cn"))[0] || "-"; - my $sn = ($entry->getValues("sn"))[0] ||"-"; - $uid = ($entry->getValues("uid"))[0] || "-"; - my $mail = ($entry->getValues("mail"))[0] || "-"; - my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; - my $departmentNumber = ($entry->getValues("departmentNumber"))[0] || ""; - my $employeeNumber = ($entry->getValues("employeeNumber"))[0] || ""; - - while ($l = ) - { - $l =~ s/\$mail/$mail/g; - $l =~ s/\$uid/$uid/g; - $l =~ s/\$givenName/$givenName/g; - $l =~ s/\$sn/$sn/g; - $l =~ s/\$cn/$cn/g; - $l =~ s/\$phone/$phone/g; - $l =~ s/\$departmentNumber/$departmentNumber/g; - $l =~ s/\$employeeNumber/$employeeNumber/g; - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - print $l; - } - - close(ENROLL_FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/enroll_temp.cgi b/base/tps/forms/esc/cgi-bin/sow/enroll_temp.cgi deleted file mode 100755 index 5817039a2..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/enroll_temp.cgi +++ /dev/null @@ -1,246 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -$gQuery = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - $gQueryAction = "default"; - $gQueryOverrideAction = "default"; - - @gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - - $gQueryAction = $gQuery->param("action") if - (defined $gQuery->param("action")); - - $gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - - if ($gQueryOverrideAction ne "default") - { - $gQueryAction = $gQueryOverrideAction; - } - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - - if ($gQueryAction eq "default") - { - GenerateEnrollmentPage(); - exit 0; - } -} - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateEnrollmentPage -{ - my ($l); - my $ldap_host = get_ldap_host(); - my $ldap_port = get_ldap_port(); - my $secureconn = get_ldap_secure(); - my $basedn = get_base_dn(); - my $port = get_port(); - my $host = get_host(); - my $secure_port = get_secure_port(); - my $certdir = get_ldap_certdir(); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< enroll_temp.html")); - - print $gQuery->header(); - - my $uid = $gQuery->param("uid"); - - my $conn = PKI::TPS::Common::make_connection( - {host => $ldap_host, port => $ldap_port, cert => $certdir}, - $secureconn); - - ExitError("Failed to connect to the database. $msg") if (!$conn); - - my $entry = $conn->search ( $basedn, - "sub", - "uid=$uid", - 0 - ); - - if (!$entry) { - $conn->close(); - ExitError("User $uid not found"); - } - - my $givenName = ($entry->getValues("givenName"))[0] || "-"; - my $cn = ($entry->getValues("cn"))[0] || "-"; - my $sn = ($entry->getValues("sn"))[0] ||"-"; - $uid = ($entry->getValues("uid"))[0] || "-"; - my $mail = ($entry->getValues("mail"))[0] || "-"; - my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; - my $departmentNumber = ($entry->getValues("departmentNumber"))[0] || ""; - my $employeeNumber = ($entry->getValues("employeeNumber"))[0] || ""; - - while ($l = ) - { - $l =~ s/\$mail/$mail/g; - $l =~ s/\$uid/$uid/g; - $l =~ s/\$givenName/$givenName/g; - $l =~ s/\$sn/$sn/g; - $l =~ s/\$cn/$cn/g; - $l =~ s/\$phone/$phone/g; - $l =~ s/\$departmentNumber/$departmentNumber/g; - $l =~ s/\$employeeNumber/$employeeNumber/g; - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - print $l; - } - - close(ENROLL_FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/format.cgi b/base/tps/forms/esc/cgi-bin/sow/format.cgi deleted file mode 100755 index 9b310991d..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/format.cgi +++ /dev/null @@ -1,207 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); -my $host = get_host(); -my $port = get_port(); -my $secure_port = get_secure_port(); - -$gQuery = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - $gQueryAction = "default"; - $gQueryOverrideAction = "default"; - - @gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - - $gQueryAction = $gQuery->param("action") if - (defined $gQuery->param("action")); - - $gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - - if ($gQueryOverrideAction ne "default") - { - $gQueryAction = $gQueryOverrideAction; - } - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - - if ($gQueryAction eq "default") - { - GeneratePage(); - exit 0; - } -} - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GeneratePage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< format.html")); - - print $gQuery->header(); - - while ($l = ) - { - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - print $l; - } - - close(ENROLL_FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/formatso.cgi b/base/tps/forms/esc/cgi-bin/sow/formatso.cgi deleted file mode 100755 index d53129139..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/formatso.cgi +++ /dev/null @@ -1,207 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); -my $host = get_host(); -my $port = get_port(); -my $secure_port = get_secure_port(); - -$gQuery = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - $gQueryAction = "default"; - $gQueryOverrideAction = "default"; - - @gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - - $gQueryAction = $gQuery->param("action") if - (defined $gQuery->param("action")); - - $gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - - if ($gQueryOverrideAction ne "default") - { - $gQueryAction = $gQueryOverrideAction; - } - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - - if ($gQueryAction eq "default") - { - GeneratePage(); - exit 0; - } -} - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GeneratePage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< formatso.html")); - - print $gQuery->header(); - - while ($l = ) - { - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - print $l; - } - - close(ENROLL_FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/index.cgi b/base/tps/forms/esc/cgi-bin/sow/index.cgi deleted file mode 100755 index 7f7a98869..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/index.cgi +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# -print "Content-type: text/xml\n\n"; -print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; -print ""; -print ""; -print "Fedora Project"; # Vendor -print "\n"; -print ""; -print ""; -print "https://[SERVER_NAME]:[SECURE_PORT]/nk_service"; -print ""; -print ""; -print "https://[SERVER_NAME]:[SECURE_PORT]/cgi-bin/sow/search.cgi"; -print ""; -print ""; -print ""; -print ""; -print ""; diff --git a/base/tps/forms/esc/cgi-bin/sow/is_agent.cgi b/base/tps/forms/esc/cgi-bin/sow/is_agent.cgi deleted file mode 100755 index c6b6a87f7..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/is_agent.cgi +++ /dev/null @@ -1,69 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); - -my $q = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoIsAgent -{ - - print "Content-type: text/xml\n\n"; - - if (!&authorize()) { - return; - } - - my $uid = $q->param('uid'); - - if(&is_agent("uid=$uid")) - { - print "yes\n"; - } - else - { - print "no\n"; - } - -} - -&DoIsAgent(); diff --git a/base/tps/forms/esc/cgi-bin/sow/is_user.cgi b/base/tps/forms/esc/cgi-bin/sow/is_user.cgi deleted file mode 100755 index d7a551421..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/is_user.cgi +++ /dev/null @@ -1,71 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -use CGI::Carp qw(fatalsToBrowser); - -[REQUIRE_CFG_PL] - - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); - -my $q = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoIsUser -{ - - print "Content-type: text/xml\n\n"; - - if (!&authorize()) { - return; - } - - my $uid = $q->param('uid'); - - if(&is_user("uid=$uid")) - { - print "yes\n"; - } - else - { - print "no\n"; - } - -} - -&DoIsUser(); diff --git a/base/tps/forms/esc/cgi-bin/sow/main.cgi b/base/tps/forms/esc/cgi-bin/sow/main.cgi deleted file mode 100755 index c6f65e42e..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/main.cgi +++ /dev/null @@ -1,70 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); - -my $q = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $q->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - my $error = $q->param('error'); - $error = "" if !defined $error; - - open(FILE, "< main.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$error/$error/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/noaccess.cgi b/base/tps/forms/esc/cgi-bin/sow/noaccess.cgi deleted file mode 100755 index 17166bcb6..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/noaccess.cgi +++ /dev/null @@ -1,56 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $host = get_host(); -my $secure_port = get_secure_port(); -my $port = get_port(); - -my $q = new CGI; - -sub DoPage -{ - - my $error = $q->param('error'); - - open(FILE, "< noaccess.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$error/$error/g; - $l =~ s/\$host/$host/g; - $l =~ s/\$secure_port/$secure_port/g; - $l =~ s/\$port/$port/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/read.cgi b/base/tps/forms/esc/cgi-bin/sow/read.cgi deleted file mode 100755 index 8a5793c2b..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/read.cgi +++ /dev/null @@ -1,128 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -[REQUIRE_CFG_PL] - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - my $q = new CGI; - my $host = get_ldap_host(); - my $port = get_ldap_port(); - my $secureconn = get_ldap_secure(); - my $basedn = get_base_dn(); - my $certdir = get_ldap_certdir(); - - if (!&authorize()) { - print $q->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - my $name = $q->param('name'); - my $uid = $q->param('name_ID'); - $name = "" if !defined $name; - - if ($name eq "") { - print $q->redirect("/cgi-bin/sow/search.cgi?error=Name cannot be empty"); - return; - } - - my $conn = PKI::TPS::Common::make_connection( - {host => $host, port => $port, cert => $certdir}, - $secureconn); - - if (!$conn) { - print $q->redirect("/cgi-bin/sow/search.cgi?error=Failed to connect to the database."); - return; - }; - - my $entry = $conn->search ( $basedn, - "sub", - "cn=$name", - 0 - ); - - if (!$entry) { - $conn->close(); - print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); - return; - } - - my $givenName = ($entry->getValues("givenName"))[0] || "-"; - my $cn = ($entry->getValues("cn"))[0] || "-"; - my $sn = ($entry->getValues("sn"))[0] ||"-"; - $uid = ($entry->getValues("uid"))[0] || "-"; - my $mail = ($entry->getValues("mail"))[0] || "-"; - my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; - my $photoLarge = ($entry->getValues("photoLarge"))[0] || ""; # photo (full size) - my $photoSmall = ($entry->getValues("photoSmall"))[0] || ""; # photo (thumb) - my $height = ($entry->getValues("height"))[0] || ""; - my $weight = ($entry->getValues("weight"))[0] || ""; - my $eyecolor = ($entry->getValues("eyeColor"))[0] || ""; - - $conn->close(); - - if ($uid eq "-") { - print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); - return; - } - - open(FILE, "< read.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$mail/$mail/g; - $l =~ s/\$uid/$uid/g; - $l =~ s/\$givenName/$givenName/g; - $l =~ s/\$sn/$sn/g; - $l =~ s/\$cn/$cn/g; - $l =~ s/\$phone/$phone/g; - $l =~ s/\$photoLarge/$photoLarge/g; - $l =~ s/\$photoSmall/$photoSmall/g; - $l =~ s/\$height/$height/g; - $l =~ s/\$weight/$weight/g; - $l =~ s/\$eyecolor/$eyecolor/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/read_temp.cgi b/base/tps/forms/esc/cgi-bin/sow/read_temp.cgi deleted file mode 100755 index 31c6fd7e3..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/read_temp.cgi +++ /dev/null @@ -1,125 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; -use Mozilla::LDAP::Conn; -use PKI::TPS::Common; - -[REQUIRE_CFG_PL] - - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - my $q = new CGI; - my $host = get_ldap_host(); - my $port = get_ldap_port(); - my $secureconn = get_ldap_secure(); - my $basedn = get_base_dn(); - my $certdir = get_ldap_certdir(); - - if (!&authorize()) { - print $q->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - my $name = $q->param('name'); - my $uid = $q->param('name_ID'); - $name = "" if !defined $name; - - if ($name eq "") { - print $q->redirect("/cgi-bin/sow/search.cgi?error=Name cannot be empty"); - return; - } - - my $conn = PKI::TPS::Common::make_connection( - {host => $host, port => $port, cert => $certdir}, - $secureconn); - - - my $entry = $conn->search ( $basedn, - "sub", - "cn=$name", - 0 - ); - - if (!$entry) { - $conn->close(); - print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); - return; - } - - my $givenName = ($entry->getValues("givenName"))[0] || "-"; - my $cn = ($entry->getValues("cn"))[0] || "-"; - my $sn = ($entry->getValues("sn"))[0] ||"-"; - $uid = ($entry->getValues("uid"))[0] || "-"; - my $mail = ($entry->getValues("mail"))[0] || "-"; - my $phone = ($entry->getValues("telephoneNumber"))[0] || "-"; - my $photoLarge = ($entry->getValues("photoLarge"))[0] || ""; # photo (full size) - my $photoSmall = ($entry->getValues("photoSmall"))[0] || ""; # photo (thumb) - my $height = ($entry->getValues("height"))[0] || ""; - my $weight = ($entry->getValues("weight"))[0] || ""; - my $eyecolor = ($entry->getValues("eyeColor"))[0] || ""; - - $conn->close(); - - if ($uid eq "-") { - print $q->redirect("/cgi-bin/sow/search.cgi?error=User $name not found"); - return; - } - - open(FILE, "< read_temp.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$mail/$mail/g; - $l =~ s/\$uid/$uid/g; - $l =~ s/\$givenName/$givenName/g; - $l =~ s/\$sn/$sn/g; - $l =~ s/\$cn/$cn/g; - $l =~ s/\$phone/$phone/g; - $l =~ s/\$photoLarge/$photoLarge/g; - $l =~ s/\$photoSmall/$photoSmall/g; - $l =~ s/\$height/$height/g; - $l =~ s/\$weight/$weight/g; - $l =~ s/\$eyecolor/$eyecolor/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/search.cgi b/base/tps/forms/esc/cgi-bin/sow/search.cgi deleted file mode 100755 index e681ed100..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/search.cgi +++ /dev/null @@ -1,70 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); - -my $q = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $q->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - my $error = $q->param('error'); - $error = "" if !defined $error; - - open(FILE, "< search.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$error/$error/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/search_temp.cgi b/base/tps/forms/esc/cgi-bin/sow/search_temp.cgi deleted file mode 100755 index 5d752a49d..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/search_temp.cgi +++ /dev/null @@ -1,70 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); - -my $q = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $q->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - my $error = $q->param('error'); - $error = "" if !defined $error; - - open(FILE, "< search_temp.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$error/$error/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/seturl.cgi b/base/tps/forms/esc/cgi-bin/sow/seturl.cgi deleted file mode 100755 index dfac46d8f..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/seturl.cgi +++ /dev/null @@ -1,207 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -[REQUIRE_CFG_PL] - -use CGI; - -my $ldapHost = get_ldap_host(); -my $ldapPort = get_ldap_port(); -my $basedn = get_base_dn(); -my $host = get_host(); -my $port = get_port(); -my $secure_port = get_secure_port(); - -$gQuery = new CGI; - -sub authorize -{ - my $client_dn = $ENV{'SSL_CLIENT_S_DN'}; - $client_dn =~ tr/A-Z/a-z/; # all lower cases - $client_dn =~ s/\s+//g; # remove all spacing - - if (&is_agent($client_dn)) { - return 1; - } - return 0; -} - -sub DoPage -{ - if (!&authorize()) { - print $gQuery->redirect("/cgi-bin/sow/noaccess.cgi"); - return; - } - - $gQueryAction = "default"; - $gQueryOverrideAction = "default"; - - @gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - - $gQueryAction = $gQuery->param("action") if - (defined $gQuery->param("action")); - - $gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - - if ($gQueryOverrideAction ne "default") - { - $gQueryAction = $gQueryOverrideAction; - } - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - - if ($gQueryAction eq "default") - { - GeneratePage(); - exit 0; - } -} - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GeneratePage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< seturl.html")); - - print $gQuery->header(); - - while ($l = ) - { - $l =~ s/\$host/$host/g; - $l =~ s/\$port/$port/g; - $l =~ s/\$secure_port/$secure_port/g; - print $l; - } - - close(ENROLL_FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/cgi-bin/sow/welcome.cgi b/base/tps/forms/esc/cgi-bin/sow/welcome.cgi deleted file mode 100755 index bc76dd3fa..000000000 --- a/base/tps/forms/esc/cgi-bin/sow/welcome.cgi +++ /dev/null @@ -1,57 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# - -use CGI; - -[REQUIRE_CFG_PL] - - -my $host = get_host(); -my $secure_port = get_secure_port(); -my $port = get_port(); - -my $q = new CGI; - -sub DoPage -{ - - my $error = $q->param('error'); - $error = "" if !defined $error; - - open(FILE, "< welcome.html"); - - print $q->header(); - - while ($l = ) - { - $l =~ s/\$error/$error/g; - $l =~ s/\$host/$host/g; - $l =~ s/\$secure_port/$secure_port/g; - $l =~ s/\$port/$port/g; - print $l; - } - - close(FILE); -} - -&DoPage(); diff --git a/base/tps/forms/esc/esc.cgi b/base/tps/forms/esc/esc.cgi deleted file mode 100755 index 70a93c0a0..000000000 --- a/base/tps/forms/esc/esc.cgi +++ /dev/null @@ -1,1239 +0,0 @@ -#! /usr/bin/perl -w -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -######################################################################## -# -# Script: esc.cgi -# Author: Kin Blas () -# Date: 12/19/2003 -# -# CGI.pm Docs: -# -# http://stein.cshl.org/WWW/software/CGI/ -# -######################################################################## - -use CGI; - -$gQuery = new CGI; - -$gQueryAction = "default"; -$gQueryOverrideAction = "default"; - -@gCookieNames = ("ascScreenName", - "ascSubscriptionType", - "ascBindings"); - -$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); - -$gQueryOverrideAction = $gQuery->param("override_action") - if (defined $gQuery->param("override_action")); - -if ($gQueryOverrideAction ne "default") -{ - $gQueryAction = $gQueryOverrideAction; -} - -######################################################################## -# -# If no action was provided, we default to showing our -# admin page! -# -# http://www.foo.com/esc.cgi -# -######################################################################## - -if ($gQueryAction eq "default") -{ - GenerateAdminPage(); - exit 0; -} - -######################################################################## -# -# We aren't doing any admin functions, before proceeding -# on to user specific functions, make sure we have a screen name -# and that they are subscribed to a service. -# -######################################################################## - -#if (!HaveScreenName() || $gQueryAction eq "screennamepage") -#{ -# GenerateScreenNamePage($gQueryAction); -# exit 0; -#} - -LoadUserDatabase("default"); - -######################################################################## -# -# Subscribe? -# -# http://www.foo.com/esc.cgi?action=subscribe -# -######################################################################## - -#if ($gQueryAction eq "subscribe") -#{ -# SaveSubscription(); -# $nextAction = GetNextAction(); -# $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); -# print $gQuery->redirect(-uri=>$redirectLocation); -# exit 0; -#} - -#if (!IsSubscriber() || $gQueryAction eq "subscriptionpage") -#{ -# GenerateTOSPage($gQueryAction); -# exit 0; -#} - -######################################################################## -# -# Show our cookie management page? -# -# http://www.foo.com/esc.cgi?action=cookiepage -# -######################################################################## - -#if ($gQueryAction eq "cookiepage") -#{ -# GenerateCookiesPage(); -# exit 0; -#} - -######################################################################## -# -# Clear cookies? -# -# http://www.foo.com/esc.cgi?action=clearAllCookies -# -######################################################################## - -#if ($gQueryAction eq "removeCookies") -#{ -# @expCookies = (); -# foreach $cookie (@gCookieNames) -# { -# if (defined $gQuery->param($cookie)) -# { -# $expCookies[$cookieCnt++] = CreateExpiredCookie($cookie); -# } -# } -# $redirectLocation = $gQuery->url(-path_info=>1)."?action=cookiepage&screenname=".GetScreenName(); -# print $gQuery->redirect(-uri=>$redirectLocation, -# -cookie=>\@expCookies); -# exit 0; -#} - -######################################################################## -# -# Bind? -# -# -######################################################################## - -if ($gQueryAction eq "bind") -{ - UpdateBindingsForBind(); - $nextAction = GetNextAction(); - - $nextAction = "bindpage" if ($nextAction eq $gQueryAction); - - $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&prevaction=bind&screenname=".GetScreenName()."&keytype=".GetKeyType()."&keyid=".GetKeyID()."&keylabel=".GetKeyLabelArg(); - print $gQuery->redirect(-uri=>$redirectLocation); - exit 0; -} - -######################################################################## -# -# Unbind? -# -# -######################################################################## - -if ($gQueryAction eq "unbind") -{ - UpdateBindingsForUnbind(); - - $nextAction = GetNextAction(); - - $nextAction = "bindpage" if ($nextAction eq $gQueryAction); - - $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&prevaction=unbind&screenname=".GetScreenName()."&keytype=".GetKeyType()."&keyid=".GetKeyID()."&keylabel=".GetKeyLabelArg(); - print $gQuery->redirect(-uri=>$redirectLocation); - exit 0; -} - -######################################################################## -# -# Label? -# -# -######################################################################## - -if ($gQueryAction eq "label") -{ - UpdateBindingsForLabel(); - - $nextAction = GetNextAction(); - - $nextAction = "bindpage" if ($nextAction eq $gQueryAction); - - $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); - print $gQuery->redirect(-uri=>$redirectLocation); - exit 0; -} - -######################################################################## -# -# ScreenName? -# -# -######################################################################## - -#if ($gQueryAction eq "screenname") -#{ -# $nextAction = GetNextAction(); -# $redirectLocation = $gQuery->url(-path_info=>1)."?action=$nextAction&screenname=".GetScreenName(); -# print $gQuery->redirect(-uri=>$redirectLocation); -# exit 0; -#} - -######################################################################## -# -# Check if we are displaying the label page. -# -# -######################################################################## - -if ($gQueryAction eq "labelpage") -{ - my $nextAction = GetNextAction(); - $nextAction = "bindpage" if ($nextAction eq $gQueryAction); - - my $keyType = GetKeyType(); - my $keyId = GetKeyID(); - - GenerateLabelPage($keyType, $keyId, $nextAction); - exit 0; -} - -######################################################################## -# -# Show our enrollment page? -# -# http://www.foo.com/esc.cgi?action=enrollmentpage -# -######################################################################## - -if ($gQueryAction eq "enrollmentpage") -{ - GenerateEnrollmentPage(); - exit 0; -} - -if ($gQueryAction eq "advancepage") -{ - GenerateAdvancePage(); - exit 0; -} - -if ($gQueryAction eq "tokenmanagerpage") -{ - GenerateTokenManagerPage(); - exit 0; -} - -if($gQueryAction eq "authenticate") -{ - - GenerateAuthenticationPage(); - exit 0; -} - -if ($gQueryAction eq "autoenroll") -{ - GenerateAutoEnrollmentPage(); - exit 0; -} - -######################################################################## -# -# Show our ticket request page? -# -# -######################################################################## - -if ($gQueryAction eq "ticketreqpage") -{ - GenerateTicketRequestPage(); - exit 0; -} - -######################################################################## -# -# Show our load external url page? -# -# http://www.foo.com/esc.cgi?action=loadurlpage -# -######################################################################## - - -if ($gQueryAction eq "loadurl") -{ - $nextAction = GetNextAction(); - $redirectLocation = $gQuery->param('url'); - print $gQuery->redirect(-uri=>$redirectLocation); - exit 0; -} - -if ($gQueryAction eq "loadurlpage") -{ - GenerateLoadURLPage(); - exit 0; -} - -######################################################################## -# -# User is subscribed, check if we are displaying the -# settings page. -# -# -######################################################################## - -if ($gQueryAction eq "settingspage") -{ - GenerateSettingsPage(); - exit 0; -} - -######################################################################## -# -# Check if we are displaying the set label page. -# -# -######################################################################## - -if ($gQueryAction eq "setlabelpage") -{ - GenerateSetLabelPage(); - exit 0; -} - -######################################################################## -# -# Check if we are displaying the bind/unbind progress page! -# -# -######################################################################## - -if ($gQueryAction eq "bindprogresspage") -{ - GenerateBindProgressPage("bind"); - exit 0; -} - -if ($gQueryAction eq "unbindprogresspage") -{ - GenerateBindProgressPage("unbind"); - exit 0; -} - -######################################################################## -# -# Check if we are displaying the bind/unbind success page! -# -# -######################################################################## - -if ($gQueryAction eq "bindsuccesspage") -{ - GenerateBindSuccessPage("bind"); - exit 0; -} - -if ($gQueryAction eq "unbindsuccesspage") -{ - GenerateBindSuccessPage("unbind"); - exit 0; -} - -######################################################################## -# -# XXX: Lose this code! -# User is subscribed, check if we are displaying the -# binding page. -# -# -######################################################################## - -if ($gQueryAction eq "bindpage") -{ - GenerateBindingConfigPage(); - exit 0; -} - -print "

Unknown Query Action "; -print $qQueryAction; -print "

"; -exit 0; - -######################################################################## -# -# -######################################################################## - - -sub ExitError -{ - my($str) = @_; - print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); - exit 0; -} - -sub GetScreenName -{ - my $sn = ""; - - if (defined $gQuery->param("screenname")) - { - $sn = $gQuery->param("screenname"); - } else { - $sn = "default"; - } - - return $sn; -} - -sub GetKeyType -{ - my $keyType = 0; - - if (defined $gQuery->param("keytype")) - { - $keyType = $gQuery->param("keytype"); - } - - return $keyType; -} - -sub GetKeyID -{ - my $keyID = ""; - - if (defined $gQuery->param("keyid")) - { - $keyID = $gQuery->param("keyid"); - } - - return $keyID; -} - -sub GetKeyLabelArg -{ - my $keyLabel = ""; - - if (defined $gQuery->param("keylabel")) - { - $keyLabel = $gQuery->param("keylabel"); - } - - return $keyLabel; -} - -sub HaveScreenName -{ - return 1 if (GetScreenName() ne ""); - return 0; -} - -sub IsSubscriber -{ - my $subType = $gUserObj{'SUBSCRIPTION'}; - return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); - - return 0; -} - -sub GetNextAction -{ - my($nextActn) = "default"; - - if (defined $gQuery->param('nextaction')) - { - $nextActn = $gQuery->param('nextaction'); - } - elsif (defined $gQuery->param('action')) - { - $nextActn = $gQuery->param('action'); - } - - return $nextActn; -} - -sub GenerateAdminPage() -{ - my ($l); - - ExitError("Failed to load Admin Page") if (!open(ADMIN_FILE, "< ./AdminEsc.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - } - print $l; - } - close(ADMIN_FILE); -} - -sub GenerateCookiesPage() -{ - my ($nextPage) = @_; - - my ($l); - - ExitError("Failed to load TOS Page") if (!open(COOKIE_FILE, "< Cookies.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_COOKIE_LIST/) - { - my @cookies = $gQuery->cookie(); - if (@cookies < 1) - { - print "No ASC Cookies currently defined!
\n"; - } - else - { - my $cookieName; - foreach $cookieName (@cookies) - { - # - # Display only ASC related cookies! - # - - if ($cookieName =~ /^asc/) - { - print "$cookieName", $gQuery->cookie($cookieName), "\n"; - } - } - print "
\n"; - } - } - elsif ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(COOKIE_FILE); -} - -sub GenerateScreenNamePage -{ - my ($nextPage) = @_; - - my ($l); - - ExitError("Failed to load ScreenName Page") if (!open(SN_FILE, "< ScreenName.html")); - - print $gQuery->header(); - - my $sn = GetScreenName(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) - { - if ($nextPage) - { - print "\n"; - print "\n"; - } - - if ($sn) - { - print "\n"; - } - } - elsif ($l =~ //) - { - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(SN_FILE); -} - -sub GenerateTOSPage -{ - my ($nextPage) = @_; - - my ($l); - - ExitError("Failed to load TOS Page") if (!open(TOS_FILE, "< Subscribe.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) - { - if ($nextPage) - { - print "\n"; - print "\n"; - } - } - elsif ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(TOS_FILE); -} - -sub GenerateSettingsPage -{ - my ($l); - - ExitError("Failed to load settings page!") if (!open(SETTINGS_FILE, "< SettingsEsc.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_BINDINGS_ARRAY/) - { - my(@curBindings) = GetBindings(); - my $arrSize = scalar(@curBindings); - my($i); - - for ($i = 0; $i < $arrSize; $i++) - { - my($keyType, $keyId, $keyLabel) = split(/&/, $curBindings[$i]); - print " [ $keyType, \"$keyId\", \"$keyLabel\" ]"; - print "," if ($arrSize > 1 && $i != $arrSize - 1); - print "\n"; - } - } - elsif ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(SETTINGS_FILE); -} - -sub GenerateSetLabelPage -{ - my ($l); - - ExitError("Failed to open label page!") if (!open(LABEL_PAGE, "< Label.html")); - - my $sn = GetScreenName(); - ExitError("Failed to get a valid screen name!") if (! $sn); - - my $keyType = GetKeyType(); - my $keyID = GetKeyID(); - ExitError("Failed to get a valid keyID!") if (! $keyID); - - $defLabel = $keyID; - $defLabel =~ s/^[0-9a-fA-F]{12}//; - $defLabel = "$sn-$defLabel"; - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - $l =~ s//$sn/g; - } - if ($l =~ //) - { - $l =~ s//$keyType/g; - } - if ($l =~ //) - { - $l =~ s//$keyID/g; - } - if ($l =~ //) - { - $l =~ s//$defLabel/g; - } - print $l; - } - close(LABEL_FILE); -} - -sub GenerateBindProgressPage -{ - my ($action) = @_; - my ($l); - - ExitError("Failed to open progress page!") if (!open(PROG_PAGE, "< Progress.html")); - - my $sn = GetScreenName(); - ExitError("Failed to get a valid screen name!") if (! $sn); - - my $keyType = GetKeyType(); - my $keyID = GetKeyID(); - ExitError("Failed to get a valid keyID!") if (! $keyID); - - my $keyLabel = ""; - - if ($action eq "bind") - { - $keyLabel = GetKeyLabelArg(); - ExitError("Failed to get a valid keyLabel!") if (! $keyLabel); - } - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - $l =~ s//$sn/g; - } - if ($l =~ //) - { - $l =~ s//$keyType/g; - } - if ($l =~ //) - { - $l =~ s//$keyID/g; - } - if ($l =~ //) - { - $l =~ s//$keyLabel/g; - } - if ($l =~ //) - { - $l =~ s//$action/g; - } - if ($l =~ //) - { - $challengeData = ""; - $challengeData = "QVNDIHJvY2tzIHRoZSBwYXJ0eSE=" if ($action eq "bind"); - - $l =~ s//$challengeData/g; - } - print $l; - } - close(PROG_PAGE); -} - -sub GenerateBindSuccessPage -{ - my ($action) = @_; - my ($l); - - ExitError("Failed to open progress page!") if (!open(SUCCESS_PAGE, "< BindSuccess.html")); - - my $sn = GetScreenName(); - ExitError("Failed to get a valid screen name!") if (! $sn); - - my $keyType = GetKeyType(); - my $keyID = GetKeyID(); - ExitError("Failed to get a valid keyID!") if (! $keyID); - - my $keyLabel = ""; - - if ($action eq "bind") - { - $keyLabel = GetKeyLabelArg(); - ExitError("Failed to get a valid keyLabel!") if (! $keyLabel); - } - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - $l =~ s//$sn/g; - } - if ($l =~ //) - { - $l =~ s//$keyType/g; - } - if ($l =~ //) - { - $l =~ s//$keyID/g; - } - if ($l =~ //) - { - $l =~ s//$keyLabel/g; - } - if ($l =~ //) - { - $l =~ s//$action/g; - } - print $l; - } - close(SUCCESS_PAGE); -} - -sub GenerateBindingConfigPage -{ - my ($l); - - ExitError("Failed to load binding page!") if (!open(BINDING_FILE, "< Bindings.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_BINDINGS_ARRAY/) - { - my(@curBindings) = GetBindings(); - my $arrSize = scalar(@curBindings); - my($i); - - for ($i = 0; $i < $arrSize; $i++) - { - my($keyType, $keyId, $keyLabel) = split(/&/, $curBindings[$i]); - print " [ $keyType, \"$keyId\", \"$keyLabel\" ]"; - print "," if ($arrSize > 1 && $i != $arrSize - 1); - print "\n"; - } - } - elsif ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(BINDING_FILE); -} - -sub GetKeyLabel -{ - my($keyType, $keyId) = @_; - - my(@curBindings) = GetBindings(); - my($numBindings) = scalar(@curBindings); - - while($numBindings > 0) - { - --$numBindings; - if ($curBindings[$numBindings] =~ /^$keyType&$keyId&/) - { - my($ktype, $id, $lbl) = split(/&/, $curBindings[$numBindings]); - return $lbl; - } - } - - return ""; -} - -sub GenerateLabelPage -{ - my($keyType, $keyId, $nextAction) = @_; - my($keyLabel) = GetKeyLabel($keyType, $keyId); - - return if ($keyLabel eq ""); - - my ($l); - - ExitError("Failed to load label page!") if (!open(EDIT_LABEL_FILE, "< EditLabel.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ /SECURECOOL_NEXTACTION_INPUT_TAG/) - { - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - } - elsif ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - close(EDIT_LABEL_FILE); -} - -sub GenerateAutoEnrollmentPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< EnrollPopup.html")); - - print $gQuery->header(); - - while ($l = ) - { - print $l; - } - - close(ENROLL_FILE); -} -sub GenerateAuthenticationPage -{ - my ($l); - ExitError("Failed to load enrollment page!") if (!open(AUTH_FILE, "< GenericAuth.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(AUTH_FILE); -} - -sub GenerateEnrollmentPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< EnrollPopup.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(ENROLL_FILE); -} - -sub GenerateAdvancePage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< AdvancePopup.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(ENROLL_FILE); -} - -sub GenerateTokenManagerPage -{ - my ($l); - - ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< TokenManager.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(ENROLL_FILE); -} - -sub GenerateTicketRequestPage -{ - my ($l); - - ExitError("Failed to load ticket request page!") if (!open(TICKETREQ_FILE, "< Ticket.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(TICKETREQ_FILE); -} - -sub GenerateLoadURLPage -{ - my ($l); - - ExitError("Failed to load url request page!") if (!open(LOADURL_FILE, "< LoadURL.html")); - - print $gQuery->header(); - - while ($l = ) - { - if ($l =~ //) - { - my $sn = GetScreenName(); - $l =~ s//$sn/g; - print $l; - } - else - { - print $l; - } - } - - close(LOADURL_FILE); -} - -sub CreateExpiredCookie -{ - my($cookieName) = @_; - my $cookie = $gQuery->cookie(-name=>$cookieName, - -value=>'', - -expires=>'-2d', - -path=>$gQuery->url(-absolute=>1), - -domain=>$gQuery->server_name()); - return $cookie; - -} - -sub SaveSubscription -{ - - $gUserObj{'SUBSCRIPTION'} = $gQuery->param("subscriptiontype"); - SaveUserDatabase(GetScreenName()); -} - -sub GetBindings -{ - my $bindings = $gUserObj{'BINDINGS'}; - return @$bindings; -} - -sub BindingsArrayToString -{ - my(@bindings) = @_; - my $i; - my $str = ""; - - for ($i = 0; $i < @bindings; $i++) - { - if ($bindings[$i] ne "") - { - $str .= "&" if ($str ne ""); - $str .= ASCUrlEncode($bindings[$i]); - } - } - - return $str; -} - -sub AddItemToBindings -{ - my($keyType, $keyId, $keyLabel) = @_; - - my(@curBindings) = GetBindings(); - my($pos) = scalar(@curBindings); - - # First check to see if the key already exists in - # the cookie! If it does, we'll just overwrite it. - - my($i) = $pos; - while($i > 0) - { - --$i; - if ($curBindings[$i] =~ /^$keyType&$keyId&/) - { - $pos = $i; - last; - } - } - - $curBindings[$pos] = "$keyType&$keyId&$keyLabel"; - - $gUserObj{'BINDINGS'} = \@curBindings; - #SaveUserDatabase(GetScreenName()); -} - -sub RemoveItemFromBindings -{ - my($keyType, $keyId) = @_; - - my(@curBindings) = GetBindings(); - my($numBindings) = scalar(@curBindings); - my @newBindings; - - while($numBindings > 0) - { - --$numBindings; - next if ($curBindings[$numBindings] =~ /^$keyType&$keyId&/); - push @newBindings, $curBindings[$numBindings]; - } - - $gUserObj{'BINDINGS'} = \@newBindings; - #SaveUserDatabase(GetScreenName()); -} - -sub UpdateBindingsForBind -{ - return if (! defined $gQuery->param("keytype")); - my($keyType) = $gQuery->param("keytype"); - - return if (! defined $gQuery->param("keyid")); - my($keyId) = $gQuery->param("keyid"); - - return if (! defined $gQuery->param("keylabel")); - my($keyLabel) = $gQuery->param("keylabel"); - - return AddItemToBindings($keyType, $keyId, $keyLabel); -} - -sub UpdateBindingsForUnbind -{ - return if (! defined $gQuery->param("keytype")); - my($keyType) = $gQuery->param("keytype"); - - return if (! defined $gQuery->param("keyid")); - my($keyId) = $gQuery->param("keyid"); - - return RemoveItemFromBindings($keyType, $keyId,); -} - -sub UpdateBindingsForLabel -{ - return UpdateBindingsForBind(); -} - -sub ASCUrlDecode -{ - my($qstr) = @_; - $qstr =~ s/\+/ /g; - $qstr =~ s/%([0-9A-F]{2})/pack("C", hex($1))/eig; - return $qstr; -} - -sub ASCUrlEncode -{ - my($qstr) = @_; - $qstr =~ s/([^a-zA-Z0-9_ ])/sprintf("%%%.2X", unpack("C", $1))/eig; - $qstr =~ s/ /+/g; - return $qstr; -} - -sub LoadUserDatabase -{ - my($sn) = @_; - - $gUserObj{'SUBSCRIPTION'} = ""; - - $gUserObj{'BINDINGS'} = ""; - return; - -} - -sub SaveUserDatabase -{ - my($sn) = @_; - my($snfile) = "UserDatabase/$sn"; - - return; - -} diff --git a/base/tps/forms/esc/home.cgi b/base/tps/forms/esc/home.cgi deleted file mode 100755 index 5fdf5ecf8..000000000 --- a/base/tps/forms/esc/home.cgi +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; -# version 2.1 of the License. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301 USA -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# -print "Content-type: text/xml\n\n"; -print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; -print ""; -print ""; -print "Fedora Project"; # Vendor -print "\n"; -print ""; -print ""; -print "http://machine.fedora.redhat.com:7888/nk_service"; -print ""; -print ""; -print "http://machine.fedora.redhat.com:7888/cgi-bin/esc.cgi"; -print ""; -print ""; -print ""; diff --git a/base/tps/forms/index.cgi b/base/tps/forms/index.cgi deleted file mode 100755 index 0e643166b..000000000 --- a/base/tps/forms/index.cgi +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/perl -# -# --- BEGIN COPYRIGHT BLOCK --- -# 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; version 2 of the License. -# -# 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., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# --- END COPYRIGHT BLOCK --- -# -# -# -# - -package op; - -use lib $ENV{DOCUMENT_ROOT} . "/../lib/perl"; - -use CGI; -use PKI::Service::Op; -use Template::Velocity; -use PKI::Base::Conf; -use PKI::Base::Registry; - -use vars qw (@ISA); -use PKI::Service::Op; -@ISA = qw(PKI::Service::Op); - -sub new { - my $self = {}; - bless ($self); - return $self; -} - -sub process() -{ - my $self = shift; - - my $q = CGI->new(); - - my $docroot = PKI::Base::Registry->get_docroot(); - my $parser = PKI::Base::Registry->get_parser(); - my $cfg = PKI::Base::Registry->get_config(); - - $self->debug_params($cfg, $q); - - $::symbol{machineName} = $cfg->get("service.machineName"); - $::symbol{non_clientauth_securePort} = $cfg->get("service.non_clientauth_securePort"); - $::symbol{securePort} = $cfg->get("service.securePort"); - $::symbol{unsecurePort} = $cfg->get("service.unsecurePort"); - - my $result = $parser->execute_file("index.vm"); - - my $xml = $q->param('xml'); - if ($xml eq "true") { - print "Content-Type: text/xml\n\n"; - print $self->xml_output(\%::symbol); - } else { - print "Content-Type: text/html\n\n"; - print "$result"; - } -} - - -my $op = op->new(); -$op->execute(); diff --git a/base/tps/forms/index.html b/base/tps/forms/index.html deleted file mode 100644 index b225251a1..000000000 --- a/base/tps/forms/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - -- cgit