diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-15 21:54:43 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-15 22:27:35 +0200 |
commit | 9c6b52ccee9ab24d26cd318131e6e9da1f40393a (patch) | |
tree | fcef379f9cc297aeb46ad8bfeb0b2c67450f196e /src/Permission.cxx | |
parent | a47ecf9cb1c4c2efe853d69bc6ff790e91154bb2 (diff) |
Permission: add special permissions for local sockets
Closes #296
Diffstat (limited to 'src/Permission.cxx')
-rw-r--r-- | src/Permission.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Permission.cxx b/src/Permission.cxx index a3d98a0de..8387b3754 100644 --- a/src/Permission.cxx +++ b/src/Permission.cxx @@ -49,6 +49,10 @@ static std::map<std::string, unsigned> permission_passwords; static unsigned permission_default; +#ifdef HAVE_UN +static unsigned local_permissions; +#endif + static unsigned ParsePermission(const char *p) { @@ -121,6 +125,14 @@ void initPermissions(void) if (param) permission_default = parsePermissions(param->value.c_str()); + +#ifdef HAVE_UN + param = config_get_param(ConfigOption::LOCAL_PERMISSIONS); + if (param != nullptr) + local_permissions = parsePermissions(param->value.c_str()); + else + local_permissions = permission_default; +#endif } int getPermissionFromPassword(char const* password, unsigned* permission) @@ -137,3 +149,13 @@ unsigned getDefaultPermissions(void) { return permission_default; } + +#ifdef HAVE_UN + +unsigned +GetLocalPermissions() noexcept +{ + return local_permissions; +} + +#endif |