Bugfixes and test without libconfi.
authorAndrea Zagli <azagli@libero.it>
Sat, 13 Feb 2010 07:34:38 +0000 (08:34 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 13 Feb 2010 07:34:38 +0000 (08:34 +0100)
src/aute_ldap.c
tests/test.c

index 748427bf135f67cdf6515eee7b8fc87dbad347c4..ae187b559caca86d73644632bbe6e9890842198d 100644 (file)
@@ -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 */
index 46d470d23bb7475e2bc5554106bca4a86847c327..c5328119bc328711cec4794d6a25e4fb2c8a3b61 100644 (file)
@@ -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);