svn commit: r194267 - in head: lib/libc/sys usr.bin usr.bin/revoke
Ed Schouten
ed at FreeBSD.org
Mon Jun 15 21:52:28 UTC 2009
Author: ed
Date: Mon Jun 15 21:52:27 2009
New Revision: 194267
URL: http://svn.freebsd.org/changeset/base/194267
Log:
Add revoke(1).
While hacking on TTY code, I often miss a small utility to revoke my own
(pseudo-)terminals. This small utility is just a small wrapper around
the revoke(2) call, so you can destroy your very own login sessions.
Approved by: re
Added:
head/usr.bin/revoke/
head/usr.bin/revoke/Makefile (contents, props changed)
head/usr.bin/revoke/revoke.1 (contents, props changed)
head/usr.bin/revoke/revoke.c (contents, props changed)
Modified:
head/lib/libc/sys/revoke.2
head/usr.bin/Makefile
Modified: head/lib/libc/sys/revoke.2
==============================================================================
--- head/lib/libc/sys/revoke.2 Mon Jun 15 21:05:00 2009 (r194266)
+++ head/lib/libc/sys/revoke.2 Mon Jun 15 21:52:27 2009 (r194267)
@@ -97,7 +97,8 @@ operation on the named file.
The caller is neither the owner of the file nor the super user.
.El
.Sh SEE ALSO
-.Xr close 2
+.Xr close 2 ,
+.Xr revoke 1
.Sh HISTORY
The
.Fn revoke
Modified: head/usr.bin/Makefile
==============================================================================
--- head/usr.bin/Makefile Mon Jun 15 21:05:00 2009 (r194266)
+++ head/usr.bin/Makefile Mon Jun 15 21:52:27 2009 (r194267)
@@ -157,6 +157,7 @@ SUBDIR= alias \
${_quota} \
renice \
rev \
+ revoke \
${_rlogin} \
${_rpcgen} \
rpcinfo \
Added: head/usr.bin/revoke/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/revoke/Makefile Mon Jun 15 21:52:27 2009 (r194267)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= revoke
+
+WARNS?= 6
+
+.include <bsd.prog.mk>
Added: head/usr.bin/revoke/revoke.1
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/revoke/revoke.1 Mon Jun 15 21:52:27 2009 (r194267)
@@ -0,0 +1,56 @@
+.\" Copyright (c) 2009 Ed Schouten <ed at FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 15, 2009
+.Dt REVOKE 1
+.Os
+.Sh NAME
+.Nm revoke
+.Nd "revoke a character device"
+.Sh SYNOPSIS
+.Nm
+.Ar
+.Sh DESCRIPTION
+The
+.Nm
+program revokes the character devices using
+.Xr revoke 2 .
+When used on a TTY, calls like
+.Xr read 2 ,
+.Xr write 2
+and
+.Xr ioctl 2 ,
+will be aborted immediately, effectively causing login sessions to be
+terminated.
+.Sh SEE ALSO
+.Xr revoke 2
+.Sh HISTORY
+The
+.Nm
+program first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Ed Schouten Aq ed at FreeBSD.org
Added: head/usr.bin/revoke/revoke.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/revoke/revoke.c Mon Jun 15 21:52:27 2009 (r194267)
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2009 Ed Schouten <ed at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static void
+usage(void)
+{
+
+ fprintf(stderr, "usage: revoke file ...\n");
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char **d;
+ int error = 0;
+
+ if (argc == 1)
+ usage();
+
+ for (d = &argv[1]; *d != NULL; d++) {
+ if (revoke(*d) != 0) {
+ perror(*d);
+ error = 1;
+ }
+ }
+
+ return (error);
+}
More information about the svn-src-all
mailing list