config.h
stamp-h1
tests/test
+tests/test_confi
tests/test_nogui
tools/zakauthedb-mkpwd
*.tar.gz
AC_PROG_LIBTOOL
# Checks for libraries.
-PKG_CHECK_MODULES(LIBAUTEDB, [libzakauthe >= 0.5.0
- libgtkform >= 0.5.0])
+PKG_CHECK_MODULES(LIBZAKAUTHEDB, [libzakauthe >= 0.5.0
+ libgtkform >= 0.5.0])
-AC_SUBST(LIBAUTEDB_CFLAGS)
-AC_SUBST(LIBAUTEDB_LIBS)
+AC_SUBST(LIBZAKAUTHEDB_CFLAGS)
+AC_SUBST(LIBZAKAUTHEDB_LIBS)
-PKG_CHECK_MODULES(LIBCONFI, [libconfi >= 0.0.2], [AC_DEFINE(HAVE_LIBCONFI, [1], [libconfi is present]), have_libconfi=yes], have_libconfi=no)
+PKG_CHECK_MODULES(LIBZAKCONFI, [libzakconfi >= 0.0.2], [AC_DEFINE(HAVE_LIBZAKCONFI, [1], [libzakconfi is present]), have_libzakconfi=yes], have_libzakconfi=no)
-AM_CONDITIONAL(HAVE_LIBCONFI, test x"$have_libconfi" = "xyes")
-AC_SUBST(LIBCONFI_CFLAGS)
-AC_SUBST(LIBCONFI_LIBS)
+AM_CONDITIONAL(HAVE_LIBZAKCONFI, test x"$have_libzakconfi" = "xyes")
+AC_SUBST(LIBZAKCONFI_CFLAGS)
+AC_SUBST(LIBZAKCONFI_LIBS)
AM_PATH_LIBGCRYPT(1.2.1, :, [AC_MSG_ERROR([libgcrypt >= 1.2.1 not found.])])
guidir = $(datadir)/libzakauthedb/gui
formdir = $(datadir)/libzakauthedb/form
-AM_CPPFLAGS = $(LIBAUTEDB_CFLAGS) \
+AM_CPPFLAGS = $(LIBZAKAUTHEDB_CFLAGS) \
$(LIBGCRYPT_CFLAGS) \
$(GPG_ERROR_CFLAGS) \
- $(LIBCONFI_CFLAGS) \
+ $(LIBZAKCONFI_CFLAGS) \
-DGUIDIR=\""$(guidir)"\" \
-DFORMDIR=\""$(formdir)"\"
-LIBS = $(LIBAUTEDB_LIBS) \
+LIBS = $(LIBZAKAUTHEDB_LIBS) \
$(LIBGCRYPT_LIBS) \
$(GPG_ERROR_LIBS) \
- $(LIBCONFI_LIBS)
+ $(LIBZAKCONFI_LIBS)
libzakauthe_pluginsdir = $(libdir)/libzakauthe/plugins
libzakauthe_plugins_LTLIBRARIES = libzakauthedb.la
#include <libgdaex/libgdaex.h>
#include <libgtkform/fielddatetime.h>
-#ifdef HAVE_LIBCONFI
- #include <libconfi.h>
+#ifdef HAVE_LIBZAKCONFI
+ #include <libzakconfi/libzakconfi.h>
#endif
#include "user.h"
}
#endif
-#ifdef HAVE_LIBCONFI
+#ifdef HAVE_LIBZAKCONFI
static gboolean
-get_connection_parameters_from_confi (Confi *confi, gchar **cnc_string)
+get_connection_parameters_from_confi (ZakConfi *confi, gchar **cnc_string)
{
gboolean ret = TRUE;
- *cnc_string = confi_path_get_value (confi, "libzakauthe/libzakauthedb/db/cnc_string");
+ *cnc_string = zak_confi_path_get_value (confi, "libzakauthe/libzakauthedb/db/cnc_string");
if (*cnc_string == NULL
|| strcmp (g_strstrip (*cnc_string), "") == 0)
cnc_string = 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))
+#ifdef HAVE_LIBZAKCONFI
+ /* the first and only parameters must be a ZakConfi object */
+ if (g_strcmp0 ((gchar *)parameters->data, "{libzakconfi}") == 0)
{
- if (!get_connection_parameters_from_confi (CONFI (parameters->data), &cnc_string))
+ if (ZAK_IS_CONFI ((ZakConfi *)g_slist_nth_data (parameters, 1)))
{
- cnc_string = NULL;
+ if (!get_connection_parameters_from_confi (ZAK_CONFI ((ZakConfi *)g_slist_nth_data (parameters, 1)), &cnc_string))
+ {
+ cnc_string = NULL;
+ }
}
}
#endif
AM_CPPFLAGS = $(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS) \
- $(LIBAUTEDB_CFLAGS) \
+ $(LIBZAKAUTHEDB_CFLAGS) \
+ $(LIBZAKCONFI_CFLAGS) \
-I../src
LIBS = $(GTK_LIBS) \
- $(LIBAUTEDB_LIBS)
+ $(LIBZAKAUTHEDB_LIBS) \
+ $(LIBZAKCONFI_LIBS)
LDADD = ../src/libzakauthedb.la
noinst_PROGRAMS = test \
+ test_confi \
test_nogui
+
+EXTRA_DIST = test_confi.conf
--- /dev/null
+/*
+ * Copyright (C) 2016 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 <libzakconfi/libzakconfi.h>
+
+#include <libzakauthe.h>
+
+int
+main (int argc, char **argv)
+{
+ ZakAuthe *aute;
+ ZakConfi *confi;
+ GSList *params;
+
+ gtk_init (&argc, &argv);
+
+ aute = zak_authe_new ();
+
+ params = NULL;
+
+ confi = zak_confi_new (argv[1]);
+
+ params = g_slist_append (params, "{libzakconfi}");
+ params = g_slist_append (params, confi);
+
+ zak_authe_set_config (aute, params);
+
+ g_message ("User %s\n", zak_authe_authe (aute));
+
+ return 0;
+}
--- /dev/null
+[libzakauthe]
+plugin=/usr/local/lib/libzakauthe/plugins/libzakauthedb.so
+
+[libzakauthe/libzakauthedb/db]
+cnc_string=PostgreSql://postgres:postgres@HOST=localhost;DB_NAME=autedb
\ No newline at end of file