[Git][NTPsec/ntpsec][master] ntpd: print error message, and fail, for obsolete -b and -r.

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 19:58:09 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
a794256b by Gary E. Miller at 2017-04-14T12:57:17-07:00
ntpd: print error message, and fail, for obsolete -b and -r.

The broadcast options removed a while ago.

- - - - -


1 changed file:

- ntpd/ntpd.c


Changes:

=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -128,7 +128,7 @@ extern  void    close_all_beyond(int);
 extern  void    close_all_except(int);
 
 
-#define ALL_OPTIONS "46c:dD:f:gGhi:I:k:l:LmnNp:PqRs:t:u:U:Vw:xzZ"
+#define ALL_OPTIONS "46bc:dD:f:gGhi:I:k:l:LmnNp:Pqr:Rs:t:u:U:Vw:xzZ"
 static const struct option longoptions[] = {
     { "ipv4",		    0, 0, '4' },
     { "ipv6",		    0, 0, '6' },
@@ -244,7 +244,10 @@ parse_cmdline_opts(
 		opt_ipv6 = true;
 		break;
 	    case 'b':
-                /* huh?? */
+		fputs("ERROR: Obsolete and unsupported broadcast option -b\n",
+                      stderr);
+		ntpd_usage();
+		exit(1);
 		break;
 	    case 'c':
 		if (ntp_optarg != NULL)
@@ -326,17 +329,10 @@ parse_cmdline_opts(
 		nofork = true;
 		break;
 	    case 'r':
-                /* huh? */
-		if (ntp_optarg != NULL)
-		{
-		    double tmp;
-		    if (sscanf(ntp_optarg, "%lf", &tmp) != 1) {
-			msyslog(LOG_ERR,
-				"command line broadcast delay value %s undecodable",
-				ntp_optarg);
-			exit(0);
-		    }
-		}
+		fputs("ERROR: Obsolete and unsupported broadcast option -r\n",
+                      stderr);
+		ntpd_usage();
+		exit(1);
 	        break;
 	    case 'R':	/* undocumented -- dump CLI options for testing */
 		dumpopts = true;
@@ -403,7 +399,8 @@ parse_cmdline_opts(
 		/* defer */
 		break;
 	    default:
-		fputs("Unknown command line switch or missing argument.\n", stderr);
+		fputs("Unknown command line switch or missing argument.\n",
+                      stderr);
 		ntpd_usage();
 		exit(1);
 	    } /*switch*/
@@ -704,6 +701,14 @@ ntpdmain(
 	    switch (op) {
             case '4':
             case '6':
+                /* handled elsewhere */
+                break;
+	    case 'b':
+		fputs("ERROR: Obsolete and unsupported broadcast option -b\n",
+                      stderr);
+		ntpd_usage();
+		exit(1);
+		break;
             case 'c':
             case 'd':
             case 'D':
@@ -744,6 +749,14 @@ ntpdmain(
 		break;
             case 'P':
             case 'q':
+                /* handled elsewhere */
+                break;
+	    case 'r':
+		fputs("ERROR: Obsolete and unsupported broadcast option -r\n",
+                      stderr);
+		ntpd_usage();
+		exit(1);
+		break;
             case 'R':
                 /* handled elsewhere */
                 break;



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a794256bf41a81e58262ea597a97059387210d4b

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a794256bf41a81e58262ea597a97059387210d4b
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170414/283053ef/attachment.html>


More information about the vc mailing list