From 675069b8298c07b617676285dcd42badf61386d1 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 4 Sep 2010 09:57:38 +0200 Subject: [PATCH] Excluded system's users and groups. --- src/aute_smbldap.c | 50 +++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/aute_smbldap.c b/src/aute_smbldap.c index 0297c66..48658ea 100644 --- a/src/aute_smbldap.c +++ b/src/aute_smbldap.c @@ -335,19 +335,30 @@ autesmbldap_load_users_list () } else if (g_strcmp0 (attr, "uidNumber") == 0) { - gtk_list_store_set (lstore_users, &iter, - COL_USERS_UID, strtol (vals[0]->bv_val, NULL, 10), - -1); + if (strtol (vals[0]->bv_val, NULL, 10) < 1000) + { + /* system's user */ + /* undo the insertion */ + gtk_list_store_remove (lstore_users, &iter); + break; + } + else + { + gtk_list_store_set (lstore_users, &iter, + COL_USERS_UID, strtol (vals[0]->bv_val, NULL, 10), + -1); + } } } ldap_value_free_len (vals); } ldap_memfree (attr); } - if (ber != NULL) - { - ber_free (ber, 0); - } + if (ber != NULL) + { + ber_free (ber, 0); + } + entry = ldap_next_entry (ldap, entry); } } @@ -399,19 +410,30 @@ autesmbldap_load_groups_list () } else if (g_strcmp0 (attr, "gidNumber") == 0) { - gtk_list_store_set (lstore_groups, &iter, - COL_GROUPS_GID, strtol (vals[0]->bv_val, NULL, 10), - -1); + if (strtol (vals[0]->bv_val, NULL, 10) < 1000) + { + /* system's group */ + /* undo the insertion */ + gtk_list_store_remove (lstore_groups, &iter); + break; + } + else + { + gtk_list_store_set (lstore_groups, &iter, + COL_GROUPS_GID, strtol (vals[0]->bv_val, NULL, 10), + -1); + } } } ldap_value_free_len (vals); } ldap_memfree (attr); } - if (ber != NULL) - { - ber_free (ber, 0); - } + if (ber != NULL) + { + ber_free (ber, 0); + } + entry = ldap_next_entry (ldap, entry); } } -- 2.49.0