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

  • Committer: Teddy Hogeborn
  • Date: 2010-09-25 16:53:58 UTC
  • Revision ID: teddy@fukt.bsnet.se-20100925165358-6fvrfd4ws9am7dgf
* mandos-ctl: Bug fix: only show properties of specifies clients.

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
        parser.add_option("-D", "--deny", action="store_true",
162
162
                          help="Deny any current client request")
163
163
        options, client_names = parser.parse_args()
164
 
 
 
164
        
165
165
        if has_actions(options) and not client_names and not options.all:
166
166
            parser.error('Options requires clients names or --all.')
167
167
        if options.verbose and has_actions(options):
195
195
            print >> sys.stderr, "Access denied: Accessing mandos server through dbus."
196
196
            sys.exit(1)
197
197
            
198
 
        # Compile list of clients to process
199
 
        clients=[]
200
 
 
 
198
        # Compile dict of (clients: properties) to process
 
199
        clients={}
 
200
        
201
201
        if options.all or not client_names:
202
 
            clients = (bus.get_object(busname, path) for path in mandos_clients.iterkeys())
 
202
            clients = dict((bus.get_object(busname, path), properties)
 
203
                           for path, properties in
 
204
                           mandos_clients.iteritems())
203
205
        else:
204
206
            for name in client_names:
205
207
                for path, client in mandos_clients.iteritems():
206
208
                    if client['Name'] == name:
207
209
                        client_objc = bus.get_object(busname, path)
208
 
                        clients.append(client_objc)
 
210
                        clients[client_objc] = client
209
211
                        break
210
212
                else:
211
213
                    print >> sys.stderr, "Client not found on server: %r" % name
219
221
            else:
220
222
                keywords = defaultkeywords
221
223
                
222
 
            print_clients(mandos_clients.values(), keywords)
 
224
            print_clients(clients.values(), keywords)
223
225
        else:
224
226
            # Process each client in the list by all selected options
225
227
            for client in clients: