From fd7f9d19081948755d92a35b53c17306a1a5db3f Mon Sep 17 00:00:00 2001
From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Date: Wed, 24 Aug 2011 18:00:27 -0300
Subject: [PATCH] bandwidth.sh: Added a test to check if the user is in
 sudoers(1)

If the agent was updated from old versions (which didn't have root
permissions), it will avoid running the bandwidth.sh script while keeping to
collect other data and send a simplified XML (equal to the UCA's and
Projectors' XML).

Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
Signed-off-by: Josiney de Souza <josineys@c3sl.ufpr.br>
---
 net/bandwidth.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bandwidth.sh b/net/bandwidth.sh
index 7a62b88..21190e1 100755
--- a/net/bandwidth.sh
+++ b/net/bandwidth.sh
@@ -61,8 +61,9 @@ PREFIX="$(dirname $(readlink -f $0))"
 PROJECT=$PREFIX/../scripts/collect/project/source.int
 
 # Verify if this is not an UCA Classmate, UCA Server nor Projector ProInfo. If
-# it is, do not collect network data and exit
-if test "$(bash $PROJECT)" != "0"; then
+# it is, do not collect network data and exit. Also exit if the user is not in
+# the sudoers(1)
+if test "$(bash $PROJECT)" != "0" || ! sudo -v &> /dev/null; then
     exit 0
 fi
 
-- 
GitLab