From: Dave Hart Date: Sat, 3 Oct 2009 05:13:07 +0000 (+0000) Subject: [Bug 1318] Allow multiple -g options on ntpd command line. X-Git-Tag: NTP_4_2_5P226~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c485d11d957f6312c030499a8867d2c57404331;p=thirdparty%2Fntp.git [Bug 1318] Allow multiple -g options on ntpd command line. [Bug 1327] ntpq, ntpdc, ntp-keygen -d and -D should work with configure --disable-debugging. Add ntpd --saveconfigquit option for future build-time testing of saveconfig fidelity. bk: 4ac6dd63AUTFprTd66oQ37No_psLmg --- diff --git a/ChangeLog b/ChangeLog index 4e5698b09..99f843c3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +[Bug 1318] Allow multiple -g options on ntpd command line. +[Bug 1327] ntpq, ntpdc, ntp-keygen -d and -D should work with configure + --disable-debugging. +* Add ntpd --saveconfigquit option for future build-time + testing of saveconfig fidelity. (4.2.5p225) 2009/09/30 Released by Harlan Stenn * authopt documentation changes from Dave Mills/Dave Hart. * [Bug 1324] support bracketed IPv6 numeric addresses for restrict. diff --git a/configure.ac b/configure.ac index ae60fb7c4..e3b466d86 100644 --- a/configure.ac +++ b/configure.ac @@ -2002,12 +2002,12 @@ case "$ac_cv_var_no_parenb_ignpar" in yes) AC_DEFINE(NO_PARENB_IGNPAR, 1, [Is there a problem using PARENB and IGNPAR (IRIX)?]) ;; esac -AC_MSG_CHECKING([if we're including debugging code]) +AC_MSG_CHECKING([if we're including ntpd debugging code]) AC_ARG_ENABLE(debugging, - AC_HELP_STRING([--enable-debugging], [+ include debugging code]), + AC_HELP_STRING([--enable-debugging], [+ include ntpd debugging code]), [ntp_ok=$enableval], [ntp_ok=yes]) if test "$ntp_ok" = "yes"; then - AC_DEFINE(DEBUG, 1, [Enable debugging?]) + AC_DEFINE(DEBUG, 1, [Enable ntpd debugging code?]) fi AC_MSG_RESULT($ntp_ok) diff --git a/include/debug-opt.def b/include/debug-opt.def index 2c3da2a63..783e5b0b1 100644 --- a/include/debug-opt.def +++ b/include/debug-opt.def @@ -11,7 +11,6 @@ flag = { name = debug-level; value = d; max = NOLIMIT; - ifdef = DEBUG; nopreset; descrip = "Increase output debug message level"; doc = <<- _EndOfDoc_ @@ -23,7 +22,6 @@ flag = { name = set-debug-level; value = D; max = NOLIMIT; - ifdef = DEBUG; descrip = "Set the output debug message level"; arg-type = string; flag-code = 'DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );'; diff --git a/include/ntp_config.h b/include/ntp_config.h index 4b3000e46..98cb868ab 100644 --- a/include/ntp_config.h +++ b/include/ntp_config.h @@ -224,8 +224,8 @@ extern struct REMOTE_CONFIG_INFO remote_config; void config_remotely(sockaddr_u *); #ifdef SAVECONFIG -int dump_config_tree(struct config_tree *ptree, FILE *df); -int dump_all_config_trees(FILE *df); +int dump_config_tree(struct config_tree *ptree, FILE *df, int comment); +int dump_all_config_trees(FILE *df, int comment); #endif diff --git a/libntp/Makefile.am b/libntp/Makefile.am index a80fa4ac6..946cb424e 100644 --- a/libntp/Makefile.am +++ b/libntp/Makefile.am @@ -49,15 +49,9 @@ libntp_a_SRCS = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \ libntp_a_SOURCES = systime.c $(libntp_a_SRCS) libntpsim_a_SOURCES = systime_s.c $(libntp_a_SRCS) EXTRA_libntp_a_SOURCES = adjtimex.c -INCLUDES = -I$(top_srcdir)/include \ - -I../include \ - -I$(top_srcdir)/lib/isc/include \ - -I../lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I../lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - -I../lib/isc/unix/include \ - $(NULL) +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include ETAGS_ARGS = Makefile.am noinst_HEADERS = lib_strbuf.h diff --git a/libparse/Makefile.am b/libparse/Makefile.am index b05ed9736..20ea25356 100644 --- a/libparse/Makefile.am +++ b/libparse/Makefile.am @@ -10,19 +10,19 @@ CLEANFILES = libparse.a libparse_kernel.a K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS libparse_a_SOURCES = parse.c \ - parse_conf.c \ - clk_meinberg.c \ - clk_schmid.c \ + parse_conf.c \ + clk_meinberg.c \ + clk_schmid.c \ clk_rawdcf.c \ clk_trimtsip.c \ - clk_dcf7000.c \ - clk_trimtaip.c \ - clk_rcc8000.c \ - clk_hopf6021.c \ - clk_computime.c \ + clk_dcf7000.c \ + clk_trimtaip.c \ + clk_rcc8000.c \ + clk_hopf6021.c \ + clk_computime.c \ clk_wharton.c \ clk_varitext.c \ - data_mbg.c \ + data_mbg.c \ info_trimble.c \ trim_info.c \ binio.c \ @@ -52,12 +52,10 @@ libparse_kernel_a_LIBADD = kparse$U.o \ $(NULL) -INCLUDES = -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - -I$(top_srcdir)/kernel \ - $(NULL) +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include -I$(top_srcdir)/kernel + ETAGS_ARGS = Makefile.am EXTRA_DIST = parsesolaris.c parsestreams.c mkinfo_scmd.sed mkinfo_rcmd.sed info_trimble.c diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index 6120a77a9..a25b10a3e 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -7,16 +7,10 @@ bin_PROGRAMS= ntpd @MAKE_NTPDSIM@ noinst_LIBRARIES= libntpd.a -AM_CPPFLAGS= -I$(top_srcdir)/include \ - -I../include \ - -I$(top_srcdir)/lib/isc/include \ - -I../lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I../lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - -I../lib/isc/unix/include \ - $(LIBOPTS_CFLAGS) \ - $(NULL) +AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS) + # LDADD might need RESLIB and ADJLIB. LDADD= version.o libntpd.a @LIBPARSE@ AM_YFLAGS= -d -t -r all @@ -58,11 +52,13 @@ vphack_after: ) BUILT_SOURCES= $(VPHACK) ntp_parser.c ntp_parser.h $(VPHACK_AFTER) \ - ntpd-opts.c ntpd-opts.h ntpd.1 ntpd-opts.texi ntpd-opts.menu + ntpd-opts.c ntpd-opts.h ntpd.1 ntpd-opts.texi ntpd-opts.menu man_MANS= ntpd.1 -# What about ntpdsim.1? +# ntpdsim.1 is a remnant along with all the ntpdsim-opts.* files, the +# simulator currently uses ntpd-opts.[ch]. This also means there is no +# longer a reason to have ntpdbase-opts.def split off of ntpd-opts.def. # ntpd may need: # log10 refclock_wwv.o @@ -83,39 +79,91 @@ ETAGS_ARGS = Makefile.am check_PROGRAMS = @MAKE_CHECK_Y2K@ EXTRA_PROGRAMS = check_y2k ntpdsim run_ag= cd $(srcdir) && autogen -L ../include --writable -std_def_list= $(top_srcdir)/include/debug-opt.def \ - $(top_srcdir)/include/autogen-version.def \ +std_def_list= $(top_srcdir)/include/autogen-version.def \ $(top_srcdir)/include/copyright.def \ $(top_srcdir)/include/version.def check-local: @MAKE_CHECK_Y2K@ test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@ -# SIM: cmd_args.c ntp_config.c ntp_io.c ntpd.c + ntpsim.c (include/ntpsim.h) -# ntp_resolver.c is presently unused... -ntpd_SOURCES = cmd_args.c ntp_config.c ntp_io.c ntp_parser.y \ - ntp_data_structures.c ntp_scanner.c ntp_scanner.h ntpd.c \ - ntpd-opts.c ntpd-opts.h -ntpdsim_SOURCES = $(ntpd_SOURCES) ntpsim.c -libntpd_a_SOURCES = jupiter.h ntp_control.c \ - ntp_crypto.c ntp_filegen.c \ - ntp_intres.c ntp_loopfilter.c ntp_monitor.c ntp_peer.c \ - ntp_proto.c ntp_refclock.c ntp_request.c \ - ntp_restrict.c ntp_timer.c ntp_util.c ntp_signd.c \ - ppsapi_timepps.h \ - refclock_acts.c refclock_arbiter.c refclock_arc.c refclock_as2201.c \ - refclock_atom.c refclock_bancomm.c refclock_chronolog.c \ - refclock_chu.c refclock_conf.c refclock_datum.c refclock_dumbclock.c \ - refclock_fg.c refclock_gpsvme.c refclock_heath.c refclock_hopfser.c \ - refclock_hopfpci.c refclock_hpgps.c refclock_irig.c refclock_jjy.c \ - refclock_jupiter.c refclock_leitch.c refclock_local.c \ - refclock_mx4200.c refclock_neoclock4x.c \ - refclock_nmea.c refclock_oncore.c refclock_palisade.c \ - refclock_palisade.h refclock_parse.c \ - refclock_pcf.c refclock_pst.c refclock_ripencc.c refclock_shm.c \ - refclock_tpro.c refclock_true.c refclock_tt560.c \ - refclock_ulink.c refclock_wwv.c refclock_wwvb.c \ - refclock_zyfer.c +ntpd_SOURCES = \ + cmd_args.c \ + ntp_config.c \ + ntp_data_structures.c \ + ntp_io.c \ + ntp_parser.y \ + ntp_scanner.c \ + ntp_scanner.h \ + ntpd.c \ + ntpd-opts.c \ + ntpd-opts.h \ + $(NULL) + +ntpdsim_SOURCES = \ + $(ntpd_SOURCES) \ + ntpsim.c \ + $(NULL) + +# libntpd_a_SOURCES do not use #ifdef SIM + +libntpd_a_SOURCES = \ + jupiter.h \ + ntp_control.c \ + ntp_crypto.c \ + ntp_filegen.c \ + ntp_intres.c \ + ntp_loopfilter.c \ + ntp_monitor.c \ + ntp_peer.c \ + ntp_proto.c \ + ntp_refclock.c \ + ntp_request.c \ + ntp_restrict.c \ + ntp_signd.c \ + ntp_timer.c \ + ntp_util.c \ + ppsapi_timepps.h \ + refclock_acts.c \ + refclock_arbiter.c \ + refclock_arc.c \ + refclock_as2201.c \ + refclock_atom.c \ + refclock_bancomm.c \ + refclock_chronolog.c \ + refclock_chu.c \ + refclock_conf.c \ + refclock_datum.c \ + refclock_dumbclock.c \ + refclock_fg.c \ + refclock_gpsvme.c \ + refclock_heath.c \ + refclock_hopfser.c \ + refclock_hopfpci.c \ + refclock_hpgps.c \ + refclock_irig.c \ + refclock_jjy.c \ + refclock_jupiter.c \ + refclock_leitch.c \ + refclock_local.c \ + refclock_mx4200.c \ + refclock_neoclock4x.c \ + refclock_nmea.c \ + refclock_oncore.c \ + refclock_palisade.c \ + refclock_palisade.h \ + refclock_parse.c \ + refclock_pcf.c \ + refclock_pst.c \ + refclock_ripencc.c \ + refclock_shm.c \ + refclock_tpro.c \ + refclock_true.c \ + refclock_tt560.c \ + refclock_ulink.c \ + refclock_wwv.c \ + refclock_wwvb.c \ + refclock_zyfer.c \ + $(NULL) $(srcdir)/ntpd-opts.h: $(srcdir)/ntpd-opts.c $(srcdir)/ntpd-opts.c: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list) diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 9ae417343..44b5f4166 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -26,6 +26,7 @@ #include "ntp_stdlib.h" #include "ntp_assert.h" #include "ntpsim.h" +#include "ntpd-opts.h" #include #include #include @@ -470,15 +471,18 @@ free_config_tree( #ifdef SAVECONFIG /* Dump all trees */ int -dump_all_config_trees ( - FILE *df - ) +dump_all_config_trees( + FILE *df, + int comment + ) { struct config_tree *cfg_ptr = cfg_tree_history; int return_value = 0; - for(; cfg_ptr != NULL; cfg_ptr = cfg_ptr->link) - return_value |= dump_config_tree(cfg_ptr, df); + for (cfg_ptr = cfg_tree_history; + cfg_ptr != NULL; + cfg_ptr = cfg_ptr->link) + return_value |= dump_config_tree(cfg_ptr, df, comment); return return_value; } @@ -488,7 +492,8 @@ dump_all_config_trees ( int dump_config_tree( struct config_tree *ptree, - FILE *df + FILE *df, + int comment ) { struct peer_node *peer = NULL; @@ -517,18 +522,21 @@ dump_config_tree( char timestamp[80]; int enable; - printf("dump_config_tree(%p)\n", ptree); + DPRINTF(1, ("dump_config_tree(%p)\n", ptree)); - if (!strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", - localtime(&ptree->timestamp))) - timestamp[0] = '\0'; + if (comment) { + if (!strftime(timestamp, sizeof(timestamp), + "%Y-%m-%d %H:%M:%S", + localtime(&ptree->timestamp))) + timestamp[0] = '\0'; - fprintf(df, "# %s %s %s\n", - timestamp, - (CONF_SOURCE_NTPQ == ptree->source.attr) - ? "ntpq remote config from" - : "startup configuration file", - ptree->source.value.s); + fprintf(df, "# %s %s %s\n", + timestamp, + (CONF_SOURCE_NTPQ == ptree->source.attr) + ? "ntpq remote config from" + : "startup configuration file", + ptree->source.value.s); + } /* For options I didn't find documentation I'll just output its name and the cor. value */ list_ptr = queue_head(ptree->vars); @@ -3834,6 +3842,22 @@ getconfig( free_netinfo_config(config_netinfo); #endif /* HAVE_NETINFO */ +#ifdef SAVECONFIG + if (HAVE_OPT( SAVECONFIGQUIT )) { + FILE *dumpfile; + int dumpfailed; + + dumpfile = fopen(OPT_ARG( SAVECONFIGQUIT ), "w"); + dumpfailed = dump_all_config_trees(dumpfile, 0); + if (dumpfailed) + fprintf(stderr, + "--saveconfigquit %s error %d\n", + OPT_ARG( SAVECONFIGQUIT ), + dumpfailed); + exit(dumpfailed); + } +#endif /* SAVECONFIG */ + /* printf("getconfig: res_fp <%p> call_resolver: %d", res_fp, call_resolver); */ diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c index b21445e5d..4172c42c5 100644 --- a/ntpd/ntp_control.c +++ b/ntpd/ntp_control.c @@ -629,7 +629,7 @@ save_config( else fptr = fdopen(fd, "w"); - if (NULL == fptr || -1 == dump_all_config_trees(fptr)) { + if (NULL == fptr || -1 == dump_all_config_trees(fptr, 1)) { snprintf(reply, sizeof(reply), "Unable to save configuration to file %s", filename); diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index ff2a1b532..417a8646f 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -33,6 +33,7 @@ #include "ntp.h" #include "ntp_unixtime.h" #include "ntp_assert.h" +#include "ntpd-opts.h" /* Don't include ISC's version of IPv6 variables and structures */ #define ISC_IPV6_H 1 @@ -581,7 +582,7 @@ io_open_sockets(void) { static int already_opened; - if (already_opened) + if (already_opened || HAVE_OPT( SAVECONFIGQUIT )) return; already_opened = 1; diff --git a/ntpd/ntpd-opts.c b/ntpd/ntpd-opts.c index 2ad4b3f9d..2674c51bf 100644 --- a/ntpd/ntpd-opts.c +++ b/ntpd/ntpd-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.c) * - * It has been AutoGen-ed September 30, 2009 at 07:33:07 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:52:55 AM UTC * From the definitions ntpd-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpd copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpd copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -51,7 +51,7 @@ extern tUsageProc optionUsage; * global included definitions */ #ifdef __windows - extern int atoi(const char*); + extern int atoi(const char *); #else # include #endif @@ -317,6 +317,25 @@ tSCC zPropagationdelay_Name[] = "propagationdelay"; #define PROPAGATIONDELAY_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) +/* + * Saveconfigquit option description: + */ +#ifdef SAVECONFIG +tSCC zSaveconfigquitText[] = + "Save parsed configuration and quit"; +tSCC zSaveconfigquit_NAME[] = "SAVECONFIGQUIT"; +tSCC zSaveconfigquit_Name[] = "saveconfigquit"; +#define SAVECONFIGQUIT_FLAGS (OPTST_DISABLED \ + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) + +#else /* disable Saveconfigquit */ +#define VALUE_OPT_SAVECONFIGQUIT NO_EQUIVALENT +#define SAVECONFIGQUIT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) +#define zSaveconfigquitText NULL +#define zSaveconfigquit_NAME NULL +#define zSaveconfigquit_Name NULL +#endif /* SAVECONFIG */ + /* * Statsdir option description: */ @@ -604,7 +623,7 @@ static tOptDesc optDesc[ OPTION_CT ] = { { /* entry idx, value */ 9, VALUE_OPT_PANICGATE, /* equiv idx, value */ 9, VALUE_OPT_PANICGATE, /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, + /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ PANICGATE_FLAGS, 0, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, @@ -757,8 +776,20 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zPropagationdelayText, zPropagationdelay_NAME, zPropagationdelay_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 22, VALUE_OPT_STATSDIR, - /* equiv idx, value */ 22, VALUE_OPT_STATSDIR, + { /* entry idx, value */ 22, VALUE_OPT_SAVECONFIGQUIT, + /* equiv idx, value */ 22, VALUE_OPT_SAVECONFIGQUIT, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ SAVECONFIGQUIT_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zSaveconfigquitText, zSaveconfigquit_NAME, zSaveconfigquit_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 23, VALUE_OPT_STATSDIR, + /* equiv idx, value */ 23, VALUE_OPT_STATSDIR, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ STATSDIR_FLAGS, 0, @@ -769,8 +800,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zStatsdirText, zStatsdir_NAME, zStatsdir_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 23, VALUE_OPT_TRUSTEDKEY, - /* equiv idx, value */ 23, VALUE_OPT_TRUSTEDKEY, + { /* entry idx, value */ 24, VALUE_OPT_TRUSTEDKEY, + /* equiv idx, value */ 24, VALUE_OPT_TRUSTEDKEY, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ TRUSTEDKEY_FLAGS, 0, @@ -781,8 +812,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zTrustedkeyText, zTrustedkey_NAME, zTrustedkey_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 24, VALUE_OPT_USER, - /* equiv idx, value */ 24, VALUE_OPT_USER, + { /* entry idx, value */ 25, VALUE_OPT_USER, + /* equiv idx, value */ 25, VALUE_OPT_USER, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ USER_FLAGS, 0, @@ -793,8 +824,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zUserText, zUser_NAME, zUser_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 25, VALUE_OPT_UPDATEINTERVAL, - /* equiv idx, value */ 25, VALUE_OPT_UPDATEINTERVAL, + { /* entry idx, value */ 26, VALUE_OPT_UPDATEINTERVAL, + /* equiv idx, value */ 26, VALUE_OPT_UPDATEINTERVAL, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ UPDATEINTERVAL_FLAGS, 0, @@ -805,8 +836,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zUpdateintervalText, zUpdateinterval_NAME, zUpdateinterval_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 26, VALUE_OPT_VAR, - /* equiv idx, value */ 26, VALUE_OPT_VAR, + { /* entry idx, value */ 27, VALUE_OPT_VAR, + /* equiv idx, value */ 27, VALUE_OPT_VAR, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ VAR_FLAGS, 0, @@ -817,8 +848,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zVarText, zVar_NAME, zVar_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 27, VALUE_OPT_DVAR, - /* equiv idx, value */ 27, VALUE_OPT_DVAR, + { /* entry idx, value */ 28, VALUE_OPT_DVAR, + /* equiv idx, value */ 28, VALUE_OPT_DVAR, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, NOLIMIT, 0, /* opt state flags */ DVAR_FLAGS, 0, @@ -829,8 +860,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zDvarText, zDvar_NAME, zDvar_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 28, VALUE_OPT_SLEW, - /* equiv idx, value */ 28, VALUE_OPT_SLEW, + { /* entry idx, value */ 29, VALUE_OPT_SLEW, + /* equiv idx, value */ 29, VALUE_OPT_SLEW, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SLEW_FLAGS, 0, @@ -841,8 +872,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zSlewText, zSlew_NAME, zSlew_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 29, VALUE_OPT_USEPCC, - /* equiv idx, value */ 29, VALUE_OPT_USEPCC, + { /* entry idx, value */ 30, VALUE_OPT_USEPCC, + /* equiv idx, value */ 30, VALUE_OPT_USEPCC, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ USEPCC_FLAGS, 0, @@ -853,8 +884,8 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zUsepccText, zUsepcc_NAME, zUsepcc_Name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 30, VALUE_OPT_PCCFREQ, - /* equiv idx, value */ 30, VALUE_OPT_PCCFREQ, + { /* entry idx, value */ 31, VALUE_OPT_PCCFREQ, + /* equiv idx, value */ 31, VALUE_OPT_PCCFREQ, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PCCFREQ_FLAGS, 0, @@ -967,7 +998,7 @@ tOptions ntpdOptions = { NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 34 /* full option count */, 31 /* user option count */, + 35 /* full option count */, 32 /* user option count */, ntpd_full_usage, ntpd_short_usage, NULL, NULL }; @@ -994,7 +1025,7 @@ doUsageOpt( static void doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { - /* extracted from ../include/debug-opt.def, line 29 */ + /* extracted from ntpdbase-opts.def, line 98 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } #endif /* defined DEBUG */ diff --git a/ntpd/ntpd-opts.h b/ntpd/ntpd-opts.h index 322fb469a..e22a07896 100644 --- a/ntpd/ntpd-opts.h +++ b/ntpd/ntpd-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.h) * - * It has been AutoGen-ed September 30, 2009 at 07:33:06 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:52:54 AM UTC * From the definitions ntpd-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpd copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpd copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -74,21 +74,22 @@ typedef enum { INDEX_OPT_PRIORITY = 19, INDEX_OPT_QUIT = 20, INDEX_OPT_PROPAGATIONDELAY = 21, - INDEX_OPT_STATSDIR = 22, - INDEX_OPT_TRUSTEDKEY = 23, - INDEX_OPT_USER = 24, - INDEX_OPT_UPDATEINTERVAL = 25, - INDEX_OPT_VAR = 26, - INDEX_OPT_DVAR = 27, - INDEX_OPT_SLEW = 28, - INDEX_OPT_USEPCC = 29, - INDEX_OPT_PCCFREQ = 30, - INDEX_OPT_VERSION = 31, - INDEX_OPT_HELP = 32, - INDEX_OPT_MORE_HELP = 33 + INDEX_OPT_SAVECONFIGQUIT = 22, + INDEX_OPT_STATSDIR = 23, + INDEX_OPT_TRUSTEDKEY = 24, + INDEX_OPT_USER = 25, + INDEX_OPT_UPDATEINTERVAL = 26, + INDEX_OPT_VAR = 27, + INDEX_OPT_DVAR = 28, + INDEX_OPT_SLEW = 29, + INDEX_OPT_USEPCC = 30, + INDEX_OPT_PCCFREQ = 31, + INDEX_OPT_VERSION = 32, + INDEX_OPT_HELP = 33, + INDEX_OPT_MORE_HELP = 34 } teOptIndex; -#define OPTION_CT 34 +#define OPTION_CT 35 #define NTPD_VERSION "4.2.5p225" #define NTPD_FULL_VERSION "ntpd - NTP daemon program - Ver. 4.2.5p225" @@ -205,6 +206,10 @@ typedef enum { # warning undefining PROPAGATIONDELAY due to option name conflict # undef PROPAGATIONDELAY # endif +# ifdef SAVECONFIGQUIT +# warning undefining SAVECONFIGQUIT due to option name conflict +# undef SAVECONFIGQUIT +# endif # ifdef STATSDIR # warning undefining STATSDIR due to option name conflict # undef STATSDIR @@ -264,6 +269,7 @@ typedef enum { # undef PRIORITY # undef QUIT # undef PROPAGATIONDELAY +# undef SAVECONFIGQUIT # undef STATSDIR # undef TRUSTEDKEY # undef USER @@ -312,6 +318,9 @@ typedef enum { #define OPT_VALUE_PRIORITY (DESC(PRIORITY).optArg.argInt) #define VALUE_OPT_QUIT 'q' #define VALUE_OPT_PROPAGATIONDELAY 'r' +#ifdef SAVECONFIG +#define VALUE_OPT_SAVECONFIGQUIT 22 +#endif /* SAVECONFIG */ #define VALUE_OPT_STATSDIR 's' #define VALUE_OPT_TRUSTEDKEY 't' #ifdef HAVE_DROPROOT @@ -319,14 +328,14 @@ typedef enum { #endif /* HAVE_DROPROOT */ #define VALUE_OPT_UPDATEINTERVAL 'U' #define OPT_VALUE_UPDATEINTERVAL (DESC(UPDATEINTERVAL).optArg.argInt) -#define VALUE_OPT_VAR 26 -#define VALUE_OPT_DVAR 27 +#define VALUE_OPT_VAR 27 +#define VALUE_OPT_DVAR 28 #define VALUE_OPT_SLEW 'x' #ifdef SYS_WINNT -#define VALUE_OPT_USEPCC 29 +#define VALUE_OPT_USEPCC 30 #endif /* SYS_WINNT */ #ifdef SYS_WINNT -#define VALUE_OPT_PCCFREQ 30 +#define VALUE_OPT_PCCFREQ 31 #endif /* SYS_WINNT */ #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' diff --git a/ntpd/ntpd-opts.texi b/ntpd/ntpd-opts.texi index 2693eb760..f489c5e37 100644 --- a/ntpd/ntpd-opts.texi +++ b/ntpd/ntpd-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntpd-opts.texi) # -# It has been AutoGen-ed September 30, 2009 at 07:33:10 AM by AutoGen 5.9.9pre5 +# It has been AutoGen-ed Saturday October 3, 2009 at 03:52:56 AM UTC # From the definitions ntpd-opts.def # and the template file aginfo.tpl @end ignore @@ -44,6 +44,7 @@ This software is released under a specialized copyright license. * ntpd priority:: priority option (-P) * ntpd propagationdelay:: propagationdelay option (-r) * ntpd quit:: quit option (-q) +* ntpd saveconfigquit:: saveconfigquit option * ntpd set-debug-level:: set-debug-level option (-D) * ntpd slew:: slew option (-x) * ntpd statsdir:: statsdir option (-s) @@ -62,7 +63,7 @@ This is the automatically generated usage text for ntpd: @exampleindent 0 @example -ntpd - NTP daemon program - Ver. 4.2.5p220 +ntpd - NTP daemon program - Ver. 4.2.5p225 USAGE: ntpd [ - [] | --[@{=| @}] ]... Flg Arg Option-Name Description -4 no ipv4 Force IPv4 DNS name resolution @@ -250,6 +251,13 @@ file. @cindex ntpd-panicgate This is the ``allow the first adjustment to be big'' option. + +This option has some usage constraints. It: +@itemize @bullet +@item +may appear an unlimited number of times. +@end itemize + Normally, ntpd exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that, @@ -403,6 +411,22 @@ Note: The kernel time discipline is disabled with this option. This is the ``broadcast/propagation delay'' option. Specify the default propagation delay from the broadcast/multicast server to this client. This is necessary only if the delay cannot be computed automatically by the protocol. +@node ntpd saveconfigquit +@subsection saveconfigquit option +@cindex ntpd-saveconfigquit + +This is the ``save parsed configuration and quit'' option. + +This option has some usage constraints. It: +@itemize @bullet +@item +must be compiled in by defining @code{SAVECONFIG} during the compilation. +@end itemize + +Cause ntpd to parse its startup configuration file and save an +equivalent to the given filename and exit. This option was +designed for automated testing. + @node ntpd statsdir @subsection statsdir option (-s) @cindex ntpd-statsdir diff --git a/ntpd/ntpd.1 b/ntpd/ntpd.1 index d9d2ceebf..548c8eaef 100644 --- a/ntpd/ntpd.1 +++ b/ntpd/ntpd.1 @@ -1,7 +1,7 @@ -.TH NTPD 1 2009-09-30 "( 4.2.5p225)" "Programmer's Manual" +.TH NTPD 1 2009-10-03 "( 4.2.5p225)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntpd.1) .\" -.\" It has been AutoGen-ed September 30, 2009 at 07:33:09 AM by AutoGen 5.9.9pre5 +.\" It has been AutoGen-ed Saturday October 3, 2009 at 03:52:55 AM UTC .\" From the definitions ntpd-opts.def .\" and the template file agman1.tpl .\" @@ -89,6 +89,7 @@ file. .TP .BR \-g ", " \--panicgate Allow the first adjustment to be Big. +This option may appear an unlimited number of times. .sp Normally, ntpd @@ -200,6 +201,13 @@ Broadcast/propagation delay. .sp Specify the default propagation delay from the broadcast/multicast server to this client. This is necessary only if the delay cannot be computed automatically by the protocol. .TP +.BR \--saveconfigquit "=\fIstring\fP" +Save parsed configuration and quit. +.sp +Cause ntpd to parse its startup configuration file and save an +equivalent to the given filename and exit. This option was +designed for automated testing. +.TP .BR \-s " \fIstring\fP, " \--statsdir "=" \fIstring\fP Statistics file location. .sp diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index b7d54b6e0..062fc5654 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -222,6 +222,7 @@ int ntpdmain (int, char **); static void set_process_priority (void); void init_logging (char const *, int); void setup_logfile (void); +static void process_commandline_opts(int *, char ***); static void assertion_failed (const char *file, int line, isc_assertiontype_t type, const char *cond); @@ -314,6 +315,21 @@ setup_logfile( } } + +static void +process_commandline_opts( + int *pargc, + char ***pargv + ) +{ + int optct; + + optct = optionProcess(&ntpdOptions, *pargc, *pargv); + *pargc -= optct; + *pargv += optct; +} + + #ifdef SIM int main( @@ -321,6 +337,8 @@ main( char *argv[] ) { + process_commandline_opts(&argc, &argv); + return ntpsim(argc, argv); } #else /* SIM */ @@ -477,17 +495,8 @@ ntpdmain( #endif progname = argv[0]; - initializing = 1; /* mark that we are initializing */ - - { - int optct = optionProcess( - &ntpdOptions - , argc, argv); - argc -= optct; - argv += optct; - } - + process_commandline_opts(&argc, &argv); init_logging(progname, 1); /* Open the log file */ #ifdef HAVE_UMASK @@ -507,8 +516,7 @@ ntpdmain( uid_t uid; uid = getuid(); - if (uid) - { + if (uid && !HAVE_OPT( SAVECONFIGQUIT )) { msyslog(LOG_ERR, "ntpd: must be run as root, not uid %ld", (long)uid); printf("must be run as root, not uid %ld\n", (long)uid); exit(1); @@ -534,7 +542,11 @@ ntpdmain( set_mm_timer(MM_TIMER_HIRES); #endif - if (HAVE_OPT( NOFORK ) || HAVE_OPT( QUIT )) + if (HAVE_OPT( NOFORK ) || HAVE_OPT( QUIT ) +#ifdef DEBUG + || debug +#endif + || HAVE_OPT( SAVECONFIGQUIT )) nofork = 1; if (HAVE_OPT( NOVIRTUALIPS )) @@ -588,20 +600,16 @@ ntpdmain( /* * Detach us from the terminal. May need an #ifndef GIZMO. */ - if ( -# ifdef DEBUG - !debug && -# endif /* DEBUG */ - !nofork) - { + if (!nofork) { - /* - * Install trap handlers to log errors and assertion failures. - * Default handlers print to stderr which doesn't work if detached. - */ - isc_assertion_setcallback(assertion_failed); - isc_error_setfatal(library_fatal_error); - isc_error_setunexpected(library_unexpected_error); + /* + * Install trap handlers to log errors and assertion + * failures. Default handlers print to stderr which + * doesn't work if detached. + */ + isc_assertion_setcallback(assertion_failed); + isc_error_setfatal(library_fatal_error); + isc_error_setunexpected(library_unexpected_error); # ifndef SYS_WINNT # ifdef HAVE_DAEMON @@ -862,13 +870,13 @@ ntpdmain( #ifdef HAVE_LINUX_CAPABILITIES /* set flag: keep privileges accross setuid() call (we only really need cap_sys_time): */ - if( prctl( PR_SET_KEEPCAPS, 1L, 0L, 0L, 0L ) == -1 ) { + if (prctl( PR_SET_KEEPCAPS, 1L, 0L, 0L, 0L ) == -1) { msyslog( LOG_ERR, "prctl( PR_SET_KEEPCAPS, 1L ) failed: %m" ); exit(-1); } #else /* we need a user to switch to */ - if( user == NULL ) { + if (user == NULL) { msyslog(LOG_ERR, "Need user name to drop root privileges (see -u flag!)" ); exit(-1); } diff --git a/ntpd/ntpdbase-opts.def b/ntpd/ntpdbase-opts.def index 231c3a468..b2e04e2a0 100644 --- a/ntpd/ntpdbase-opts.def +++ b/ntpd/ntpdbase-opts.def @@ -1,5 +1,13 @@ #include autogen-version.def +include = <<- _EOF_ + #ifdef __windows + extern int atoi(const char *); + #else + # include + #endif + _EOF_; + test-main; flag = { @@ -68,7 +76,31 @@ flag = { _EndOfDoc_; }; -#include debug-opt.def +flag = { + name = debug-level; + value = d; + max = NOLIMIT; + ifdef = DEBUG; + nopreset; + descrip = "Increase output debug message level"; + doc = <<- _EndOfDoc_ + Increase the debugging message output level. + _EndOfDoc_; +}; + +flag = { + name = set-debug-level; + value = D; + max = NOLIMIT; + ifdef = DEBUG; + descrip = "Set the output debug message level"; + arg-type = string; + flag-code = 'DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );'; + doc = <<- _EndOfDoc_ + Set the output debugging level. Can be supplied multiple times, + but each overrides the previous value(s). + _EndOfDoc_; +}; flag = { name = driftfile; @@ -90,6 +122,7 @@ flag = { flag = { name = panicgate; value = g; + max = NOLIMIT; descrip = "Allow the first adjustment to be Big"; doc = <<- _EndOfDoc_ Normally, @@ -260,6 +293,18 @@ flag = { _EndOfDoc_; }; +flag = { + ifdef = SAVECONFIG; + name = saveconfigquit; + arg-type = string; + descrip = "Save parsed configuration and quit"; + doc = <<- _EndOfDoc_ + Cause ntpd to parse its startup configuration file and save an + equivalent to the given filename and exit. This option was + designed for automated testing. + _EndOfDoc_; +}; + flag = { name = statsdir; value = s; diff --git a/ntpdate/Makefile.am b/ntpdate/Makefile.am index 32481d4aa..1ab3d7b30 100644 --- a/ntpdate/Makefile.am +++ b/ntpdate/Makefile.am @@ -7,11 +7,11 @@ bin_PROGRAMS= ntpdate EXTRA_PROGRAMS= ntptimeset ntptimeset_SOURCES= ntptimeset.c ntptime_config.c -AM_CPPFLAGS= -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - $(NULL) + +AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include + # LDADD might need RESLIB and ADJLIB LDADD= version.o ../libntp/libntp.a DISTCLEANFILES= .version version.c stamp-v diff --git a/ntpdc/Makefile.am b/ntpdc/Makefile.am index 09b36c43e..64d546ed6 100644 --- a/ntpdc/Makefile.am +++ b/ntpdc/Makefile.am @@ -6,12 +6,9 @@ bin_PROGRAMS= ntpdc EXTRA_PROGRAMS= ntpdc-layout EXTRA_DATA= check-layout BUILT_SOURCES= @MAKE_CHECK_LAYOUT@ -AM_CPPFLAGS= -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - $(LIBOPTS_CFLAGS) \ - $(NULL) +AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS) # LDADD might need RESLIB and ADJLIB ntpdc_LDADD= version.o @EDITLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a # ntpdc-layout doesn't need any additional libraries at all diff --git a/ntpdc/ntpdc-opts.c b/ntpdc/ntpdc-opts.c index 71bf22aac..7dab6f438 100644 --- a/ntpdc/ntpdc-opts.c +++ b/ntpdc/ntpdc-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpdc-opts.c) * - * It has been AutoGen-ed September 30, 2009 at 07:35:47 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:57:35 AM UTC * From the definitions ntpdc-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpdc copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -151,25 +151,15 @@ static const int /* * Debug_Level option description: */ -#ifdef DEBUG tSCC zDebug_LevelText[] = "Increase output debug message level"; tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL"; tSCC zDebug_Level_Name[] = "debug-level"; #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED) -#else /* disable Debug_Level */ -#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT -#define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zDebug_LevelText NULL -#define zDebug_Level_NAME NULL -#define zDebug_Level_Name NULL -#endif /* DEBUG */ - /* * Set_Debug_Level option description: */ -#ifdef DEBUG tSCC zSet_Debug_LevelText[] = "Set the output debug message level"; tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL"; @@ -177,14 +167,6 @@ tSCC zSet_Debug_Level_Name[] = "set-debug-level"; #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) -#else /* disable Set_Debug_Level */ -#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT -#define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zSet_Debug_LevelText NULL -#define zSet_Debug_Level_NAME NULL -#define zSet_Debug_Level_Name NULL -#endif /* DEBUG */ - /* * Numeric option description: */ @@ -213,11 +195,6 @@ tSCC zNotLoad_Opts_Pfx[] = "no"; /* * Declare option callback procedures */ -#ifdef DEBUG - static tOptProc doOptSet_Debug_Level; -#else /* not DEBUG */ -# define doOptSet_Debug_Level NULL -#endif /* def/not DEBUG */ #if defined(TEST_NTPDC_OPTS) /* * Under test, omit argument processing, or call optionStackArg, @@ -241,7 +218,7 @@ static tOptProc extern tOptProc optionPagedUsage, optionPrintVersion, optionStackArg; static tOptProc - doUsageOpt; + doOptSet_Debug_Level, doUsageOpt; /* * #define map the "normal" callout procs @@ -548,16 +525,14 @@ doUsageOpt( /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * For the set-debug-level option, when DEBUG is #define-d. + * For the set-debug-level option. */ -#ifdef DEBUG static void doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { - /* extracted from ../include/debug-opt.def, line 29 */ + /* extracted from ../include/debug-opt.def, line 27 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } -#endif /* defined DEBUG */ #endif /* defined(TEST_NTPDC_OPTS) */ /* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ diff --git a/ntpdc/ntpdc-opts.h b/ntpdc/ntpdc-opts.h index 6b30f8cbd..34b4d88c3 100644 --- a/ntpdc/ntpdc-opts.h +++ b/ntpdc/ntpdc-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h) * - * It has been AutoGen-ed September 30, 2009 at 07:35:46 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:57:35 AM UTC * From the definitions ntpdc-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpdc copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -164,12 +164,8 @@ typedef enum { #define VALUE_OPT_PEERS 'p' #define VALUE_OPT_SHOWPEERS 's' #define VALUE_OPT_INTERACTIVE 'i' -#ifdef DEBUG #define VALUE_OPT_DEBUG_LEVEL 'd' -#endif /* DEBUG */ -#ifdef DEBUG #define VALUE_OPT_SET_DEBUG_LEVEL 'D' -#endif /* DEBUG */ #define VALUE_OPT_NUMERIC 'n' #define VALUE_OPT_HELP '?' #define VALUE_OPT_MORE_HELP '!' diff --git a/ntpdc/ntpdc-opts.texi b/ntpdc/ntpdc-opts.texi index 97d96ec74..62c4aa5a5 100644 --- a/ntpdc/ntpdc-opts.texi +++ b/ntpdc/ntpdc-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntpdc-opts.texi) # -# It has been AutoGen-ed September 30, 2009 at 07:35:49 AM by AutoGen 5.9.9pre5 +# It has been AutoGen-ed Saturday October 3, 2009 at 03:57:36 AM UTC # From the definitions ntpdc-opts.def # and the template file aginfo.tpl @end ignore @@ -58,7 +58,7 @@ This is the automatically generated usage text for ntpdc: @exampleindent 0 @example -ntpdc - vendor-specific NTP query program - Ver. 4.2.5p220 +ntpdc - vendor-specific NTP query program - Ver. 4.2.5p225 USAGE: ntpdc [ - [] | --[@{=| @}] ]... [ host ...] Flg Arg Option-Name Description -4 no ipv4 Force IPv4 DNS name resolution @@ -98,8 +98,8 @@ Options are specified by doubled hyphens and their name or by a single hyphen and the flag character. The following option preset mechanisms are supported: - - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/ntpdc/.ntprc + - reading file /m/pogo/users/hart/.ntprc + - reading file /m/pogo/users/hart/ntp-dev-1318-27/ntpdc/.ntprc - examining environment variables named NTPDC_* The @@ -243,8 +243,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Increase the debugging message output level. @@ -259,8 +257,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Set the output debugging level. Can be supplied multiple times, diff --git a/ntpdc/ntpdc.1 b/ntpdc/ntpdc.1 index 594c69273..a22ef2da0 100644 --- a/ntpdc/ntpdc.1 +++ b/ntpdc/ntpdc.1 @@ -1,7 +1,7 @@ -.TH NTPDC 1 2009-09-30 "( 4.2.5p225)" "Programmer's Manual" +.TH NTPDC 1 2009-10-03 "( 4.2.5p225)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntpdc.1) .\" -.\" It has been AutoGen-ed September 30, 2009 at 07:35:48 AM by AutoGen 5.9.9pre5 +.\" It has been AutoGen-ed Saturday October 3, 2009 at 03:57:35 AM UTC .\" From the definitions ntpdc-opts.def .\" and the template file agman1.tpl .\" diff --git a/ntpq/Makefile.am b/ntpq/Makefile.am index af421f97f..0109a3575 100644 --- a/ntpq/Makefile.am +++ b/ntpq/Makefile.am @@ -2,12 +2,11 @@ NULL= AUTOMAKE_OPTIONS= bin_PROGRAMS= ntpq -AM_CPPFLAGS= -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - $(LIBOPTS_CFLAGS) \ - $(NULL) + +AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS) + # LDADD might need RESLIB and ADJLIB ntpq_LDADD= version.o @EDITLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a noinst_HEADERS= ntpq.h diff --git a/ntpq/ntpq-opts.c b/ntpq/ntpq-opts.c index 9405404e1..6f6a9b8d7 100644 --- a/ntpq/ntpq-opts.c +++ b/ntpq/ntpq-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpq-opts.c) * - * It has been AutoGen-ed September 30, 2009 at 07:36:23 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:57:53 AM UTC * From the definitions ntpq-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpq copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpq copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -96,25 +96,15 @@ tSCC zCommand_Name[] = "command"; /* * Debug_Level option description: */ -#ifdef DEBUG tSCC zDebug_LevelText[] = "Increase output debug message level"; tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL"; tSCC zDebug_Level_Name[] = "debug-level"; #define DEBUG_LEVEL_FLAGS (OPTST_DISABLED) -#else /* disable Debug_Level */ -#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT -#define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zDebug_LevelText NULL -#define zDebug_Level_NAME NULL -#define zDebug_Level_Name NULL -#endif /* DEBUG */ - /* * Set_Debug_Level option description: */ -#ifdef DEBUG tSCC zSet_Debug_LevelText[] = "Set the output debug message level"; tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL"; @@ -122,14 +112,6 @@ tSCC zSet_Debug_Level_Name[] = "set-debug-level"; #define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) -#else /* disable Set_Debug_Level */ -#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT -#define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) -#define zSet_Debug_LevelText NULL -#define zSet_Debug_Level_NAME NULL -#define zSet_Debug_Level_Name NULL -#endif /* DEBUG */ - /* * Peers option description with * "Must also have options" and "Incompatible options": @@ -185,11 +167,6 @@ tSCC zNotLoad_Opts_Pfx[] = "no"; /* * Declare option callback procedures */ -#ifdef DEBUG - static tOptProc doOptSet_Debug_Level; -#else /* not DEBUG */ -# define doOptSet_Debug_Level NULL -#endif /* def/not DEBUG */ #if defined(TEST_NTPQ_OPTS) /* * Under test, omit argument processing, or call optionStackArg, @@ -215,7 +192,7 @@ static tOptProc extern tOptProc ntpq_custom_opt_handler, optionPagedUsage, optionPrintVersion; static tOptProc - doUsageOpt; + doOptSet_Debug_Level, doUsageOpt; /* * #define map the "normal" callout procs @@ -494,16 +471,14 @@ doUsageOpt( /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * For the set-debug-level option, when DEBUG is #define-d. + * For the set-debug-level option. */ -#ifdef DEBUG static void doOptSet_Debug_Level(tOptions* pOptions, tOptDesc* pOptDesc) { - /* extracted from ../include/debug-opt.def, line 29 */ + /* extracted from ../include/debug-opt.def, line 27 */ DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg ); } -#endif /* defined DEBUG */ #endif /* defined(TEST_NTPQ_OPTS) */ /* extracted from /usr/local/gnu/share/autogen/optmain.tpl near line 109 */ diff --git a/ntpq/ntpq-opts.h b/ntpq/ntpq-opts.h index c5f9bc407..60aa832e8 100644 --- a/ntpq/ntpq-opts.h +++ b/ntpq/ntpq-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntpq-opts.h) * - * It has been AutoGen-ed September 30, 2009 at 07:36:22 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:57:53 AM UTC * From the definitions ntpq-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntpq copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntpq copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -148,12 +148,8 @@ typedef enum { #define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex) #define VALUE_OPT_IPV6 '6' #define VALUE_OPT_COMMAND 'c' -#ifdef DEBUG #define VALUE_OPT_DEBUG_LEVEL 'd' -#endif /* DEBUG */ -#ifdef DEBUG #define VALUE_OPT_SET_DEBUG_LEVEL 'D' -#endif /* DEBUG */ #define VALUE_OPT_PEERS 'p' #define VALUE_OPT_INTERACTIVE 'i' #define VALUE_OPT_NUMERIC 'n' diff --git a/ntpq/ntpq-opts.texi b/ntpq/ntpq-opts.texi index 8324183fc..b9d1ee406 100644 --- a/ntpq/ntpq-opts.texi +++ b/ntpq/ntpq-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntpq-opts.texi) # -# It has been AutoGen-ed September 30, 2009 at 07:36:25 AM by AutoGen 5.9.9pre5 +# It has been AutoGen-ed Saturday October 3, 2009 at 03:57:54 AM UTC # From the definitions ntpq-opts.def # and the template file aginfo.tpl @end ignore @@ -46,7 +46,7 @@ This is the automatically generated usage text for ntpq: @exampleindent 0 @example -ntpq - standard NTP query program - Ver. 4.2.5p220 +ntpq - standard NTP query program - Ver. 4.2.5p225 USAGE: ntpq [ - [] | --[@{=| @}] ]... [ host ...] Flg Arg Option-Name Description -4 no ipv4 Force IPv4 DNS name resolution @@ -78,8 +78,8 @@ Options are specified by doubled hyphens and their name or by a single hyphen and the flag character. The following option preset mechanisms are supported: - - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/ntpq/.ntprc + - reading file /m/pogo/users/hart/.ntprc + - reading file /m/pogo/users/hart/ntp-dev-1318-27/ntpq/.ntprc - examining environment variables named NTPQ_* The @@ -151,8 +151,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Increase the debugging message output level. @@ -167,8 +165,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Set the output debugging level. Can be supplied multiple times, diff --git a/ntpq/ntpq.1 b/ntpq/ntpq.1 index a31a6f10b..0e4a1df96 100644 --- a/ntpq/ntpq.1 +++ b/ntpq/ntpq.1 @@ -1,7 +1,7 @@ -.TH NTPQ 1 2009-09-30 "( 4.2.5p225)" "Programmer's Manual" +.TH NTPQ 1 2009-10-03 "( 4.2.5p225)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntpq.1) .\" -.\" It has been AutoGen-ed September 30, 2009 at 07:36:24 AM by AutoGen 5.9.9pre5 +.\" It has been AutoGen-ed Saturday October 3, 2009 at 03:57:54 AM UTC .\" From the definitions ntpq-opts.def .\" and the template file agman1.tpl .\" diff --git a/ntpsnmpd/Makefile.am b/ntpsnmpd/Makefile.am index 41f2b7317..e508aab59 100644 --- a/ntpsnmpd/Makefile.am +++ b/ntpsnmpd/Makefile.am @@ -9,14 +9,12 @@ noinst_HEADERS= ntpSnmpSubagentObject.h # HMS: we probably want a version.o file here, too. LDADD= ../ntpq/libntpq.a ../libntp/libntp.a @SNMP_LIBS@ \ $(LIBOPTS_LDADD) -AM_CPPFLAGS= -I$(top_srcdir)/ntpq \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - @SNMP_CPPFLAGS@ \ - $(LIBOPTS_CFLAGS) \ - $(NULL) +AM_CPPFLAGS= -I$(top_srcdir)/ntpq -I$(top_srcdir)/include \ + -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include \ + @SNMP_CPPFLAGS@ $(LIBOPTS_CFLAGS) + AM_CFLAGS= @SNMP_CFLAGS@ EXTRA_DIST= ntpsnmpd-opts.def ntpsnmpd.1 ntpsnmpd-opts.texi \ ntpsnmpd-opts.menu ntpv4-mib.mib @@ -24,8 +22,7 @@ BUILT_SOURCES= ntpsnmpd-opts.c ntpsnmpd-opts.h ntpsnmpd.1 ntpsnmpd-opts.texi \ ntpsnmpd-opts.menu man_MANS= ntpsnmpd.1 run_ag= cd $(srcdir) && autogen -L ../include --writable -std_def_list= $(top_srcdir)/include/debug-opt.def \ - $(top_srcdir)/include/autogen-version.def \ +std_def_list= $(top_srcdir)/include/autogen-version.def \ $(top_srcdir)/include/copyright.def \ $(top_srcdir)/include/homerc.def \ $(top_srcdir)/include/version.def diff --git a/parseutil/Makefile.am b/parseutil/Makefile.am index 570aac668..8f959aa98 100644 --- a/parseutil/Makefile.am +++ b/parseutil/Makefile.am @@ -3,11 +3,11 @@ NULL= AUTOMAKE_OPTIONS = noinst_PROGRAMS = @TESTDCF@ @DCFD@ EXTRA_PROGRAMS = testdcf dcfd -INCLUDES = -I$(top_srcdir)/include \ - -I$(top_srcdir)/lib/isc/include \ - -I$(top_srcdir)/lib/isc/nothreads/include \ - -I$(top_srcdir)/lib/isc/unix/include \ - $(NULL) + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \ + -I$(top_srcdir)/lib/isc/nothreads/include \ + -I$(top_srcdir)/lib/isc/unix/include + ETAGS_ARGS = Makefile.am DISTCLEANFILES = $(EXTRA_PROGRAMS) #EXTRA_DIST= TAGS diff --git a/ports/winnt/ntpd/ntservice.c b/ports/winnt/ntpd/ntservice.c index a9b823c3f..a4cf01f19 100644 --- a/ports/winnt/ntpd/ntservice.c +++ b/ports/winnt/ntpd/ntservice.c @@ -88,9 +88,15 @@ int main( int argc, char *argv[] ) /* Command line users should put -n in the options */ while (argv[i]) { if (!_strnicmp(argv[i], "-d", 2) || + !strcmp(argv[i], "--debug_level") || + !strcmp(argv[i], "--set-debug_level") || !strcmp(argv[i], "-q") || + !strcmp(argv[i], "--quit") || + !strcmp(argv[i], "-?") || !strcmp(argv[i], "--help") || - !strcmp(argv[i], "-n")) { + !strcmp(argv[i], "-n") || + !strcmp(argv[i], "--nofork") || + !strcmp(argv[i], "--saveconfigquit")) { foreground = TRUE; break; } diff --git a/ports/winnt/vs2008/libntp/libntp.vcproj b/ports/winnt/vs2008/libntp/libntp.vcproj index 731aa4645..35811a518 100644 --- a/ports/winnt/vs2008/libntp/libntp.vcproj +++ b/ports/winnt/vs2008/libntp/libntp.vcproj @@ -708,6 +708,10 @@ RelativePath="..\..\..\..\include\ntp_malloc.h" > + + @@ -813,11 +817,11 @@ > pzLastArg ); } -#endif /* defined DEBUG */ #endif /* defined(TEST_NTP_KEYGEN_OPTS) */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/util/ntp-keygen-opts.h b/util/ntp-keygen-opts.h index 693b93067..5eb01d5bc 100644 --- a/util/ntp-keygen-opts.h +++ b/util/ntp-keygen-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h) * - * It has been AutoGen-ed September 30, 2009 at 07:42:22 AM by AutoGen 5.9.9pre5 + * It has been AutoGen-ed Saturday October 3, 2009 at 03:59:08 AM UTC * From the definitions ntp-keygen-opts.def * and the template file options * @@ -19,7 +19,7 @@ * * This source file is copyrighted and licensed under the following terms: * - * ntp-keygen copyright (c) 1970-2009 David L. Mills and/or others - all rights reserved + * ntp-keygen copyright 1970-2009 David L. Mills and/or others - all rights reserved * * see html/copyright.html */ @@ -206,12 +206,8 @@ typedef enum { #ifdef OPENSSL #define VALUE_OPT_CERTIFICATE 'c' #endif /* OPENSSL */ -#ifdef DEBUG #define VALUE_OPT_DEBUG_LEVEL 'd' -#endif /* DEBUG */ -#ifdef DEBUG #define VALUE_OPT_SET_DEBUG_LEVEL 'D' -#endif /* DEBUG */ #ifdef OPENSSL #define VALUE_OPT_ID_KEY 'e' #endif /* OPENSSL */ diff --git a/util/ntp-keygen-opts.texi b/util/ntp-keygen-opts.texi index 172f42f44..69ab65a75 100644 --- a/util/ntp-keygen-opts.texi +++ b/util/ntp-keygen-opts.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.texi) # -# It has been AutoGen-ed September 30, 2009 at 07:42:25 AM by AutoGen 5.9.9pre5 +# It has been AutoGen-ed Saturday October 3, 2009 at 03:59:10 AM UTC # From the definitions ntp-keygen-opts.def # and the template file aginfo.tpl @end ignore @@ -51,7 +51,7 @@ This is the automatically generated usage text for ntp-keygen: @exampleindent 0 @example Using OpenSSL version 90704f -ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.5p220 +ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.5p225 USAGE: ntp-keygen [ - [] | --[@{=| @}] ]... Flg Arg Option-Name Description -c Str certificate certificate scheme @@ -87,8 +87,8 @@ Options are specified by doubled hyphens and their name or by a single hyphen and the flag character. The following option preset mechanisms are supported: - - reading file /users/stenn/.ntprc - - reading file /deacon/backroom/snaps/ntp-dev/util/.ntprc + - reading file /m/pogo/users/hart/.ntprc + - reading file /m/pogo/users/hart/ntp-dev-1318-27/util/.ntprc - examining environment variables named NTP_KEYGEN_* If there is no new host key, look for an existing one. @@ -129,8 +129,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Increase the debugging message output level. @@ -145,8 +143,6 @@ This option has some usage constraints. It: @itemize @bullet @item may appear an unlimited number of times. -@item -must be compiled in by defining @code{DEBUG} during the compilation. @end itemize Set the output debugging level. Can be supplied multiple times, diff --git a/util/ntp-keygen.1 b/util/ntp-keygen.1 index 25433d617..83d1b5b91 100644 --- a/util/ntp-keygen.1 +++ b/util/ntp-keygen.1 @@ -1,7 +1,7 @@ -.TH NTP-KEYGEN 1 2009-09-30 "(ntp 4.2.5p225)" "Programmer's Manual" +.TH NTP-KEYGEN 1 2009-10-03 "(ntp 4.2.5p225)" "Programmer's Manual" .\" EDIT THIS FILE WITH CAUTION (ntp-keygen.1) .\" -.\" It has been AutoGen-ed September 30, 2009 at 07:42:24 AM by AutoGen 5.9.9pre5 +.\" It has been AutoGen-ed Saturday October 3, 2009 at 03:59:09 AM UTC .\" From the definitions ntp-keygen-opts.def .\" and the template file agman1.tpl .\"