From 4f92dcd66b5d20b68b1ef991839fc675994bcf8c Mon Sep 17 00:00:00 2001
From: Jaco Kroon <jaco@uls.co.za>
Date: Wed, 18 Mar 2020 11:21:21 +0200
Subject: [PATCH] dahdiras: Only set plugin dahdi.so to pppd if we're running
 as root.

Users of this should set plugin dahdi.so in their options file.

ASTERISK-16676

Change-Id: I6d01ad0a10e9fea477876d0941c3f38aac357e91
---
 apps/app_dahdiras.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c
index dffa2a4ee1..b5b1ae91c4 100644
--- a/apps/app_dahdiras.c
+++ b/apps/app_dahdiras.c
@@ -113,8 +113,10 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
 		c = strsep(&stringp, ",");
 	}
 
-	argv[argc++] = "plugin";
-	argv[argc++] = "dahdi.so";
+	if (geteuid() == 0) {
+		argv[argc++] = "plugin";
+		argv[argc++] = "dahdi.so";
+	}
 	argv[argc++] = "stdin";
 
 	/* Finally launch PPP */
-- 
GitLab