Module: kamailio
Branch: master
Commit: 62f573d4ecbbebe5f0f2d3b39be7ad4c2b460e65
URL:
https://github.com/kamailio/kamailio/commit/62f573d4ecbbebe5f0f2d3b39be7ad4…
Author: Alexander Lutay <alutay(a)sipwise.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-08-02T09:06:05+02:00
kamctl: fix dangerous 'rm -rf' code in case if variables are not defined
---
Modified: utils/kamctl/kamctl
---
Diff:
https://github.com/kamailio/kamailio/commit/62f573d4ecbbebe5f0f2d3b39be7ad4…
Patch:
https://github.com/kamailio/kamailio/commit/62f573d4ecbbebe5f0f2d3b39be7ad4…
---
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 30d5878482..3aaecbd15a 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2614,7 +2614,7 @@ tls_ca() {
merr "Failed to create root directory $CA_PATH"
exit 1
fi
- rm -fr $CA_PATH/*
+ rm -fr "${CA_PATH:?}"/*
mkdir $CA_PATH/private
mkdir $CA_PATH/certs
touch $CA_PATH/index.txt
@@ -2685,7 +2685,7 @@ tls_ca() {
merr "Failed to create user directory $USER_DIR "
exit 1
fi
- rm -fr $USER_DIR/*
+ rm -fr "${USER_DIR:?}"/*
mecho "Creating user certificate request"
openssl req -config $USER_CFG -out $USER_DIR/$USER-cert_req.pem \