/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2019-11-21 19:50:51 UTC
  • Revision ID: teddy@recompile.se-20191121195051-jq57g07ybacsjw3r
Makefile: Declare phoniness of targets at each target

Instead of having one global list of .PHONY targets, with its
associated risk of that list becoming out-of-date, declare a target to
be phony at each target declaration.

* Makefile (.PHONY): Remove global list.  Spread out .PHONY
  declarations to be located before the declaration of each target.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
import collections
79
79
import codecs
80
80
import unittest
81
 
import random
82
 
import shlex
83
81
 
84
82
import dbus
85
83
import dbus.service
93
91
 
94
92
if sys.version_info.major == 2:
95
93
    __metaclass__ = type
96
 
    str = unicode
97
 
 
98
 
# Add collections.abc.Callable if it does not exist
99
 
try:
100
 
    collections.abc.Callable
101
 
except AttributeError:
102
 
    class abc:
103
 
        Callable = collections.Callable
104
 
    collections.abc = abc
105
 
    del abc
106
 
 
107
 
# Add shlex.quote if it does not exist
108
 
try:
109
 
    shlex.quote
110
 
except AttributeError:
111
 
    shlex.quote = re.escape
112
94
 
113
95
# Show warnings by default
114
96
if not sys.warnoptions:
140
122
            # No value found
141
123
            SO_BINDTODEVICE = None
142
124
 
 
125
if sys.version_info.major == 2:
 
126
    str = unicode
 
127
 
143
128
if sys.version_info < (3, 2):
144
129
    configparser.Configparser = configparser.SafeConfigParser
145
130
 
1052
1037
        if self.checker_initiator_tag is not None:
1053
1038
            GLib.source_remove(self.checker_initiator_tag)
1054
1039
        self.checker_initiator_tag = GLib.timeout_add(
1055
 
            random.randrange(int(self.interval.total_seconds() * 1000
1056
 
                                 + 1)),
 
1040
            int(self.interval.total_seconds() * 1000),
1057
1041
            self.start_checker)
1058
1042
        # Schedule a disable() when 'timeout' has passed
1059
1043
        if self.disable_initiator_tag is not None:
1134
1118
        if self.checker is None:
1135
1119
            # Escape attributes for the shell
1136
1120
            escaped_attrs = {
1137
 
                attr: shlex.quote(str(getattr(self, attr)))
 
1121
                attr: re.escape(str(getattr(self, attr)))
1138
1122
                for attr in self.runtime_expansions}
1139
1123
            try:
1140
1124
                command = self.checker_command % escaped_attrs
1429
1413
                raise ValueError("Byte arrays not supported for non-"
1430
1414
                                 "'ay' signature {!r}"
1431
1415
                                 .format(prop._dbus_signature))
1432
 
            value = dbus.ByteArray(bytes(value))
 
1416
            value = dbus.ByteArray(b''.join(chr(byte)
 
1417
                                            for byte in value))
1433
1418
        prop(value)
1434
1419
 
1435
1420
    @dbus.service.method(dbus.PROPERTIES_IFACE,
2764
2749
        if command == 'getattr':
2765
2750
            attrname = request[1]
2766
2751
            if isinstance(client_object.__getattribute__(attrname),
2767
 
                          collections.abc.Callable):
 
2752
                          collections.Callable):
2768
2753
                parent_pipe.send(('function', ))
2769
2754
            else:
2770
2755
                parent_pipe.send((