From b65d2646e3a54376a07534f396532e30087d09bc Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 13 Feb 2010 08:34:38 +0100 Subject: [PATCH] Bugfixes and test without libconfi. --- src/aute_ldap.c | 14 ++++++++------ tests/test.c | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/aute_ldap.c b/src/aute_ldap.c index 748427b..ae187b5 100644 --- a/src/aute_ldap.c +++ b/src/aute_ldap.c @@ -65,7 +65,8 @@ get_connection_parameters_from_confi (Confi *confi, gchar **host, gchar **base_d static gchar *controllo (GSList *parameters) { - gchar *utente = ""; + gchar *user_dn; + gchar *utente; gchar *password; gchar *password_nuova; @@ -77,6 +78,8 @@ static gchar int version; int retldap; + user_dn = ""; + 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)))); @@ -117,7 +120,7 @@ static gchar if (param != NULL && param->data != NULL) { base_dn = g_strdup ((gchar *)param->data); - base_dn = g_strstrip (host); + base_dn = g_strstrip (base_dn); if (g_strcmp0 (base_dn, "") == 0) { base_dn = NULL; @@ -146,7 +149,6 @@ static gchar { return NULL; } - ldap = NULL; version = 3; @@ -164,8 +166,8 @@ static gchar return NULL; } - retldap = ldap_simple_bind_s (ldap, - g_strdup_printf ("%s=%s,%s", user_field, utente, base_dn), password); + user_dn = g_strdup_printf ("%s=%s,%s", user_field, utente, base_dn); + retldap = ldap_simple_bind_s (ldap, user_dn, password); if (retldap != LDAP_SUCCESS) { g_warning ("Errore nel bind.\n%s\n", ldap_err2string (retldap)); @@ -208,7 +210,7 @@ static gchar return NULL; } - return utente; + return user_dn; } /* PUBLIC */ diff --git a/tests/test.c b/tests/test.c index 46d470d..c532811 100644 --- a/tests/test.c +++ b/tests/test.c @@ -32,6 +32,8 @@ main (int argc, char **argv) params = g_slist_append (params, argv[1]); params = g_slist_append (params, argv[2]); + params = g_slist_append (params, argv[3]); + params = g_slist_append (params, argv[4]); aute_set_config (aute, params); -- 2.49.0