summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-29 20:24:17 +0000
committerJeremy Allison <jra@samba.org>1998-09-29 20:24:17 +0000
commit9066025a8a4afe1f7f559c455d86fc023792ed17 (patch)
tree6ced773fa584a81c9a0fe957cac357c1f8a9aa2d /source3/lib/util.c
parent282eb4f3e8ea2f19c5609bc498d24a68a1ca48a5 (diff)
downloadsamba-9066025a8a4afe1f7f559c455d86fc023792ed17.tar.gz
samba-9066025a8a4afe1f7f559c455d86fc023792ed17.tar.bz2
samba-9066025a8a4afe1f7f559c455d86fc023792ed17.zip
Got very strict about the differences and uses of
uid_t, gid_t and vuid. Added sys_getgroups() to get around the int * return problem. Set correct datatypes for all uid, gid and vuid variables. Jeremy. (This used to be commit e570db46fc3a78e499523fd342e9a34cebb18998)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 8561c4f3f4..37c7a5519e 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -346,7 +346,8 @@ void close_sockets(void )
/****************************************************************************
determine whether we are in the specified group
****************************************************************************/
-BOOL in_group(gid_t group, int current_gid, int ngroups, GID_T *groups)
+
+BOOL in_group(gid_t group, gid_t current_gid, int ngroups, gid_t *groups)
{
int i;
@@ -4033,6 +4034,7 @@ struct hostent *Get_Hostbyname(char *name)
/****************************************************************************
check if a process exists. Does this work on all unixes?
****************************************************************************/
+
BOOL process_exists(int pid)
{
return(kill(pid,0) == 0 || errno != ESRCH);
@@ -4042,24 +4044,26 @@ BOOL process_exists(int pid)
/*******************************************************************
turn a uid into a user name
********************************************************************/
-char *uidtoname(int uid)
+
+char *uidtoname(uid_t uid)
{
static char name[40];
struct passwd *pass = getpwuid(uid);
if (pass) return(pass->pw_name);
- slprintf(name, sizeof(name) - 1, "%d",uid);
+ slprintf(name, sizeof(name) - 1, "%d",(int)uid);
return(name);
}
/*******************************************************************
turn a gid into a group name
********************************************************************/
-char *gidtoname(int gid)
+
+char *gidtoname(gid_t gid)
{
static char name[40];
struct group *grp = getgrgid(gid);
if (grp) return(grp->gr_name);
- slprintf(name,sizeof(name) - 1, "%d",gid);
+ slprintf(name,sizeof(name) - 1, "%d",(int)gid);
return(name);
}