diff --git a/vyatta-cjdns/opt/vyatta/sbin/vyatta-cjdns-readconf b/vyatta-cjdns/opt/vyatta/sbin/vyatta-cjdns-readconf index ca8d831..18a4f7d 100755 --- a/vyatta-cjdns/opt/vyatta/sbin/vyatta-cjdns-readconf +++ b/vyatta-cjdns/opt/vyatta/sbin/vyatta-cjdns-readconf @@ -65,18 +65,23 @@ def showConnectionUsernames(): print block['user'] def showConnectionDetails(user): + listedPorts = [] for block in data['authorizedPasswords']: if block['user'] == user: for bind in data['interfaces']['UDPInterface']: if bind['bind'] == "": continue - print '"{}":'.format(bind['bind']), '{' + tokens = bind['bind'].split(":") + if len(tokens) < 2: continue + if tokens[1] in listedPorts: continue + listedPorts += tokens[1] + print '"ip-address:{}":'.format(tokens[-1]), '{' print ' "publicKey": "{}",'.format(data['publicKey']) print ' "login": "{}",'.format(block['user']) print ' "password": "{}"'.format(block['password']) print '}' return print "No such user found" - + try: if sys.argv[2] == "getAdminAddress": getAdminAddress() if sys.argv[2] == "getAdminPassword": getAdminPassword() diff --git a/vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.def b/vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.tag/node.def similarity index 97% rename from vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.def rename to vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.tag/node.def index b987175..749b314 100644 --- a/vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.def +++ b/vyatta-cjdns/opt/vyatta/share/vyatta-op/templates/show/interfaces/cjdns/node.tag/connection-details/node.tag/node.def @@ -1,3 +1,4 @@ +tag: allowed: /opt/vyatta/sbin/vyatta-cjdns-readconf $4 showConnectionUsernames run: /opt/vyatta/sbin/vyatta-cjdns-readconf $4 showConnectionDetails $6 help: Show connection details for a given username