Skip to content

Commit

Permalink
Make sure optarg is set before calling parse().
Browse files Browse the repository at this point in the history
  • Loading branch information
ldx committed Feb 2, 2013
1 parent 5a64626 commit f07d9dd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions iptc/xtables.py
Expand Up @@ -337,6 +337,9 @@ def _parse(self, module, argv, inv, flags, entry, ptr):
# Dispatch arguments to the appropriate parse function, based upon the
# extension's choice of API.
def parse_target(self, argv, invert, t, fw, ptr):
_optarg.value = argv[1]
_optind.value = 2

if not t.x6_options or not t.x6_parse: # old API
self._parse(t, argv, invert, t.tflags, fw, ptr)
return
Expand All @@ -346,9 +349,6 @@ def parse_target(self, argv, invert, t, fw, ptr):
if not entry:
raise XTablesError("%s does not know parameter" % (t.name, argv[0]))

_optarg.value = argv[1]
_optind.value = 2

cb = xt_option_call()
cb.entry = ct.pointer(entry)
cb.arg = _optarg
Expand All @@ -368,6 +368,9 @@ def parse_target(self, argv, invert, t, fw, ptr):
# Dispatch arguments to the appropriate parse function, based upon the
# extension's choice of API.
def parse_match(self, argv, invert, m, fw, ptr):
_optarg.value = argv[1]
_optind.value = 2

if not m.x6_options or not m.x6_parse: # old API
self._parse(m, argv, invert, m.mflags, fw, ptr)
return
Expand All @@ -377,9 +380,6 @@ def parse_match(self, argv, invert, m, fw, ptr):
if not entry:
raise XTablesError("%s does not know parameter" % (m.name, argv[0]))

_optarg.value = argv[1]
_optind.value = 2

cb = xt_option_call()
cb.entry = ct.pointer(entry)
cb.arg = _optarg
Expand Down

0 comments on commit f07d9dd

Please sign in to comment.