summaryrefslogtreecommitdiffstats
path: root/web/attachments/241808-configure.in_check_dig.c.diff
blob: 3ba9b50ed92e29f3445bfa95a20f3cca6805e207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -Nru configure.in.orig configure.in
--- configure.in.orig	2007-07-28 17:40:54.000000000 +0000
+++ configure.in	2007-07-28 13:38:11.000000000 +0000
@@ -93,6 +93,7 @@
 PKG_ARCH=`uname -p`
 REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
 REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
+first_ip=`/sbin/ifconfig | egrep "inet addr:" | sed -n '1p' | sed 's/ Bcast.*$//' | sed 's/^\s*inet addr://'`
 
 AC_SUBST(PKG_ARCH)
 AC_SUBST(REV_DATESTAMP)
@@ -771,14 +772,14 @@
 	fi
 
 elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
-	$PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
+	$PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
 	ac_cv_ping_packets_first=yes
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -U -w 10 -c 1 127.0.0.1 2>/dev/null | \
+elif $PATH_TO_PING -n -U -w 10 -c 1 $first_ip 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
         with_ping_command="$PATH_TO_PING -n -U -w %d -c %d %s"
@@ -786,52 +787,52 @@
   ac_cv_ping_has_timeout=yes
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -U -c 1 127.0.0.1 2>/dev/null | \
+elif $PATH_TO_PING -n -U -c 1 $first_ip 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
         with_ping_command="$PATH_TO_PING -n -U -c %d %s"
 	ac_cv_ping_packets_first=yes
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
+elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n -c %d %s"
 	ac_cv_ping_packets_first=yes
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n 127.0.0.1 -c 1 2>/dev/null | \
+elif $PATH_TO_PING -n $first_ip -c 1 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n %s -c %d"
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING 127.0.0.1 -n 1 2>/dev/null | \
+elif $PATH_TO_PING $first_ip -n 1 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING %s -n %d"
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
+elif $PATH_TO_PING -n -s $first_ip 56 1 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n -s %s 56 %d"
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -h 127.0.0.1 -s 56 -c 1 2>/dev/null | \
+elif $PATH_TO_PING -n -h $first_ip -s 56 -c 1 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n -h %s -s 56 -c %d"
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -s 56 -c 1 127.0.0.1 2>/dev/null | \
+elif $PATH_TO_PING -n -s 56 -c 1 $first_ip 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n -s 56 -c %d %s"
 	ac_cv_ping_packets_first=yes
 	AC_MSG_RESULT([$with_ping_command])
 
-elif $PATH_TO_PING -n -c 1 127.0.0.1 2>/dev/null | \
+elif $PATH_TO_PING -n -c 1 $first_ip 2>/dev/null | \
 	egrep -i "^round-trip|^rtt" >/dev/null
 then
 	with_ping_command="$PATH_TO_PING -n -c %d %s"
@@ -1034,7 +1035,7 @@
 	if test -n "$PATH_TO_NSLOOKUP"
 	then
 		AC_MSG_CHECKING(for nslookup syntax)
-		if $PATH_TO_NSLOOKUP -sil 127.0.0.1 2>&1 | grep ["Invalid option: sil"] >/dev/null
+		if $PATH_TO_NSLOOKUP -sil $first_ip 2>&1 | grep ["Invalid option: sil"] >/dev/null
 		then
 			ac_cv_nslookup_command="$PATH_TO_NSLOOKUP"
 			AC_MSG_RESULT([$ac_cv_nslookup_command])
diff -Nru plugins/check_dig.c.orig plugins/check_dig.c			
--- plugins/check_dig.c.orig	2007-07-29 20:59:04.000000000 +0200
+++ plugins/check_dig.c	2007-07-29 20:53:15.000000000 +0200
@@ -59,6 +59,7 @@
 char *record_type = "A";
 char *expected_address = NULL;
 char *dns_server = NULL;
+char server_name[256];
 int verbose = FALSE;
 int server_port = DEFAULT_PORT;
 double warning_interval = UNDEFINED;
@@ -277,8 +278,13 @@
       dns_server = argv[c];
     }
     else {
-      dns_server = strdup ("127.0.0.1");
-    }
+      if(gethostname(server_name, 255) != 0) {
+      	host_or_die("Can't get local hostname");
+      }
+      else {
+        dns_server = strdup (server_name);
+      }
+    }  
   }
 
   return validate_arguments ();