]> saetta.ns0.it Git - zakauthe/plugins/ldap/commitdiff
Initial commit.
authorAndrea Zagli <azagli@libero.it>
Fri, 12 Feb 2010 17:28:43 +0000 (18:28 +0100)
committerAndrea Zagli <azagli@libero.it>
Fri, 12 Feb 2010 17:28:43 +0000 (18:28 +0100)
17 files changed:
.gitignore [new file with mode: 0644]
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/auteldap_confi_schema.xml [new file with mode: 0644]
data/libauteldap/Makefile.am [new file with mode: 0644]
data/libauteldap/gui/Makefile.am [new file with mode: 0644]
data/libauteldap/gui/auteldap.gui [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/aute_ldap.c [new file with mode: 0644]
tests/Makefile.am [new file with mode: 0644]
tests/test.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..92fb8b9
--- /dev/null
@@ -0,0 +1,29 @@
+COPYING
+INSTALL
+Makefile
+aclocal.m4
+autom4te.cache/
+config.guess
+config.log
+config.status
+config.sub
+configure
+depcomp
+version.xml
+gtk-doc.make
+install-sh
+libaute.pc
+libtool
+ltmain.sh
+missing
+.deps
+.libs
+*.lo
+*.o
+*.la
+*~
+*.in
+config.h
+stamp-h1
+tests/test
+tools/aute-db-mkpwd
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..c577ac6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src tests data
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..5ac0213
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
+La directory tools contiene il programma aute-db-mkpwd che serve per generare
+l'hash md5 utilizzato per la cifratura delle password
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..a2f1aba
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="libaute-ldap"
+
+(test -f $srcdir/configure.ac \
+  && test -d $srcdir/src \
+  && test -f $srcdir/src/aute_ldap.c) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level libauteldap directory"
+    exit 1
+}
+
+which gnome-autogen.sh || {
+    echo "You need to install gnome-common from GNOME and make"
+    echo "sure the gnome-autogen.sh script is in your \$PATH."
+    exit 1
+}
+
+USE_GNOME2_MACROS=1 . gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..2441086
--- /dev/null
@@ -0,0 +1,56 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+AC_INIT([libaute-ldap], [0.0.1], [azagli@libero.it])
+AC_CONFIG_SRCDIR([src/aute_ldap.c])
+AC_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE
+AM_MAINTAINER_MODE
+
+AC_CANONICAL_SYSTEM
+
+AC_LIBTOOL_WIN32_DLL
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+PKG_CHECK_MODULES(LIBAUTELDAP, [gtk+-2.0 >= 2.16.0
+                              libaute >= 0.0.2])
+
+AC_SUBST(LIBAUTELDAP_CFLAGS)
+AC_SUBST(LIBAUTELDAP_LIBS)
+
+with_ldap=no
+AC_CHECK_LIB([ldap], [ldap_initialize], with_ldap=yes)
+
+if test "$with_ldap" = "yes"
+then
+       AC_SUBST(LIBLDAP_LIBS, [" -lldap"])
+fi
+
+PKG_CHECK_MODULES(LIBCONFI, [libconfi >= 0.0.2], [AC_DEFINE(HAVE_LIBCONFI, [1], [libconfi is present]), have_libconfi=yes], have_libconfi=no)
+
+AM_CONDITIONAL(HAVE_LIBCONFI, test x"$have_libconfi" = "xyes")
+AC_SUBST(LIBCONFI_CFLAGS)
+AC_SUBST(LIBCONFI_LIBS)
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+# Checks for library functions.
+
+AC_CONFIG_FILES([
+  Makefile
+  src/Makefile
+  tests/Makefile
+  data/Makefile
+  data/libauteldap/Makefile
+  data/libauteldap/gui/Makefile
+])
+AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644 (file)
index 0000000..f4a0be3
--- /dev/null
@@ -0,0 +1,3 @@
+SUBDIRS = libauteldap
+
+EXTRA_DIST = auteldap_confi_schema.xml
diff --git a/data/auteldap_confi_schema.xml b/data/auteldap_confi_schema.xml
new file mode 100644 (file)
index 0000000..0c1b4e4
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+<gconfi-key>
+       <name>aute-ldap</name>
+       <description>Plugin di libaute di autenticazione su ldap</description>
+
+       <gconfi-key>
+               <name>ldap</name>
+               <description>Parametri per la connessione al server ldap</description>
+
+               <gconfi-key>
+                       <name>host</name>
+                       <description>Host address</description>
+               </gconfi-key>
+               <gconfi-key>
+                       <name>base_dn</name>
+                       <description>Base DN</description>
+               </gconfi-key>
+               <gconfi-key>
+                       <name>user_field</name>
+                       <description>User name field</description>
+               </gconfi-key>
+       </gconfi-key>
+</gconfi-key>
diff --git a/data/libauteldap/Makefile.am b/data/libauteldap/Makefile.am
new file mode 100644 (file)
index 0000000..13c2b3d
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = gui
diff --git a/data/libauteldap/gui/Makefile.am b/data/libauteldap/gui/Makefile.am
new file mode 100644 (file)
index 0000000..3f0a988
--- /dev/null
@@ -0,0 +1,5 @@
+guidir = $(datadir)/libauteldap/gui
+
+gui_DATA = auteldap.gui
+
+EXTRA_DIST = $(gui_DATA)
diff --git a/data/libauteldap/gui/auteldap.gui b/data/libauteldap/gui/auteldap.gui
new file mode 100644 (file)
index 0000000..382a861
--- /dev/null
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+<interface>
+  <!-- interface-requires gtk+ 2.6 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkDialog" id="diag_main">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Autenticazione</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkTable" id="table1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="n_rows">3</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">3</property>
+            <property name="row_spacing">3</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Utente</property>
+              </object>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Password</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="txt_utente">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="activates_default">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="txt_password">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="visibility">False</property>
+                <property name="activates_default">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkExpander" id="exp_cambio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="border_width">5</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">3</property>
+                    <property name="row_spacing">3</property>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Nuova</property>
+                      </object>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label5">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Conferma</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="txt_password_nuova">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="visibility">False</property>
+                        <property name="activates_default">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="txt_password_conferma">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="visibility">False</property>
+                        <property name="activates_default">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_Cambia password</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton1">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton1</action-widget>
+      <action-widget response="-5">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..8cac9e1
--- /dev/null
@@ -0,0 +1,15 @@
+guidir = $(datadir)/libauteldap/gui
+
+AM_CPPFLAGS = $(LIBAUTELDAP_CFLAGS) \
+              $(LIBLDAP_CFLAGS) \
+              $(LIBCONFI_CFLAGS) \
+              -DGUIDIR=\""$(guidir)"\"
+
+LIBS = $(LIBAUTELDAP_LIBS) \
+       $(LIBLDAP_LIBS) \
+       $(LIBCONFI_LIBS)
+
+libaute_pluginsdir = $(libdir)/libaute/plugins
+libaute_plugins_LTLIBRARIES = libaute-ldap.la
+
+libaute_ldap_la_SOURCES = aute_ldap.c
diff --git a/src/aute_ldap.c b/src/aute_ldap.c
new file mode 100644 (file)
index 0000000..748427b
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2005-2010 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+       #include "config.h"
+#endif
+  
+#include <gtk/gtk.h>
+#include <ldap.h>
+
+#ifdef HAVE_LIBCONFI
+       #include <libconfi.h>
+#endif
+
+static GtkWidget *txt_utente;
+static GtkWidget *txt_password;
+static GtkWidget *exp_cambio;
+static GtkWidget *txt_password_nuova;
+static GtkWidget *txt_password_conferma;
+
+/* PRIVATE */
+#ifdef HAVE_LIBCONFI
+static gboolean
+get_connection_parameters_from_confi (Confi *confi, gchar **host, gchar **base_dn, gchar **user_field)
+{
+       gboolean ret = TRUE;
+
+       *host = confi_path_get_value (confi, "aute/aute-ldap/ldap/host");
+       *base_dn = confi_path_get_value (confi, "aute/aute-ldap/ldap/base_dn");
+       *user_field = confi_path_get_value (confi, "aute/aute-ldap/ldap/user_field");
+
+       if (*host == NULL
+           || strcmp (g_strstrip (*host), "") == 0
+           || base_dn == NULL
+           || strcmp (g_strstrip (*base_dn), "") == 0
+           || user_field == NULL
+           || strcmp (g_strstrip (*user_field), "") == 0)
+               {
+                       *host = NULL;
+                       *base_dn = NULL;
+                       *user_field = NULL;
+
+                       ret = FALSE;
+               }
+
+       return ret;
+}
+#endif
+
+static gchar
+*controllo (GSList *parameters)
+{
+       gchar *utente = "";
+       gchar *password;
+       gchar *password_nuova;
+
+       gchar *host;
+       gchar *base_dn;
+       gchar *user_field;
+
+       LDAP *ldap;
+       int version;
+       int retldap;
+
+       utente = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txt_utente))));
+       password = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txt_password))));
+
+       host = NULL;
+       base_dn = NULL;
+       user_field = NULL;
+
+#ifdef HAVE_LIBCONFI
+       /* the first and only parameters must be a Confi object */
+       /* leggo i parametri di connessione dalla configurazione */
+       if (IS_CONFI (parameters->data))
+               {
+                       if (!get_connection_parameters_from_confi (CONFI (parameters->data), &host, &base_dn, &user_field))
+                               {
+                                       host = NULL;
+                                       base_dn = NULL;
+                                       user_field = NULL;
+                               }
+               }
+#endif
+
+       if (host == NULL)
+               {
+                       GSList *param;
+
+                       param = g_slist_next (parameters);
+                       if (param != NULL && param->data != NULL)
+                               {
+                                       host = g_strdup ((gchar *)param->data);
+                                       host = g_strstrip (host);
+                                       if (g_strcmp0 (host, "") == 0)
+                                               {
+                                                       host = NULL;
+                                               }
+                                       else
+                                               {
+                                                       param = g_slist_next (param);
+                                                       if (param != NULL && param->data != NULL)
+                                                               {
+                                                                       base_dn = g_strdup ((gchar *)param->data);
+                                                                       base_dn = g_strstrip (host);
+                                                                       if (g_strcmp0 (base_dn, "") == 0)
+                                                                               {
+                                                                                       base_dn = NULL;
+                                                                               }
+                                                                       else
+                                                                               {
+                                                                                       param = g_slist_next (param);
+                                                                                       if (param != NULL && param->data != NULL)
+                                                                                               {
+                                                                                                       user_field = g_strdup ((gchar *)param->data);
+                                                                                                       user_field = g_strstrip (user_field);
+                                                                                                       if (g_strcmp0 (user_field, "") == 0)
+                                                                                                               {
+                                                                                                                       user_field = NULL;
+                                                                                                               }
+                                                                                               }
+                                                                               }
+                                                               }
+                                               }
+                               }
+               }
+
+       if (host == NULL
+               || base_dn == NULL
+               || user_field == NULL)
+               {
+                       return NULL;
+               }
+
+       ldap = NULL;
+       version = 3;
+
+       retldap = ldap_initialize (&ldap, host);
+       if (retldap != LDAP_SUCCESS)
+               {
+                       g_warning ("Errore nell'inizializzazione.\n%s\n", ldap_err2string (retldap));
+                       return NULL;
+               }
+
+       retldap = ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &version);
+       if (retldap != LDAP_OPT_SUCCESS)
+               {
+                       g_warning ("Errore nell'impostazione della versione del protocollo.\n%s\n", ldap_err2string (retldap));
+                       return NULL;
+               }
+
+       retldap = ldap_simple_bind_s (ldap,
+               g_strdup_printf ("%s=%s,%s", user_field, utente, base_dn), password);
+       if (retldap != LDAP_SUCCESS)
+               {
+                       g_warning ("Errore nel bind.\n%s\n", ldap_err2string (retldap));
+                       return NULL;
+               }
+
+/*
+       if (strcmp (utente, "") != 0
+           && gtk_expander_get_expanded (GTK_EXPANDER (exp_cambio)))
+               {
+                       password_nuova = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txt_password_nuova))));
+                       if (strlen (password_nuova) == 0 || strcmp (g_strstrip (password_nuova), "") == 0)
+                               {
+                                       g_warning ("La nuova password รจ vuota.");
+                               }
+                       else if (strcmp (g_strstrip (password_nuova), g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txt_password_conferma))))) != 0)
+                               {
+                                       g_warning ("La nuova password e la conferma non coincidono.");
+                               }
+                       else
+                               {
+                                       sql = g_strdup_printf ("UPDATE utenti "
+                                                        "SET password = '%s' "
+                                                        "WHERE codice = '%s'",
+                                                        gdaex_strescape (cifra_password (password_nuova), NULL),
+                                                        gdaex_strescape (utente, NULL));
+                                       if (gdaex_execute (gdaex, sql) == -1)
+                                               {
+                                                       g_warning ("Errore durante la modifica della password.");
+                                                       return NULL;
+                                               }
+                               }
+               }
+*/
+
+       retldap = ldap_unbind (ldap);
+       if (retldap != LDAP_SUCCESS)
+               {
+                       g_warning ("Errore nell'unbind.\n%s\n", ldap_err2string (retldap));
+                       return NULL;
+               }
+
+       return utente;
+}
+
+/* PUBLIC */
+gchar
+*autentica (GSList *parameters)
+{
+       GError *error;
+       gchar *ret = NULL;
+
+       error = NULL;
+
+       GtkBuilder *gtkbuilder = gtk_builder_new ();
+       if (!gtk_builder_add_from_file (gtkbuilder, GUIDIR "/auteldap.gui", &error))
+               {
+                       return NULL;
+               }
+
+       GtkWidget *diag = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "diag_main"));
+
+       txt_utente = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "txt_utente"));
+       txt_password = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "txt_password"));
+       exp_cambio = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "exp_cambio"));
+       txt_password_nuova = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "txt_password_nuova"));
+       txt_password_conferma = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "txt_password_conferma"));
+
+       /* imposto di default l'utente corrente della sessione */
+       gtk_entry_set_text (GTK_ENTRY (txt_utente), g_get_user_name ());
+       gtk_editable_select_region (GTK_EDITABLE (txt_utente), 0, -1);
+
+       switch (gtk_dialog_run (GTK_DIALOG (diag)))
+               {
+                       case GTK_RESPONSE_OK:
+                               /* controllo dell'utente e della password */
+                               ret = controllo (parameters);
+                               break;
+
+                       case GTK_RESPONSE_CANCEL:
+                               ret = g_strdup ("");
+                               break;
+
+                       default:
+                               break;
+               }
+
+       gtk_widget_destroy (diag);
+       g_object_unref (gtkbuilder);
+
+       return ret;
+}
+
+/**
+ * crea_utente:
+ * @parameters:
+ * @codice:
+ * @password:
+ */
+gboolean
+crea_utente (GSList *parameters, const gchar *codice, const gchar *password)
+{
+       /* TODO */
+       return FALSE;
+}
+
+/**
+ * modifice_utente:
+ * @parameters:
+ * @codice:
+ * @password:
+ */
+gboolean
+modifica_utente (GSList *parameters, const gchar *codice, const gchar *password)
+{
+       /* TODO */
+       return FALSE;
+}
+
+/**
+ * elimina_utente:
+ * @parameters:
+ * @codice:
+ */
+gboolean
+elimina_utente (GSList *parameters, const gchar *codice)
+{
+       /* TODO */
+       return FALSE;
+}
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..10f47f9
--- /dev/null
@@ -0,0 +1,13 @@
+AM_CPPFLAGS = $(WARN_CFLAGS) \
+              $(DISABLE_DEPRECATED_CFLAGS) \
+              $(LIBAUTELDAP_CFLAGS) \
+              $(LIBLDAP_CFLAGS) \
+              -I../src
+
+LIBS = $(GTK_LIBS) \
+       $(LIBAUTELDAP_LIBS) \
+       $(LIBLDAP_LIBS)
+
+LDADD = ../src/libaute-ldap.la
+
+noinst_PROGRAMS = test
diff --git a/tests/test.c b/tests/test.c
new file mode 100644 (file)
index 0000000..46d470d
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 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 <gtk/gtk.h>
+
+#include <libaute.h>
+
+int
+main (int argc, char **argv)
+{
+       Aute *aute;
+       GSList *params;
+
+       gtk_init (&argc, &argv);
+
+       aute = aute_new ();
+
+       params = g_slist_append (params, argv[1]);
+       params = g_slist_append (params, argv[2]);
+
+       aute_set_config (aute, params);
+
+       g_fprintf (stderr, "Utente %s\n", aute_autentica (aute));
+
+       return 0;
+}