File nm-iptables-path.patch of Package NetworkManager
Index: NetworkManager-0.7.0/configure.in
===================================================================
--- NetworkManager-0.7.0.orig/configure.in
+++ NetworkManager-0.7.0/configure.in
@@ -435,6 +435,19 @@ if test -n "${RESOLVCONF_PATH}"; then
AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$RESOLVCONF_PATH", [Define if you have a resolvconf implementation])
fi
+# iptables path
+AC_ARG_WITH(iptables, AC_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables]))
+if test "x${with_iptables}" = x; then
+ AC_PATH_PROG(IPTABLES_PATH, iptables, [], $PATH:/sbin:/usr/sbin)
+ if ! test -x "$IPTABLES_PATH"; then
+ AC_MSG_ERROR(iptables was not installed.)
+ fi
+else
+ IPTABLES_PATH="$with_iptables"
+fi
+AC_DEFINE_UNQUOTED(IPTABLES_PATH, "$IPTABLES_PATH", [Define to path of iptables binary])
+AC_SUBST(IPTABLES_PATH)
+
# system CA certificates path
AC_ARG_WITH(system-ca-path, AS_HELP_STRING([--with-system-ca-path=/path/to/ssl/certs], [path to system CA certificates]))
if test "x${with_system_ca_path}" = x; then
Index: NetworkManager-0.7.0/src/nm-activation-request.c
===================================================================
--- NetworkManager-0.7.0.orig/src/nm-activation-request.c
+++ NetworkManager-0.7.0/src/nm-activation-request.c
@@ -711,22 +711,24 @@ nm_act_request_set_shared (NMActRequest
for (iter = list; iter; iter = g_slist_next (iter)) {
ShareRule *rule = (ShareRule *) iter->data;
char *envp[1] = { NULL };
- char **argv;
+ char *argv[6];
char *cmd;
int status;
GError *error = NULL;
+ argv[0] = IPTABLES_PATH;
+ argv[1] = "--table";
+ argv[2] = rule->table;
+
if (shared)
- cmd = g_strdup_printf ("/sbin/iptables --table %s --insert %s", rule->table, rule->rule);
+ argv[3] = "--insert";
else
- cmd = g_strdup_printf ("/sbin/iptables --table %s --delete %s", rule->table, rule->rule);
+ argv[3] = "--delete";
- argv = g_strsplit (cmd, " ", 0);
- if (!argv || !argv[0]) {
- continue;
- g_free (cmd);
- }
+ argv[4] = rule->rule;
+ argv[5] = NULL;
+ cmd = g_strjoinv (" ", argv);
nm_info ("Executing: %s", cmd);
g_free (cmd);
@@ -738,8 +740,6 @@ nm_act_request_set_shared (NMActRequest
g_error_free (error);
} else if (WEXITSTATUS (status))
nm_info ("** Command returned exit status %d.", WEXITSTATUS (status));
-
- g_strfreev (argv);
}
g_slist_free (list);