From: root Date: Wed, 20 May 2009 15:07:01 +0000 (+0200) Subject: Initial import X-Git-Tag: 0.0.2~10 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=d85e89b740ada56ebadfaf2de02ca7ef685d4f0e;p=zakauthe%2Flibzakauthe Initial import --- d85e89b740ada56ebadfaf2de02ca7ef685d4f0e diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..ad1de0f --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Andrea Zagli diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8ece957 --- /dev/null +++ b/Makefile.am @@ -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 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..36cce34 --- /dev/null +++ b/autogen.sh @@ -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 index 0000000..07d06b1 --- /dev/null +++ b/configure.ac @@ -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 index 0000000..dfb1130 --- /dev/null +++ b/data/Makefile.am @@ -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 index 0000000..61cf093 --- /dev/null +++ b/data/aute_confi_schema.xml @@ -0,0 +1,10 @@ + + + aute + Gestione autenticazione + + + plugin + Il nome del plugin da utilizzare + + diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..f3ddc22 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = reference diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am new file mode 100644 index 0000000..6fbc23d --- /dev/null +++ b/docs/reference/Makefile.am @@ -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 index 0000000..bb5e299 --- /dev/null +++ b/docs/reference/libaute-docs.sgml @@ -0,0 +1,14 @@ + + + + + [Insert name here] Reference Manual + + + + [Insert title here] + + + + diff --git a/docs/reference/libaute-overrides.txt b/docs/reference/libaute-overrides.txt new file mode 100644 index 0000000..e69de29 diff --git a/docs/reference/libaute-sections.txt b/docs/reference/libaute-sections.txt new file mode 100644 index 0000000..562f52c --- /dev/null +++ b/docs/reference/libaute-sections.txt @@ -0,0 +1,14 @@ +
+libaute +aute_autentica +aute_plugin_get_module +
+ +
+aute +Aute +aute_init +aute_autentica +aute_destroy +
+ diff --git a/docs/reference/libaute-undocumented.txt b/docs/reference/libaute-undocumented.txt new file mode 100644 index 0000000..00913fe --- /dev/null +++ b/docs/reference/libaute-undocumented.txt @@ -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 index 0000000..f2eb768 --- /dev/null +++ b/docs/reference/tmpl/aute.sgml @@ -0,0 +1,55 @@ + +aute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@tipo: +@params: +@Returns: + + + + + + + +@confi: +@Returns: + + + + + + + +@aute: +@Returns: + + diff --git a/docs/reference/tmpl/libaute-unused.sgml b/docs/reference/tmpl/libaute-unused.sgml new file mode 100644 index 0000000..e69de29 diff --git a/docs/reference/tmpl/libaute.sgml b/docs/reference/tmpl/libaute.sgml new file mode 100644 index 0000000..2306fcd --- /dev/null +++ b/docs/reference/tmpl/libaute.sgml @@ -0,0 +1,39 @@ + +libaute + + + + + + + + + + + + + + + + + + + + + + + + +@confi: +@Returns: + + + + + + + +@confi: +@Returns: + + diff --git a/docs/reference/version.xml.in b/docs/reference/version.xml.in new file mode 100644 index 0000000..a24f987 --- /dev/null +++ b/docs/reference/version.xml.in @@ -0,0 +1 @@ +@PACKAGE_VERSION@ diff --git a/libaute.pc.in b/libaute.pc.in new file mode 100644 index 0000000..1d3a557 --- /dev/null +++ b/libaute.pc.in @@ -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 index 0000000..a7b7431 --- /dev/null +++ b/src/Makefile.am @@ -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 index 0000000..1fd4774 --- /dev/null +++ b/src/aute.c @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2005-2006 Andrea Zagli + * + * 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 + +#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 index 0000000..2bb25a7 --- /dev/null +++ b/src/libaute.h @@ -0,0 +1,39 @@ +/* + * Copyright 2005-2006 Andrea Zagli + * + * 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 +#include + +#include + + +G_BEGIN_DECLS + + +gchar *aute_autentica (Confi *confi); + +GModule *aute_plugin_get_module (Confi *confi); + + +G_END_DECLS + + +#endif /* __AUTE_H__ */