From b6c2aff0d1d2930d73937b7d07e603a905884be8 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Thu, 21 May 2020 18:34:21 +0300 Subject: [PATCH] Agent: check count of 'cmd' tags --- tools/pamusb-agent | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/pamusb-agent b/tools/pamusb-agent index b06da3e..5889f8b 100755 --- a/tools/pamusb-agent +++ b/tools/pamusb-agent @@ -186,6 +186,10 @@ def userDeviceThread(user): for hotplug in user.findall('agent'): henvs = {} + if len(hotplug.findall('cmd')) != 1: + logger.error('one command for an agent must be determined in user "%s" configuration.' % userName) + return 1 + for henv in hotplug.findall('env'): henv_var = re.sub(r'^(.*?)=.*$', '\\1', henv.text) henv_arg = re.sub(r'^.*?=(.*)$', '\\1', henv.text)