/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-monitor

  • Committer: Teddy Hogeborn
  • Date: 2011-08-07 14:49:02 UTC
  • Revision ID: teddy@fukt.bsnet.se-20110807144902-ika77xz6rgaijwmw
* plugins.d/mandos-client.c (main): Do not even try to work around
                                    Debian bug 633582 if --seckey or
                                    --pubkey specifies a different
                                    directory.  Bug fix: Remove all
                                    files in GPG temporary directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Contact the authors at <mandos@fukt.bsnet.se>.
23
23
24
24
 
25
 
from __future__ import division, absolute_import, print_function, unicode_literals
 
25
from __future__ import (division, absolute_import, print_function,
 
26
                        unicode_literals)
26
27
 
27
28
import sys
28
29
import os
51
52
domain = 'se.bsnet.fukt'
52
53
server_interface = domain + '.Mandos'
53
54
client_interface = domain + '.Mandos.Client'
54
 
version = "1.3.0"
 
55
version = "1.3.1"
55
56
 
56
57
# Always run in monochrome mode
57
58
urwid.curses_display.curses.has_colors = lambda : False
86
87
        self.proxy = proxy_object # Mandos Client proxy object
87
88
        
88
89
        self.properties = dict()
89
 
        self.proxy.connect_to_signal("PropertyChanged",
90
 
                                     self.property_changed,
91
 
                                     client_interface,
92
 
                                     byte_arrays=True)
 
90
        self.property_changed_match = (
 
91
            self.proxy.connect_to_signal("PropertyChanged",
 
92
                                         self.property_changed,
 
93
                                         client_interface,
 
94
                                         byte_arrays=True))
93
95
        
94
96
        self.properties.update(
95
97
            self.proxy.GetAll(client_interface,
96
98
                              dbus_interface = dbus.PROPERTIES_IFACE))
97
99
 
98
 
        #XXX This break good super behaviour!
 
100
        #XXX This breaks good super behaviour
99
101
#        super(MandosClientPropertyCache, self).__init__(
100
102
#            *args, **kwargs)
101
103
    
105
107
        """
106
108
        # Update properties dict with new value
107
109
        self.properties[property] = value
 
110
    
 
111
    def delete(self, *args, **kwargs):
 
112
        self.property_changed_match.remove()
 
113
        super(MandosClientPropertyCache, self).__init__(
 
114
            *args, **kwargs)
108
115
 
109
116
 
110
117
class MandosClientWidget(urwid.FlowWidget, MandosClientPropertyCache):
154
161
        if self.need_approval:
155
162
            self.using_timer(True)
156
163
        
157
 
        self.proxy.connect_to_signal("CheckerCompleted",
158
 
                                     self.checker_completed,
159
 
                                     client_interface,
160
 
                                     byte_arrays=True)
161
 
        self.proxy.connect_to_signal("CheckerStarted",
162
 
                                     self.checker_started,
163
 
                                     client_interface,
164
 
                                     byte_arrays=True)
165
 
        self.proxy.connect_to_signal("GotSecret",
166
 
                                     self.got_secret,
167
 
                                     client_interface,
168
 
                                     byte_arrays=True)
169
 
        self.proxy.connect_to_signal("NeedApproval",
170
 
                                     self.need_approval,
171
 
                                     client_interface,
172
 
                                     byte_arrays=True)
173
 
        self.proxy.connect_to_signal("Rejected",
174
 
                                     self.rejected,
175
 
                                     client_interface,
176
 
                                     byte_arrays=True)
 
164
        self.match_objects = (
 
165
            self.proxy.connect_to_signal("CheckerCompleted",
 
166
                                         self.checker_completed,
 
167
                                         client_interface,
 
168
                                         byte_arrays=True),
 
169
            self.proxy.connect_to_signal("CheckerStarted",
 
170
                                         self.checker_started,
 
171
                                         client_interface,
 
172
                                         byte_arrays=True),
 
173
            self.proxy.connect_to_signal("GotSecret",
 
174
                                         self.got_secret,
 
175
                                         client_interface,
 
176
                                         byte_arrays=True),
 
177
            self.proxy.connect_to_signal("NeedApproval",
 
178
                                         self.need_approval,
 
179
                                         client_interface,
 
180
                                         byte_arrays=True),
 
181
            self.proxy.connect_to_signal("Rejected",
 
182
                                         self.rejected,
 
183
                                         client_interface,
 
184
                                         byte_arrays=True))
 
185
        #self.logger('Created client %s' % (self.properties["Name"]))
177
186
    
178
187
    def property_changed(self, property=None, value=None):
179
188
        super(self, MandosClientWidget).property_changed(property,
341
350
        self.update()
342
351
        return True             # Keep calling this
343
352
    
344
 
    def delete(self):
 
353
    def delete(self, *args, **kwargs):
345
354
        if self._update_timer_callback_tag is not None:
346
355
            gobject.source_remove(self._update_timer_callback_tag)
347
356
            self._update_timer_callback_tag = None
 
357
        for match in self.match_objects:
 
358
            match.remove()
 
359
        self.match_objects = ()
348
360
        if self.delete_hook is not None:
349
361
            self.delete_hook(self)
 
362
        return super(MandosClientWidget, self).delete(*args, **kwargs)
350
363
    
351
364
    def render(self, maxcolrow, focus=False):
352
365
        """Render differently if we have focus.
580
593
        #self.log_message("Wrap mode: " + self.log_wrap)
581
594
    
582
595
    def find_and_remove_client(self, path, name):
583
 
        """Find an client from its object path and remove it.
 
596
        """Find a client by its object path and remove it.
584
597
        
585
598
        This is connected to the ClientRemoved signal from the
586
599
        Mandos server object."""
588
601
            client = self.clients_dict[path]
589
602
        except KeyError:
590
603
            # not found?
 
604
            self.log_message("Unknown client %r (%r) removed", name,
 
605
                             path)
591
606
            return
592
 
        self.remove_client(client, path)
 
607
        client.delete()
593
608
    
594
609
    def add_new_client(self, path):
595
610
        client_proxy_object = self.bus.get_object(self.busname, path)