diff options
-rwxr-xr-x | lualdap/Makefile | 4 | ||||
-rwxr-xr-x | lualdap/README | 3 | ||||
-rwxr-xr-x | lualdap/doc/us/index.html | 50 | ||||
-rwxr-xr-x | lualdap/doc/us/license.html | 80 | ||||
-rwxr-xr-x | lualdap/doc/us/manual.html | 33 | ||||
-rwxr-xr-x | lualdap/src/lualdap.c | 44 | ||||
-rwxr-xr-x | lualdap/tests/test.lua | 4 |
7 files changed, 194 insertions, 24 deletions
diff --git a/lualdap/Makefile b/lualdap/Makefile index 6529a6b..8b8aff8 100755 --- a/lualdap/Makefile +++ b/lualdap/Makefile @@ -11,7 +11,7 @@ ZIP_FILE= $(PKG).zip SRCS= README Makefile \ lualdap.c loader.tmpl \ test.lua \ - index.html manual.html lua.png + index.html manual.html license.html lua.png AR= ar rcu RANLIB= ranlib @@ -45,4 +45,4 @@ $(DYLIB): $(OBJ) gcc -o $@ -dynamiclib $(OBJ) $(LIBS_DIR) $(LIBS) clean: - rm -f $(OBJ) $(LIB) $(SO) $(DYLIB) $(DLL) + rm -f $(OBJ) $(LIB) $(SO) $(DYLIB) $(DLL) $(TAR_FILE) $(ZIP_FILE) diff --git a/lualdap/README b/lualdap/README index 53ba6d8..c919f06 100755 --- a/lualdap/README +++ b/lualdap/README @@ -3,6 +3,7 @@ LuaLDAP is a Lua interface to the OpenLDAP library. Here goes a small description of the files in the distribution index.html -- Home page + license.html -- Copyright & License lualdap.c -- C source file lualdap.def -- .def file for Windows lua.png -- Lua Logo @@ -12,4 +13,4 @@ Here goes a small description of the files in the distribution README -- This file test.lua -- Overall API test script -$Id: README,v 1.1 2003-06-15 11:55:59 tomas Exp $ +$Id: README,v 1.2 2003-12-02 14:25:09 tomas Exp $ diff --git a/lualdap/doc/us/index.html b/lualdap/doc/us/index.html index 3453636..0653e6b 100755 --- a/lualdap/doc/us/index.html +++ b/lualdap/doc/us/index.html @@ -1,5 +1,6 @@ +<! See Copyright Notice in license.html>
<html>
-<!$Id: index.html,v 1.7 2003-09-12 18:50:39 tomas Exp $>
+<!$Id: index.html,v 1.8 2003-12-02 14:25:09 tomas Exp $>
<head>
<style type="text/css">
@@ -28,6 +29,7 @@ ul { list-style-type: disc }; <a href=#new>what's new</a> ·
<a href=#installation>installation</a> ·
<a href="manual.html">manual</a> ·
+<a href="license.html">license</a> ·
<a href=#hist>history</a>
</small></center>
<p>
@@ -37,21 +39,22 @@ ul { list-style-type: disc }; <h2>Contents</h2>
<p>
<ul>
-<li> <a href=#over>Overview</a>
-<li> <a href=#version>Current Version</a>
-<li> <a href=#download>Download</a>
-<li> <a href=#new>What's new</a>
-<li> <a href=#installation>Installation</a>
-<li> <a href="manual.html">User's manual</a>
- <ul>
- <li> <a href="manual.html#introduction">Introduction</a>
- <li> <a href="#attributes">attributes</a>
- <li> <a href="#dn">DN</a>
- <li> <a href="#initialization_functions">initialization</a>
- <li> <a href="#connection_object">connection</a>
- <li> <a href="manual.html#examples">Examples</a>
- </ul>
-<li> <a href=#hist>History</a>
+ <li> <a href=#over>Overview</a>
+ <li> <a href=#version>Current Version</a>
+ <li> <a href=#download>Download</a>
+ <li> <a href=#new>What's new</a>
+ <li> <a href=#installation>Installation</a>
+ <li> <a href="manual.html">User's manual</a>
+ <ul>
+ <li> <a href="manual.html#introduction">Introduction</a>
+ <li> <a href="#attributes">attributes</a>
+ <li> <a href="#dn">DN</a>
+ <li> <a href="#initialization_functions">initialization</a>
+ <li> <a href="#connection_object">connection</a>
+ <li> <a href="manual.html#examples">Examples</a>
+ </ul>
+ <li> <a href="license.html">Copyright & License</a>
+ <li> <a href=#hist>History</a>
</ul>
</p>
@@ -59,7 +62,7 @@ ul { list-style-type: disc }; <a name=over>
<h2>Overview</h2>
<p>
-LuaLDAP is simple interface from Lua to an LDAP client
+LuaLDAP is a simple interface from Lua to an LDAP client
(in fact it's a bind to <a href="http://www.openldap.org">OpenLDAP</a> client).
It enables a Lua program to:
<ul>
@@ -67,12 +70,17 @@ It enables a Lua program to: <li> Execute any operation (search, add, compare, delete, modify and rename);
<li> Retrieve entries and references of the search result.
</ul>
+</p>
+<p>
+LuaLDAP is
+<a href="license.html">free software</a>.
<a name=version>
<h2>Current version</h2>
<p>
Current version is 1.0 alpha.
+It was developed for Lua 5.0 and OpenLDAP 2.1.
</p>
@@ -114,6 +122,13 @@ You can download the library from the <h2>History</h2>
<p>
+LuaLDAP was designed by Roberto Ierusalimschy, André Carregal
+and Tomás Guisasola for
+<a href="http://www.keplerproject.org">The Kepler Project</a>
+that keeps its copyright.
+It was implemented by Tomás Guisasola.
+</p>
+<p>
LuaLDAP development was sponsored by
<a href="http://www.fabricadigital.com.br">Fábrica Digital</a>
and FINEP.
@@ -127,6 +142,7 @@ and FINEP. <a href=#new>what's new</a> ·
<a href=#installation>installation</a> ·
<a href="manual.html">manual</a> ·
+<a href="license.html">license</a> ·
<a href=#hist>history</a>
</small></center>
<p>
diff --git a/lualdap/doc/us/license.html b/lualdap/doc/us/license.html new file mode 100755 index 0000000..54809f7 --- /dev/null +++ b/lualdap/doc/us/license.html @@ -0,0 +1,80 @@ +<! See Copyright Notice at the end of this file> +<HTML> +<HEAD> +<TITLE>LuaLDAP: license</TITLE> +</HEAD> +<!$Id: license.html,v 1.1 2003-12-02 14:25:09 tomas Exp $> + +<BODY BGCOLOR="#FFFFFF"> + +<HR> +<H1> +License +</H1> + +LuaLDAP +is free software: +it can be used for both academic and commercial purposes at absolutely no cost. +There are no royalties or GNU-like "copyleft" restrictions. +LuaLDAP qualifies as +<A HREF="http://www.opensource.org/docs/definition.html">Open Source</A> +software. +Its licenses are compatible with +<A HREF="http://www.gnu.org/licenses/gpl.html">GPL</A>. +LuaLDAP is not in the public domain and +<a href="http://www.keplerproject.org">The Kepler Project</a> +keep its copyright. +The legal details are below. +<P> + +The spirit of the license is that +you are free to use LuaLDAP for any purpose at no cost without having to ask us. +The only requirement is that +if you do use LuaLDAP, +then you should give us credit by including the appropriate copyright notice +somewhere in your product or its documentation. +<P> + +The LuaLDAP library is designed and implemented +by +Roberto Ierusalimschy, +André Carregal and +Tomás Guisasola. +The implementation is not derived from licensed software. +<P> + +<!-- ===================================================================== --> +<HR> +Copyright © 2003 The Kepler Project. +<P> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +<P> + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. +<P> + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +<P> + +<!-- ===================================================================== --> +<HR> +<SMALL> +Last update: +Fri Nov 28 15:57:05 BRST 2003 +</SMALL> + +</BODY> +</HTML> diff --git a/lualdap/doc/us/manual.html b/lualdap/doc/us/manual.html index 15cd600..8d14fc2 100755 --- a/lualdap/doc/us/manual.html +++ b/lualdap/doc/us/manual.html @@ -1,5 +1,6 @@ +<! See Copyright Notice in license.html>
<html>
-<!$Id: manual.html,v 1.9 2003-09-03 08:04:30 tomas Exp $>
+<!$Id: manual.html,v 1.10 2003-12-02 14:25:09 tomas Exp $>
<head>
<style type="text/css">
@@ -37,6 +38,34 @@ ul { list-style-type: disc }; <a name="introduction"></a>
<h2>Introduction</h2>
<p>
+LuaLDAP is a simple interface from Lua to an LDAP client
+(in fact it's a bind to
+<a href="http://www.openldap.org">OpenLDAP</a>
+client).
+</p>
+<p>
+LuaLDAP defines one single global variable, a table called
+<tt>lualdap</tt>
+which holds the function that creates a connection object.
+To initiate an LDAP session is required a hostname and a user
+identification.
+If desired Transport Layer Security (TLS) can be used throughout
+the connection.
+</p>
+<p>
+With a connection object any operation can be performed on the
+directory such as value comparation, addition of new entries,
+modification of attributes on existing entries, remotion and
+the most common of all: searches.
+Entries are represented as Lua tables; attributes are it's
+fields.
+Attribute's values can be strings or tables of strings when
+they have multiple values on the directory.
+</p>
+<p>
+LuaLDAP is
+<a href="license.html">free software</a>.
+</p>
<a name="attributes">
@@ -290,7 +319,7 @@ of LDAP Search Filters (RFC 2254)</a> <hr>
<small>
Last modified on
-Mon Sep 1 15:54:23 BRT 2003
+Tue Dec 2 14:45:25 BRST 2003
</small>
</body>
diff --git a/lualdap/src/lualdap.c b/lualdap/src/lualdap.c index e48087d..0de04a9 100755 --- a/lualdap/src/lualdap.c +++ b/lualdap/src/lualdap.c @@ -1,6 +1,7 @@ /* ** LuaLDAP -** $Id: lualdap.c,v 1.25 2003-09-04 15:41:53 tomas Exp $ +** See Copyright Notice in license.html +** $Id: lualdap.c,v 1.26 2003-12-02 14:25:09 tomas Exp $ */ #include <stdlib.h> @@ -810,6 +811,39 @@ static int lualdap_search (lua_State *L) { /* +** Return the name of the object's metatable. +** This function is used by `tostring'. +*/ +static int lualdap_conn_tostring (lua_State *L) { + char buff[100]; + conn_data *conn = (conn_data *)lua_touserdata (L, 1); + if (conn->ld == NULL) + strcpy (buff, "closed"); + else + sprintf (buff, "%p", conn); + lua_pushfstring (L, "%s (%s)", LUALDAP_CONNECTION_METATABLE, buff); + return 1; +} + + +/* +** Return the name of the object's metatable. +** This function is used by `tostring'. +*/ +static int lualdap_search_tostring (lua_State *L) { + char buff[100]; + search_data *search = (search_data *)lua_touserdata (L, 1); + luaL_argcheck (L,search->conn!=LUA_NOREF,1,LUALDAP_PREFIX"LDAP search is closed"); + if (search->conn == LUA_NOREF) + strcpy (buff, "closed"); + else + sprintf (buff, "%p", search); + lua_pushfstring (L, "%s (%s)", LUALDAP_SEARCH_METATABLE, buff); + return 1; +} + + +/* ** Create a metatable. */ static int lualdap_createmeta (lua_State *L) { @@ -839,6 +873,10 @@ static int lualdap_createmeta (lua_State *L) { lua_pushvalue (L, -2); lua_settable (L, -3); + lua_pushliteral (L, "__tostring"); + lua_pushcfunction (L, lualdap_conn_tostring); + lua_settable (L, -3); + lua_pushliteral (L, "__metatable"); lua_pushliteral(L,LUALDAP_PREFIX"you're not allowed to get this metatable"); lua_settable (L, -3); @@ -850,6 +888,10 @@ static int lualdap_createmeta (lua_State *L) { lua_pushcfunction (L, lualdap_search_close); lua_settable (L, -3); + lua_pushliteral (L, "__tostring"); + lua_pushcclosure (L, lualdap_search_tostring, 1); + lua_settable (L, -3); + lua_pushliteral (L, "__metatable"); lua_pushliteral(L,LUALDAP_PREFIX"you're not allowed to get this metatable"); lua_settable (L, -3); diff --git a/lualdap/tests/test.lua b/lualdap/tests/test.lua index 831b13a..6166e65 100755 --- a/lualdap/tests/test.lua +++ b/lualdap/tests/test.lua @@ -1,10 +1,12 @@ #!/usr/local/bin/lua --------------------------------------------------------------------- -- LuaLDAP test file. --- $Id: test.lua,v 1.8 2003-09-03 11:07:51 tomas Exp $ -- This test will create a copy of an existing entry on the -- directory to work on. This new entry will be modified, -- renamed and deleted at the end. +-- +-- See Copyright Notice in license.html +-- $Id: test.lua,v 1.9 2003-12-02 14:25:09 tomas Exp $ --------------------------------------------------------------------- DN_PAT = "^([^,=]+)%=([^,]+)%,(.*)$" |