projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
missing #includes
[unix-history]
/
usr
/
src
/
sbin
/
mount_portal
/
pt_file.c
diff --git
a/usr/src/sbin/mount_portal/pt_file.c
b/usr/src/sbin/mount_portal/pt_file.c
index
4eaec98
..
c6d5e11
100644
(file)
--- a/
usr/src/sbin/mount_portal/pt_file.c
+++ b/
usr/src/sbin/mount_portal/pt_file.c
@@
-1,6
+1,6
@@
/*
/*
- * Copyright (c) 1992
The Regents of the University of California
- *
Copyright (c) 1990, 1992 Jan-Simon Pendry
+ * Copyright (c) 1992
, 1993
+ *
The Regents of the University of California. All rights reserved.
* All rights reserved.
*
* This code is derived from software donated to Berkeley by
* All rights reserved.
*
* This code is derived from software donated to Berkeley by
@@
-8,7
+8,7
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)pt_file.c
1.1
(Berkeley) %G%
+ * @(#)pt_file.c
8.2
(Berkeley) %G%
*
* $Id: pt_file.c,v 1.1 1992/05/25 21:43:09 jsp Exp jsp $
*/
*
* $Id: pt_file.c,v 1.1 1992/05/25 21:43:09 jsp Exp jsp $
*/
@@
-16,6
+16,7
@@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
@@
-32,25
+33,25
@@
int so;
int *fdp;
{
int fd;
int *fdp;
{
int fd;
- int gid;
char pbuf[MAXPATHLEN];
int error;
char pbuf[MAXPATHLEN];
int error;
+ int gidset[NGROUPS];
+ int i;
pbuf[0] = '/';
strcpy(pbuf+1, key + (v[1] ? strlen(v[1]) : 0));
#ifdef DEBUG
pbuf[0] = '/';
strcpy(pbuf+1, key + (v[1] ? strlen(v[1]) : 0));
#ifdef DEBUG
- printf("path = %s, uid = %d, gid = %d\n", pbuf, pcr->pcr_uid, pcr->pcr_g
id
);
+ printf("path = %s, uid = %d, gid = %d\n", pbuf, pcr->pcr_uid, pcr->pcr_g
roups[0]
);
#endif
#endif
-
if (setregid(0, pcr->pcr_gid) < 0
)
-
return (errno)
;
+
for (i = 0; i < pcr->pcr_ngroups; i++
)
+
gidset[i] = pcr->pcr_groups[i]
;
- gid = pcr->pcr_gid;
- if (setgroups(1, &gid) < 0)
+ if (setgroups(pcr->pcr_ngroups, gidset) < 0)
return (errno);
return (errno);
- if (set
reuid(0,
pcr->pcr_uid) < 0)
+ if (set
euid(
pcr->pcr_uid) < 0)
return (errno);
fd = open(pbuf, O_RDWR|O_CREAT, 0666);
return (errno);
fd = open(pbuf, O_RDWR|O_CREAT, 0666);
@@
-59,7
+60,7
@@
int *fdp;
else
error = 0;
else
error = 0;
- if (set
reuid(0, 0) < 0 || setregid(0, 0) < 0) {
+ if (set
euid((uid_t) 0) < 0) { /* XXX - should reset gidset too */
error = errno;
syslog(LOG_ERR, "setcred: %s", strerror(error));
if (fd >= 0) {
error = errno;
syslog(LOG_ERR, "setcred: %s", strerror(error));
if (fd >= 0) {