]> saetta.ns0.it Git - zakauthe/libzakauthe/commitdiff
Initial import
authorroot <root@saetta.homelinux.org>
Wed, 20 May 2009 15:07:01 +0000 (17:07 +0200)
committerroot <root@saetta.homelinux.org>
Wed, 20 May 2009 15:07:01 +0000 (17:07 +0200)
23 files changed:
AUTHORS [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
data/Makefile.am [new file with mode: 0644]
data/aute_confi_schema.xml [new file with mode: 0644]
docs/Makefile.am [new file with mode: 0644]
docs/reference/Makefile.am [new file with mode: 0644]
docs/reference/libaute-docs.sgml [new file with mode: 0644]
docs/reference/libaute-overrides.txt [new file with mode: 0644]
docs/reference/libaute-sections.txt [new file with mode: 0644]
docs/reference/libaute-undocumented.txt [new file with mode: 0644]
docs/reference/tmpl/aute.sgml [new file with mode: 0644]
docs/reference/tmpl/libaute-unused.sgml [new file with mode: 0644]
docs/reference/tmpl/libaute.sgml [new file with mode: 0644]
docs/reference/version.xml.in [new file with mode: 0644]
libaute.pc.in [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/aute.c [new file with mode: 0644]
src/libaute.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..ad1de0f
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Andrea Zagli <azagli@libero.it>
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..8ece957
--- /dev/null
@@ -0,0 +1,6 @@
+SUBDIRS = src docs
+
+EXTRA_DIST = libaute.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libaute.pc
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..36cce34
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+PROJECT=libaute
+TEST_TYPE=-f
+FILE=configure.ac
+
+DIE=0
+
+have_libtool=false
+if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
+       libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+       case $libtool_version in
+           1.4*|1.5*)
+               have_libtool=true
+               ;;
+       esac
+fi
+if $have_libtool ; then : ; else
+       echo
+       echo "You must have libtool 1.4 installed to compile $PROJECT."
+       echo "Install the appropriate package for your distribution,"
+       echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
+       DIE=1
+fi
+
+(gtkdocize --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have gtk-doc installed to compile $PROJECT."
+       echo "Install the appropriate package for your distribution,"
+       echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
+       DIE=1
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have autoconf installed to compile $PROJECT."
+       echo "Install the appropriate package for your distribution,"
+       echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+       DIE=1
+}
+
+if automake --version < /dev/null > /dev/null 2>&1 ; then
+    AUTOMAKE=automake
+    ACLOCAL=aclocal
+else
+       echo
+       echo "You must have automake 1.7.x installed to compile $PROJECT."
+       echo "Install the appropriate package for your distribution,"
+       echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+       DIE=1
+fi
+
+if test "$DIE" -eq 1; then
+       exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+       echo "You must run this script in the top-level $PROJECT directory"
+       exit 1
+}
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+        if test -z "$*"; then
+                echo "I am going to run ./configure with no arguments - if you wish "
+                echo "to pass any to it, please specify them on the $0 command line."
+        fi
+fi
+
+rm -rf autom4te.cache
+
+# README and INSTALL are required by automake, but may be deleted by clean
+# up rules. to get automake to work, simply touch these here, they will be
+# regenerated from their corresponding *.in files by ./configure anyway.
+touch README INSTALL
+
+$ACLOCAL || exit $?
+
+libtoolize --force || exit $?
+gtkdocize || exit $?
+
+autoheader || exit $?
+
+$AUTOMAKE --add-missing || exit $?
+autoconf || exit $?
+cd $ORIGDIR || exit $?
+
+if test -z "$AUTOGEN_SUBDIR_MODE"; then
+        $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
+
+        echo 
+        echo "Now type 'make' to compile $PROJECT."
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..07d06b1
--- /dev/null
@@ -0,0 +1,47 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([libaute], [0.0.1], [azagli@libero.it])
+AC_CONFIG_SRCDIR([src/aute.c])
+
+AM_INIT_AUTOMAKE
+AM_MAINTAINER_MODE
+
+AC_CANONICAL_SYSTEM
+
+AC_LIBTOOL_WIN32_DLL
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+GTK_DOC_CHECK
+
+# Checks for libraries.
+PKG_CHECK_MODULES(LIBAUTE, [glib-2.0 >= 2.10.0
+                            gmodule-2.0 >= 2.10.0
+                            libconfi >= 0.0.2])
+
+AC_SUBST(LIBAUTE_CFLAGS)
+AC_SUBST(LIBAUTE_LIBS)
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+
+AC_CONFIG_FILES([
+  libaute.pc
+  Makefile
+  src/Makefile
+  data/Makefile
+  docs/Makefile
+  docs/reference/Makefile
+  docs/reference/version.xml
+])
+
+AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644 (file)
index 0000000..dfb1130
--- /dev/null
@@ -0,0 +1 @@
+EXTRA_DIST = aute_confi_schema.xml
diff --git a/data/aute_confi_schema.xml b/data/aute_confi_schema.xml
new file mode 100644 (file)
index 0000000..61cf093
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<gconfi-key>
+       <name>aute</name>
+       <description>Gestione autenticazione</description>
+
+       <gconfi-key>
+               <name>plugin</name>
+               <description>Il nome del plugin da utilizzare</description>
+       </gconfi-key>
+</gconfi-key>
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644 (file)
index 0000000..f3ddc22
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = reference
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
new file mode 100644 (file)
index 0000000..6fbc23d
--- /dev/null
@@ -0,0 +1,78 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# This is a blank Makefile.am for using gtk-doc.
+# Copy this to your project's API docs directory and modify the variables to
+# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+# of using the various options.
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=libaute
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=../../src
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" 
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-mktmpl
+# e.g. MKTMPL_OPTIONS=--only-section-tmpl
+MKTMPL_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/src/*.h
+CFILE_GLOB=$(top_srcdir)/src/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES=
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=
+
+# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
+# These files must be listed here *and* in content_files
+# e.g. expand_content_files=running.sgml
+expand_content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES=-I$(top_srcdir) -I($top_builddir) $(LIBAUTE_CFLAGS)
+GTKDOC_LIBS=$(top_builddir)/src/libaute.la $(LIBAUTE_LIBS)
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST += version.xml.in
diff --git a/docs/reference/libaute-docs.sgml b/docs/reference/libaute-docs.sgml
new file mode 100644 (file)
index 0000000..bb5e299
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
+  <bookinfo>
+    <title>[Insert name here] Reference Manual</title>
+  </bookinfo>
+
+  <chapter>
+    <title>[Insert title here]</title>
+    <xi:include href="xml/libaute.xml"/>
+    <xi:include href="xml/aute.xml"/>
+  </chapter>
+</book>
diff --git a/docs/reference/libaute-overrides.txt b/docs/reference/libaute-overrides.txt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/docs/reference/libaute-sections.txt b/docs/reference/libaute-sections.txt
new file mode 100644 (file)
index 0000000..562f52c
--- /dev/null
@@ -0,0 +1,14 @@
+<SECTION>
+<FILE>libaute</FILE>
+aute_autentica
+aute_plugin_get_module
+</SECTION>
+
+<SECTION>
+<FILE>aute</FILE>
+Aute
+aute_init
+aute_autentica
+aute_destroy
+</SECTION>
+
diff --git a/docs/reference/libaute-undocumented.txt b/docs/reference/libaute-undocumented.txt
new file mode 100644 (file)
index 0000000..00913fe
--- /dev/null
@@ -0,0 +1,16 @@
+11% symbol docs coverage.
+1 symbols documented.
+0 symbols incomplete.
+8 not documented.
+
+
+Aute
+aute_autentica
+aute_destroy
+aute_init
+aute_plugin_get_module
+
+
+aute:Short_Description
+libaute:Long_Description
+libaute:Short_Description
diff --git a/docs/reference/tmpl/aute.sgml b/docs/reference/tmpl/aute.sgml
new file mode 100644 (file)
index 0000000..f2eb768
--- /dev/null
@@ -0,0 +1,55 @@
+<!-- ##### SECTION Title ##### -->
+aute
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### TYPEDEF Aute ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION aute_init ##### -->
+<para>
+
+</para>
+
+@tipo: 
+@params: 
+@Returns: 
+
+
+<!-- ##### FUNCTION aute_autentica ##### -->
+<para>
+
+</para>
+
+@confi: 
+@Returns: 
+
+
+<!-- ##### FUNCTION aute_destroy ##### -->
+<para>
+
+</para>
+
+@aute: 
+@Returns: 
+
+
diff --git a/docs/reference/tmpl/libaute-unused.sgml b/docs/reference/tmpl/libaute-unused.sgml
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/docs/reference/tmpl/libaute.sgml b/docs/reference/tmpl/libaute.sgml
new file mode 100644 (file)
index 0000000..2306fcd
--- /dev/null
@@ -0,0 +1,39 @@
+<!-- ##### SECTION Title ##### -->
+libaute
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION aute_autentica ##### -->
+<para>
+
+</para>
+
+@confi: 
+@Returns: 
+
+
+<!-- ##### FUNCTION aute_plugin_get_module ##### -->
+<para>
+
+</para>
+
+@confi: 
+@Returns: 
+
+
diff --git a/docs/reference/version.xml.in b/docs/reference/version.xml.in
new file mode 100644 (file)
index 0000000..a24f987
--- /dev/null
@@ -0,0 +1 @@
+@PACKAGE_VERSION@
diff --git a/libaute.pc.in b/libaute.pc.in
new file mode 100644 (file)
index 0000000..1d3a557
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: Libreria per la gestione dell'autenticazione attraverso plugin
+Version: @PACKAGE_VERSION@
+Requires: glib-2.0, libconfi
+Libs: -L${libdir} -laute
+Cflags: -I${includedir}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..a7b7431
--- /dev/null
@@ -0,0 +1,10 @@
+AM_CPPFLAGS = $(LIBAUTE_CFLAGS) \
+              -DLIBAUTE_PLUGINS_DIR=\""$(libdir)/libaute/plugins"\"
+
+LIBS = $(LIBAUTE_LIBS)
+
+lib_LTLIBRARIES = libaute.la
+
+libaute_la_SOURCES = aute.c
+
+include_HEADERS = libaute.h
diff --git a/src/aute.c b/src/aute.c
new file mode 100644 (file)
index 0000000..1fd4774
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2005-2006 Andrea Zagli <azagli@libero.it>
+ *
+ *  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 <stdio.h>
+
+#include "libaute.h"
+
+/**
+ * aute_autentica:
+ * @confi: un oggetto #Confi; se viene passato NULL verrĂ  utilizzata la 
+ * configurazione Default, letta dal database specificato in GConf dell'utente
+ * corrente.
+ *
+ * Returns: il nome utente se l'autenticazione va a buon fine; 
+ * stringa vuota ("") se viene premuto "Annulla"; NULL in caso di errore.
+ */
+gchar
+*aute_autentica (Confi *confi)
+{
+       GModule *module;
+
+       gchar *(*autentica) (Confi *confi);
+       gchar *ret;
+
+       if (confi == NULL)
+               {
+                       /* TO DO */
+                       /* leggere il provider_id e cnc_string da GConf dell'utente */
+                       confi = confi_new (NULL, "PostgreSQL", "HOSTADDR=127.0.0.1;PORT=5432;DATABASE=confi;HOST=localhost;USER=postgres", "Default", NULL, FALSE);
+                       if (confi == NULL)
+                               {
+                                       /* TO DO */
+                                       return NULL;
+                               }
+               }
+
+       /* caricamento del plugin in base alla configurazione */
+       module = aute_plugin_get_module (confi);
+
+       /* carico la funzione */
+       if (!g_module_symbol (module, "autentica", (gpointer *)&autentica))
+               {
+                       /* TO DO */
+                       g_fprintf (stderr, "Error g_module_symbol\n");
+                       return NULL;
+               }
+
+       /* chiamo la funzione del plugin */
+       ret = (*autentica) (confi);
+
+       /* chiudo la libreria */
+       if (!g_module_close (module))
+               {
+                       g_fprintf (stderr, "Error g_module_close\n");
+               }
+
+       return ret;
+}
+
+/**
+ * aute_get_plugin_module:
+ * @confi: un oggetto #Confi.
+ *
+ * Returns: l'oggetto #GModule corrispondente al plugin.
+ */
+GModule
+*aute_plugin_get_module (Confi *confi)
+{
+       gchar *libname;
+       GModule *module = NULL;
+
+       libname = confi_path_get_value (confi, "aute/plugin");
+       if (libname == NULL)
+               {
+                       /* TO DO */
+                       g_warning ("Valore nullo della configurazione per il plugin.");
+                       return NULL;
+               }
+       libname = g_strconcat (LIBAUTE_PLUGINS_DIR "/", libname, NULL);
+
+       /* carico la libreria */
+       module = g_module_open (libname, G_MODULE_BIND_LAZY);
+       if (!module)
+               {
+                       /* TO DO */
+                       g_warning ("Error g_module_open.");
+                       return NULL;
+               }
+
+       return module;
+}
diff --git a/src/libaute.h b/src/libaute.h
new file mode 100644 (file)
index 0000000..2bb25a7
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005-2006 Andrea Zagli <azagli@libero.it>
+ *
+ *  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.
+ */
+
+#ifndef __AUTE_H__
+#define __AUTE_H__
+
+#include <glib.h>
+#include <gmodule.h>
+
+#include <libconfi.h>
+
+
+G_BEGIN_DECLS
+
+
+gchar *aute_autentica (Confi *confi);
+
+GModule *aute_plugin_get_module (Confi *confi);
+
+
+G_END_DECLS
+
+
+#endif /* __AUTE_H__ */