NetBSD/usr.sbin/timed/timedc/cmdtab.c
cbiere 0f2ebef2a8 * timedc is no longer setuid-root and is only usable by root due to the
use of a raw socket for ICMP; thus there is also no need to differ
   between privileged and unprivileged commands.
 * Switch to user "nobody" after allocating the raw socket.
 * Close all file descriptors above 2 (just in case).
2007-01-27 17:57:45 +00:00

61 lines
2.5 KiB
C

/* $NetBSD: cmdtab.c,v 1.7 2007/01/27 17:57:45 cbiere Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: cmdtab.c,v 1.7 2007/01/27 17:57:45 cbiere Exp $");
#endif
#endif /* not lint */
#include "timedc.h"
const char clockdiffhelp[] = "measures clock differences between machines";
const char helphelp[] = "gets help on commands";
const char msitehelp[] = "finds location of master";
const char quithelp[] = "exits timedc";
const char testinghelp[] = "causes election timers to expire";
const char tracinghelp[] = "turns tracing on or off";
const struct cmd cmdtab[] = {
{ "clockdiff", clockdiffhelp, clockdiff },
{ "election", testinghelp, testing },
{ "help", helphelp, help },
{ "msite", msitehelp, msite },
{ "quit", quithelp, quit },
{ "trace", tracinghelp, tracing },
{ "?", helphelp, help },
};
int NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);