#
# Redistribution and use in source and binary forms, with or without
@@ -24,6 +24,11 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+if [ "$(id -u)" != "0" ]; then
+ echo "Must be root."
+ exit 1
+fi
+
sysctl kern.geom.debugflags=16 >/dev/null
sysctl net.link.ether.inet.log_arp_wrong_iface=0 >/dev/null
diff --git a/src/www/system_usermanager.php b/src/www/system_usermanager.php
index 9f4c51e7e..20dc32532 100644
--- a/src/www/system_usermanager.php
+++ b/src/www/system_usermanager.php
@@ -76,7 +76,6 @@ function get_user_privdesc(& $user)
return $privs;
}
-// link user section
$a_user = &config_read_array('system', 'user');
// reset errors and action
@@ -95,7 +94,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if ($act == "expcert" && isset($id)) {
// export certificate
- $cert =& lookup_cert($a_user[$id]['cert'][$_GET['certid']]);
+ $cert = &lookup_cert($a_user[$id]['cert'][$_GET['certid']]);
$exp_name = urlencode("{$a_user[$id]['name']}-{$cert['descr']}.crt");
$exp_data = base64_decode($cert['crt']);
@@ -108,7 +107,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
exit;
} elseif ($act == "expckey" && isset($id)) {
// export private key
- $cert =& lookup_cert($a_user[$id]['cert'][$_GET['certid']]);
+ $cert = &lookup_cert($a_user[$id]['cert'][$_GET['certid']]);
$exp_name = urlencode("{$a_user[$id]['name']}-{$cert['descr']}.key");
$exp_data = base64_decode($cert['prv']);
$exp_size = strlen($exp_data);
@@ -304,7 +303,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
- if (count($input_errors)==0) {
+ if (!empty($pconfig['shell']) && !in_array($pconfig['shell'], auth_get_shells(isset($id) ? $a_user[$id]['uid'] : $config['system']['nextuid']))) {
+ $input_errors[] = gettext('Invalid login shell provided.');
+ }
+
+ if (!count($input_errors)) {
$userent = array();
if (isset($id)) {
@@ -646,8 +649,8 @@ $( document ).ready(function() {
|
|