diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-09 04:18:57 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-06-09 04:18:57 +0000 |
commit | 8f3c38da64d7a898ce55b085f7251504d7a1f5c9 (patch) | |
tree | ae8074a81ebcf037a1ab417e6e5f9f7086ec1d61 /bin/systrace/policy.c | |
parent | b6af46dd6ae1cf59ece35cc07c88ffa639fe038d (diff) |
allow numeric group ID (group ID appear in /etc/passwd, but not in /etc/group)
niels ok
Diffstat (limited to 'bin/systrace/policy.c')
-rw-r--r-- | bin/systrace/policy.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c index c2b50df0b02..89e55352847 100644 --- a/bin/systrace/policy.c +++ b/bin/systrace/policy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: policy.c,v 1.7 2002/06/05 21:09:02 provos Exp $ */ +/* $OpenBSD: policy.c,v 1.8 2002/06/09 04:18:56 itojun Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -120,6 +120,7 @@ int systrace_initpolicy(char *file) { gid_t groups[NGROUPS_MAX]; + char gidbuf[10]; int i; SPLAY_INIT(&policyroot); @@ -132,10 +133,15 @@ systrace_initpolicy(char *file) for (i = 0; i < ngroups; i++) { struct group *gr; - if ((gr = getgrgid(groups[i])) == NULL) - err(1, "getgrgid(%d)", groups[i]); - if ((groupnames[i] = strdup(gr->gr_name)) == NULL) - err(1, "strdup(%s)", gr->gr_name); + if ((gr = getgrgid(groups[i])) != NULL) { + if ((groupnames[i] = strdup(gr->gr_name)) == NULL) + err(1, "strdup(%s)", gr->gr_name); + } else { + snprintf(gidbuf, sizeof(gidbuf), "%lu", + (u_long)groups[i]); + if ((groupnames[i] = strdup(gidbuf)) == NULL) + err(1, "strdup(%s)", gidbuf); + } } if (userpolicy) |