summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-06-08 18:08:22 -0400
committerRenato Botelho <renato@netgate.com>2016-06-08 19:03:52 -0400
commit78fd804cb8496acd6a08245627b5a682a3e280cd (patch)
tree8380b6f0613e7479a5369776b564b67f3bbd57e6
parent1cdaa0dd5654edd3979163010f4e78756b2d9da9 (diff)
downloadpfsense-78fd804cb8496acd6a08245627b5a682a3e280cd.zip
pfsense-78fd804cb8496acd6a08245627b5a682a3e280cd.tar.gz
Implement pkg_valid_name()
-rw-r--r--src/etc/inc/pkg-utils.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index daa0a55..6f3f18e 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -83,6 +83,14 @@ if (!function_exists("pkg_debug")) {
}
}
+/* Validate if pkg name is valid */
+function pkg_valid_name($pkgname) {
+ global $g;
+
+ $pattern = "/^{$g['pkg_prefix']}[a-zA-Z0-9\.\-_]+$/";
+ return preg_match($pattern, $pkgname);
+}
+
/* Remove pkg_prefix from package name if it's present */
function pkg_remove_prefix(&$pkg_name) {
global $g;
OpenPOWER on IntegriCloud