Browse Source

Agent: check that command(s) are supplied in agent XML element

master
Pekka Helenius 4 years ago
parent
commit
0b08062797
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      tools/pamusb-agent

+ 8
- 6
tools/pamusb-agent View File

@ -220,10 +220,11 @@ def userDeviceThread(user):
'locking down user "%s"...' % (deviceName, userName)) 'locking down user "%s"...' % (deviceName, userName))
for l in events['lock']: for l in events['lock']:
for cmd in l['cmd']:
if len(l['cmd']) != 0:
for cmd in l['cmd']:
logger.info('Running "%s"' % cmd)
subprocess.run(cmd.split(), env=l['env'], preexec_fn=runAs(uid, gid))
logger.info('Running "%s"' % cmd)
subprocess.run(cmd.split(), env=l['env'], preexec_fn=runAs(uid, gid))
logger.info('Locked.') logger.info('Locked.')
return return
@ -238,10 +239,11 @@ def userDeviceThread(user):
'Unlocking user "%s"...' % userName) 'Unlocking user "%s"...' % userName)
for l in events['unlock']: for l in events['unlock']:
for cmd in l['cmd']:
if len(l['cmd']) != 0:
for cmd in l['cmd']:
logger.info('Running "%s"' % cmd)
subprocess.run(cmd.split(), env=l['env'], preexec_fn=runAs(uid, gid))
logger.info('Running "%s"' % cmd)
subprocess.run(cmd.split(), env=l['env'], preexec_fn=runAs(uid, gid))
logger.info('Unlocked.') logger.info('Unlocked.')
return return


Loading…
Cancel
Save