126244Swpaul/* 226244Swpaul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 326244Swpaul * unrestricted use provided that this legend is included on all tape 426244Swpaul * media and as a part of the software program in whole or part. Users 526244Swpaul * may copy or modify Sun RPC without charge, but are not authorized 626244Swpaul * to license or distribute it to anyone else except as part of a product or 726244Swpaul * program developed by the user or with the express written consent of 826244Swpaul * Sun Microsystems, Inc. 926244Swpaul * 1026244Swpaul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 1126244Swpaul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 1226244Swpaul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 1326244Swpaul * 1426244Swpaul * Sun RPC is provided with no support and without any obligation on the 1526244Swpaul * part of Sun Microsystems, Inc. to assist in its use, correction, 1626244Swpaul * modification or enhancement. 1726244Swpaul * 1826244Swpaul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 1926244Swpaul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 2026244Swpaul * OR ANY PART THEREOF. 2126244Swpaul * 2226244Swpaul * In no event will Sun Microsystems, Inc. be liable for any lost revenue 2326244Swpaul * or profits or other special, indirect and consequential damages, even if 2426244Swpaul * Sun has been advised of the possibility of such damages. 2526244Swpaul * 2626244Swpaul * Sun Microsystems, Inc. 2726244Swpaul * 2550 Garcia Avenue 2826244Swpaul * Mountain View, California 94043 2926244Swpaul */ 3026244Swpaul/* 3126244Swpaul * Copyright (C) 1986, Sun Microsystems, Inc. 3226244Swpaul */ 3326244Swpaul 3499112Sobrien#include <sys/cdefs.h> 3599112Sobrien__FBSDID("$FreeBSD$"); 3632501Scharnier 3726244Swpaul/* 3826244Swpaul * unset the secret key on local machine 3926244Swpaul */ 4032501Scharnier 4126244Swpaul#include <stdio.h> 4278717Sdd#include <stdlib.h> 4378717Sdd#include <string.h> 4426244Swpaul#include <unistd.h> 4526244Swpaul#include <rpc/key_prot.h> 4626244Swpaul 4726244Swpaulint 48194791Sdelphijmain(int argc, char **argv) 4926244Swpaul{ 5026244Swpaul static char secret[HEXKEYBYTES + 1]; 5126244Swpaul 5226244Swpaul if (geteuid() == 0) { 5326244Swpaul if ((argc != 2 ) || (strcmp(argv[1], "-f") != 0)) { 5426244Swpaul fprintf(stderr, 5526244Swpaul"keylogout by root would break all servers that use secure rpc!\n"); 5626244Swpaul fprintf(stderr, 5726244Swpaul"root may use keylogout -f to do this (at your own risk)!\n"); 5832501Scharnier exit(1); 5926244Swpaul } 6026244Swpaul } 6126244Swpaul 6226244Swpaul if (key_setsecret(secret) < 0) { 6326244Swpaul fprintf(stderr, "Could not unset your secret key.\n"); 6426244Swpaul fprintf(stderr, "Maybe the keyserver is down?\n"); 6526244Swpaul exit(1); 6626244Swpaul } 6726244Swpaul exit(0); 6826244Swpaul /* NOTREACHED */ 6926244Swpaul} 70