[Pkg-shadow-commits] r1753 - in upstream/trunk: . lib

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Feb 3 16:51:08 UTC 2008


Author: nekral-guest
Date: 2008-02-03 16:51:08 +0000 (Sun, 03 Feb 2008)
New Revision: 1753

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/groupio.c
   upstream/trunk/lib/groupio.h
Log:
New function to find a group by its GID on the local database.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-02-03 16:50:14 UTC (rev 1752)
+++ upstream/trunk/ChangeLog	2008-02-03 16:51:08 UTC (rev 1753)
@@ -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 at centraliens.net>
 

Modified: upstream/trunk/lib/groupio.c
===================================================================
--- upstream/trunk/lib/groupio.c	2008-02-03 16:50:14 UTC (rev 1752)
+++ upstream/trunk/lib/groupio.c	2008-02-03 16:51:08 UTC (rev 1753)
@@ -113,6 +113,18 @@
 	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);

Modified: upstream/trunk/lib/groupio.h
===================================================================
--- upstream/trunk/lib/groupio.h	2008-02-03 16:50:14 UTC (rev 1752)
+++ upstream/trunk/lib/groupio.h	2008-02-03 16:51:08 UTC (rev 1753)
@@ -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);




More information about the Pkg-shadow-commits mailing list