[master] 6e7c5cf Complain if no -a arguments.

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 14 10:53:51 CEST 2015


commit 6e7c5cf62cc1a54caf7937c70a881a2846e84b11
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 14 08:53:15 2015 +0000

    Complain if no -a arguments.
    
    Also open argv-supplied secret files with elevated privs.

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 48e654e..3622b12 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -599,11 +599,13 @@ main(int argc, char * const *argv)
 		fprintf(stderr,
 		    "Warning: Empty -S argument, no CLI authentication.\n");
 	} else if (S_arg != NULL) {
+		VJ_master(JAIL_MASTER_FILE);
 		o = open(S_arg, O_RDONLY, 0);
 		if (o < 0)
 			ARGV_ERR("Cannot open -S file (%s): %s\n",
 			    S_arg, strerror(errno));
 		AZ(close(o));
+		VJ_master(JAIL_MASTER_LOW);
 	}
 
 	if (f_arg != NULL) {
@@ -651,6 +653,9 @@ main(int argc, char * const *argv)
 	} else if (C_flag)
 		ARGV_ERR("-C only good with -b or -f\n");
 
+	if (VTAILQ_EMPTY(&heritage.socks))
+		ARGV_ERR("Need -a argument(s)\n");
+
 	if (!d_flag) {
 		if (b_arg == NULL && f_arg == NULL) {
 			fprintf(stderr,



More information about the varnish-commit mailing list