diff options
| author | Romain Chantereay <rchantereau@entrouvert.com> | 2004-08-23 14:39:34 +0000 |
|---|---|---|
| committer | Romain Chantereay <rchantereau@entrouvert.com> | 2004-08-23 14:39:34 +0000 |
| commit | 579eae8b88803cf98f67c3f54f507d53a31c0a8f (patch) | |
| tree | 7e417cb09568662c2097fcc0ede21634c459796d /php | |
| parent | b2dc7bcf645d7186ac81e83263268e86fa842d27 (diff) | |
| download | lasso-579eae8b88803cf98f67c3f54f507d53a31c0a8f.tar.gz lasso-579eae8b88803cf98f67c3f54f507d53a31c0a8f.tar.xz lasso-579eae8b88803cf98f67c3f54f507d53a31c0a8f.zip | |
REmoved now useless binding files.
See attic for more information.
Diffstat (limited to 'php')
28 files changed, 0 insertions, 4067 deletions
diff --git a/php/Attic/examples/leak.php b/php/Attic/examples/leak.php deleted file mode 100644 index 7701c270..00000000 --- a/php/Attic/examples/leak.php +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/php -<?php - - if(!extension_loaded('lasso')) { - dl('lasso.' . PHP_SHLIB_SUFFIX); - } - - /* - * - */ - - lasso_init(); - - $server = lasso_server_new("./sp.xml", "./rsapub.pem", - "./rsakey.pem", "./rsacert.pem", lassoSignatureMethodRsaSha1); - lasso_server_add_provider($server, "./idp.xml", "", ""); - - $login = lasso_login_new($server); - - lasso_login_init_authn_request($login, - "https://identity-provider:2003/liberty-alliance/metadata"); - - $profile = lasso_cast_to_profile($login); - lasso_profile_get_request($profile); - - $profile2 = lasso_cast_to_profile($login); - lasso_profile_get_request($profile2); - - lasso_shutdown(); -?> diff --git a/php/Attic/examples/login.php b/php/Attic/examples/login.php deleted file mode 100644 index d82c20ed..00000000 --- a/php/Attic/examples/login.php +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/php -<?php - if(!extension_loaded('lasso')) { - dl('lasso.' . PHP_SHLIB_SUFFIX); - } - - lasso_init(); - - print "Lasso version : " . lasso_version() . "\n"; - - $server = lasso_server_new( - "./sp.xml", - "./rsapub.pem", - "./rsakey.pem", - "./rsacert.pem", lassoSignatureMethodRsaSha1); - - lasso_server_add_provider($server, "./idp.xml", "", ""); - - $splogin = lasso_login_new($server); - - # Create AuthnRequest - - lasso_login_init_authn_request($splogin, lassoHttpMethodRedirect); - - $profile = lasso_cast_to_profile($splogin); - - $node = lasso_profile_get_request($profile); - - $lib_authn_request = lasso_cast_to_lib_authn_request($node); - - lasso_lib_authn_request_set_ispassive($lib_authn_request, FALSE); - lasso_lib_authn_request_set_forceauthn($lib_authn_request, TRUE); - lasso_lib_authn_request_set_nameidpolicy($lib_authn_request, lassoLibNameIDPolicyTypeFederated); - lasso_lib_authn_request_set_relaystate($lib_authn_request, "fake"); - lasso_lib_authn_request_set_protocolprofile($lib_authn_request, lassoLibProtocolProfileBrwsArt); - - lasso_login_build_authn_request_msg($splogin, "https://identity-provider:2003/liberty-alliance/metadata"); - - print "msg_url : " . lasso_profile_get_msg_url($profile) . "\n"; - print "msg_body : " . lasso_profile_get_msg_body($profile) . "\n"; - - lasso_shutdown(); -?> diff --git a/php/Attic/examples/sample-sp/admin_user.php b/php/Attic/examples/sample-sp/admin_user.php deleted file mode 100644 index 6893ad72..00000000 --- a/php/Attic/examples/sample-sp/admin_user.php +++ /dev/null @@ -1,162 +0,0 @@ -<?php -/* - * Service Provider Example -- User Administration - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - $config = unserialize(file_get_contents('config.inc')); - - require_once 'DB.php'; - - - $db = &DB::connect($config['dsn']); - - if (DB::isError($db)) - die($db->getMessage()); - - if (!empty($_GET['dump'])) { - $query = "SELECT identity_dump FROM users WHERE user_id='" . $_GET['dump'] . "'"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - $row = $res->fetchRow(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html> -<body> -<table> -<caption>Identity Dump</caption> -<tr> -<td> -<textarea rows="15" cols="50"> -<?php - echo htmlentities($row[0], ENT_QUOTES); -?> -</textarea> -</td> -</tr> -<tr> -<td align="center"><a href="javascript:window.close(self)">Close</a></td> -</tr> -</table> -</body> -</html> -<?php - exit; - } - - if (!empty($_GET['del'])) { - - $query = "DELETE FROM nameidentifiers WHERE user_id='" . $_GET['del'] . "'" ; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - $query = "DELETE FROM users WHERE user_id='" . $_GET['del'] . "'" ; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - } - - - $query = "SELECT * FROM users"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html> -<head> -<title>Lasso Service Provider Example : Users Management</title> -<script type="text/javascript"> - - function openpopup(popurl){ - var winpops=window.open(popurl,"","width=400,height=300") - } - -</script> -</head> -<body> - -<table border="1" align="center"> -<caption>Users</caption> -<?php - $num_col = $res->numCols(); - $tableinfo = $db->tableInfo($res); -?> -<thead> -<tr align="center"><?php - for ($i = 0; $i < $num_col; $i++) { - echo "<td>" . $tableinfo[$i]['name'] ."</td>"; - } -?><td> </td> -</tr> -</thead> -<tbody> -<?php - while ($row =& $res->fetchRow()) { -?> -<tr align="center"> -<?php - for ($i = 0; $i < $num_col; $i++) - { - ?> - <td> - <?php - switch ($tableinfo[$i]['name']) - { - case "identity_dump": - echo "<a href=javascript:openpopup('". $PHP_SELF . '?dump=' . $row[0] . "')>view</a>"; - break; - - default: - echo (empty($row[$i])) ? " " : $row[$i]; - } - ?> - </td> - <?php - } - ?> - <td> - <a href="<?php echo $PHP_SELF . '?del=' . $row[0]; ?>">delete</a> - </td> -</tr> -<?php -} -?> -</tbody> -<tfoot> -<tr> -<td colspan="<?php echo $num_col; ?>"> </td> -<td>Total: <?php echo $res->numRows();?> Users</td> -</tr> -</tfoot> -</table> - -</body> - -</html> -<?php - $db->disconnect(); -?> diff --git a/php/Attic/examples/sample-sp/assertionConsumer.php b/php/Attic/examples/sample-sp/assertionConsumer.php deleted file mode 100644 index 2f434e24..00000000 --- a/php/Attic/examples/sample-sp/assertionConsumer.php +++ /dev/null @@ -1,184 +0,0 @@ -<?php -/* - * Service Provider Example -- AssertionConsumer - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - $config = unserialize(file_get_contents('config.inc')); - - require_once 'DB.php'; - - - if (!$_GET['SAMLart']) { - exit(1); - } - - session_start(); - - lasso_init(); - - $server_dump = file_get_contents($config['server_dump_filename']); - - $server = lasso_server_new_from_dump($server_dump); - - $login = lasso_login_new($server); - - lasso_login_init_request($login, $_SERVER['QUERY_STRING'], lassoHttpMethodRedirect); - lasso_login_build_request_msg($login); - - $profile = lasso_cast_to_profile($login); - - - $msg_url = lasso_profile_get_msg_url($profile); - $msg_body = lasso_profile_get_msg_body($profile); - - $url = parse_url($msg_url); - - $soap = sprintf( - "POST %s HTTP/1.1\r\nHost: %s:%d\r\nAccept-Encoding: identity\r\nContent-Length: %d\r\nContent-Type: text/xml\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html\r\nConnection: close\r\n\r\n%s\r\n", - $url['path'], $url['host'], $url['port'], strlen($msg_body), $msg_body); - - - # PHP 4.3.0 with OpenSSL support required - $fp = fsockopen("ssl://" . $url['host'], $url['port'], $errno, $errstr, 30) or die($errstr ($errno)); - fwrite($fp, $soap); - $ret = fgets($fp); - - if (!preg_match("/^HTTP\/1\\.. 200/i", $ret)) { - die("Wrong artifact"); - } - - while (!feof($fp)) { - $reponse .= @fread($fp, 8192); - } - - fclose($fp); - - list($header, $body) = preg_split("/\r\n\r\n/", $reponse, 2); - - lasso_login_process_response_msg($login, $body); - $nameidentifier = lasso_profile_get_nameidentifier($profile); - - # Look for the name_identifier in user db. - $options = array( - 'debug' => 2, - ); - $db = &DB::connect($config['dsn'], $options); - - if (DB::isError($db)) - die($db->getMessage()); - - $query = "SELECT user_id FROM nameidentifiers WHERE name_identifier='$nameidentifier'"; - $res =& $db->query($query); - - if (DB::isError($res)) - die($res->getMessage()); - - if ($res->numRows() > 0) - { - // User already exist in the database - $row =& $res->fetchRow(); - $user_id = $row[0]; - - # Get Identity Dump from the data base - $query = "SELECT identity_dump FROM users WHERE user_id='$user_id'"; - $res =& $db->query($query); - - if (DB::isError($db)) - die($db->getMessage()); - - $row =& $res->fetchRow(); - $identity_dump = $row[0]; - - lasso_profile_set_identity_from_dump($profile, $identity_dump); - - $res->free(); - - lasso_login_accept_sso($login); - - $session = lasso_profile_get_session($profile); - $session_dump = lasso_session_dump($session); - - $_SESSION["nameidentifier"] = $nameidentifier; - $_SESSION["session_dump"] = $session_dump; - $_SESSION["user_id"] = $user_id; - - - $url = "index.php?SID=". $SID; - } - else - { - // New User - lasso_login_accept_sso($login); - - $identity = lasso_profile_get_identity($profile); - $identity_dump = lasso_identity_dump($identity); - // print "identity_dump: " . $identity_dump . "<br>\n"; - - $session = lasso_profile_get_session($profile); - $session_dump = lasso_session_dump($session); - // print "session_dump: " . $session_dump . "<br>\n"; - - // Insert into users - $identity_dump_quoted = $db->quoteSmart($identity_dump); - $query = "INSERT INTO users (user_id,identity_dump,created) VALUES(nextval('user_id_seq'), $identity_dump_quoted, NOW())"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - - // Get UserID - $query = "SELECT last_value FROM user_id_seq"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - $row = $res->fetchRow(); - $user_id = $row[0]; - - // Insert into nameidentifiers - $query = "INSERT INTO nameidentifiers VALUES('$nameidentifier', '$user_id')"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - - $_SESSION["nameidentifier"] = $nameidentifier; - $_SESSION["session_dump"] = $session_dump; - $_SESSION["user_id"] = $user_id; - - $url = "register.php?SID=". $SID; - } - - // Update last_login - $query = "UPDATE users SET last_login=NOW() WHERE user_id='$user_id'"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - $db->disconnect(); - - lasso_shutdown(); - - header("Request-URI: $url"); - header("Content-Location: $url"); - header("Location: $url"); - exit(); -?> diff --git a/php/Attic/examples/sample-sp/index.php b/php/Attic/examples/sample-sp/index.php deleted file mode 100644 index b0e82797..00000000 --- a/php/Attic/examples/sample-sp/index.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -/* - * Service Provider Example -- Configuration File - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - if(!extension_loaded('lasso')) { - $ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); - if ($ret == FALSE) - { -?> -<p align='center'><b>The Lasso Extension is not available</b><br> -Please check your PHP extensions<br> -You can get more informations about <b>Lasso</b> at <br> -<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p> -<?php - exit(); - } - } - - if (!file_exists('config.inc')) - { -?> -<p align='center'><b>Service Provider Configuration file is not available</b><br> -Please run the setup script :<br> -<a href='setup.php'>Lasso Service Provider Setup</a><br> -You can get more informations about <b>Lasso</b> at <br> -<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p> -<?php - } - - $config = unserialize(file_get_contents('config.inc')); - - require_once 'DB.php'; - - session_start($SID); - - lasso_init(); - -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> -<head> -<title>Lasso Service Provider Example</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> -</head> - -<body> -<p> -<table border="1" frame="above"> -<tr> - <td><b>Service Provider Administration</b></td> -</tr> -<tr> - <td><a href="setup.php">Setup</a></td> -</tr> -<tr> - <td><a href="admin_user.php">Users Management</a></td> -</tr> -<!--<tr> - <td><a href="admin_fed.php">Federation Administration</a></td> -</tr> --> -<tr> - <td><b>Serice Provider Fonctionnality</b></td> -</tr> -<?php - if (!isset($_SESSION["nameidentifier"])) { - ?> -<tr> - <td><a href="login.php">Login!</a></td> -</tr> -<?php } else { ?> -<tr> - <td><a href="logout.php?SID=<?php echo $SID ?>">Logout!</a></td> -</tr> -<?php } ?> -</table> -</p> -<p> -<table border="1" frame="above"> -<caption><b>Status</b></caption> -<tr> - <?php - if (!isset($_SESSION["nameidentifier"])) - { - echo "<td>User is <b>not</b> logged in!</td>"; - } - else - { - ?> - <td colspan='2' align="center">User <b>is</b> logged in!</td> -</tr> -<tr> - <td><b>Name Identifier:</b></td><td><?php echo $_SESSION["nameidentifier"]; ?></td> -</tr> -<tr> - <td><b>UserID:</b></td><td><?php echo $_SESSION["user_id"]; ?></td> -</tr> -<?php - $db = &DB::connect($config['dsn']); - - if (DB::isError($db)) - die($db->getMessage()); - - $query = "SELECT * FROM users WHERE user_id='". $_SESSION["user_id"] ."'"; - - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - list($user_id, $identity_dump, $first_name, $last_name, $created, $last_login) = $res->fetchRow(); - - ?> -<tr> - <td><b>Last Name:</b></td><td><?php echo $last_name; ?></td> -</tr> -<tr> - <td><b>First Name:</b></td><td><?php echo $first_name; ?></td> -</tr> -<tr> - <td><b>PHP Session ID:</b></td><td><?php echo session_id(); ?></td> -</tr> -<tr> - <td><b>Account Created:</b></td><td><?php echo $created; ?></td> -</tr> -<tr> - <td><b>Last Login:</b></td><td><?php echo $last_login; ?></td> - <?php - $db->disconnect(); - } - ?> -</tr> -</table> -</p> -<p>Lasso Version : <?php echo lasso_version(); ?></p> - -<br> -<p>Copyright © 2004 Entr'ouvert</p> - -</body> - -</html> -<?php - lasso_shutdown(); - ?> diff --git a/php/Attic/examples/sample-sp/login.php b/php/Attic/examples/sample-sp/login.php deleted file mode 100644 index b2c87879..00000000 --- a/php/Attic/examples/sample-sp/login.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/* - * - * Service Provider Example -- Simple Sing On - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - - $config = unserialize(file_get_contents('config.inc')); - - lasso_init(); - - $server_dump = file_get_contents($config['server_dump_filename']); - - $server = lasso_server_new_from_dump($server_dump); - - $login = lasso_login_new($server); - - lasso_login_init_authn_request($login, lassoHttpMethodRedirect); - - $profile = lasso_cast_to_profile($login); - - $node = lasso_profile_get_request($profile); - - $lib_authn_request = lasso_cast_to_lib_authn_request($node); - - // lasso_lib_authn_request_set_forceauthn($lib_authn_request, TRUE); - lasso_lib_authn_request_set_ispassive($lib_authn_request, FALSE); - lasso_lib_authn_request_set_nameidpolicy($lib_authn_request, lassoLibNameIDPolicyTypeFederated); - lasso_lib_authn_request_set_consent($lib_authn_request, lassoLibConsentObtained); - - lasso_login_build_authn_request_msg($login, "https://idp1/metadata"); - - - $url = lasso_profile_get_msg_url($profile); - - header("Request-URI: $url"); - header("Content-Location: $url"); - header("Location: $url"); - exit(); -?> diff --git a/php/Attic/examples/sample-sp/logout.php b/php/Attic/examples/sample-sp/logout.php deleted file mode 100644 index 7662bbc6..00000000 --- a/php/Attic/examples/sample-sp/logout.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php -/* - * Service Provider Example -- Logout - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - $config = unserialize(file_get_contents('config.inc')); - - require_once 'DB.php'; - - if (!empty($_GET['SID'])) - session_start($_GET['SID']); - else - session_start(); - - if (!isset($_SESSION["nameidentifier"])) { - print "User is not logged in"; - exit(0); - } - - lasso_init(); - - $db = &DB::connect($config['dsn']); - - if (DB::isError($db)) - die($db->getMessage()); - - $server_dump = file_get_contents($config['server_dump_filename']); - - $server = lasso_server_new_from_dump($server_dump); - - $logout = lasso_logout_new($server, lassoProviderTypeSp); - - $profile = lasso_cast_to_profile($logout); - - - $query = "SELECT identity_dump FROM users WHERE user_id='" . $_SESSION['user_id'] . "'"; - - $res =& $db->query($query); - - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - $row = $res->fetchRow(); - $identity_dump = $row[0]; - $session_dump = $_SESSION['session_dump']; - - lasso_profile_set_identity_from_dump($profile, $identity_dump); - lasso_profile_set_session_from_dump($profile, $session_dump); - - lasso_logout_init_request($logout); - - lasso_logout_build_request_msg($logout); - - - $msg_url = lasso_profile_get_msg_url($profile); - $msg_body = lasso_profile_get_msg_body($profile); - - $url = parse_url($msg_url); - - $soap = sprintf( - "POST %s HTTP/1.1\r\nHost: %s:%d\r\nAccept-Encoding: identity\r\nContent-Length: %d\r\nContent-Type: text/xml\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html\r\nConnection: close\r\n\r\n%s\r\n", - $url['path'], $url['host'], $url['port'], strlen($msg_body), $msg_body); - - # PHP 4.3.0 with OpenSSL support required - $fp = fsockopen("ssl://" . $url['host'], $url['port'], $errno, $errstr, 30) or die($errstr ($errno)); - - fwrite($fp, $soap); - $ret = fgets($fp); - - if (!preg_match("/^HTTP\/1\\.. 200/i", $ret)) { - die("User is already logged out"); - } - - while (!feof($fp)) { - $reponse .= @fread($fp, 8192); - } - - fclose($fp); - - # Destroy PHP Session - $_SESSION = array(); - - session_destroy(); - - - $db->disconnect(); - lasso_shutdown(); - - $url = "index.php"; - - header("Request-URI: $url"); - header("Content-Location: $url"); - header("Location: $url"); -?> diff --git a/php/Attic/examples/sample-sp/register.php b/php/Attic/examples/sample-sp/register.php deleted file mode 100644 index 427fefb5..00000000 --- a/php/Attic/examples/sample-sp/register.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/* - * Service Provider Example -- Register Form - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - $config = unserialize(file_get_contents('config.inc')); - - require_once 'DB.php'; - - session_start(); - - if (!isset($_SESSION["nameidentifier"])) { - print "User is not logged in"; - exit(0); - } - - switch($_POST['action']) { - case "submit": - $db = &DB::connect($config['dsn']); - - if (DB::isError($db)) - die($db->getMessage()); - - $query = "UPDATE users SET first_name='" . $_POST['first_name'] . "',last_name='". $_POST['last_name'] ."' WHERE user_id='".$_SESSION["user_id"]."'"; - $res =& $db->query($query); - if (DB::isError($res)) - print $res->getMessage(). "\n"; - - $url = "index.php"; - header("Request-URI: $url"); - header("Content-Location: $url"); - header("Location: $url"); - break; - default: -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html> -<head> -<title>Lasso Service Provider Example : Registration Form</title> -</head> - -<body> -<form name='frm' action="<?php echo $PHP_SELF; ?>" method='post'> -<table align="center"> -<caption>Registration Form</caption> -<tr> - <td>First Name:</td><td><input type='text' name="first_name" maxlength='50'></td> -</tr> -<tr> - <td>Last Name:</td><td><input type='text' name="last_name" maxlength='50'></td> -</tr> -<tr> - <td> </td><td><input type='submit' value="Ok"></td> -</tr> -</table> -<input type='hidden' name='action' value='submit'> -</form> - -</body> -</html> -<?php -} -?> diff --git a/php/Attic/examples/sample-sp/setup.php b/php/Attic/examples/sample-sp/setup.php deleted file mode 100644 index ea0fd03c..00000000 --- a/php/Attic/examples/sample-sp/setup.php +++ /dev/null @@ -1,316 +0,0 @@ -<?php -/* - * - * Service Provider Example -- Installation Script - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<?php - if(!extension_loaded('lasso')) { - $ret = @dl('lasso.' . PHP_SHLIB_SUFFIX); - if ($ret == FALSE) - { - print "<p align='center'><b>The Lasso Extension is not available</b><br>"; - print "Please check your PHP extensions<br>"; - print "You can get more informations about <b>Lasso</b> at <br>"; - print "<a href='http://lasso.entrouvert.org/'>http://lasso.entrouvert.org/</a></p>"; - exit(); - } - } - - require_once 'DB.php'; - - # default config - if (!file_exists('config.inc')) - { - $cwd = getcwd(); - $config = array( - 'dsn' => "pgsql://sp:sp@localhost/sp", - 'server_dump_filename' => "lasso_server_dump.xml", - 'sp-metadata' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/metadata.xml", - 'sp-public_key' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/public-key.pem", - 'sp-private_key' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/private-key-raw.pem", - 'sp-ca' => "/home/cnowicki/mcvs/lasso/tests/data/sp1-la/certificate.pem", - 'idp-metadata' => "/home/cnowicki/mcvs/lasso/tests/data/idp1-la/metadata.xml", - 'idp-public_key' => "/home/cnowicki/mcvs/lasso/tests/data/idp1-la/public-key.pem", - 'idp-ca' => "/home/cnowicki/mcvs/lasso/tests/data/ca1-la/certificate.pem", - ); - - $config_ser = serialize($config); - - if (($fd = fopen(getcwd()."/config.inc", "w"))) - { - fwrite($fd, $config_ser); - fclose($fd); - } - else - die("Could not write default config file"); - } - else - { - $config = unserialize(file_get_contents('config.inc')); - } - - if ($_POST['action'] == 'setup') - { - ob_start(); - - $setup = FALSE; - - print "<b>Lasso Service Provider Setup</b><br>"; - - unset($_POST['action']); - - $diff = array_diff($_POST, $config); - - foreach($diff as $key => $value) { - $config[$key] = $value; - } - - print "Check Data base : "; - - $db = &DB::connect($config['dsn']); - - if (DB::isError($db)) { - die("Failed (" . $db->getMessage() . ")"); - } - else - print "OK"; - - print "<br>Create sequence 'user_id_seq' : "; - - $query = "DROP SEQUENCE user_id_seq"; - $res =& $db->query($query); - - $query = "CREATE SEQUENCE user_id_seq"; - $res =& $db->query($query); - if (DB::isError($res)) - die($res->getMessage()); - - print "OK"; - - print "<br>Create table 'users' : "; - $query = "DROP TABLE users CASCADE"; - $res =& $db->query($query); - - $query = "CREATE TABLE users ( - user_id varchar(100) primary key, - identity_dump text, - first_name varchar(50), - last_name varchar(50), - last_login timestamp, - created timestamp)"; - $res =& $db->query($query); - if (DB::isError($res)) - die($res->getMessage()); - - print "OK"; - - print "<br>Create table 'nameidentifiers' : "; - - $query = "DROP TABLE nameidentifiers CASCADE"; - $res =& $db->query($query); - - $query = "CREATE TABLE nameidentifiers ( - name_identifier varchar(100) primary key, - user_id varchar(100), - FOREIGN KEY (user_id) REFERENCES users (user_id))"; - $res =& $db->query($query); - if (DB::isError($res)) - die($res->getMessage()); - - print "OK"; - - $db->disconnect(); - - $keys = array_keys($config); - $files = preg_grep("/(sp|idp)/", $keys); - - foreach($files as $file) - { - print "<br>Check file " . $config[$file] . " : "; - if (!file_exists($config[$file])) - { - die("Failed (file does not exist)"); - } - else - print "OK"; - } - - lasso_init(); - - print "<br>Create Server : "; - - $server = lasso_server_new( - $config['sp-metadata'], $config['sp-public_key'], - $config['sp-private_key'], $config['sp-ca'], lassoSignatureMethodRsaSha1); - - if (empty($server)) - { - die("Failed"); - } - else - print "OK"; - - print "<br>Add provider : "; - - $ret = lasso_server_add_provider($server, - $config['idp-metadata'], $config['idp-public_key'], $config['idp-ca']); - - /*if ($ret != TRUE) - { - print "Failed"; - break; - } - else */ - print "OK"; - - print "<br>Write XML Server Dump : "; - - $dump = lasso_server_dump($server); - - if (($fd = fopen($config['server_dump_filename'], "w"))) - { - fwrite($fd, $dump); - fclose($fd); - print "OK"; - } - else - die("Failed"); - - lasso_shutdown(); - - print "<br>Save configuration file : "; - - # Save configuration file - $config_ser = serialize($config); - if (($fd = fopen("config.inc", "w"))) - { - fwrite($fd, $config_ser); - fclose($fd); - print "OK"; - } - else - { - print("Failed"); - break; - } - $setup = TRUE; - } - ob_start(); -?> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> -<head> -<title>Setup script for Lasso (Liberty Alliance Single Sign On)</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> -<?php - if ($setup == TRUE) { -?> -<meta http-equiv="Refresh" CONTENT="3; URL=index.php"> -<?php } ?> -</head> -<body> -<?php - ob_end_flush(); - ob_end_flush(); - ?> -</body> -</html> -<?php - if (empty($setup)) - { -?> - -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> -<head> -<title>Setup script for Lasso (Liberty Alliance Single Sign On)</title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> -</head> -<body> -<form name='frm' action='<?php echo $PHP_SELF ?>' method='POST'> -<table> -<caption>Lasso Service Provider Setup</caption> -<tr> - <td colspan='3' align='center'>Database Configuration</td> -</tr> -<tr> - <td>DSN (Data Source Name) :</td><td><input type='text' name='dsn' size='50' value='<?php echo $config['dsn']; ?>' maxlength='100'></td><td><a href='http://pear.php.net/manual/en/package.database.db.intro-dsn.php' target='_new'>Help</a></td> -</tr> -<tr> - <td>Server XML Dump:</td><td><input type='text' name='server_dump_filename' size='50' value='<?php echo $config['server_dump_filename']; ?>' maxlength='100'></td><td> </td> - -</tr> -<tr> - <td colspan='3' align='center'>Service Provider</td> -</tr> - -<tr> - <td>Metadata</td><td><input type='text' name='sp-metadata' size='50' value='<?php echo $config['sp-metadata']; ?>'></td><td> </td> - -</tr> - -<tr> - <td>Public Key</td><td><input type='text' name='sp-public_key' size='50' value='<?php echo $config['sp-public_key']; ?>'></td><td> </td> - -</tr> - -<tr> - <td>Private Key</td><td><input type='text' name='sp-private_key' size='50' value='<?php echo $config['sp-private_key']; ?>'></td><td> </td> - -</tr> - -<tr> - <td>Certificate</td><td><input type='text' name='sp-ca' size='50' value='<?php echo $config['sp-ca']; ?>'></td><td> </td> - -</tr> - -<tr> - <td colspan='3' align='center'>Identity Provider</td> -</tr> - -<tr> - <td>Metadata</td><td><input type='text' name='idp-metadata' size='50' value='<?php echo $config['idp-metadata']; ?>'></td><td> </td> - -</tr> -<tr> - <td>Public Key</td><td><input type='text' name='idp-public_key' size='50' value='<?php echo $config['idp-public_key']; ?>'></td><td> </td> - -</tr> -<tr> - <td>Certificate</td><td><input type='text' name='idp-ca' size='50' value='<?php echo $config['idp-ca']; ?>'></td><td> </td> -</tr> - -<tr> - <td colspan='3'> </td> -</tr> - -<tr> - <td align='center' colspan='3'><input type='submit' value='setup'></td> -</tr> -</table> -<input type='hidden' name='action' value='setup'> -</form> -</body> -</html> -<?php - } -?> diff --git a/php/Attic/examples/test.php b/php/Attic/examples/test.php deleted file mode 100644 index dad9a727..00000000 --- a/php/Attic/examples/test.php +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/php -<?php - if(!extension_loaded('lasso')) { - dl('lasso.' . PHP_SHLIB_SUFFIX); - } - - $module = 'lasso'; - $functions = get_extension_funcs($module); - echo "Functions available in the lasso extension:<br>\n"; - foreach($functions as $func) { - echo $func."<br>\n"; - } - - - echo "\n"; - - lasso_init(); - - - print lasso_version() . "\n"; - - $identity = lasso_identity_new(); - - var_dump($identity); - - $dump = lasso_identity_dump($identity); - - var_dump($identity); - - $server = lasso_server_new("./sp.xml", "./rsapub.pem", "./rsakey.pem", "./rsacert.pem", lassoSignatureMethodRsaSha1); - lasso_server_add_provider($server, "./idp.xml", "", ""); - - var_dump($server); - - $dump = lasso_server_dump($server); - - print $dump; - - lasso_server_destroy($server); - - var_dump($server); - - $new_server = lasso_server_new_from_dump($dump); - - var_dump($new_server); - - $spsession = lasso_login_new($new_server); - - var_dump($spsession); - - lasso_login_init_authn_request($spsession, lassoHttpMethodRedirect); - - - - $profile = lasso_cast_to_profile($spsession); - - var_dump($profile); - - $node = lasso_profile_get_request($profile); - - var_dump($node); - - $lib_authn_request = lasso_cast_to_lib_authn_request($node); - - var_dump($lib_authn_request); - - lasso_lib_authn_request_set_consent($lib_authn_request, lassoLibConsentObtained); - lasso_lib_authn_request_set_ispassive($lib_authn_request, FALSE); - lasso_lib_authn_request_set_forceauthn($lib_authn_request, TRUE); - lasso_lib_authn_request_set_nameidpolicy($lib_authn_request, lassoLibNameIDPolicyTypeFederated); - lasso_lib_authn_request_set_relaystate($lib_authn_request, "fake"); - lasso_lib_authn_request_set_protocolprofile($lib_authn_request, lassoLibProtocolProfileBrwsArt); - - lasso_login_build_authn_request_msg($spsession, - "https://identity-provider:2003/liberty-alliance/metadata"); - - $ret = lasso_login_init_authn_request($spsession, lassoHttpMethodRedirect); - if (!$ret) { - print("lasso_login_init_authn_request failed"); - } - - /* $dump = lasso_user_dump($user); - print ($dump); - - $identity = lasso_identity_new("http://remote-provider-id.com"); - - var_dump($identity); - - lasso_login_destroy($spsession); */ - - lasso_shutdown(); - -?> diff --git a/php/environs/Makefile.am b/php/environs/Makefile.am deleted file mode 100644 index 8e2b03f8..00000000 --- a/php/environs/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -DPACKAGE=\"@PACKAGE@\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lasso \ - $(LASSO_DEFINES) \ - $(LASSO_CFLAGS) \ - $(PHP_INCLUDES) - - -ENVSOURCES = lasso_identity.c lasso_profile.c lasso_session.c lasso_federation.c lasso_login.c lasso_server.c lasso_logout.c - -noinst_LIBRARIES = libenvirons.a -libenvirons_a_SOURCES = $(ENVSOURCES) - -EXTRA_DIST = $(ENVSOURCES) diff --git a/php/environs/lasso_federation.c b/php/environs/lasso_federation.c deleted file mode 100644 index b51a4d95..00000000 --- a/php/environs/lasso_federation.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - -#include "lasso.h" - -/* {{{ proto resource lasso_federation_new(string remote_providerID) */ -PHP_FUNCTION(lasso_federation_new) { - LassoFederation *federation; - char *remote_providerID; - int remote_providerID_len; - - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "s", - &remote_providerID, &remote_providerID_len) == FAILURE) { - return; - } - - - federation = lasso_federation_new(remote_providerID); - - ZEND_REGISTER_RESOURCE(return_value, federation, le_lassofederation); -} -/* }}} */ diff --git a/php/environs/lasso_identity.c b/php/environs/lasso_identity.c deleted file mode 100644 index 539a8928..00000000 --- a/php/environs/lasso_identity.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - -#include "lasso.h" - -/* {{{ proto resource lasso_identity_new() */ -PHP_FUNCTION(lasso_identity_new) { - LassoIdentity *identity; - - - - identity = lasso_identity_new(); - - ZEND_REGISTER_RESOURCE(return_value, identity, le_lassoidentity); -} -/* }}} */ - -/* {{{ proto lasso_identity_destroy(resource identity) */ -PHP_FUNCTION(lasso_identity_destroy) { - - LassoIdentity *identity; - zval *param; - - - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(identity, LassoIdentity *, ¶m, -1, le_lassoidentity_name, le_lassoidentity); - - - lasso_identity_destroy(identity); - - zend_list_delete(Z_RESVAL_PP(¶m)); -} -/* }}} */ - -/* {{{ proto lasso_identity_dump(resource identity) */ -PHP_FUNCTION(lasso_identity_dump) { - LassoIdentity *identity; - zval *param; - char *identity_dump; - - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(identity, LassoIdentity *, ¶m, -1, le_lassoidentity_name, le_lassoidentity); - - identity_dump = lasso_identity_dump(identity); - - RETURN_STRING(identity_dump, 1); - -} -/* }}} */ diff --git a/php/environs/lasso_login.c b/php/environs/lasso_login.c deleted file mode 100644 index 798302fb..00000000 --- a/php/environs/lasso_login.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - -#include "lasso.h" - -/* {{{ proto resource lasso_login_new(resource server) */ -PHP_FUNCTION(lasso_login_new) { - - LassoLogin *login; - LassoServer *server; - zval *param; - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, ¶m, -1, le_lassoserver_name, le_lassoserver); - - login = lasso_login_new(server); - - ZEND_REGISTER_RESOURCE(return_value, login, le_lassologin); -} -/* }}} */ - -/* {{{ proto resource lasso_login_init_authn_request(resource login, long http_method) */ -PHP_FUNCTION(lasso_login_init_authn_request) { - LassoLogin *login; - zval *param; - char *meta; - int meta_len; - long http_method; - - - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zl", ¶m, - &http_method) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, ¶m, -1, - le_lassologin_name, le_lassologin); - - ret = lasso_login_init_authn_request(login, http_method); - - (ret) ? (RETURN_FALSE) : (RETURN_TRUE); -} -/* }}} */ - - - -/* {{{ proto lasso_login_destroy(resource login) */ -PHP_FUNCTION(lasso_login_destroy) { - - LassoLogin *login; - zval *param; - - - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, ¶m, -1, le_lassologin_name, le_lassologin); - - lasso_login_destroy(login); - - zend_list_delete(Z_RESVAL_PP(¶m)); -} -/* }}} */ - -/* {{{ proto resource lasso_login_new_from_dump(resource server, string dump) */ -PHP_FUNCTION(lasso_login_new_from_dump) { - - LassoServer *server; - LassoLogin *login; - char *dump; - int dump_len; - - - - zval *parm_server, *parm_user; - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm_server, - &dump, &dump_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, &parm_server, -1, le_lassoserver_name, le_lassoserver); - - - login = lasso_login_new_from_dump(server, dump); - - ZEND_REGISTER_RESOURCE(return_value, login, le_lassologin); -} -/* }}} */ - - -/* {{{ proto lasso_login_build_request_msg(resource login) */ -PHP_FUNCTION(lasso_login_build_request_msg) { - - LassoLogin *login; - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - - lasso_login_build_request_msg(login); -} -/* }}} */ - -/* {{{ proto lasso_login_build_authn_request_msg(resource login, string remote_providerID) */ -PHP_FUNCTION(lasso_login_build_authn_request_msg) { - - LassoLogin *login; - char *remote_providerID; - int remote_providerID_len; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm, - &remote_providerID, &remote_providerID_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - - lasso_login_build_authn_request_msg(login, remote_providerID); -} -/* }}} */ - -/* {{{ proto lasso_login_init_request(resource login, string response_msg, long response_method) */ -PHP_FUNCTION(lasso_login_init_request) { - - LassoLogin *login; - char *response_msg; - int response_msg_len; - long response_method; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 3) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zsl", &parm, - &response_msg, &response_msg_len, - &response_method) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - - lasso_login_init_request(login, response_msg, response_method); -} -/* }}} */ - -/* {{{ proto lasso_login_process_response_msg(resource login, string response_msg) */ -PHP_FUNCTION(lasso_login_process_response_msg) { - - LassoLogin *login; - char *response_msg; - int response_msg_len; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm, - &response_msg, &response_msg_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - - lasso_login_process_response_msg(login, response_msg); -} -/* }}} */ - - -/* {{{ proto lasso_login_accept_sso(resource login) */ -PHP_FUNCTION(lasso_login_accept_sso) { - - LassoLogin *login; - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - - lasso_login_accept_sso(login); -} -/* }}} */ - - - diff --git a/php/environs/lasso_logout.c b/php/environs/lasso_logout.c deleted file mode 100644 index f1a5ec0c..00000000 --- a/php/environs/lasso_logout.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - -#include "lasso.h" - -/* {{{ proto resource lasso_logout_new(resource server, long provider_type) */ -PHP_FUNCTION(lasso_logout_new) { - - LassoLogout *logout; - LassoServer *server; - zval *param; - long provider_type; - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zl", - ¶m, &provider_type) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, ¶m, -1, le_lassoserver_name, le_lassoserver); - - logout = lasso_logout_new(server, provider_type); - - ZEND_REGISTER_RESOURCE(return_value, logout, le_lassologout); -} -/* }}} */ - -/* {{{ proto resource lasso_logout_init_request(resource logout, string remote_providerid) */ -PHP_FUNCTION(lasso_logout_init_request) { - - LassoLogout *logout; - char *remote_providerid = 0; - int remote_providerid_len = 0; - zval *param; - long provider_type; - - int num_args; - - num_args = ZEND_NUM_ARGS(); - if (num_args != 1 && num_args != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z|s", - ¶m, &remote_providerid, &remote_providerid_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(logout, LassoLogout *, ¶m, -1, le_lassologout_name, le_lassologout); - - lasso_logout_init_request(logout, remote_providerid); -} -/* }}} */ - -/* {{{ proto resource lasso_logout_build_request_msg(resource logout) */ -PHP_FUNCTION(lasso_logout_build_request_msg) { - - LassoLogout *logout; - zval *param; - long provider_type; - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(logout, LassoLogout *, ¶m, -1, le_lassologout_name, le_lassologout); - - lasso_logout_build_request_msg(logout); -} -/* }}} */ diff --git a/php/environs/lasso_profile.c b/php/environs/lasso_profile.c deleted file mode 100644 index d363960f..00000000 --- a/php/environs/lasso_profile.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - - -#include "lasso.h" - -/* {{{ proto lasso_profile_new(resource server, resource identity, resource session) */ -PHP_FUNCTION(lasso_profile_new) -{ - LassoServer *server; - LassoIdentity *identity; - LassoSession *session; - LassoProfile *ctx; - - zval *parm_server, *parm_identity, *parm_session; - - - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 3) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zzz", - &parm_server, &parm_identity, &parm_session) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, &parm_server, -1, le_lassoserver_name, le_lassoserver); - - - ZEND_FETCH_RESOURCE(identity, LassoIdentity *, &parm_identity, -1, le_lassoidentity_name, le_lassoidentity); - - ZEND_FETCH_RESOURCE(session, LassoSession *, &parm_session, -1, le_lassosession_name, le_lassosession); - - ctx = lasso_profile_new(server, identity, session); - - ZEND_REGISTER_RESOURCE(return_value, ctx, le_lassoprofile); - -} -/* }}} */ - -/* TODO {{{ proto lasso_profile_dump() */ -PHP_FUNCTION(lasso_profile_dump) -{ - -} -/* }}} */ - -/* TODO {{{ proto lasso_profile_set_remote_providerid() */ -PHP_FUNCTION(lasso_profile_set_remote_providerid) -{ - -} -/* }}} */ - -/* TODO {{{ proto lasso_profile_set_response_status() */ -PHP_FUNCTION(lasso_profile_set_response_status) -{ - -} -/* }}} */ - -/* TODO {{{ proto lasso_profile_user_from_dump() */ -PHP_FUNCTION(lasso_profile_user_from_dump) -{ - -} -/* }}} */ - -/* TODO {{{ proto lasso_profile_get_request_type_from_soap_msg() */ -PHP_FUNCTION(lasso_profile_get_request_type_from_soap_msg) -{ - -} -/* }}} */ - -/* {{{ proto resource lasso_cast_to_profile(resource login|logout) */ -PHP_FUNCTION(lasso_cast_to_profile) -{ - LassoProfile *ctx; - LassoLogin *login; - LassoLogout *logout; - - zval *parm; - char *typename; - int num_args; - int ret; - - ctx = 0; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - typename = zend_rsrc_list_get_rsrc_type(Z_LVAL_P(parm) TSRMLS_CC); - - if (strcmp(typename, le_lassologin_name) == 0) - { - ZEND_FETCH_RESOURCE(login, LassoLogin *, &parm, -1, le_lassologin_name, le_lassologin); - ctx = LASSO_PROFILE(login); - } - else if (strcmp(typename, le_lassologout_name) == 0) - { - ZEND_FETCH_RESOURCE(logout, LassoLogout *, &parm, -1, le_lassologout_name, le_lassologout); - ctx = LASSO_PROFILE(logout); - } - else - { - zend_error(E_ERROR, "Can not cast %s to LassoProfile", typename); - } - - if (ctx) - ZEND_REGISTER_RESOURCE(return_value, ctx, le_lassoprofile); -} -/* }}} */ - -/* {{{ proto resource lasso_profile_get_request(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_request) { - LassoProfile *ctx; - LassoNode *node; - - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - - node = ctx->request; - - ZEND_REGISTER_RESOURCE(return_value, node, le_lassonode); -} - -/* {{{ proto string lasso_profile_get_msg_url(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_msg_url) { - LassoProfile *ctx; - LassoNode *node; - - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - if (ctx->msg_url) - RETURN_STRING(ctx->msg_url, 1); -} -/* }}} */ - -/* {{{ proto string lasso_profile_get_msg_body(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_msg_body) { - LassoProfile *ctx; - LassoNode *node; - - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - if (ctx->msg_body) - RETURN_STRING(ctx->msg_body, 1); -} -/* }}} */ - -/* {{{ proto string lasso_profile_get_msg_relaystate(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_msg_relaystate) { - LassoProfile *ctx; - LassoNode *node; - - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - if (ctx->msg_relayState) - RETURN_STRING(ctx->msg_relayState, 1); -} -/* }}} */ - - -/* {{{ proto resource lasso_profile_get_identity(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_identity) { - LassoProfile *ctx; - LassoIdentity *identity; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - identity = lasso_profile_get_identity(ctx); - - // zend_printf("value of %p\n", identity); - - ZEND_REGISTER_RESOURCE(return_value, identity, le_lassoidentity); -} -/* }}} */ - -/* {{{ proto bool lasso_profile_is_identity_dirty(resource ctx) */ -PHP_FUNCTION(lasso_profile_is_identity_dirty) { - LassoProfile *ctx; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - ret = lasso_profile_is_identity_dirty(ctx); - - RETURN_BOOL(ret); -} -/* }}} */ - -/* {{{ proto lasso_profile_get_session(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_session) { - LassoProfile *ctx; - LassoSession *session; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - session = lasso_profile_get_session(ctx); - - ZEND_REGISTER_RESOURCE(return_value, session, le_lassosession); -} -/* }}} */ - -/* {{{ proto bool lasso_profile_is_session_dirty(resource ctx) */ -PHP_FUNCTION(lasso_profile_is_session_dirty) { - LassoProfile *ctx; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - ret = lasso_profile_is_session_dirty(ctx); - - RETURN_BOOL(ret); -} -/* }}} */ - - -/* {{{ proto string lasso_profile_get_nameidentifier(resource ctx) */ -PHP_FUNCTION(lasso_profile_get_nameidentifier) { - LassoProfile *ctx; - - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", &parm) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - if (ctx->nameIdentifier) - RETURN_STRING(ctx->nameIdentifier, 1); -} -/* }}} */ - -/* {{{ proto lasso_profile_set_identity_from_dump(resource profile, string dump) */ -PHP_FUNCTION(lasso_profile_set_identity_from_dump) { - - LassoProfile *ctx; - char *dump; - int dump_len; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm, - &dump, &dump_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - lasso_profile_set_identity_from_dump(ctx, dump); -} -/* }}} */ - -/* {{{ proto lasso_profile_set_session_from_dump(resource profile, string dump) */ -PHP_FUNCTION(lasso_profile_set_session_from_dump) { - - LassoProfile *ctx; - char *dump; - int dump_len; - - zval *parm; - - int num_args; - int ret; - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", &parm, - &dump, &dump_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(ctx, LassoProfile *, &parm, -1, le_lassoprofile_name, le_lassoprofile); - - lasso_profile_set_session_from_dump(ctx, dump); -} -/* }}} */ diff --git a/php/environs/lasso_server.c b/php/environs/lasso_server.c deleted file mode 100644 index d2355c64..00000000 --- a/php/environs/lasso_server.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - - -#include "lasso.h" - - -/* {{{ proto lasso_server_new(string sp, string rsapub, string rsakey, - * string rsacert, long signaturemethod) */ -PHP_FUNCTION(lasso_server_new) { - - LassoServer *server; - - char *sp; - int sp_len; - char *rsapub; - int rsapub_len; - char *rsakey; - int rsakey_len; - char *rsacert; - int rsacert_len; - long signaturemethod; - - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 5) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "ssssl", - &sp, &sp_len, &rsapub, &rsapub_len, - &rsakey, &rsakey_len, &rsacert, &rsacert_len, - &signaturemethod) == FAILURE) { - return; - } - - server = lasso_server_new(sp, rsapub, rsakey, rsacert, signaturemethod); - - ZEND_REGISTER_RESOURCE(return_value, server, le_lassoserver); -} -/* }}} */ - -/* {{{ proto lasso_server_add_provider(resource server, string idp, string a, string b) */ -PHP_FUNCTION(lasso_server_add_provider) { - - LassoServer *server; - zval *param; - char *idp; - int idp_len; - char *a; - int a_len; - char *b; - int b_len; - - - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 4) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zsss", ¶m, - &idp, &idp_len, &a, &a_len, &b, &b_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, ¶m, -1, le_lassoserver_name, le_lassoserver); - - lasso_server_add_provider(server, idp, a, b); - - -} -/* }}} */ - -/* {{{ proto string lasso_server_dump(resource server) */ -PHP_FUNCTION(lasso_server_dump) { - - LassoServer *server; - zval *param; - char *server_dump; - - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, ¶m, -1, le_lassoserver_name, le_lassoserver); - - server_dump = lasso_server_dump(server); - - RETURN_STRING(server_dump, 1); -} -/* }}} */ - -/* {{{ proto lasso_server_destroy(resource server) */ -PHP_FUNCTION(lasso_server_destroy) { - - LassoServer *server; - zval *param; - - - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(server, LassoServer *, ¶m, -1, le_lassoserver_name, le_lassoserver); - - lasso_server_destroy(server); - - zend_list_delete(Z_RESVAL_PP(¶m)); -} -/* }}} */ - -/* {{{ proto resource lasso_server_new_from_dump(string dump) */ -PHP_FUNCTION(lasso_server_new_from_dump) { - - LassoServer *server; - char *dump; - int dump_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "s", - &dump, &dump_len) == FAILURE) { - return; - } - - server = lasso_server_new_from_dump(dump); - - ZEND_REGISTER_RESOURCE(return_value, server, le_lassoserver); -} -/* }}} */ diff --git a/php/environs/lasso_session.c b/php/environs/lasso_session.c deleted file mode 100644 index 66b5f98b..00000000 --- a/php/environs/lasso_session.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - - -#include "lasso.h" - -/* {{{ proto string lasso_session_dump(resource server) */ -PHP_FUNCTION(lasso_session_dump) { - - LassoSession *session; - zval *param; - char *session_dump; - - int num_args; - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(session, LassoSession *, ¶m, -1, le_lassosession_name, le_lassosession); - - session_dump = lasso_session_dump(session); - - RETURN_STRING(session_dump, 1); -} -/* }}} */ diff --git a/php/lasso.c b/php/lasso.c deleted file mode 100644 index d4e024eb..00000000 --- a/php/lasso.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - - -#include "lasso.h" - -/* True global resources - no need for thread safety here */ -int le_lasso; -int le_lassonode; -int le_lassoserver; -int le_lassologin; -int le_lassologout; -int le_lassouser; -int le_lassofederation; -int le_lassosession; -int le_lassoidentity; -int le_lassoprofile; -int le_lassolibauthnrequest; - -ZEND_DECLARE_MODULE_GLOBALS(lasso) - -/* {{{ lasso_functions[] - * - * Every user visible function must have an entry in lasso_functions[]. - */ -function_entry lasso_functions[] = { - PHP_FE(lasso_init, NULL) - PHP_FE(lasso_version, NULL) - PHP_FE(lasso_shutdown, NULL) - - /* lasso_server.c */ - PHP_FE(lasso_server_new, NULL) - PHP_FE(lasso_server_dump, NULL) - PHP_FE(lasso_server_add_provider, NULL) - PHP_FE(lasso_server_destroy, NULL) - PHP_FE(lasso_server_new_from_dump, NULL) - - /* lasso_login.c */ - PHP_FE(lasso_login_new, NULL) - PHP_FE(lasso_login_new_from_dump, NULL) - PHP_FE(lasso_login_init_authn_request, NULL) - PHP_FE(lasso_login_destroy, NULL) - PHP_FE(lasso_login_build_request_msg, NULL) - PHP_FE(lasso_login_build_authn_request_msg, NULL) - PHP_FE(lasso_login_init_request, NULL) - PHP_FE(lasso_login_process_response_msg, NULL) - PHP_FE(lasso_login_accept_sso, NULL) - - /* lasso_user.c */ - PHP_FE(lasso_identity_new, NULL) - PHP_FE(lasso_identity_dump, NULL) - PHP_FE(lasso_identity_destroy, NULL) - - /* lasso_profile.c */ - PHP_FE(lasso_profile_new, NULL) - PHP_FE(lasso_profile_dump, NULL) - PHP_FE(lasso_profile_set_remote_providerid, NULL) - PHP_FE(lasso_profile_set_response_status, NULL) - PHP_FE(lasso_profile_user_from_dump, NULL) - PHP_FE(lasso_profile_get_request_type_from_soap_msg, NULL) - PHP_FE(lasso_cast_to_profile, NULL) - PHP_FE(lasso_profile_get_request, NULL) - PHP_FE(lasso_profile_get_msg_url, NULL) - PHP_FE(lasso_profile_get_msg_body, NULL) - PHP_FE(lasso_profile_get_msg_relaystate, NULL) - PHP_FE(lasso_profile_get_identity, NULL) - PHP_FE(lasso_profile_is_identity_dirty, NULL) - PHP_FE(lasso_profile_get_session, NULL) - PHP_FE(lasso_profile_is_session_dirty, NULL) - PHP_FE(lasso_profile_get_nameidentifier, NULL) - PHP_FE(lasso_profile_set_identity_from_dump, NULL) - PHP_FE(lasso_profile_set_session_from_dump, NULL) - - /* lasso_lib_authn_request.c */ - PHP_FE(lasso_cast_to_lib_authn_request, NULL) - PHP_FE(lasso_lib_authn_request_set_consent, NULL) - PHP_FE(lasso_lib_authn_request_set_ispassive, NULL) - PHP_FE(lasso_lib_authn_request_set_forceauthn, NULL) - PHP_FE(lasso_lib_authn_request_set_nameidpolicy, NULL) - PHP_FE(lasso_lib_authn_request_set_relaystate, NULL) - PHP_FE(lasso_lib_authn_request_set_protocolprofile, NULL) - PHP_FE(lasso_lib_authn_response_set_consent, NULL) - - /* lasso_identity */ - PHP_FE(lasso_federation_new, NULL) - - /* lasso_session.c */ - PHP_FE(lasso_session_dump, NULL) - - /* lasso_logout.c */ - PHP_FE(lasso_logout_new, NULL) - PHP_FE(lasso_logout_init_request, NULL) - PHP_FE(lasso_logout_build_request_msg, NULL) - - {NULL, NULL, NULL} -}; -/* }}} */ - -/* {{{ lasso_module_entry - */ -zend_module_entry lasso_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - "lasso", - lasso_functions, - PHP_MINIT(lasso), - PHP_MSHUTDOWN(lasso), - PHP_RINIT(lasso), /* Replace with NULL if there's nothing to do at request start */ - PHP_RSHUTDOWN(lasso), /* Replace with NULL if there's nothing to do at request end */ - PHP_MINFO(lasso), -#if ZEND_MODULE_API_NO >= 20010901 - "0.1", /* Replace with version number for your extension */ -#endif - STANDARD_MODULE_PROPERTIES -}; -/* }}} */ - -ZEND_GET_MODULE(lasso) - -/* {{{ PHP_INI - */ -/* Remove comments and fill if you need to have entries in php.ini -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("lasso.global_value", "42", PHP_INI_ALL, OnUpdateInt, global_value, zend_lasso_globals, lasso_globals) - STD_PHP_INI_ENTRY("lasso.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_lasso_globals, lasso_globals) -PHP_INI_END() -*/ -/* }}} */ - -/* {{{ */ -void lassonode_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoNode *my_rsrc = (LassoNode *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassoserver_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoServer *my_rsrc = (LassoServer *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassologin_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoLogin *my_rsrc = (LassoLogin *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassoidentity_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoIdentity *my_rsrc = (LassoIdentity *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassosession_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoSession *my_rsrc = (LassoSession *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassoprofile_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoProfile *my_rsrc = (LassoProfile *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassofederation_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoFederation *my_rsrc = (LassoFederation *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassolibauthnrequest_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoLibAuthnRequest *my_rsrc = (LassoLibAuthnRequest *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ */ -void lassologout_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) { - LassoLogout *my_rsrc = (LassoLogout *) rsrc->ptr; - // do_whatever_needs_to_be_done_with_the_resource(my_rsrc); -} -/* }}} */ - -/* {{{ php_lasso_init_globals - */ -static void php_lasso_init_globals(zend_lasso_globals *lasso_globals) -{ - lasso_globals->global_value = 0; - lasso_globals->global_string = NULL; -} -/* }}} */ - -/* {{{ PHP_MINIT_FUNCTION - */ -PHP_MINIT_FUNCTION(lasso) -{ - ZEND_INIT_MODULE_GLOBALS(lasso, php_lasso_init_globals, NULL); -/* REGISTER_INI_ENTRIES(); */ - - /* Resources */ - le_lassonode = zend_register_list_destructors_ex(lassonode_destruction_handler, NULL, le_lassonode_name, module_number); - le_lassoserver = zend_register_list_destructors_ex(lassoserver_destruction_handler, NULL, le_lassoserver_name, module_number); - le_lassologin = zend_register_list_destructors_ex(lassologin_destruction_handler, NULL, le_lassologin_name, module_number); - le_lassologout = zend_register_list_destructors_ex(lassologout_destruction_handler, NULL, le_lassologout_name, module_number); - le_lassoidentity = zend_register_list_destructors_ex(lassoidentity_destruction_handler, NULL, le_lassoidentity_name, module_number); - le_lassosession = zend_register_list_destructors_ex(lassosession_destruction_handler, NULL, le_lassosession_name, module_number); - le_lassofederation = zend_register_list_destructors_ex(lassofederation_destruction_handler, NULL, le_lassofederation_name, module_number); - le_lassoprofile = zend_register_list_destructors_ex(lassoprofile_destruction_handler, NULL, le_lassoprofile_name, module_number); - le_lassolibauthnrequest = zend_register_list_destructors_ex(lassolibauthnrequest_destruction_handler, NULL, le_lassolibauthnrequest_name, module_number); - - - /* Constants */ - REGISTER_LONG_CONSTANT("lassoSignatureMethodRsaSha1", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_STRING_CONSTANT("lassoLibConsentObtained", (char *) lassoLibConsentObtained, CONST_CS | CONST_PERSISTENT); - REGISTER_STRING_CONSTANT("lassoLibNameIDPolicyTypeFederated", (char *)lassoLibNameIDPolicyTypeFederated, CONST_CS | CONST_PERSISTENT); - REGISTER_STRING_CONSTANT("lassoLibProtocolProfileBrwsArt", (char *) lassoLibProtocolProfileBrwsArt, CONST_CS | CONST_PERSISTENT); - - /* lassoHttpMethod */ - REGISTER_LONG_CONSTANT("lassoHttpMethodGet", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("lassoHttpMethodPost", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("lassoHttpMethodRedirect", 3, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("lassoHttpMethodSoap", 4, CONST_CS | CONST_PERSISTENT); - - /* lassoProviderType */ - REGISTER_LONG_CONSTANT("lassoProviderTypeNone", 1, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("lassoProviderTypeSp", 2, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("lassoProviderTypeIdp", 3, CONST_CS | CONST_PERSISTENT); - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ -PHP_MSHUTDOWN_FUNCTION(lasso) -{ - /* uncomment this line if you have INI entries - UNREGISTER_INI_ENTRIES(); - */ - return SUCCESS; -} -/* }}} */ - -/* Remove if there's nothing to do at request start */ -/* {{{ PHP_RINIT_FUNCTION - */ -PHP_RINIT_FUNCTION(lasso) -{ - return SUCCESS; -} -/* }}} */ - -/* Remove if there's nothing to do at request end */ -/* {{{ PHP_RSHUTDOWN_FUNCTION - */ -PHP_RSHUTDOWN_FUNCTION(lasso) -{ - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION - */ -PHP_MINFO_FUNCTION(lasso) -{ - php_info_print_table_start(); - php_info_print_table_header(2, "L.A.S.O.O support", "enabled"); - php_info_print_table_end(); - - /* Remove comments if you have entries in php.ini - DISPLAY_INI_ENTRIES(); - */ -} -/* }}} */ - - - -/* Remove the following function when you have succesfully modified config.m4 - so that your module can be compiled into PHP, it exists only for testing - purposes. */ - -/* {{{ proto long lasso_init() - Initialise le bourdel */ -PHP_FUNCTION(lasso_init) -{ - - if (ZEND_NUM_ARGS() != 0) - WRONG_PARAM_COUNT - - RETURN_LONG(lasso_init()); - -} -/* }}} */ - -/* {{{ proto long lasso_shutdown() */ -PHP_FUNCTION(lasso_shutdown) -{ - - if (ZEND_NUM_ARGS() != 0) - WRONG_PARAM_COUNT - - RETURN_LONG(lasso_shutdown()); - -} -/* }}} */ - -/* {{{ proto string lasso_version() */ -PHP_FUNCTION(lasso_version) -{ - char lasso_version[6]; - - snprintf(lasso_version, 6, "%d.%d.%d", LASSO_VERSION_MAJOR, - LASSO_VERSION_MINOR, LASSO_VERSION_SUBMINOR); - - RETURN_STRING(lasso_version, 1) -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/php/lasso.h b/php/lasso.h deleted file mode 100644 index 5834545c..00000000 --- a/php/lasso.h +++ /dev/null @@ -1,7 +0,0 @@ - -#ifndef LASSO_H -#define LASSO_H - -#include <lasso/lasso.h> - -#endif /* LASSO_H */ diff --git a/php/php_lasso.h b/php/php_lasso.h deleted file mode 100644 index f05079ba..00000000 --- a/php/php_lasso.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: | - +----------------------------------------------------------------------+ - - $Id$ -*/ - -#ifndef PHP_LASSO_H -#define PHP_LASSO_H - -extern zend_module_entry lasso_module_entry; -#define phpext_lasso_ptr &lasso_module_entry - -#ifdef PHP_WIN32 -#define PHP_LASSO_API __declspec(dllexport) -#else -#define PHP_LASSO_API -#endif - -#ifdef ZTS -#include "TSRM.h" -#endif - -/* Avoid warning about multiple definitions */ -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION - -/* Resource */ -#define le_lassonode_name "LASSO Node Resource" -#define le_lassoserver_name "LASSO Server Resource" -#define le_lassologin_name "LASSO Login Resource" -#define le_lassologout_name "LASSO Logout Resource" -#define le_lassoidentity_name "LASSO Identity Resource" -#define le_lassosession_name "LASSO Session Resource" -#define le_lassofederation_name "LASSO Federation Resource" -#define le_lassoprofile_name "LASSO Profile Resource" -#define le_lassolibauthnrequest_name "LASSO Lib Authn Request Resource" - -PHP_MINIT_FUNCTION(lasso); -PHP_MSHUTDOWN_FUNCTION(lasso); -PHP_RINIT_FUNCTION(lasso); -PHP_RSHUTDOWN_FUNCTION(lasso); -PHP_MINFO_FUNCTION(lasso); - -PHP_FUNCTION(lasso_init); -PHP_FUNCTION(lasso_version); -PHP_FUNCTION(lasso_shutdown); - -/* lasso_server.c */ -PHP_FUNCTION(lasso_server_new); -PHP_FUNCTION(lasso_server_dump); -PHP_FUNCTION(lasso_server_add_provider); -PHP_FUNCTION(lasso_server_destroy); -PHP_FUNCTION(lasso_server_new_from_dump); - -/* lasso_login.c */ -PHP_FUNCTION(lasso_login_new); -PHP_FUNCTION(lasso_login_new_from_dump); -PHP_FUNCTION(lasso_login_init_authn_request); -PHP_FUNCTION(lasso_login_destroy); -PHP_FUNCTION(lasso_login_build_authn_request_msg); -PHP_FUNCTION(lasso_login_init_request); -PHP_FUNCTION(lasso_login_build_request_msg); -PHP_FUNCTION(lasso_login_process_response_msg); -PHP_FUNCTION(lasso_login_accept_sso); - -/* lasso_identity.c */ -PHP_FUNCTION(lasso_identity_new); -PHP_FUNCTION(lasso_identity_dump); -PHP_FUNCTION(lasso_identity_destroy); - -/* lasso_federation.c */ -PHP_FUNCTION(lasso_federation_new); - -/* lasso_session.c */ -PHP_FUNCTION(lasso_session_dump); - -/* lasso_profile_.c */ -PHP_FUNCTION(lasso_profile_new); -PHP_FUNCTION(lasso_profile_dump); -PHP_FUNCTION(lasso_profile_set_remote_providerid); -PHP_FUNCTION(lasso_profile_set_response_status); -PHP_FUNCTION(lasso_profile_user_from_dump); -PHP_FUNCTION(lasso_profile_get_request_type_from_soap_msg); -PHP_FUNCTION(lasso_cast_to_profile); -PHP_FUNCTION(lasso_profile_get_request); -PHP_FUNCTION(lasso_profile_get_msg_url); -PHP_FUNCTION(lasso_profile_get_msg_body); -PHP_FUNCTION(lasso_profile_get_msg_relaystate); -PHP_FUNCTION(lasso_profile_get_identity); -PHP_FUNCTION(lasso_profile_is_identity_dirty); -PHP_FUNCTION(lasso_profile_get_session); -PHP_FUNCTION(lasso_profile_is_session_dirty); -PHP_FUNCTION(lasso_profile_get_nameidentifier); -PHP_FUNCTION(lasso_profile_set_identity_from_dump); -PHP_FUNCTION(lasso_profile_set_session_from_dump); - -/* lasso_lib_authn_request.c */ -PHP_FUNCTION(lasso_cast_to_lib_authn_request); -PHP_FUNCTION(lasso_lib_authn_request_set_consent); -PHP_FUNCTION(lasso_lib_authn_request_set_ispassive); -PHP_FUNCTION(lasso_lib_authn_request_set_forceauthn); -PHP_FUNCTION(lasso_lib_authn_request_set_nameidpolicy); -PHP_FUNCTION(lasso_lib_authn_request_set_relaystate); -PHP_FUNCTION(lasso_lib_authn_request_set_protocolprofile); -PHP_FUNCTION(lasso_lib_authn_response_set_consent); - -/* lasso_logout.c */ -PHP_FUNCTION(lasso_logout_new); -PHP_FUNCTION(lasso_logout_init_request); -PHP_FUNCTION(lasso_logout_build_request_msg); - -/* GLOBALS */ -ZEND_BEGIN_MODULE_GLOBALS(lasso) - long global_value; - char *global_string; -ZEND_END_MODULE_GLOBALS(lasso) - -/* global resoucres */ -extern int le_lasso; -extern int le_lassonode; -extern int le_lassoserver; -extern int le_lassologin; -extern int le_lassologout; -extern int le_lassoidentity; -extern int le_lassosession; -extern int le_lassofederation; -extern int le_lassoprofile; -extern int le_lassolibauthnrequest; - -/* In every utility function you add that needs to use variables - in php_lasso_globals, call TSRMLS_FETCH(); after declaring other - variables used by that function, or better yet, pass in TSRMLS_CC - after the last function argument and declare your utility function - with TSRMLS_DC after the last declared argument. Always refer to - the globals in your function as LASSO_G(variable). You are - encouraged to rename these macros something shorter, see - examples in any other php module directory. -*/ - -#ifdef ZTS -#define LASSO_G(v) TSRMG(lasso_globals_id, zend_lasso_globals *, v) -#else -#define LASSO_G(v) (lasso_globals.v) -#endif - -#endif /* PHP_LASSO_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - */ diff --git a/php/run-tests.php.in b/php/run-tests.php.in deleted file mode 100644 index 94e3d781..00000000 --- a/php/run-tests.php.in +++ /dev/null @@ -1,695 +0,0 @@ -<?php -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Ilia Alshanetsky <iliaa@php.net> | - | Preston L. Bannister <pbannister@php.net> | - | Marcus Boerger <helly@php.net> | - | Derick Rethans <derick@php.net> | - | Sander Roobol <sander@php.net> | - | (based on version by: Stig Bakken <ssb@fast.no>) | - | (based on the PHP 3 test framework by Rasmus Lerdorf) | - +----------------------------------------------------------------------+ - */ - -/* - Require exact specification of PHP executable to test (no guessing!). - Die if any internal errors encountered in test script. - Regularized output for simpler post-processing of output. - Optionally output error lines indicating the failing test source and log - for direct jump with MSVC or Emacs. -*/ - -$cwd = getcwd(); -set_time_limit(0); - -// delete as much output buffers as possible -while(@ob_end_clean()); -if (ob_get_level()) echo "Not all buffers were deleted.\n"; - -error_reporting(E_ALL); -ini_set('magic_quotes_runtime',0); // this would break tests by modifying EXPECT sections - -if (ini_get('safe_mode')) { - echo <<< SAFE_MODE_WARNING - -+-----------------------------------------------------------+ -| ! WARNING ! | -| You are running the test-suite with "safe_mode" ENABLED ! | -| | -| Chances are high that no test will work at all, | -| depending on how you configured "safe_mode" ! | -+-----------------------------------------------------------+ - - -SAFE_MODE_WARNING; -} - -$php = "@PHP_PATH@"; - -if (getenv('TEST_PHP_LOG_FORMAT')) { - $log_format = strtoupper(getenv('TEST_PHP_LOG_FORMAT')); -} else { - $log_format = 'LEOD'; -} - -if (function_exists('is_executable') && !@is_executable($php)) { - error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = " . $php); -} - -// Check whether a detailed log is wanted. -if (getenv('TEST_PHP_DETAILED')) { - define('DETAILED', getenv('TEST_PHP_DETAILED')); -} else { - define('DETAILED', 0); -} - -// Check whether user test dirs are requested. -if (getenv('TEST_PHP_USER')) { - $user_tests = explode (',', getenv('TEST_PHP_USER')); -} else { - $user_tests = array(); -} - -// Get info from php -$info_file = realpath(dirname(__FILE__)) . '/run-test-info.php'; -@unlink($info_file); -$php_info = '<?php echo " -PHP_SAPI : " . PHP_SAPI . " -PHP_VERSION : " . phpversion() . " -ZEND_VERSION: " . zend_version() . " -PHP_OS : " . PHP_OS . " - " . php_uname() . " -INI actual : " . realpath(get_cfg_var("cfg_file_path")) . " -More .INIs : " . (function_exists(\'php_ini_scanned_files\') ? str_replace("\n","", php_ini_scanned_files()) : "** not determined **"); ?>'; -save_text($info_file, $php_info); -$ini_overwrites = array( - 'mbstring.script_encoding=pass', - 'output_handler=', - 'zlib.output_compression=Off', - 'open_basedir=', - 'safe_mode=0', - 'disable_functions=', - 'output_buffering=Off', - 'error_reporting=2047', - 'display_errors=1', - 'log_errors=0', - 'html_errors=0', - 'track_errors=1', - 'report_memleaks=1', - 'docref_root=/phpmanual/', - 'docref_ext=.html', - 'error_prepend_string=', - 'error_append_string=', - 'auto_prepend_file=', - 'auto_append_file=', - 'magic_quotes_runtime=0', - 'session.auto_start=0' - ); -$info_params = array(); -settings2array($ini_overwrites,$info_params); -settings2params($info_params); -$php_info = `$php $info_params $info_file`; -@unlink($info_file); -define('TESTED_PHP_VERSION', `$php -r 'echo PHP_VERSION;'`); - -// Write test context information. - -echo " -===================================================================== -CWD : $cwd -PHP : $php $php_info -Extra dirs : "; -foreach ($user_tests as $test_dir) { - echo "{$test_dir}\n "; -} -echo " -===================================================================== -"; - -// Determine the tests to be run. - -$test_files = array(); -$test_results = array(); -$GLOBALS['__PHP_FAILED_TESTS__'] = array(); - -// If parameters given assume they represent selected tests to run. -if (isset($argc) && $argc > 1) { - for ($i=1; $i<$argc; $i++) { - $testfile = realpath($argv[$i]); - if (is_dir($testfile)) { - find_files($testfile); - } else if (preg_match("/\.phpt$/", $testfile)) { - $test_files[] = $testfile; - } - } - $test_files = array_unique($test_files); - - // Run selected tests. - if (count($test_files)) { - usort($test_files, "test_sort"); - echo "Running selected tests.\n"; - foreach($test_files AS $name) { - $test_results[$name] = run_test($php,$name); - } - if (getenv('REPORT_EXIT_STATUS') == 1 and ereg('FAILED( |$)', implode(' ', $test_results))) { - exit(1); - } - exit(0); - } -} - -// Compile a list of all test files (*.phpt). -$test_files = array(); -$exts_to_test = get_loaded_extensions(); -$exts_tested = count($exts_to_test); -$exts_skipped = 0; -$ignored_by_ext = 0; -sort($exts_to_test); -$test_dirs = array('tests'); - -foreach ($test_dirs as $dir) { - find_files("{$cwd}/{$dir}", ($dir == 'ext')); -} - -foreach ($user_tests as $dir) { - find_files($dir, ($dir == 'ext')); -} - -function find_files($dir,$is_ext_dir=FALSE,$ignore=FALSE) -{ - global $test_files, $exts_to_test, $ignored_by_ext, $exts_skipped, $exts_tested; - - $o = opendir($dir) or error("cannot open directory: $dir"); - while (($name = readdir($o)) !== FALSE) { - if (is_dir("{$dir}/{$name}") && !in_array($name, array('.', '..', 'CVS'))) { - $skip_ext = ($is_ext_dir && !in_array($name, $exts_to_test)); - if ($skip_ext) { - $exts_skipped++; - } - find_files("{$dir}/{$name}", FALSE, $ignore || $skip_ext); - } - - // Cleanup any left-over tmp files from last run. - if (substr($name, -4) == '.tmp') { - @unlink("$dir/$name"); - continue; - } - - // Otherwise we're only interested in *.phpt files. - if (substr($name, -5) == '.phpt') { - if ($ignore) { - $ignored_by_ext++; - } else { - $testfile = realpath("{$dir}/{$name}"); - $test_files[] = $testfile; - } - } - } - closedir($o); -} - -function test_sort($a, $b) { - global $cwd; - - $ta = strpos($a, "{$cwd}/tests")===0 ? 1 + (strpos($a, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; - $tb = strpos($b, "{$cwd}/tests")===0 ? 1 + (strpos($b, "{$cwd}/tests/run-test")===0 ? 1 : 0) : 0; - if ($ta == $tb) { - return strcmp($a, $b); - } else { - return $tb - $ta; - } -} - -$test_files = array_unique($test_files); -usort($test_files, "test_sort"); - -$start_time = time(); - -echo "TIME START " . date('Y-m-d H:i:s', $start_time) . " -===================================================================== -"; - -foreach ($test_files as $name) { - $test_results[$name] = run_test($php,$name); -} - -$end_time = time(); - -// Summarize results - -if (0 == count($test_results)) { - echo "No tests were run.\n"; - return; -} - -$n_total = count($test_results); -$n_total += $ignored_by_ext; - -$sum_results = array('PASSED'=>0, 'WARNED'=>0, 'SKIPPED'=>0, 'FAILED'=>0); -foreach ($test_results as $v) { - $sum_results[$v]++; -} -$sum_results['SKIPPED'] += $ignored_by_ext; -$percent_results = array(); -while (list($v,$n) = each($sum_results)) { - $percent_results[$v] = (100.0 * $n) / $n_total; -} - -echo " -===================================================================== -TIME END " . date('Y-m-d H:i:s', $end_time); - -$summary = " -===================================================================== -TEST RESULT SUMMARY ---------------------------------------------------------------------- -Exts skipped : " . sprintf("%4d",$exts_skipped) . " -Exts tested : " . sprintf("%4d",$exts_tested) . " ---------------------------------------------------------------------- -Number of tests : " . sprintf("%4d",$n_total) . " -Tests skipped : " . sprintf("%4d (%2.1f%%)",$sum_results['SKIPPED'],$percent_results['SKIPPED']) . " -Tests warned : " . sprintf("%4d (%2.1f%%)",$sum_results['WARNED'],$percent_results['WARNED']) . " -Tests failed : " . sprintf("%4d (%2.1f%%)",$sum_results['FAILED'],$percent_results['FAILED']) . " -Tests passed : " . sprintf("%4d (%2.1f%%)",$sum_results['PASSED'],$percent_results['PASSED']) . " ---------------------------------------------------------------------- -Time taken : " . sprintf("%4d seconds", $end_time - $start_time) . " -===================================================================== -"; -echo $summary; - -$failed_test_summary = ''; -if (count($GLOBALS['__PHP_FAILED_TESTS__'])) { - $failed_test_summary .= " -===================================================================== -FAILED TEST SUMMARY ---------------------------------------------------------------------- -"; - foreach ($GLOBALS['__PHP_FAILED_TESTS__'] as $failed_test_data) { - $failed_test_summary .= $failed_test_data['test_name'] . $failed_test_data['info'] . "\n"; - } - $failed_test_summary .= "=====================================================================\n"; -} - -if ($failed_test_summary && !getenv('NO_PHPTEST_SUMMARY')) { - echo $failed_test_summary; -} - - -// -// Write the given text to a temporary file, and return the filename. -// - -function save_text($filename,$text) -{ - $fp = @fopen($filename,'w') or error("Cannot open file '" . $filename . "' (save_text)"); - fwrite($fp,$text); - fclose($fp); - if (1 < DETAILED) echo " -FILE $filename {{{ -$text -}}} -"; -} - -// -// Write an error in a format recognizable to Emacs or MSVC. -// - -function error_report($testname,$logname,$tested) -{ - $testname = realpath($testname); - $logname = realpath($logname); - switch (strtoupper(getenv('TEST_PHP_ERROR_STYLE'))) { - case 'MSVC': - echo $testname . "(1) : $tested\n"; - echo $logname . "(1) : $tested\n"; - break; - case 'EMACS': - echo $testname . ":1: $tested\n"; - echo $logname . ":1: $tested\n"; - break; - } -} - -// -// Run an individual test case. -// - -function run_test($php,$file) -{ - global $log_format, $info_params, $ini_overwrites; - - if (DETAILED) echo " -================= -TEST $file -"; - - // Load the sections of the test file. - $section_text = array( - 'TEST' => '(unnamed test)', - 'SKIPIF' => '', - 'GET' => '', - 'ARGS' => '', - ); - - $fp = @fopen($file, "r") or error("Cannot open test file: $file"); - - $section = ''; - while (!feof($fp)) { - $line = fgets($fp); - - // Match the beginning of a section. - if (ereg('^--([A-Z]+)--',$line,$r)) { - $section = $r[1]; - $section_text[$section] = ''; - continue; - } - - // Add to the section text. - $section_text[$section] .= $line; - } - fclose($fp); - - /* For GET/POST tests, check if cgi sapi is avaliable and if it is, use it. */ - if ((!empty($section_text['GET']) || !empty($section_text['POST']))) { - if (file_exists("./sapi/cgi/php")) { - $old_php = $php; - $php = realpath("./sapi/cgi/php") . ' -C '; - } - } - - $shortname = str_replace($GLOBALS['cwd'].'/', '', $file); - $tested = trim($section_text['TEST'])." [$shortname]"; - - $tmp = realpath(dirname($file)); - $tmp_skipif = $tmp . uniqid('/phpt.'); - $tmp_file = ereg_replace('\.phpt$','.php',$file); - $tmp_post = $tmp . uniqid('/phpt.'); - - @unlink($tmp_skipif); - @unlink($tmp_file); - @unlink($tmp_post); - - // unlink old test results - @unlink(ereg_replace('\.phpt$','.diff',$file)); - @unlink(ereg_replace('\.phpt$','.log',$file)); - @unlink(ereg_replace('\.phpt$','.exp',$file)); - @unlink(ereg_replace('\.phpt$','.out',$file)); - - // Reset environment from any previous test. - putenv("REDIRECT_STATUS="); - putenv("QUERY_STRING="); - putenv("PATH_TRANSLATED="); - putenv("SCRIPT_FILENAME="); - putenv("REQUEST_METHOD="); - putenv("CONTENT_TYPE="); - putenv("CONTENT_LENGTH="); - - // Check if test should be skipped. - $info = ''; - $warn = false; - if (array_key_exists('SKIPIF', $section_text)) { - if (trim($section_text['SKIPIF'])) { - save_text($tmp_skipif, $section_text['SKIPIF']); - $extra = substr(PHP_OS, 0, 3) !== "WIN" ? - "unset REQUEST_METHOD;": ""; - - $output = `$extra $php $info_params -f $tmp_skipif`; - @unlink($tmp_skipif); - if (eregi("^skip", trim($output))) { - echo "SKIP $tested"; - $reason = (eregi("^skip[[:space:]]*(.+)\$", trim($output))) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - echo " (reason: $reason)\n"; - } else { - echo "\n"; - } - if (isset($old_php)) { - $php = $old_php; - } - return 'SKIPPED'; - } - if (eregi("^info", trim($output))) { - $reason = (ereg("^info[[:space:]]*(.+)\$", trim($output))) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - $info = " (info: $reason)"; - } - } - if (eregi("^warn", trim($output))) { - $reason = (ereg("^warn[[:space:]]*(.+)\$", trim($output))) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; - if ($reason) { - $warn = true; /* only if there is a reason */ - $info = " (warn: $reason)"; - } - } - } - } - - // Default ini settings - $ini_settings = array(); - // additional ini overwrites - //$ini_overwrites[] = 'setting=value'; - settings2array($ini_overwrites, $ini_settings); - - // Any special ini settings - // these may overwrite the test defaults... - if (array_key_exists('INI', $section_text)) { - settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings); - } - settings2params($ini_settings); - - // We've satisfied the preconditions - run the test! - save_text($tmp_file,$section_text['FILE']); - if (array_key_exists('GET', $section_text)) { - $query_string = trim($section_text['GET']); - } else { - $query_string = ''; - } - - putenv("REDIRECT_STATUS=1"); - putenv("QUERY_STRING=$query_string"); - putenv("PATH_TRANSLATED=$tmp_file"); - putenv("SCRIPT_FILENAME=$tmp_file"); - - $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : ''; - - if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) { - - $post = trim($section_text['POST']); - save_text($tmp_post,$post); - $content_length = strlen($post); - - putenv("REQUEST_METHOD=POST"); - putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); - putenv("CONTENT_LENGTH=$content_length"); - - $cmd = "$php$ini_settings -f \"$tmp_file\" 2>&1 < $tmp_post"; - - } else { - - putenv("REQUEST_METHOD=GET"); - putenv("CONTENT_TYPE="); - putenv("CONTENT_LENGTH="); - - $cmd = "$php$ini_settings -f \"$tmp_file\" $args 2>&1"; - } - - if (DETAILED) echo " -CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . " -CONTENT_TYPE = " . getenv("CONTENT_TYPE") . " -PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . " -QUERY_STRING = " . getenv("QUERY_STRING") . " -REDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . " -REQUEST_METHOD = " . getenv("REQUEST_METHOD") . " -SCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . " -COMMAND $cmd -"; - - $out = `$cmd`; - - @unlink($tmp_post); - - // Does the output match what is expected? - $output = trim($out); - $output = preg_replace('/\r\n/',"\n",$output); - - /* when using CGI, strip the headers from the output */ - if (isset($old_php) && ($pos = strpos($output, "\n\n")) !== FALSE) { - $output = substr($output, ($pos + 2)); - } - - if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) { - if (isset($section_text['EXPECTF'])) { - $wanted = trim($section_text['EXPECTF']); - } else { - $wanted = trim($section_text['EXPECTREGEX']); - } - $wanted_re = preg_replace('/\r\n/',"\n",$wanted); - if (isset($section_text['EXPECTF'])) { - $wanted_re = preg_quote($wanted_re, '/'); - // Stick to basics - $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy - $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re); - $wanted_re = str_replace("%d", "[0-9]+", $wanted_re); - $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re); - $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re); - $wanted_re = str_replace("%c", ".", $wanted_re); - // %f allows two points "-.0.0" but that is the best *simple* expression - } -/* DEBUG YOUR REGEX HERE - var_dump($wanted_re); - print(str_repeat('=', 80) . "\n"); - var_dump($output); -*/ - if (preg_match("/^$wanted_re\$/s", $output)) { - @unlink($tmp_file); - echo "PASS $tested$info\n"; - if (isset($old_php)) { - $php = $old_php; - } - return 'PASSED'; - } - - } else { - $wanted = trim($section_text['EXPECT']); - $wanted = preg_replace('/\r\n/',"\n",$wanted); - // compare and leave on success - $ok = (0 == strcmp($output,$wanted)); - if ($ok) { - @unlink($tmp_file); - echo "PASS $tested$info\n"; - if (isset($old_php)) { - $php = $old_php; - } - return 'PASSED'; - } - } - - // Test failed so we need to report details. - if ($warn) { - echo "WARN $tested$info\n"; - } else { - echo "FAIL $tested$info\n"; - } - - $GLOBALS['__PHP_FAILED_TESTS__'][] = array( - 'name' => $file, - 'test_name' => $tested, - 'output' => ereg_replace('\.phpt$','.log', $file), - 'diff' => ereg_replace('\.phpt$','.diff', $file), - 'info' => $info - ); - - // write .exp - if (strpos($log_format,'E') !== FALSE) { - $logname = ereg_replace('\.phpt$','.exp',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,$wanted); - fclose($log); - } - - // write .out - if (strpos($log_format,'O') !== FALSE) { - $logname = ereg_replace('\.phpt$','.out',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,$output); - fclose($log); - } - - // write .diff - if (strpos($log_format,'D') !== FALSE) { - $logname = ereg_replace('\.phpt$','.diff',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log,generate_diff($wanted,$output)); - fclose($log); - } - - // write .log - if (strpos($log_format,'L') !== FALSE) { - $logname = ereg_replace('\.phpt$','.log',$file); - $log = fopen($logname,'w') or error("Cannot create test log - $logname"); - fwrite($log," ----- EXPECTED OUTPUT -$wanted ----- ACTUAL OUTPUT -$output ----- FAILED -"); - fclose($log); - error_report($file,$logname,$tested); - } - - if (isset($old_php)) { - $php = $old_php; - } - - return $warn ? 'WARNED' : 'FAILED'; -} - -function generate_diff($wanted,$output) -{ - $w = explode("\n", $wanted); - $o = explode("\n", $output); - $w1 = array_diff_assoc($w,$o); - $o1 = array_diff_assoc($o,$w); - $w2 = array(); - $o2 = array(); - foreach($w1 as $idx => $val) $w2[sprintf("%03d<",$idx)] = sprintf("%03d- ", $idx+1).$val; - foreach($o1 as $idx => $val) $o2[sprintf("%03d>",$idx)] = sprintf("%03d+ ", $idx+1).$val; - $diff = array_merge($w2, $o2); - ksort($diff); - return implode("\r\n", $diff); -} - -function error($message) -{ - echo "ERROR: {$message}\n"; - exit(1); -} - -function settings2array($settings, &$ini_settings) -{ - foreach($settings as $setting) { - if (strpos($setting, '=')!==false) { - $setting = explode("=", $setting, 2); - $name = trim(strtolower($setting[0])); - $value = trim($setting[1]); - $ini_settings[$name] = $value; - } - } -} - -function settings2params(&$ini_settings) -{ - if (count($ini_settings)) { - $settings = ''; - foreach($ini_settings as $name => $value) { - $value = addslashes($value); - $settings .= " -d \"$name=$value\""; - } - $ini_settings = $settings; - } else { - $ini_settings = ''; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: fdm=marker - * vim: noet sw=4 ts=4 - */ -?> diff --git a/php/tests/001.phpt b/php/tests/001.phpt deleted file mode 100644 index 8b7bbb20..00000000 --- a/php/tests/001.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Check for lasso presence ---SKIPIF-- -<?php if (!extension_loaded("lasso")) print "skip"; ?> ---FILE-- -<?php -echo "lasso extension is available"; -?> ---EXPECT-- -lasso extension is available diff --git a/php/tests/Makefile.am b/php/tests/Makefile.am deleted file mode 100644 index 6c70fc5a..00000000 --- a/php/tests/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = 001.phpt diff --git a/php/tests/lasso_login.phpt b/php/tests/lasso_login.phpt deleted file mode 100644 index 785b2c21..00000000 --- a/php/tests/lasso_login.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Check Lasso Login ---SKIPIF-- -<?php if (!extension_loaded("lasso")) print "skip"; ?> ---FILE-- -<?php - lasso_init(); - $server = lasso_server_new("../examples/sp.xml", - "../examples/rsapub.pem", - "../examples/rsakey.pem", - "../examples/sacert.pem", lassoSignatureMethodRsaSha1); - $login = lasso_login_new($server); - var_dump($login); - lasso_login_destroy($login); - var_dump($login); - - lasso_shutdown(); -?> ---EXPECT-- -DEBUG: lasso_init -DEBUG: lasso_server_new -DEBUG: lasso_login_new -resource(5) of type (LASSO Login Resource) -DEBUG: lasso_login_destroy -resource(5) of type (Unknown) -DEBUG: lasso_shutdown diff --git a/php/tests/lasso_server.phpt b/php/tests/lasso_server.phpt deleted file mode 100644 index a601886d..00000000 --- a/php/tests/lasso_server.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -Check Lasso Server ---SKIPIF-- -<?php if (!extension_loaded("lasso")) print "skip"; ?> ---FILE-- -<?php - lasso_init(); - $server = lasso_server_new("../examples/sp.xml", - "../examples/rsapub.pem", - "../examples/rsakey.pem", - "../examples/sacert.pem", lassoSignatureMethodRsaSha1); - var_dump($server); - - lasso_server_add_provider($server, "../examples/idp.xml", "", ""); - - $dump = lasso_server_dump($server); - - print $dump . "\n"; - - $new_server = lasso_server_new_from_dump($dump); - - var_dump($new_server); - - lasso_server_destroy($server); - - var_dump($server); - - lasso_shutdown(); - -?> ---EXPECT-- -DEBUG: lasso_init -DEBUG: lasso_server_new -resource(4) of type (LASSO Server Resource) -DEBUG: lasso_server_add_provider -DEBUG: lasso_server_dump -<LassoServer SignatureMethod="1" ProviderID="https://service-provider:2003/liberty-alliance/metadata" PrivateKey="../examples/rsakey.pem" Certificate="../examples/sacert.pem" PublicKey="../examples/rsapub.pem"><EntityDescriptor xmlns="urn:liberty:metadata:2003-08" ProviderID="https://service-provider:2003/liberty-alliance/metadata"> - <SPDescriptor> - - <FederationTerminationServiceURL>https://service-provider:2003/liberty-alliance/singleLogout</FederationTerminationServiceURL> - <FederationTerminationProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</FederationTerminationProtocolProfile> - - <SingleLogoutServiceURL>https://service-provider:2003/liberty-alliance/singleLogout</SingleLogoutServiceURL> - <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</SingleLogoutProtocolProfile> - <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-sp-soap</RegisterNameIdentifierProtocolProfile> - <RegisterNameIdentifierServiceURL>https://service-provider:2003/liberty-alliance/registerNameIdentifier</RegisterNameIdentifierServiceURL> - <SoapEndpoint>https://service-provider:2003/liberty-alliance/soapEndpoint</SoapEndpoint> - <AssertionConsumerServiceURL id="AssertionConsumerServiceURL1" isDefault="true">https://service-provider:2003/liberty-alliance/assertionConsumer</AssertionConsumerServiceURL> - <AuthnRequestsSigned>true</AuthnRequestsSigned> -</SPDescriptor> -</EntityDescriptor><LassoProviders><LassoProvider PublicKey="" CaCertificate=""><EntityDescriptor xmlns="urn:liberty:metadata:2003-08" ProviderID="https://identity-provider:2003/liberty-alliance/metadata"> - <IDPDescriptor> - <FederationTerminationServiceURL>https://identity-provider:2003/liberty-alliance/federationTermination</FederationTerminationServiceURL> - <FederationTerminationNotificationProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</FederationTerminationNotificationProtocolProfile> - <SingleSignOnProtocolProfile>http://projectliberty.org/profiles/sso-get</SingleSignOnProtocolProfile> - <SingleSignOnServiceURL>http://identity-provider:2002/sso</SingleSignOnServiceURL> - <SingleLogoutServiceURL>https://identity-provider:2003/liberty-alliance/singleLogout</SingleLogoutServiceURL> - <SingleLogoutProtocolProfile>http://projectliberty.org/profiles/slo-idp-soap</SingleLogoutProtocolProfile> - <RegisterNameIdentifierProtocolProfile>http://projectliberty.org/profiles/rni-idp-soap</RegisterNameIdentifierProtocolProfile> - <RegisterNameIdentifierServiceURL>https://identity-provider:2003/liberty-alliance/registerNameIdentifier</RegisterNameIdentifierServiceURL> - <SoapEndpoint>https://identity-provider:2003/liberty-alliance/soapEndpoint</SoapEndpoint> -</IDPDescriptor> -</EntityDescriptor></LassoProvider></LassoProviders></LassoServer> -DEBUG: lasso_server_new_from_dump -resource(5) of type (LASSO Server Resource) -DEBUG: lasso_server_destroy -resource(4) of type (Unknown) -DEBUG: lasso_shutdown diff --git a/php/xml/Makefile.am b/php/xml/Makefile.am deleted file mode 100644 index ff3def57..00000000 --- a/php/xml/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -DPACKAGE=\"@PACKAGE@\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lasso \ - $(LASSO_DEFINES) \ - $(LASSO_CFLAGS) \ - $(PHP_INCLUDES) - - -XMLSOURCES = lasso_lib_authn_request.c - -noinst_LIBRARIES = libxml.a -libxml_a_SOURCES = $(XMLSOURCES) - -EXTRA_DIST = diff --git a/php/xml/lasso_lib_authn_request.c b/php/xml/lasso_lib_authn_request.c deleted file mode 100644 index 9c8c353c..00000000 --- a/php/xml/lasso_lib_authn_request.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * - * PHP lasso -- PHP bindings for Lasso library - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "../php_lasso.h" - -#ifdef HAVE_CONFIG_H -#include "lasso_config.h" -#endif - - -#include "lasso.h" - -/* {{{ proto resource lasso_cast_to_lib_authn_request(resource node) */ -PHP_FUNCTION(lasso_cast_to_lib_authn_request) -{ - LassoNode *node; - LassoLibAuthnRequest *lib_authn_request; - zval *param; - int num_args; - - - - - if ((num_args = ZEND_NUM_ARGS()) != 1) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "z", ¶m) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(node, LassoNode *, ¶m, -1, - le_lassonode_name, le_lassonode); - - lib_authn_request = LASSO_LIB_AUTHN_REQUEST(node); - - ZEND_REGISTER_RESOURCE(return_value, lib_authn_request, le_lassolibauthnrequest); -} -/* }}} */ - -/* {{{ proto lasso_lib_authn_request_set_consent(resource lib_authn_request, string consent) */ -PHP_FUNCTION(lasso_lib_authn_request_set_consent) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - char *consent; - int consent_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", ¶m, - &consent, &consent_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_consent(lib_authn_request, consent); -} -/* }}} */ - -/* {{{ proto lasso_lib_authn_response_set_consent(resource lib_authn_request, string consent) */ -PHP_FUNCTION(lasso_lib_authn_response_set_consent) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - char *consent; - int consent_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", ¶m, - &consent, &consent_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_response_set_consent(lib_authn_request, consent); -} -/* }}} */ - - -/* {{{ proto lasso_lib_authn_request_set_ispassive(resource lib_authn_request, string consent) */ -PHP_FUNCTION(lasso_lib_authn_request_set_ispassive) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - zend_bool ispassive = 1; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zb", ¶m, &ispassive) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_isPassive(lib_authn_request, ispassive); -} -/* }}} */ - -/* {{{ proto lasso_lib_authn_request_set_forceauthn(resource lib_authn_request, string consent) */ -PHP_FUNCTION(lasso_lib_authn_request_set_forceauthn) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - zend_bool forceauthn = 1; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zb", ¶m, &forceauthn) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_forceAuthn(lib_authn_request, forceauthn); -} -/* }}} */ - -/* {{{ proto lasso_lib_authn_request_set_nameidpolicy(resource lib_authn_request, string consent) */ -PHP_FUNCTION(lasso_lib_authn_request_set_nameidpolicy) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - char *nameidpolicy; - int nameidpolicy_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", ¶m, &nameidpolicy, &nameidpolicy_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_nameIDPolicy(lib_authn_request, nameidpolicy); -} -/* }}} */ - -/* {{{ proto lasso_lib_authn_request_set_relaystate(resource lib_authn_request, string relaystate) */ -PHP_FUNCTION(lasso_lib_authn_request_set_relaystate) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - char *relaystate; - int relaystate_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", ¶m, &relaystate, &relaystate_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_relayState(lib_authn_request, relaystate); -} -/* }}} */ - - -/* {{{ proto lasso_lib_authn_request_set_protocolprofile(resource lib_authn_request, string protocolprofile) */ -PHP_FUNCTION(lasso_lib_authn_request_set_protocolprofile) -{ - LassoLibAuthnRequest *lib_authn_request; - zval *param; - char *protocolprofile; - int protocolprofile_len; - int num_args; - - - - if ((num_args = ZEND_NUM_ARGS()) != 2) - WRONG_PARAM_COUNT - - if (zend_parse_parameters(num_args TSRMLS_CC, "zs", ¶m, &protocolprofile, &protocolprofile_len) == FAILURE) { - return; - } - - ZEND_FETCH_RESOURCE(lib_authn_request, LassoLibAuthnRequest *, ¶m, -1, - le_lassolibauthnrequest_name, le_lassolibauthnrequest); - - lasso_lib_authn_request_set_protocolProfile(lib_authn_request, protocolprofile); -} -/* }}} */ |
