summaryrefslogtreecommitdiff
path: root/groupaccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'groupaccess.c')
-rw-r--r--groupaccess.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/groupaccess.c b/groupaccess.c
index f50879f83..e73f62b22 100644
--- a/groupaccess.c
+++ b/groupaccess.c
@@ -1,3 +1,4 @@
1/* $OpenBSD: groupaccess.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */
1/* 2/*
2 * Copyright (c) 2001 Kevin Steves. All rights reserved. 3 * Copyright (c) 2001 Kevin Steves. All rights reserved.
3 * 4 *
@@ -23,10 +24,16 @@
23 */ 24 */
24 25
25#include "includes.h" 26#include "includes.h"
26RCSID("$OpenBSD: groupaccess.c,v 1.6 2003/04/08 20:21:28 itojun Exp $");
27 27
28#include "groupaccess.h" 28#include <sys/types.h>
29#include <sys/param.h>
30
31#include <grp.h>
32#include <unistd.h>
33#include <stdarg.h>
34
29#include "xmalloc.h" 35#include "xmalloc.h"
36#include "groupaccess.h"
30#include "match.h" 37#include "match.h"
31#include "log.h" 38#include "log.h"
32 39
@@ -52,8 +59,8 @@ ga_init(const char *user, gid_t base)
52 ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX)); 59 ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
53#endif 60#endif
54 61
55 groups_bygid = xmalloc(ngroups * sizeof(*groups_bygid)); 62 groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
56 groups_byname = xmalloc(ngroups * sizeof(*groups_byname)); 63 groups_byname = xcalloc(ngroups, sizeof(*groups_byname));
57 64
58 if (getgrouplist(user, base, groups_bygid, &ngroups) == -1) 65 if (getgrouplist(user, base, groups_bygid, &ngroups) == -1)
59 logit("getgrouplist: groups list too small"); 66 logit("getgrouplist: groups list too small");