|
|
@ -89,7 +89,7 @@ class HotPlugDevice: |
|
|
|
|
|
|
|
class Log: |
|
|
|
def __init__(self): |
|
|
|
syslog.openlog('pusb_hotplug', syslog.LOG_PID | syslog.LOG_PERROR, |
|
|
|
syslog.openlog('pamusb-agent', syslog.LOG_PID | syslog.LOG_PERROR, |
|
|
|
syslog.LOG_AUTH) |
|
|
|
|
|
|
|
def info(self, message): |
|
|
@ -102,7 +102,7 @@ class Log: |
|
|
|
syslog.syslog(priority, message) |
|
|
|
|
|
|
|
def usage(): |
|
|
|
print 'Usage: %s [--config file] [--daemon] [--path pusb_check_path]' % \ |
|
|
|
print 'Usage: %s [--config file] [--daemon] [--path pamusb-check\'s path]' % \ |
|
|
|
os.path.basename(__file__) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
@ -116,7 +116,7 @@ except getopt.GetoptError: |
|
|
|
|
|
|
|
options = {'configFile' : '/etc/pusb/pusb.conf', |
|
|
|
'daemon' : False, |
|
|
|
'path' : '/usr/bin/pusb_check'} |
|
|
|
'path' : '/usr/bin/pamusb-check'} |
|
|
|
|
|
|
|
if len(args) != 0: |
|
|
|
usage() |
|
|
@ -134,7 +134,7 @@ for o, a in opts: |
|
|
|
|
|
|
|
if not os.path.exists(options['path']): |
|
|
|
print '%s not found.' % options['path'] |
|
|
|
print "You might specify manually pusb_check's location using --path." |
|
|
|
print "You might specify manually pamusb-check's location using --path." |
|
|
|
usage() |
|
|
|
|
|
|
|
username = pwd.getpwuid(os.getuid())[0] |
|
|
@ -182,7 +182,7 @@ def authChangeCallback(event): |
|
|
|
|
|
|
|
logger.info('Device "%s" has been inserted. ' \ |
|
|
|
'Performing verification...' % deviceName) |
|
|
|
cmdLine = "%s -q -c %s -u %s -s pusb_hotplug -a" % (options['path'], |
|
|
|
cmdLine = "%s -q -c %s -u %s -s pamusb-agent -a" % (options['path'], |
|
|
|
options['configFile'], |
|
|
|
username) |
|
|
|
logger.info('Executing "%s"' % cmdLine) |
|
|
@ -204,7 +204,7 @@ hpDev.addCallback(authChangeCallback) |
|
|
|
if options['daemon'] and os.fork(): |
|
|
|
sys.exit(0) |
|
|
|
|
|
|
|
logger.info('pusb_hotplug up and running.') |
|
|
|
logger.info('pamusb-agent up and running.') |
|
|
|
logger.info('Watching device "%s" for user "%s"' % (deviceName, username)) |
|
|
|
|
|
|
|
try: |