~ubuntu-branches/debian/jessie/ufw/jessie

« back to all changes in this revision

Viewing changes to src/backend.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2009-07-25 07:01:56 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090725070156-sd66sj75tqtqow03
Tags: 0.28-2
debian/templates: also fix typo in master template

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import sys
24
24
import ufw.util
25
25
from ufw.util import warn, debug
26
 
from ufw.common import UFWError, config_dir, UFWRule
 
26
from ufw.common import UFWError, config_dir, iptables_dir, UFWRule
27
27
import ufw.applications
28
28
 
29
29
class UFWBackend:
55
55
            raise
56
56
 
57
57
        self.profiles = ufw.applications.get_profiles(self.files['apps'])
58
 
        self.iptables_version = ufw.util.get_iptables_version()
 
58
 
 
59
        self.iptables = os.path.join(iptables_dir, "iptables")
 
60
        self.iptables_restore = os.path.join(iptables_dir, "iptables-restore")
 
61
        self.ip6tables = os.path.join(iptables_dir, "ip6tables")
 
62
        self.ip6tables_restore = os.path.join(iptables_dir, \
 
63
                                              "ip6tables-restore")
 
64
 
 
65
        self.iptables_version = ufw.util.get_iptables_version(self.iptables)
59
66
 
60
67
    def _is_enabled(self):
61
68
        if self.defaults.has_key('enabled') and \
135
142
                    raise
136
143
 
137
144
                if statinfo.st_uid != 0 and not warned_owner.has_key(path):
138
 
                    warn_msg = _("uid is %s but '%s' is owned by %s") % \
139
 
                                (str(uid), path, str(statinfo.st_uid))
 
145
                    warn_msg = _("uid is %(uid)s but '%(path)s' is owned by " \
 
146
                                 "%(st_uid)s") % ({'uid': str(uid), \
 
147
                                               'path': path, \
 
148
                                               'st_uid': str(statinfo.st_uid)})
140
149
                    warn(warn_msg)
141
150
                    warned_owner[path] = True
142
151
                if mode & S_IWOTH and not warned_world_write.has_key(path):
157
166
 
158
167
        for f in self.files:
159
168
            if f != 'apps' and not os.path.isfile(self.files[f]):
160
 
                err_msg = _("'%s' file '%s' does not exist") % (f, \
161
 
                                                                self.files[f])
 
169
                err_msg = _("'%(f)s' file '%(name)s' does not exist") % \
 
170
                           ({'f': f, 'name': self.files[f]})
162
171
                raise UFWError(err_msg)
163
172
 
164
173
    def _get_defaults(self):
561
570
    def update_logging(self, level):
562
571
        raise UFWError("UFWBackend.update_logging: need to override")
563
572
 
 
573