Commit Graph

47 Commits

Author SHA1 Message Date
Max Kellermann
cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann
c7d2cb855a Permission: use std::string_view instead of StringView 2022-07-04 14:38:29 +02:00
Max Kellermann
109159e0f7 Permission: use StringView::Split() 2021-10-26 12:25:47 +02:00
Max Kellermann
907af2ad02 Permission: refactor getPermissionFromPassword() to return std::optional
This replaces the output parameter (which is bad API design).  As a
side effect, it fixes the bad [[gnu::pure]] attribute added by commit
a636d2127 which caused optimizing compilers to miscompile calls to
that function.  "Pure" functions can be assumed to have no output
arguments, so the compiler can assume the function doesn't modify
them.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1282
2021-10-17 19:58:50 +02:00
Max Kellermann
680fb51c37 Permission: add "player" to default permission set
Forgot that in commit 9a766f4cd9
2021-10-14 14:58:38 +02:00
Max Kellermann
77d74b404e Permission: add option "host_permissions"
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1115
2021-10-14 14:44:18 +02:00
Max Kellermann
9a766f4cd9 Permission: split permission "player" from "control"
Some users want certain clients to fully control playback, but do not
want them to be able to trigger database update.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1124
2021-10-14 14:19:51 +02:00
Rosen Penev
6ec5089cc9 remove std::make_pair
make_pair is an old C++98 function that can be replaced by modern
shorter constructs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-09-07 21:13:22 -07:00
Max Kellermann
5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Rosen Penev
e4dad42ca1 use std chr functions
The ones in std have overloads for const char/char.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-30 13:36:53 +02:00
Rosen Penev
ab9f5d2067
replace assert.h with cassert
The former was deprecated with C++14.

According to the C++11 and C++17 standards, both files are identical.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 15:25:38 -07:00
Max Kellermann
4f22f4d357 *: use nullptr instead of NULL 2020-02-01 14:02:43 +01:00
Max Kellermann
2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann
d663f81420 include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Max Kellermann
a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann
fdbec694c6 config/Param: add method With() 2019-05-29 21:50:04 +02:00
Max Kellermann
b8a8bdeaec Permission: use IterableSplitString 2019-04-03 21:47:20 +02:00
Max Kellermann
8f20edac9d Permission: pass StringView to ParsePermission()
Eliminates a temporary copy.
2019-04-03 21:45:01 +02:00
Max Kellermann
8499a662ea Permission: add noexcept 2019-04-03 21:42:31 +02:00
Max Kellermann
f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann
9ff2606bb8 config/Data: use std::forward_list to manage params and blocks 2018-07-18 11:03:19 +02:00
Max Kellermann
a9b8d5ecb6 Permission: use struct ConfigData 2018-07-17 23:00:42 +02:00
Max Kellermann
816603fd9a config/Config*: rename files, drop "Config" prefix 2018-07-16 19:50:07 +02:00
Max Kellermann
9c6b52ccee Permission: add special permissions for local sockets
Closes #296
2018-07-15 22:27:35 +02:00
Max Kellermann
e8333316ee Permission: throw exception instead of raising fatal error 2017-08-11 09:33:59 +02:00
Max Kellermann
788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann
5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann
5b2b4bf13c config/Param: use CamelCase 2016-10-28 11:38:37 +02:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann
1c3f5517fa config/Option: convert to strictly-typed enum 2015-01-21 23:30:00 +01:00
Max Kellermann
fe85fa3bea ConfigData: move struct config_param to Param.hxx 2015-01-21 21:23:02 +01:00
Max Kellermann
712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann
008723c62f ConfigGlobal: eliminate function config_get_next_param() 2014-02-20 00:04:23 +01:00
Max Kellermann
197b503f3e Config*: move to config/ 2014-01-24 00:20:01 +01:00
Max Kellermann
4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann
9acc1e1e97 Permission: use std::find instead of g_strsplit() 2013-10-19 16:47:56 +02:00
Max Kellermann
daa47546c7 Permission: move code to ParsePermission() and a table 2013-10-19 16:47:41 +02:00
Max Kellermann
7ece8ff85c Permission: remove nullptr check
Both callers pass non-nullptr.
2013-10-19 16:40:40 +02:00
Max Kellermann
a4effeb3f9 Permission: convert PERMISSION_PASSWORD_CHAR from macro to constexpr 2013-10-19 16:39:45 +02:00
Max Kellermann
7de96275dd ConfigData: use std::string for config_param::value 2013-10-15 22:49:01 +02:00
Max Kellermann
e13d0bf656 Permission: use std::string for temporary password allocation
As a side effect, this fixes a memory leak.
2013-10-15 22:48:09 +02:00
Max Kellermann
7a4c9f5f4c mpd_error.h: remove obsolete header
Migrate the remaining callers to FatalError().
2013-09-05 18:26:46 +02:00
Max Kellermann
26d92c80ed conf.h: remove obsolete header
Use only ConfigData.hxx in plugin sources to reduce header
dependencies.
2013-09-05 08:47:10 +02:00
Max Kellermann
28030d7edb include cleanup 2013-07-30 08:39:21 +02:00
Max Kellermann
975370c084 decoder_api.h, ...: add "extern C" 2013-01-07 10:07:40 +01:00
Max Kellermann
c4090b670d Permission: use std::map instead of GHashTable 2013-01-03 03:11:39 +01:00
Max Kellermann
ddf112378b permission: convert to C++ 2013-01-03 03:09:50 +01:00