From b1410a9d62a6e2ef1017fca3ef6b401922c40359 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 6 Sep 2015 11:00:39 +0200 Subject: [PATCH] Changed names consequently to libzakauth. --- .gitignore | 5 ++- autogen.sh | 2 +- configure.ac | 10 ++--- data/Makefile.am | 2 +- data/{libaute-db => libzakauthdb}/Makefile.am | 0 .../form/Makefile.am | 0 .../form/user.form | 0 .../gui/Makefile.am | 0 .../gui/autedb.gui | 0 src/Makefile.am | 12 +++--- src/aute_db.c | 40 +++++++++++-------- src/aute_db.h | 12 +++--- src/user.c | 4 +- tests/Makefile.am | 2 +- tests/test.c | 12 +++--- tools/Makefile.am | 4 +- tools/{aute_db_mkpwd.c => zakauthdb_mkpwd.c} | 3 +- 17 files changed, 58 insertions(+), 50 deletions(-) rename data/{libaute-db => libzakauthdb}/Makefile.am (100%) rename data/{libaute-db => libzakauthdb}/form/Makefile.am (100%) rename data/{libaute-db => libzakauthdb}/form/user.form (100%) rename data/{libaute-db => libzakauthdb}/gui/Makefile.am (100%) rename data/{libaute-db => libzakauthdb}/gui/autedb.gui (100%) rename tools/{aute_db_mkpwd.c => zakauthdb_mkpwd.c} (97%) diff --git a/.gitignore b/.gitignore index a41bfdd..00390e9 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ missing config.h stamp-h1 tests/test -tools/aute-db-mkpwd +tools/zakauthdb-mkpwd *.tar.gz -*.exe \ No newline at end of file +*.exe +compile \ No newline at end of file diff --git a/autogen.sh b/autogen.sh index 2b9d0ee..c92d9c6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,7 +4,7 @@ srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -PKG_NAME="libaute-db" +PKG_NAME="libzakauthdb" (test -f $srcdir/configure.ac \ && test -d $srcdir/src \ diff --git a/configure.ac b/configure.ac index 8a994bc..1391083 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([libaute-db], [0.5.0], [azagli@libero.it]) +AC_INIT([libzakauthdb], [0.5.0], [azagli@libero.it]) AC_CONFIG_SRCDIR([src/aute_db.c]) AC_CONFIG_HEADER([config.h]) @@ -21,7 +21,7 @@ AC_PROG_CC AC_PROG_LIBTOOL # Checks for libraries. -PKG_CHECK_MODULES(LIBAUTEDB, [libaute >= 0.2.0 +PKG_CHECK_MODULES(LIBAUTEDB, [libzakauth >= 0.5.0 libgtkform >= 0.5.0]) AC_SUBST(LIBAUTEDB_CFLAGS) @@ -56,8 +56,8 @@ AC_CONFIG_FILES([ tests/Makefile tools/Makefile data/Makefile - data/libaute-db/Makefile - data/libaute-db/form/Makefile - data/libaute-db/gui/Makefile + data/libzakauthdb/Makefile + data/libzakauthdb/form/Makefile + data/libzakauthdb/gui/Makefile ]) AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am index cffdde5..fd72b0a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = libaute-db +SUBDIRS = libzakauthdb EXTRA_DIST = autedb_confi_schema.xml \ autedb.sql diff --git a/data/libaute-db/Makefile.am b/data/libzakauthdb/Makefile.am similarity index 100% rename from data/libaute-db/Makefile.am rename to data/libzakauthdb/Makefile.am diff --git a/data/libaute-db/form/Makefile.am b/data/libzakauthdb/form/Makefile.am similarity index 100% rename from data/libaute-db/form/Makefile.am rename to data/libzakauthdb/form/Makefile.am diff --git a/data/libaute-db/form/user.form b/data/libzakauthdb/form/user.form similarity index 100% rename from data/libaute-db/form/user.form rename to data/libzakauthdb/form/user.form diff --git a/data/libaute-db/gui/Makefile.am b/data/libzakauthdb/gui/Makefile.am similarity index 100% rename from data/libaute-db/gui/Makefile.am rename to data/libzakauthdb/gui/Makefile.am diff --git a/data/libaute-db/gui/autedb.gui b/data/libzakauthdb/gui/autedb.gui similarity index 100% rename from data/libaute-db/gui/autedb.gui rename to data/libzakauthdb/gui/autedb.gui diff --git a/src/Makefile.am b/src/Makefile.am index 3d6dd25..909b4ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ -guidir = $(datadir)/libaute-db/gui -formdir = $(datadir)/libaute-db/form +guidir = $(datadir)/libzakauthdb/gui +formdir = $(datadir)/libzakauthdb/form AM_CPPFLAGS = $(LIBAUTEDB_CFLAGS) \ $(LIBGCRYPT_CFLAGS) \ @@ -13,12 +13,12 @@ LIBS = $(LIBAUTEDB_LIBS) \ $(GPG_ERROR_LIBS) \ $(LIBCONFI_LIBS) -libaute_pluginsdir = $(libdir)/libaute/plugins -libaute_plugins_LTLIBRARIES = libaute-db.la +libzakauth_pluginsdir = $(libdir)/libzakauth/plugins +libzakauth_plugins_LTLIBRARIES = libzakauthdb.la -libaute_db_la_SOURCES = aute_db.c \ +libzakauthdb_la_SOURCES = aute_db.c \ aute_db.h \ user.c \ user.h -libaute_db_la_LDFLAGS = -no-undefined +libzakauthdb_la_LDFLAGS = -no-undefined diff --git a/src/aute_db.c b/src/aute_db.c index aaf284c..138755e 100644 --- a/src/aute_db.c +++ b/src/aute_db.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Andrea Zagli + * Copyright (C) 2005-2015 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 @@ -19,7 +19,8 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + +#include #include #include #include @@ -34,6 +35,7 @@ static GtkBuilder *gtkbuilder; static GdaEx *gdaex; +static gchar *guidir; static gchar *guifile; static gchar *formdir; @@ -64,7 +66,7 @@ get_connection_parameters_from_confi (Confi *confi, gchar **cnc_string) { gboolean ret = TRUE; - *cnc_string = confi_path_get_value (confi, "aute/aute-db/db/cnc_string"); + *cnc_string = confi_path_get_value (confi, "libzakauth/libzakauthdb/db/cnc_string"); if (*cnc_string == NULL || strcmp (g_strstrip (*cnc_string), "") == 0) @@ -147,13 +149,13 @@ static GtkWindow } /** - * autedb_cifra_password: + * zak_auth_db_encrypt_password: * @password: una stringa da cifrare. * - * Return: la @password cifrata. + * Returns: the @password encrypted. */ gchar -*autedb_cifra_password (const gchar *password) +*zak_auth_db_encrypt_password (const gchar *password) { gchar digest[17] = ""; gchar pwd_gcrypt[33] = ""; @@ -190,11 +192,16 @@ static gchar " AND password = '%s'" " AND status <> 'E'", gdaex_strescape (utente, NULL), - gdaex_strescape (autedb_cifra_password (password), NULL)); + gdaex_strescape (zak_auth_db_encrypt_password (password), NULL)); dm = gdaex_query (gdaex, sql); + g_free (sql); if (dm == NULL || gda_data_model_get_n_rows (dm) <= 0) { - g_warning ("Utente o password non validi."); + if (dm != NULL) + { + g_object_unref (dm); + } + g_warning ("User name or password aren't valids."); return NULL; } @@ -212,7 +219,7 @@ static gchar else if (strcmp (g_strstrip (password_nuova), g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (txt_password_conferma))))) != 0) { /* TO DO */ - g_warning ("La nuova password e la conferma non coincidono."); + g_warning ("The new and confirm password don't match."); } else { @@ -220,7 +227,7 @@ static gchar sql = g_strdup_printf ("UPDATE users" " SET password = '%s'" " WHERE code = '%s'", - gdaex_strescape (autedb_cifra_password (password_nuova), NULL), + gdaex_strescape (zak_auth_db_encrypt_password (password_nuova), NULL), gdaex_strescape (utente, NULL)); if (gdaex_execute (gdaex, sql) == -1) { @@ -322,14 +329,14 @@ autedb_on_btn_new_clicked (GtkButton *button, gtk_window_set_transient_for (GTK_WINDOW (w), autedb_get_gtkwidget_parent_gtkwindow (w_users)); gtk_widget_show (w); } - + static void autedb_on_btn_edit_clicked (GtkButton *button, gpointer user_data) { autedb_edit_user (); } - + static void autedb_on_btn_delete_clicked (GtkButton *button, gpointer user_data) @@ -387,10 +394,10 @@ autedb_on_btn_find_clicked (GtkButton *button, gpointer user_data) { } - + /* PUBLIC */ gchar -*autentica (GSList *parameters) +*zak_auth_auth (GSList *parameters) { GError *error; gchar *ret = NULL; @@ -409,7 +416,6 @@ gchar gtkbuilder = gtk_builder_new (); #ifdef G_OS_WIN32 - gchar *guidir; gchar *moddir; gchar *p; @@ -490,7 +496,7 @@ gchar * */ GtkWidget -*get_management_gui (GSList *parameters) +*zak_auth_plg_get_management_gui (GSList *parameters) { GError *error; @@ -503,7 +509,7 @@ GtkWidget gchar *GUIDIR; - GUIDIR = g_build_filename (g_win32_get_package_installation_directory_of_module (NULL), "share", "libaute-db", "gu", NULL); + GUIDIR = g_build_filename (g_win32_get_package_installation_directory_of_module (NULL), "share", "libzakauthdb", "gui", NULL); #endif if (!gtk_builder_add_objects_from_file (gtkbuilder, g_build_filename (GUIDIR, "autedb.gui", NULL), diff --git a/src/aute_db.h b/src/aute_db.h index 6678484..d8be47b 100644 --- a/src/aute_db.h +++ b/src/aute_db.h @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010 Andrea Zagli +/* + * Copyright (C) 2010-2015 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,15 +17,15 @@ * */ -#ifndef __AUTEDB_H__ -#define __AUTEDB_H__ +#ifndef __ZAKAUTHDB_H__ +#define __ZAKAUTHDB_H__ G_BEGIN_DECLS -gchar *autedb_cifra_password (const gchar *password); +gchar *zak_auth_db_encrypt_password (const gchar *password); G_END_DECLS -#endif /* __AUTEDB_H__ */ +#endif /* __ZAKAUTHDB_H__ */ diff --git a/src/user.c b/src/user.c index 251c9d3..e1b96e9 100644 --- a/src/user.c +++ b/src/user.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2010 Andrea Zagli * * This library is free software; you can redistribute it and/or @@ -230,7 +230,7 @@ user_salva (User *user) if (priv->code == NULL || g_strcmp0 (priv->code, "") == 0) { gtk_label_set_text (GTK_LABEL (priv->objects[LBL_PASSWORD]), - autedb_cifra_password (gtk_entry_get_text (GTK_ENTRY (priv->objects[TXT_CODE])))); + zak_auth_db_encrypt_password (gtk_entry_get_text (GTK_ENTRY (priv->objects[TXT_CODE])))); sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT); } else diff --git a/tests/Makefile.am b/tests/Makefile.am index f22be27..87249fb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,6 +6,6 @@ AM_CPPFLAGS = $(WARN_CFLAGS) \ LIBS = $(GTK_LIBS) \ $(LIBAUTEDB_LIBS) -LDADD = ../src/libaute-db.la +LDADD = ../src/libzakauthdb.la noinst_PROGRAMS = test diff --git a/tests/test.c b/tests/test.c index bcae4fb..1c48027 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 Andrea Zagli + * Copyright (C) 2010-2015 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 @@ -18,26 +18,26 @@ #include -#include +#include int main (int argc, char **argv) { - Aute *aute; + ZakAuth *aute; GSList *params; gtk_init (&argc, &argv); - aute = aute_new (); + aute = zak_auth_new (); /* the libaute module to use */ params = g_slist_append (params, argv[1]); /* the libgda connection string */ params = g_slist_append (params, argv[2]); - aute_set_config (aute, params); + zak_auth_set_config (aute, params); - g_message ("User %s\n", aute_autentica (aute)); + g_message ("User %s\n", zak_auth_auth (aute)); return 0; } diff --git a/tools/Makefile.am b/tools/Makefile.am index ea3d520..e6ec6fc 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -6,6 +6,6 @@ AM_CPPFLAGS = $(WARN_CFLAGS) \ LIBS = $(LIBAUTEDB_LIBS) \ $(LIBGCRYPT_LIBS) -noinst_PROGRAMS = aute-db-mkpwd +noinst_PROGRAMS = zakauthdb-mkpwd -aute_db_mkpwd_SOURCES = aute_db_mkpwd.c +zakauthdb_mkpwd_SOURCES = zakauthdb_mkpwd.c diff --git a/tools/aute_db_mkpwd.c b/tools/zakauthdb_mkpwd.c similarity index 97% rename from tools/aute_db_mkpwd.c rename to tools/zakauthdb_mkpwd.c index ddedbcc..74f19e2 100644 --- a/tools/aute_db_mkpwd.c +++ b/tools/zakauthdb_mkpwd.c @@ -17,6 +17,7 @@ */ #include +#include #include /** @@ -49,7 +50,7 @@ int main (int argc, char **argv) { gchar *pwd = NULL; - GOptionEntry entries[] = + GOptionEntry entries[] = { { "password", 'p', 0, G_OPTION_ARG_STRING, &pwd, "La stringa da cifrare", NULL }, { NULL } -- 2.49.0