Permalink
Browse files

check for incorrect bootstrap using loopback address

  • Loading branch information...
1 parent bc20147 commit 5ec32e5cdf60f11992e96484b49725872ebea349 @estenberg estenberg committed Apr 12, 2012
Showing with 24 additions and 1 deletion.
  1. +1 −1 src/Makefile.am
  2. +17 −0 src/addr_lib.c
  3. +6 −0 src/cf-agent.c
View
2 src/Makefile.am
@@ -23,7 +23,7 @@ libpromises_la_CFLAGS = $(AM_CFLAGS)
libpromises_la_SOURCES = \
cf3parse.y cf3parse.h \
cf3lex.l \
- addr_lib.c \
+ addr_lib.c addr_lib.h \
alloc.c alloc.h \
alphalist.c alphalist.h \
args.c \
View
17 src/addr_lib.c
@@ -344,3 +344,20 @@ int FuzzyHostMatch(char *arg0, char *arg1, char *refhost)
return 0;
}
+
+/*********************************************************************/
+
+bool IsLoopbackAddress(char *address)
+{
+ if(strcmp(address, "localhost") == 0)
+ {
+ return true;
+ }
+
+ if(strcmp(address, "127.0.0.1") == 0)
+ {
+ return true;
+ }
+
+ return false;
+}
View
6 src/cf-agent.c
@@ -31,6 +31,7 @@
#include "generic_agent.h"
#include "verify_environments.h"
+#include "addr_lib.h"
extern int PR_KEPT;
extern int PR_REPAIRED;
@@ -218,6 +219,11 @@ static GenericAgentConfig CheckOpts(int argc, char **argv)
break;
case 's':
+
+ if(IsLoopbackAddress(optarg))
+ {
+ FatalError("Use a non-loopback address when bootstrapping");
+ }
// temporary assure that network functions are working
OpenNetwork();

0 comments on commit 5ec32e5

Please sign in to comment.