Add function to get user information by UID

Moving to a uid_t to store the user information makes a lot
of sense. When doing this, we need a function to get information
about a user from the uid_t

As well as creating the function g_getuser_info_by_uid() we also
rename g_getuser_info() to g_getuser_info_by_name() and make the
parameter ordering more usual.
This commit is contained in:
matt335672
2022-09-08 14:00:36 +01:00
parent 752b4bcaa5
commit a16e56f711
4 changed files with 73 additions and 16 deletions
+4 -2
View File
@@ -193,8 +193,10 @@ int g_exit(int exit_code);
int g_getpid(void);
int g_sigterm(int pid);
int g_sighup(int pid);
int g_getuser_info(const char *username, int *gid, int *uid, char **shell,
char **dir, char **gecos);
int g_getuser_info_by_name(const char *username, int *uid, int *gid,
char **shell, char **dir, char **gecos);
int g_getuser_info_by_uid(int uid, char **username, int *gid,
char **shell, char **dir, char **gecos);
int g_getgroup_info(const char *groupname, int *gid);
int g_check_user_in_group(const char *username, int gid, int *ok);
int g_time1(void);