Commit Graph

67 Commits

Author SHA1 Message Date
Alexander A. Klimov 600fb0e3c2 Introduce AtomicFile 2022-07-28 18:00:37 +02:00
Julian Brost 97d6876803 Utility: add a function to truncate strings while avoiding collisions 2021-06-17 16:21:01 +02:00
Alexander Aleksandrovič Klimov 4063e39d5f
Merge pull request #8515 from Icinga/feature/update-ssl-context-after-accepting-new-connection-8501
API: Update the ssl context after each accepting incoming connection
2021-01-15 11:21:36 +01:00
Yonas Habteab 057254695d Utility: Introduce new helper function Utility::GetFileCreationTime() 2021-01-14 18:39:14 +01:00
Alexander A. Klimov 26c944125b Close FDs based on /proc/self/fd
... not to waste time with close(2)ing RLIMIT_NOFILE-3 non-existing FDs.

Newer kernel = higher RLIMIT_NOFILE = more time wasted

refs #8437
2021-01-12 17:32:28 +01:00
Julian Brost c30d8ff373 Remove Utility::GetEnv from header
It is never used and not even implemented anywhere, probably a leftover.
2020-10-20 12:19:15 +02:00
Michael Friedrich 96f62d2d34 Add Utility::ParseVersion() and unit tests
This now uses a regex to extract the short version
similar to how Icinga Web 2 does it.

Additional unit tests prove the rule.
2019-08-14 11:22:55 +02:00
Alexander A. Klimov 5afef1015d Replace unlink() with boost::filesystem::remove()
refs #7101
2019-04-25 09:53:02 +02:00
Alexander A. Klimov 5a17722c1f Replace _unlink() + rename() with boost::filesystem::rename()
refs #7101
2019-04-25 09:53:02 +02:00
Alexander A. Klimov af78cd6050 Use Boost.Filesystem
refs #7101
2019-04-25 09:53:01 +02:00
Michael Friedrich d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Alexander A. Klimov 9558ebc0f4 Secure ApiUser::GetByAuthHeader() against timing attacks 2019-02-22 16:59:36 +01:00
Michael Friedrich f3cd3eb870 DSL: Implement getenv()
This patch also restores Utility::GetFromEnvironment()
and replaces the hardcoded `getenv()` calls.
2018-11-19 18:11:16 +01:00
Michael Friedrich dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Jean Flach ed4e008e79 Rework sysconfig file
The sysconfig file now only contains the defaults as comments, changes
made there are given to the init.d script, prepare-dirs, safe-reload and
Icinga 2 itself. If nothing is set in the sysconfig file (as is the
default as all lines are commented out) the defaults are used.

fixes #6255
2018-05-23 15:18:42 +02:00
Jean Flach c8c193a9d8 Remove need for RunAsUser/Group
They are now read form the sysconfig file which is owned by root
2018-02-20 14:16:43 +01:00
Gunnar Beutner ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Gunnar Beutner 90496b5456 Build libraries as static libraries 2018-01-02 23:29:48 +01:00
Michael Friedrich e08da4267b
Merge pull request #5930 from Icinga/feature/boost-function
Replace boost::function with std::function
2018-01-02 13:46:23 +01:00
Michael Insel 158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Gunnar Beutner dac71b3960 Replace boost::function with std::function 2018-01-02 08:55:50 +01:00
Gunnar Beutner 858873b940 Replace boost::bind/boost::function with std::bind/std::function 2017-11-27 15:15:11 +01:00
Michael Friedrich b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner aeaca5e803 Revert "Fix incorrect detection of the 'Concurrency' variable"
This reverts commit 585f0537d2.

refs #12456
2016-08-19 11:58:52 +02:00
Gunnar Beutner 585f0537d2 Fix incorrect detection of the 'Concurrency' variable
fixes #12456
2016-08-17 09:20:05 +02:00
Rune Darrud 5c0b3c58bd Do not escape backslashes and separators twice
fixes #12227

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
2016-08-17 06:10:41 +02:00
Markus Frosch a5abe1a972 Allow debugging of Utility::GetTime
So we can run unit tests that expect a certain behavior based on time.

When Icinga 2 is compiled with I2_DEBUG one can use Utility::SetTime to
override the current system time, and lock it to this value.

fixes #11875
2016-06-09 14:25:51 +02:00
Gunnar Beutner 327d12295c Implement support for upgrading NSIS-based installations
refs #11449
2016-04-01 08:42:58 +02:00
Gunnar Beutner 6bf3225e84 Implement support for running custom install/uninstall actions
refs #11449
2016-03-31 14:53:54 +02:00
Michael Friedrich 47c5425137 Fix permissions for temporary files
fixes #11212
fixes #11211
2016-02-24 11:00:44 +01:00
Michael Friedrich 4cb5b97e52 Fix unique creation of temp files
fixes #10948
2016-02-23 12:30:59 +01:00
Gunnar Beutner 599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner fba0b493cd Make sure that all strings in the IDO database are UTF8-encoded
fixes #10554
2015-12-10 12:26:19 +01:00
Gunnar Beutner 2320f7a32a Implement Platform* global variables
refs #10693
2015-11-23 13:10:25 +01:00
Gunnar Beutner 9ea51aa86e Use non-blocking open() for the command pipe
fixes #10410
2015-11-09 20:39:26 +01:00
Gunnar Beutner 06a0f182a5 Implement the cidr_match function
fixes #10354
2015-10-14 10:14:01 +02:00
Gunnar Beutner 2484016c54 Fix crash in RepositoryUtility::AddObject
fixes #10326
2015-10-13 09:15:06 +02:00
Gunnar Beutner 08ccb4e323 Build fix
refs #10245
2015-09-30 11:05:20 +02:00
Gunnar Beutner 254c076dd4 Fix incorrectly escaped arguments for CreateProcess
fixes #10245
2015-09-30 10:56:31 +02:00
Michael Friedrich 7eca257784 Fix return value of Utility::MkDir/MkDirP
None as there are exceptions thrown.

fixes #9689
2015-08-24 15:11:49 +02:00
Michael Friedrich fca7a33aac Implement config file management for the API
refs #9083

fixes #9102
fixes #9103
fixes #9104

fixes #9705
2015-07-23 17:57:24 +02:00
Jean-Marcel Flach a98d2f585d Implement URL parser
fixes #9470
2015-07-07 15:33:19 +02:00
Gunnar Beutner 111b154a6d Remove unused #includes 2015-03-29 00:03:47 +01:00
Gunnar Beutner 3e08f2e0b5 Make order for deferred initializers deterministic
refs #8791
2015-03-18 13:24:31 +01:00
Gunnar Beutner 7c31654552 Remove the return type for Utility::LoadExtensionLibrary 2015-03-03 07:19:34 +01:00
Michael Friedrich 24852e05c7 Move ValidateMacroString into the MacroProcessor class
refs #7311
2015-02-11 16:14:59 +01:00
Michael Friedrich 8ca57cba03 Add macro config validator for command args, env, custom attr, perfdata templates
fixes #7311
2015-02-11 15:32:10 +01:00
Michael Friedrich 78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner c1ac548a77 Escape special characters in repository file names
fixes #7618
2014-12-10 13:20:16 +01:00
Gunnar Beutner e4bfb5f922 Fix static initializers for Utility::AddDeferredInitializer
fixes #7646
2014-11-12 08:00:56 +01:00