From 91ec8c45841e6622b1c093234836f41a30cd72fb Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Fri, 12 Jan 2007 20:47:52 +0000 Subject: [PATCH] Handle devices without UUID. Disable one time pads if so --- pam_usb/tools/pusb_conf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pam_usb/tools/pusb_conf b/pam_usb/tools/pusb_conf index c12c2f7..abc545e 100755 --- a/pam_usb/tools/pusb_conf +++ b/pam_usb/tools/pusb_conf @@ -106,7 +106,11 @@ def addDevice(options): print 'Vendor\t\t: %s' % device.vendor print 'Model\t\t: %s' % device.product print 'Serial\t\t: %s' % device.serialNumber - print 'Volume UUID\t: %s (%s)' % (volume['uuid'], volume['device']) + if volume['uuid'] != '': + print 'Volume UUID\t: %s (%s)' % (volume['uuid'], volume['device']) + else: + print + print 'WARNING: No UUID detected for device %s. One time pads will be disabled.' % volume['device'] print print 'Save device to %s ?' % options['configFile'] @@ -134,6 +138,13 @@ def addDevice(options): e.appendChild(t) dev.appendChild(e) + # Disable one time pads if there's no device UUID + if volume['uuid'] == '': + e = doc.createElement('option') + e.setAttribute('name', 'one_time_pad') + e.appendChild(doc.createTextNode('false')) + dev.appendChild(e) + try: f = open(options['configFile'], 'w') f.write(doc.toxml())