]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
New function to find an user by its UID on the local database.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 3 Feb 2008 16:50:14 +0000 (16:50 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 3 Feb 2008 16:50:14 +0000 (16:50 +0000)
ChangeLog
lib/pwio.c
lib/pwio.h

index e0f4241685be24996615d4b0d3504c438cc96afa..42dcf6889037abcc9c67116dd636330547320ec0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-03  Nicolas François  <nicolas.francois@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@centraliens.net>
 
        * po/*.po: Updated PO files.
index 8dd6d61a08103c25aea05bc3dd2214cb3155e050..328ce3267d3401eb6cb46207638dd3433d5bf0a9 100644 (file)
@@ -96,6 +96,18 @@ const struct passwd *pw_locate (const char *name)
        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);
index e060ed051a8cb3aab5fbb45381f4f639166350c5..42082ebd420b0edc0a0f3fa1c12ca82ac721a5d1 100644 (file)
@@ -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);