]> granicus.if.org Git - shadow/commitdiff
New function to find a group by its GID on the local database.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 3 Feb 2008 16:51:08 +0000 (16:51 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 3 Feb 2008 16:51:08 +0000 (16:51 +0000)
ChangeLog
lib/groupio.c
lib/groupio.h

index 42dcf6889037abcc9c67116dd636330547320ec0..f4593305de84f1de277826da371a3bab2e244b3d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
        * lib/pwio.c, lib/pwio.h: New function to find an user by
        its UID on the local database.
+       * lib/groupio.c, lib/groupio.h: New function to find a group by
+       its GID on the local database.
 
 2008-02-02  Nicolas François  <nicolas.francois@centraliens.net>
 
index 9d9b3d30095834f4364506926d5b5700b104d52d..9839819e0f1b2d1ee4d3ae99c947a8f61f513f55 100644 (file)
@@ -113,6 +113,18 @@ const struct group *gr_locate (const char *name)
        return commonio_locate (&group_db, name);
 }
 
+const struct group *gr_locate_gid (gid_t gid)
+{
+       const struct group *grp;
+
+       gr_rewind ();
+       while (   ((grp = gr_next ()) != NULL)
+              && (grp->gr_gid != gid)) {
+       }
+
+       return grp;
+}
+
 int gr_update (const struct group *gr)
 {
        return commonio_update (&group_db, (const void *) gr);
index e2b5d04e177c7fed93c78fc92fc6f69a129895b4..2d587a588325378c28759c7bf2dbb541583bed58 100644 (file)
@@ -1,5 +1,7 @@
+#include <grp.h>
 extern int gr_close (void);
 extern const struct group *gr_locate (const char *);
+extern const struct group *gr_locate_gid (gid_t gid);
 extern int gr_lock (void);
 extern int gr_name (const char *);
 extern const struct group *gr_next (void);