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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Feb 3 16:50:14 UTC 2008


Author: nekral-guest
Date: 2008-02-03 16:50:14 +0000 (Sun, 03 Feb 2008)
New Revision: 1752

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/pwio.c
   upstream/trunk/lib/pwio.h
Log:
New function to find an user by its UID on the local database.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-02-03 16:28:03 UTC (rev 1751)
+++ upstream/trunk/ChangeLog	2008-02-03 16:50:14 UTC (rev 1752)
@@ -1,3 +1,8 @@
+2008-02-03  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* lib/pwio.c, lib/pwio.h: New function to find an user by
+	its UID on the local database.
+
 2008-02-02  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* po/*.po: Updated PO files.

Modified: upstream/trunk/lib/pwio.c
===================================================================
--- upstream/trunk/lib/pwio.c	2008-02-03 16:28:03 UTC (rev 1751)
+++ upstream/trunk/lib/pwio.c	2008-02-03 16:50:14 UTC (rev 1752)
@@ -96,6 +96,18 @@
 	return commonio_locate (&passwd_db, name);
 }
 
+const struct passwd *pw_locate_uid (uid_t uid)
+{
+	const struct passwd *pwd;
+
+	pw_rewind ();
+	while (   ((pwd = pw_next ()) != NULL)
+	       && (pwd->pw_uid != uid)) {
+	}
+
+	return pwd;
+}
+
 int pw_update (const struct passwd *pw)
 {
 	return commonio_update (&passwd_db, (const void *) pw);

Modified: upstream/trunk/lib/pwio.h
===================================================================
--- upstream/trunk/lib/pwio.h	2008-02-03 16:28:03 UTC (rev 1751)
+++ upstream/trunk/lib/pwio.h	2008-02-03 16:50:14 UTC (rev 1752)
@@ -1,5 +1,7 @@
+#include <pwd.h>
 extern int pw_close (void);
 extern const struct passwd *pw_locate (const char *);
+extern const struct passwd *pw_locate_uid (uid_t uid);
 extern int pw_lock (void);
 extern int pw_name (const char *);
 extern const struct passwd *pw_next (void);




More information about the Pkg-shadow-commits mailing list