In the KERN_GETPROC* handler:

* Handle KERN_PROC_SESSION that has been defined in <sys/sysctl.h> from
  day one.
* Add handlers for KERN_PROC_GID and KERN_PROC_RGID.
* If "op" doesn't valid, return EINVAL.
This commit is contained in:
simonb 2000-06-13 01:27:00 +00:00
parent 3f935d014c
commit e907fee281
2 changed files with 57 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sysctl.c,v 1.70 2000/06/03 20:42:42 thorpej Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.71 2000/06/13 01:27:00 simonb Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -1220,6 +1220,11 @@ again:
continue;
break;
case KERN_PROC_SESSION:
if (p->p_session->s_sid != (pid_t)arg)
continue;
break;
case KERN_PROC_TTY:
if (arg == KERN_PROC_TTY_REVOKE) {
if ((p->p_flag & P_CONTROLT) == 0 ||
@ -1243,6 +1248,24 @@ again:
if (p->p_cred->p_ruid != (uid_t)arg)
continue;
break;
case KERN_PROC_GID:
if (p->p_ucred->cr_gid != (uid_t)arg)
continue;
break;
case KERN_PROC_RGID:
if (p->p_cred->p_rgid != (uid_t)arg)
continue;
break;
case KERN_PROC_ALL:
/* allow everything */
break;
default:
error = EINVAL;
goto cleanup;
}
if (type == KERN_PROC) {
if (buflen >= sizeof(struct kinfo_proc)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.h,v 1.49 2000/06/03 04:15:43 simonb Exp $ */
/* $NetBSD: sysctl.h,v 1.50 2000/06/13 01:27:02 simonb Exp $ */
/*
* Copyright (c) 1989, 1993
@ -232,6 +232,8 @@ struct ctlname {
#define KERN_PROC_TTY 4 /* by controlling tty */
#define KERN_PROC_UID 5 /* by effective uid */
#define KERN_PROC_RUID 6 /* by real uid */
#define KERN_PROC_GID 7 /* by effective gid */
#define KERN_PROC_RGID 8 /* by real gid */
/*
* KERN_PROC_TTY sub-subtypes