]> saetta.ns0.it Git - zakauthe/plugins/smbldap/commitdiff
Excluded system's users and groups.
authorAndrea Zagli <azagli@libero.it>
Sat, 4 Sep 2010 07:57:38 +0000 (09:57 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 4 Sep 2010 07:57:38 +0000 (09:57 +0200)
src/aute_smbldap.c

index 0297c66ef949c4ffb53dfd284da4786a0ab50f0c..48658ea0f318c9056eddd38dd05fbd64af5410d1 100644 (file)
@@ -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);  
                }
 }