~ubuntu-branches/ubuntu/trusty/ufw/trusty-proposed

« back to all changes in this revision

Viewing changes to src/parser.py

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2012-04-04 12:12:25 UTC
  • mfrom: (30.1.13)
  • mto: This revision was merged to the branch mainline in revision 65.
  • Revision ID: package-import@ubuntu.com-20120404121225-pjt6j7hm3ua0q580
Tags: 0.31.1-1
* New upstream release (Closes: 663677, Closes: 625681)
* debian/control: update to standards 3.9.3
* convert to source format 3.0 (quilt)
* 0001-optimize-boot.patch: only read in /etc/ufw/ufw.conf when disabled
* debian/rules: adjust to only install the application profiles when not
  Ubuntu
* debian/po/nl.po: add Dutch translation of debconf templates. Thanks to
  Jeroen Schot (Closes: 658495)
* debian/po/da.po: add Danish translation of debconf templates. Thanks to
  Joe Dalton (Closes: 666557)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# parser.py: parser class for ufw
3
3
#
4
 
# Copyright 2009-2010 Canonical Ltd.
 
4
# Copyright 2009-2011 Canonical Ltd.
5
5
#
6
6
#    This program is free software: you can redistribute it and/or modify
7
7
#    it under the terms of the GNU General Public License version 3,
39
39
from common import UFWError
40
40
from ufw.util import debug
41
41
 
42
 
import sys
43
 
 
44
42
class UFWCommand:
45
43
    '''Generic class for parser commands.'''
46
44
    def __init__(self, type, command):
106
104
                # Using position '0' adds rule at end, which is potentially
107
105
                # confusing for the end user
108
106
                if insert_pos == "0":
109
 
                    err_msg = _("Cannot insert rule at position '%s'") % \
 
107
                    err_msg = _("Cannot insert rule at position '%s'") % \
110
108
                                (insert_pos)
111
109
                    raise UFWError(err_msg)
112
110
 
401
399
        # Verify protocol not specified with application rule
402
400
        if rule and rule.protocol != "any" and \
403
401
           (rule.sapp != "" or rule.dapp != ""):
404
 
            app = ""
405
 
            if rule.dapp:
406
 
                app = rule.dapp
407
 
            else:
408
 
                app = rule.sapp
409
402
            err_msg = _("Improper rule syntax ('%s' specified with app rule)") \
410
403
                        % (rule.protocol)
411
404
            raise UFWError(err_msg)