1290000Sglebius/*
2281348Scy * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3281348Scy * unrestricted use provided that this legend is included on all tape
4290000Sglebius * media and as a part of the software program in whole or part.  Users
5290000Sglebius * may copy or modify Sun RPC without charge, but are not authorized
6281348Scy * to license or distribute it to anyone else except as part of a product or
7281348Scy * program developed by the user or with the express written consent of
8281348Scy * Sun Microsystems, Inc.
9281348Scy *
10281348Scy * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11281348Scy * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12281348Scy * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13281348Scy *
14281348Scy * Sun RPC is provided with no support and without any obligation on the
15281348Scy * part of Sun Microsystems, Inc. to assist in its use, correction,
16281348Scy * modification or enhancement.
17281348Scy *
18281348Scy * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19290000Sglebius * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20290000Sglebius * OR ANY PART THEREOF.
21290000Sglebius *
22290000Sglebius * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23290000Sglebius * or profits or other special, indirect and consequential damages, even if
24290000Sglebius * Sun has been advised of the possibility of such damages.
25290000Sglebius *
26290000Sglebius * Sun Microsystems, Inc.
27290000Sglebius * 2550 Garcia Avenue
28290000Sglebius * Mountain View, California  94043
29290000Sglebius */
30290000Sglebius/*
31290000Sglebius * Copyright (C) 1986, Sun Microsystems, Inc.
32290000Sglebius */
33290000Sglebius
34290000Sglebius#include <sys/cdefs.h>
35290000Sglebius/*
36290000Sglebius * unset the secret key on local machine
37290000Sglebius */
38290000Sglebius
39290000Sglebius#include <stdio.h>
40290000Sglebius#include <stdlib.h>
41290000Sglebius#include <string.h>
42290000Sglebius#include <unistd.h>
43290000Sglebius#include <rpc/key_prot.h>
44290000Sglebius
45290000Sglebiusint
46290000Sglebiusmain(int argc, char **argv)
47290000Sglebius{
48290000Sglebius	static char secret[HEXKEYBYTES + 1];
49290000Sglebius
50290000Sglebius	if (geteuid() == 0) {
51290000Sglebius		if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) {
52290000Sglebius			fprintf(stderr,
53290000Sglebius"keylogout by root would break all servers that use secure rpc!\n");
54290000Sglebius			fprintf(stderr,
55290000Sglebius"root may use keylogout -f to do this (at your own risk)!\n");
56290000Sglebius			exit(1);
57290000Sglebius		}
58290000Sglebius	}
59290000Sglebius
60290000Sglebius	if (key_setsecret(secret) < 0) {
61290000Sglebius		fprintf(stderr, "Could not unset your secret key.\n");
62290000Sglebius		fprintf(stderr, "Maybe the keyserver is down?\n");
63290000Sglebius		exit(1);
64290000Sglebius	}
65290000Sglebius	exit(0);
66290000Sglebius	/* NOTREACHED */
67290000Sglebius}
68290000Sglebius