aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2004-06-25 07:00:54 +0000
committerJörg Mayer <jmayer@loplof.de>2004-06-25 07:00:54 +0000
commit021f72021e8de04728950de107fa94c750dfbc9b (patch)
tree88f8b5408d401a86cd757681ee2afb5c41bebe89 /util.c
parente790073f3afed22dc5084a37424e35ab14412400 (diff)
Fix automagically generated filters in case of remote login via IPv6.
This fix was picked from the source rpm of Suse 9.1. svn path=/trunk/; revision=11234
Diffstat (limited to 'util.c')
-rw-r--r--util.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/util.c b/util.c
index 524f0a43ed..29777962e0 100644
--- a/util.c
+++ b/util.c
@@ -1,7 +1,7 @@
/* util.c
* Utility routines
*
- * $Id: util.c,v 1.80 2004/05/22 07:50:15 guy Exp $
+ * $Id: util.c,v 1.81 2004/06/25 07:00:54 jmayer Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -56,6 +56,8 @@ typedef int mode_t; /* for win32 */
#endif /* __MINGW32__ */
#endif /* HAVE_IO_H */
+#include <epan/resolv.h>
+
/*
* This has to come after the include of <pcap.h>, as the include of
* <pcap.h> might cause <winsock2.h> to be included, and if we've
@@ -419,21 +421,21 @@ gchar *get_conn_cfilter(void) {
if ((env = getenv("SSH_CONNECTION")) != NULL) {
tokens = g_strsplit(env, " ", 4);
if (tokens[3]) {
- g_string_sprintf(filter_str, "not (tcp port %s and ip host %s "
- "and tcp port %s and ip host %s)", tokens[1], tokens[0],
- tokens[3], tokens[2]);
+ g_string_sprintf(filter_str, "not (tcp port %s and %s host %s "
+ "and tcp port %s and %s host %s)", tokens[1], host_ip_af(tokens[0]), tokens[0],
+ tokens[3], host_ip_af(tokens[2]), tokens[2]);
return filter_str->str;
}
} else if ((env = getenv("SSH_CLIENT")) != NULL) {
tokens = g_strsplit(env, " ", 3);
- g_string_sprintf(filter_str, "not (tcp port %s and ip host %s "
- "and tcp port %s)", tokens[1], tokens[0], tokens[2]);
+ g_string_sprintf(filter_str, "not (tcp port %s and %s host %s "
+ "and tcp port %s)", tokens[1], host_ip_af(tokens[0]), tokens[0], tokens[2]);
return filter_str->str;
} else if ((env = getenv("REMOTEHOST")) != NULL) {
if (strcasecmp(env, "localhost") == 0 || strcmp(env, "127.0.0.1") == 0) {
return "";
}
- g_string_sprintf(filter_str, "not ip host %s", env);
+ g_string_sprintf(filter_str, "not %s host %s", host_ip_af(env), env);
return filter_str->str;
} else if ((env = getenv("DISPLAY")) != NULL) {
tokens = g_strsplit(env, ":", 2);
@@ -442,13 +444,13 @@ gchar *get_conn_cfilter(void) {
strcmp(tokens[0], "127.0.0.1") == 0) {
return "";
}
- g_string_sprintf(filter_str, "not ip host %s",
- tokens[0]);
+ g_string_sprintf(filter_str, "not %s host %s",
+ host_ip_af(tokens[0]), tokens[0]);
return filter_str->str;
}
} else if ((env = getenv("CLIENTNAME")) != NULL) {
if (g_strcasecmp("console", env) != 0) {
- g_string_sprintf(filter_str, "not ip host %s", env);
+ g_string_sprintf(filter_str, "not %s host %s", host_ip_af(env), env);
return filter_str->str;
}
}