Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted package_method to allow package names with whitespace in the middle #5523

Draft
wants to merge 7,235 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
7235 commits
Select commit Hold shift + click to select a range
2eb2931
Added the function name to the result cache key
amousset Sep 7, 2023
2c8888d
Moved asserts to top of EvalContextFunctionCache functions
larsewi Sep 14, 2023
2f3e2fd
Merge pull request #5317 from amousset/function-name-cache
larsewi Sep 15, 2023
e45e8e2
Change suppress fail to soft fail on known failing tests
Sep 15, 2023
a35d079
Bump libntech to master
vpodzime Sep 18, 2023
44ba46c
Add missing #include's previously pulled in by libntech
vpodzime Sep 15, 2023
29563ec
Merge pull request #5327 from vpodzime/master-libntech_header_cleanup…
vpodzime Sep 18, 2023
9e08034
Merge pull request #5326 from Lex-2008/win-acceptance
nickanderson Sep 19, 2023
442de8e
Allow inheriting attributes using global variables
amousset Sep 14, 2023
0404169
Merge pull request #5324 from amousset/inheritance-memory
larsewi Sep 21, 2023
477ab28
Do not #include libcrypto-compat
vpodzime Sep 22, 2023
d8e1c23
Bump libntech to latest master
vpodzime Sep 25, 2023
e3b6c66
Merge pull request #5332 from vpodzime/master-libntech_no_libcrypto_c…
vpodzime Sep 26, 2023
df90bdf
Added selinux policy to allow cf-hub to initiate scheduled reports
craigcomstock Sep 27, 2023
3720ceb
Merge pull request #5334 from craigcomstock/ENT-10696/master
craigcomstock Sep 28, 2023
e35e22c
Small suggestions from code review
olehermanse Oct 3, 2023
fa1e825
Made cf-support use coredumpctl for core analysis only when configure…
nickanderson Apr 21, 2023
1929b6b
Merge pull request #5225 from nickanderson/ENT-9985/master
nickanderson Oct 3, 2023
2187ee3
Merge pull request #5284 from cfengine/nickanderson-patch-1
olehermanse Oct 3, 2023
614c980
Bump libntech from `49cd554` to `8545ebb`
dependabot[bot] Oct 6, 2023
03d3fdd
Modify all calls to `WriterWriteHelp` to adapt to API change
lluiscampos Oct 6, 2023
1b5e7f9
Use libntech to print help in `cf-check`
lluiscampos Oct 6, 2023
d98324f
Updated links to libntech after move
olehermanse Oct 6, 2023
249cd72
Merge pull request #5341 from olehermanse/libntech
olehermanse Oct 9, 2023
d1bed1b
Disable win-acceptance tests for now due to two issues
craigcomstock Oct 9, 2023
6b4e750
Improved locale override in masterfiles stage scripts
craigcomstock Oct 9, 2023
e9fe668
Updated source install instructions for RedHat/CentOS/Debian
craigcomstock Oct 9, 2023
0d202f7
Fixed two acceptance tests which could only run once before failing
craigcomstock Oct 9, 2023
dce595d
Merge pull request #5342 from craigcomstock/disable-win-acceptance
craigcomstock Oct 10, 2023
e9edce2
Merge pull request #5346 from craigcomstock/ENT-10761/master
craigcomstock Oct 10, 2023
ef43a84
Merge pull request #5344 from craigcomstock/ENT-10753/master
craigcomstock Oct 10, 2023
6aa995c
Merge pull request #5345 from craigcomstock/rhel-9-source-install
craigcomstock Oct 10, 2023
2943a6f
Merge pull request #5339 from lluiscampos/value-add-copyright-libntech
olehermanse Oct 11, 2023
13ba219
Bump libntech from `8545ebb` to `303bccb`
dependabot[bot] Oct 11, 2023
160e715
Merge pull request #5351 from cfengine/dependabot/submodules/libntech…
olehermanse Oct 11, 2023
237e7f6
Added version_compare() policy function
olehermanse Oct 10, 2023
2cd5a1b
Merge pull request #5349 from olehermanse/version_compare
larsewi Oct 11, 2023
02bc392
AUTHORS: Added Lars to list of authors
larsewi Oct 12, 2023
b86e34b
Merge pull request #5352 from cfengine/larsewi-patch-1
larsewi Oct 12, 2023
2389017
fix help text for `cf-check`
lluiscampos Oct 13, 2023
4859135
Merge pull request #5353 from lluiscampos/fix-cf-check-help-text
olehermanse Oct 13, 2023
8890599
Formatted InitIgnoreInterfaces() with clang-format
larsewi Oct 30, 2023
b26fb48
Moved ignore_interfaces.rx to $(sys.workdir)
larsewi Oct 30, 2023
f9d43a7
Added error message based on errno to InitIgnoreInterfaces()
larsewi Oct 31, 2023
626a26e
Fixed infinite loop on error bug while reading interface exception file
larsewi Nov 1, 2023
1bc7207
Merge pull request #5357 from larsewi/interface
larsewi Nov 2, 2023
7149389
Bump libntech from `303bccb` to `469add7`
dependabot[bot] Nov 7, 2023
e013fab
Do not add our services to cfengine3.service.wants on enable
vpodzime Nov 6, 2023
223f32a
Skip failing tests on Debian 12
larsewi Nov 7, 2023
519b993
Merge pull request #5361 from cfengine/dependabot/submodules/libntech…
olehermanse Nov 7, 2023
995cf6f
Allow CFEngine daemons to access to proc_security_t files
vpodzime Oct 31, 2023
a68eb3f
Allow cf-hub to request loading of the TLS kernel module
vpodzime Nov 1, 2023
5d74da7
Add missing SELinux rules for httpd querying users
vpodzime Nov 1, 2023
df77cf2
Various small SELinux fixes
vpodzime Nov 1, 2023
0c0174f
Enable building platform-specific SELinux policies
vpodzime Nov 1, 2023
11e4295
Introduce RHEL 9 specific SELinux policy
vpodzime Nov 1, 2023
d60ea6e
Relax the condition for matching LMDB file in `cf-check dump`
vpodzime Nov 7, 2023
4ec4e28
Drop VerifyThatDatabaseIsNotCorrupt() on locks DB
vpodzime Nov 7, 2023
0125be5
Make RestoreLockDatabase() a non-static function
vpodzime Nov 7, 2023
e6aa1ee
Only kill potential CFEngine lock holders
vpodzime Nov 7, 2023
e70f14f
Merge pull request #5358 from vpodzime/master-selinux_fixes_10_2023
vpodzime Nov 8, 2023
d18fb3a
Merge pull request #5362 from vpodzime/master-blind_shooting
vpodzime Nov 8, 2023
2832101
Fixed inventoried policy release id when masterfiles-stage.sh deploys…
nickanderson Nov 8, 2023
16e1201
Merge pull request #5363 from larsewi/deb12
nickanderson Nov 8, 2023
b56fb2b
Merge pull request #5369 from nickanderson/ENT-10832/master
nickanderson Nov 9, 2023
c1c5d38
Do aligned access to LMDB data in cf-check
vpodzime Jun 10, 2020
8af990d
Use `CF_LOCKHORIZON` to check whether to purge locks
vpodzime Nov 13, 2023
60fa76d
Added acceptance test for IP-address classes
larsewi Nov 14, 2023
d385234
Added new platform-agnostic constant `linesep`
larsewi Nov 13, 2023
447978c
Added `linesep` to constants example
larsewi Nov 13, 2023
184861a
Added acceptance test for `linesep` constant
larsewi Nov 13, 2023
19c9b90
Merge pull request #5373 from larsewi/linesep
larsewi Nov 14, 2023
e6512a0
Merge pull request #5375 from larsewi/simplistic
larsewi Nov 20, 2023
7acd08d
Add GetDBUsagePercentage() function
vpodzime Nov 13, 2023
cca2589
Make lock purging react to locks DB usage
vpodzime Nov 14, 2023
689ac3f
Improve code quality of PurgeLocks()
vpodzime Nov 14, 2023
7f1f57e
Rotate almost full LMDB files in cf-check repair
vpodzime Nov 15, 2023
6e78812
Handle MDB_MAP_FULL
vpodzime Nov 14, 2023
0ae466d
Add --test-write to cf-check repair
vpodzime Nov 15, 2023
97e54b2
Show DB usage as part of DB status in cf-check diagnose
vpodzime Nov 15, 2023
a72cf5f
Merge pull request #4215 from vpodzime/master-lmdb_fixes
vpodzime Nov 20, 2023
db93e14
Fix a couple bad strncpy() calls
vpodzime Nov 20, 2023
e831cbc
Use CURLOPT_PROTOCOLS_STR instead of CURLOPT_PROTOCOLS
vpodzime Nov 20, 2023
fd48a44
Avoid string truncation and overflows on cf-monitord observables
vpodzime Nov 20, 2023
2313da8
Tell GCC in static checks to ignore enum-int-mismatch
vpodzime Nov 20, 2023
f141ae8
Use Fedora 39 for static checks by default
vpodzime Nov 20, 2023
9dc791f
Fallback to /usr/bin/getent when /bin/getent doesn't exist
amousset Sep 18, 2023
98b086a
Merge pull request #5329 from amousset/getent
vpodzime Nov 20, 2023
46ef23d
Merge pull request #5381 from vpodzime/master-f39_static_checks
vpodzime Nov 21, 2023
d25b7bd
Specify disk cache for the vagrant CI VMs in a supported way
vpodzime Nov 27, 2023
35d28fb
Make sure libtool is always installed on vagrant CI machines
vpodzime Nov 27, 2023
452542e
Install perl(IPC::Cmd) on the full-build vagrant CI VM
vpodzime Nov 27, 2023
646886e
Merge pull request #5387 from vpodzime/master-vagrant_ci_fixes
vpodzime Nov 28, 2023
e3b0242
Added changelog for 3.23.0
craigcomstock Nov 13, 2023
0a3ddb7
Merge pull request #5374 from craigcomstock/3.23.0-changelog-2023-11-…
craigcomstock Nov 28, 2023
49a0407
cf_remote_demo.sh: Updated demo script with newer platforms
olehermanse Dec 1, 2023
953cfb7
Merge pull request #5388 from olehermanse/cf_remote_demo
olehermanse Dec 1, 2023
0a06988
Fixed changing perms noise in no-noise sequential test
larsewi Nov 27, 2023
891a298
Merge pull request #5386 from larsewi/deb12
larsewi Dec 4, 2023
61f3967
Bumped .CFVERSION number to 3.24.0
olehermanse Dec 6, 2023
babb2a7
Merge pull request #5392 from olehermanse/master
olehermanse Dec 6, 2023
b6281da
Use Ubuntu 22.04 for valgrind checks
vpodzime Dec 7, 2023
988ffb1
Do OSSL_PROVIDER_unload() on the providers that we load
vpodzime Dec 7, 2023
ca68f2b
Merge pull request #5394 from vpodzime/master-valgrind_u22
vpodzime Dec 7, 2023
e18b0a7
Migrate to PCRE2
vpodzime Dec 5, 2023
b6e6679
Do not finalize things before printing digest in cf-key
vpodzime Dec 8, 2023
a0893f8
Merge pull request #5396 from vpodzime/master-ossl_provider_fwup
vpodzime Dec 8, 2023
482e765
Use the new Regex type for compiled regular expressions
vpodzime Dec 11, 2023
41d1694
Merge pull request #5391 from vpodzime/master-pcre2
vpodzime Dec 12, 2023
7f1831c
Fix an off-by-one in the comment about ovector in FirstBackReference()
vpodzime Dec 12, 2023
0e4e649
Merge pull request #5399 from vpodzime/master-pcre2_comment_fix
vpodzime Dec 12, 2023
152ecf5
Adjusted static-check/run.sh to expose errors in create_image()
craigcomstock Dec 12, 2023
d055aad
Added arglist argument to ArgSplitCommand function
larsewi Nov 15, 2023
82f55a8
Added arglist argument to cf_popensetuid()
larsewi Dec 6, 2023
ab25af5
The `arglist` attribute now preserves spaces in arguments
larsewi Nov 17, 2023
3cd6661
Added test checking that spaces are preserved by `arglist`
larsewi Nov 17, 2023
88833a8
Merge pull request #5400 from craigcomstock/CFE-4295/master
craigcomstock Dec 13, 2023
1fd6619
Fixed cf-support call to cf-promises to collect all classes and vars
craigcomstock Dec 22, 2023
59b2d90
Merge pull request #5408 from craigcomstock/CFE-4300/master
larsewi Dec 22, 2023
f57c98c
Merge pull request #5378 from larsewi/arglist
olehermanse Jan 4, 2024
74efe3f
Removed cifuzz job as we cannot update the external details
craigcomstock Jan 4, 2024
79420d4
Allow httpd to run `ps` and get info about processes
vpodzime Jan 5, 2024
1cd2d92
Merge pull request #5416 from vpodzime/master-selinux_httpd_ps
vpodzime Jan 5, 2024
cf4f56d
Merge pull request #5415 from craigcomstock/CFE-4296/master
olehermanse Jan 5, 2024
1020afd
More SELinux policy changes for httpd/php to run ps
vpodzime Jan 5, 2024
62a49bd
Merge pull request #5419 from vpodzime/master-selinux_httpd_ps_fwup
vpodzime Jan 5, 2024
be48a73
Bump libntech from `1899478` to `ddc25a6`
dependabot[bot] Jan 9, 2024
1ed2ce6
Merge pull request #5424 from cfengine/dependabot/submodules/libntech…
larsewi Jan 9, 2024
3c0d2e3
Updated copyright headers to 2024
olehermanse Jan 16, 2024
6310c5c
Merge pull request #5428 from olehermanse/copyright
olehermanse Jan 16, 2024
ceb2de5
Fixed static-check job by forcing inclusion of config.h
craigcomstock Jan 12, 2024
57f0112
Fixed a few problems found by cppcheck
craigcomstock Jan 12, 2024
2f711e3
Merge pull request #5427 from craigcomstock/CFE-4310/master
larsewi Jan 16, 2024
e787112
Bump libntech from `ddc25a6` to `cc1540a`
dependabot[bot] Jan 17, 2024
edcf92a
In configure.ac, force with-systemd-socket=no when with-systemd-servi…
craigcomstock Jan 11, 2024
4160208
Merge pull request #5429 from cfengine/dependabot/submodules/libntech…
larsewi Jan 18, 2024
a5e7875
Merge pull request #5425 from craigcomstock/fix_protocol_test
craigcomstock Jan 18, 2024
e0ef261
Bump libntech from `cc1540a` to `8b72e12`
dependabot[bot] Jan 22, 2024
b67d703
Merge pull request #5435 from cfengine/dependabot/submodules/libntech…
larsewi Jan 23, 2024
a24915b
CONTRIBUTING.md: Rephrased the wording on the type cast whitespace fo…
larsewi Jan 29, 2024
34b71ed
Merge pull request #5439 from cfengine/larsewi-patch-2
olehermanse Jan 29, 2024
4e818f1
Add options to skip loading augments and host-specific data to cf-agent
vpodzime Jan 29, 2024
840664a
Merge pull request #5440 from vpodzime/master-skip_augments
vpodzime Jan 30, 2024
3ef1ef3
Make sure the dbid enum starts at 0
vpodzime Dec 22, 2023
8b84d47
Add explanation of possible return values of GetDBUsagePercentage()
vpodzime Jan 23, 2024
71b2840
API for testing local DBs
vpodzime Dec 14, 2023
4f91f7d
Add Python bindings for testing local DBs
vpodzime Jan 26, 2024
3a4cbf2
Merge pull request #5438 from vpodzime/master-lmdb_testbed
vpodzime Jan 30, 2024
e2f84a7
Pass the actual simulation threads to pthread_join functions
vpodzime Jan 31, 2024
032bb70
The agent no longer warns when there are no actions in a files promise
larsewi Jan 4, 2024
72ba471
Added new parser warning type -Wsanity-check
larsewi Jan 8, 2024
945dc73
Added warning to parser on promises with no actions
larsewi Jan 8, 2024
b9c30ab
Updated benchmark.cf to perform an action in order to slience warning
larsewi Jan 9, 2024
897b181
Fixed memory leak in PolicyFromJson
larsewi Jan 9, 2024
922693b
Fix condition for the simulation threads being started after a join a…
vpodzime Jan 31, 2024
06bbf98
Merge pull request #5442 from vpodzime/master-lmdb_testbed_fix
vpodzime Feb 1, 2024
eaa72d3
Merge pull request #5414 from larsewi/no-action
larsewi Feb 5, 2024
471df56
Carefully handle symlinks at the last phase of VerifyFilePromise()
vpodzime Feb 8, 2024
1d3a9c8
Remove commented out test for CFE-4148 which was rejected
vpodzime Feb 8, 2024
05bf773
Merge pull request #5444 from vpodzime/master-symlink_perms
vpodzime Feb 12, 2024
020c113
Bump libntech from `8b72e12` to `61d6baa`
dependabot[bot] Feb 13, 2024
4931e74
Move vagrant-ci from CentOS 7 to CentOS 9 Stream
vpodzime Feb 12, 2024
673faf0
Merge pull request #5446 from vpodzime/master-vagrant_ci_c9s
vpodzime Feb 14, 2024
3937e9f
Fixed implicit declaration due to missing include
larsewi Feb 15, 2024
0e6bf36
Adjusted INSTALL instructions for OpenBSD 7.4
craigcomstock Feb 15, 2024
6fbf8e0
Adjusted openssl ifdefs to support building on OpenBSD
craigcomstock Feb 15, 2024
45e4922
Merge pull request #5447 from cfengine/dependabot/submodules/libntech…
larsewi Feb 17, 2024
b0fba39
Merge pull request #5449 from craigcomstock/openbsd72
craigcomstock Feb 19, 2024
8b4f7b0
Merge pull request #5448 from cfengine/include
olehermanse Feb 19, 2024
139110d
Removed soft fail for brace support test in glob patterns
larsewi Jan 4, 2024
e283422
Removed soft fail for findfiles acceptance tests
larsewi Jan 5, 2024
4e8bdcc
Added test testing square brackets in glob patterns
larsewi Jan 5, 2024
d12ce43
Added `include <glob_lib.h>` where needed after moving GlobFileList()
larsewi Jan 12, 2024
8b431e3
findfiles.cf: Fixed wrong assumption acceptance test
larsewi Jan 31, 2024
6b762ca
Added `#include<sequence.h>` to `getopt_test.c`
larsewi Feb 19, 2024
ccb496e
Fixed incorrect sed command for cf-support filtering syslog output
craigcomstock Feb 22, 2024
6459a7d
Fixed bug related to backwards directory traversial in findfiles_up()
larsewi Feb 21, 2024
73a70d0
Reworked the acceptance test for findfiles_up()
larsewi Feb 21, 2024
2340098
Bumped libntech to master
larsewi Feb 23, 2024
91bc287
Merge pull request #5453 from craigcomstock/CFE-4337/master
craigcomstock Feb 23, 2024
6bc0f41
Merge pull request #5413 from larsewi/win-glob-compat
larsewi Feb 26, 2024
936fd39
Modified package promise default. If platform_default is present use …
craigcomstock Jan 19, 2024
a2f7192
Added warning log message when OS is not recognized
olehermanse Feb 28, 2024
b4b7b5a
Merge pull request #5460 from cfengine/olehermanse-patch-1
olehermanse Feb 28, 2024
6f03c5b
Update BSD.md
craigcomstock Feb 29, 2024
d8834e0
Merge pull request #5461 from cfengine/craigcomstock-patch-4
craigcomstock Feb 29, 2024
8e826d8
Corrected typo in warning message s/Unkown/Unknown/
craigcomstock Mar 1, 2024
e72f8ad
Merge pull request #5463 from craigcomstock/unkown-typo
olehermanse Mar 1, 2024
6f221d5
Added standard OS name & version variables for Amazon
larsewi Feb 26, 2024
243850b
Merge pull request #5457 from larsewi/amazon
olehermanse Mar 1, 2024
8d4cd23
Added instructions on building for NetBSD and OpenBSD
craigcomstock Mar 1, 2024
71663e3
Add Arch to the list of OSes recognized by SysOSNameHuman
sp1ff Mar 11, 2024
bcd7eda
Merge pull request #5468 from sp1ff/add-arch
larsewi Mar 11, 2024
bc0b4ec
Core examples for simple small examples to files promise tyupe docs
nickanderson Sep 8, 2022
025444d
Merge pull request #5046 from nickanderson/simple-small-examples-file…
nickanderson Mar 18, 2024
16053e5
Merge pull request #5465 from craigcomstock/CFE-4344/master
craigcomstock Mar 19, 2024
8a96b42
Adjusted package module inventory to include quotes around fields whe…
craigcomstock Feb 29, 2024
a96cc8a
Added sys.os_name_human for Alpine, postmarketOS, OpenBSD and NetBSD
craigcomstock Mar 1, 2024
c4c5995
Merge pull request #5434 from craigcomstock/CFE-4315/master
craigcomstock Mar 19, 2024
1530cb2
Merge pull request #5462 from craigcomstock/CFE-4341/master
craigcomstock Mar 19, 2024
6065988
Merge pull request #5464 from craigcomstock/alpine-os-human-name
olehermanse Mar 21, 2024
72719d6
Prevent systemctl from asking for password after installing unit files
vpodzime Mar 27, 2024
474561f
Added container chroot agent materials to contrib
craigcomstock Feb 27, 2024
7dade38
Merge pull request #5477 from vpodzime/master-no_systemctl_install
vpodzime Mar 28, 2024
988bed1
Merge pull request #5459 from craigcomstock/ENT-11345
craigcomstock Mar 28, 2024
e80cfa7
Bumped libntech to master
larsewi Apr 5, 2024
442a77c
Merge pull request #5478 from larsewi/basename
olehermanse Apr 8, 2024
34ccc04
Bump libntech from `58705c5` to `412f6b3`
dependabot[bot] Apr 8, 2024
5e60552
Merge pull request #5479 from cfengine/dependabot/submodules/libntech…
larsewi Apr 9, 2024
2ddd174
Changed cf-apache systemd unit to reload configuration gracefully
craigcomstock Apr 10, 2024
6bfcb0e
Merge pull request #5480 from craigcomstock/ENT-11526/master
craigcomstock Apr 12, 2024
640e8d2
Bump libntech version
craigcomstock Apr 23, 2024
03a0513
GH Actions macOS: Fixed installation and PATH for libtool and autoconf
craigcomstock Apr 23, 2024
fac3804
GH Actions macOS: Use brew --prefix to locate LMDB, OpenSSL, and pcre
larsewi Apr 24, 2024
0569897
Merge pull request #5486 from olehermanse/libntech
olehermanse Apr 25, 2024
55f4ce7
README.md: Simplified hello world example
olehermanse Apr 25, 2024
9c4aff1
Nick added ./ in front of hello.cf
olehermanse Apr 25, 2024
77f56b8
Merge pull request #5488 from olehermanse/hellow
olehermanse Apr 25, 2024
131c378
Drop cf-runalerts.service
vpodzime Apr 25, 2024
3d7cf31
Allow httpd to open tmp files
vpodzime Apr 26, 2024
26eab0b
Adapt SELinux policy to cf-reactor running alerts periodically
vpodzime Apr 26, 2024
cb5d60b
Switch static checks to Fedora 40
vpodzime Apr 29, 2024
8b82d9a
Bump libntech from `28df3c4` to `329361a`
dependabot[bot] May 1, 2024
5742e32
Merge pull request #5491 from cfengine/dependabot/submodules/libntech…
larsewi May 1, 2024
6fdbf0c
Merge pull request #5487 from vpodzime/master-runalerts_cf-reactor
vpodzime May 2, 2024
c450f6b
Merge pull request #5489 from vpodzime/master-f40_static_checks
vpodzime May 3, 2024
91d0286
Try to acquire file lock when closing DB
vpodzime May 3, 2024
0c18afb
Merge pull request #5492 from vpodzime/master-lmdb_close_lockfile
vpodzime May 6, 2024
bd792d9
Changed cf-execd's sleep behavior so it attempts to wake up at the be…
olehermanse May 6, 2024
2902716
Improve and re-enable windows acceptance test workflow
craigcomstock May 7, 2024
f35543a
Adjust expectations of windows acceptance tests
craigcomstock May 7, 2024
8063723
Merge pull request #5493 from craigcomstock/ENT-10699/master
craigcomstock May 8, 2024
d0acb0e
Merge pull request #5498 from olehermanse/master
olehermanse May 10, 2024
e0199b8
Support libntech's new efficient file/data copying
vpodzime Apr 30, 2024
5615062
Adapt files_copy_test.c to efficient data/file copying in libntech
vpodzime May 3, 2024
e05dec4
Run valgrind checks in GH actions on Ubuntu 22.04
vpodzime May 3, 2024
f4e2471
Merge pull request #5490 from vpodzime/master-libntech_efficient_data…
vpodzime May 20, 2024
341fcab
Adjust windows-acceptance test to use C: partition
craigcomstock May 21, 2024
1216201
---
dependabot[bot] May 22, 2024
70d31ab
Merge pull request #5509 from craigcomstock/ENT-11771/master
craigcomstock May 22, 2024
d91d88a
Fixed mistakenly committed test change
craigcomstock May 22, 2024
790fdbc
Merge pull request #5511 from craigcomstock/ENT-11771-2/master
vpodzime May 22, 2024
c550cdd
Merge pull request #5510 from cfengine/dependabot/submodules/libntech…
larsewi May 27, 2024
5b202d8
Adjusted package_method to allow package names with whitespace in the…
craigcomstock May 29, 2024
15b0466
FP4
craigcomstock May 29, 2024
87f3e1a
more instances where name must be properly trimmed
craigcomstock May 29, 2024
2b6f4da
DESKTOP-O6FDU4U
craigcomstock May 29, 2024
ed20f95
try to adjust install command to enclose the package name in quotes
craigcomstock May 29, 2024
b406984
DESKTOP-O6FDU4U
craigcomstock May 29, 2024
34bcff1
for windows, try single quotes instead of double since the command in…
craigcomstock May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .CFVERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.24.0
40 changes: 40 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
BasedOnStyle: Google
---
Language: Cpp
ColumnLimit: 79
IndentWidth: 4
TabWidth: 4
UseTab: Never
MaxEmptyLinesToKeep: 3
AlignTrailingComments: true
SpacesBeforeTrailingComments: 1
SortIncludes: false
DerivePointerAlignment: false
PointerAlignment: Right
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
BreakStringLiterals: false
BinPackArguments: false
BinPackParameters: false
AlignAfterOpenBracket: AlwaysBreak
AllowAllParametersOfDeclarationOnNextLine: true
IndentCaseLabels: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterStruct: true
AfterUnion: true
BeforeElse: true
SplitEmptyFunction: true
BreakBeforeBinaryOperators: NonAssignment
---
5 changes: 5 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: "CFEngine cpp CodeQL config"

queries:
- uses: cfengine/core/.github/codeql/cpp-queries/bool-type-mismatch-return.ql@master
- uses: cfengine/core/.github/codeql/cpp-queries/missing-argument-null-check.ql@master
62 changes: 62 additions & 0 deletions .github/codeql/cpp-queries/bool-type-mismatch-return.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include <stdbool.h>

int good_int()
{
return 0;
}

int bad_int()
{
return false;
}

bool good_with_variable()
{
bool r = true;
return r;
}

bool bad_with_variable()
{
int r = true;
return r;
}

bool good_with_constant()
{
return false;
}

bool bad_with_constant()
{
return 0;
}

bool good_with_function()
{
return good_with_constant();
}

bool bad_with_function()
{
return good_int();
}

bool good_with_comparison()
{
return good_int() != 0;
}

int main(void)
{
good_int();
bad_int();
good_with_variable();
bad_with_variable();
good_with_constant();
bad_with_constant();
good_with_function();
bad_with_function();
good_with_comparison();
return 0;
}
66 changes: 66 additions & 0 deletions .github/codeql/cpp-queries/bool-type-mismatch-return.qhelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>

<overview>

<p>
Boolean type mismatch between function type and return value.
This can be the result of copy-pasted code, which should have been modified.
</p>

<p>
In C, most things we think of as boolean are actually int (0 or 1).
We prefer to use <code>bool</code> return type for functions which have 2 return values (<code>true</code> or <code>false</code>).
We consider some different things boolean:
</p>

<ul>
<li>
A variable with type <code>bool</code>
</li>
<li>
A function call with return type <code>bool</code>
</li>
<li>
A boolean macro - <code>true</code> or <code>false</code>
</li>
<li>
A comparison - <code>==</code> or <code>!=</code> (or less than / greater than variants).
</li>
<li>
A logical operation - AND or OR.
</li>
</ul>

<p>
The reason why this query was added was to catch cases like <a href="https://github.com/cfengine/core/pull/3635">a boolean function returning -1</a>.
<code>int</code> functions typically return <code>0</code> for success and <code>-1</code> for failure.
This means that if you copied the error handling of an int function to a <code>bool</code> function, it would return <code>true</code> (success) in case of error.
Error handling is the main reason to have this strict type checking for <code>bool</code>.
</p>

</overview>
<recommendation>

<p>
Change the returned value to something boolean, or change the function return type to <code>bool</code>.
Sometimes this means adding an an explicit comparison in the return statement.
(Typecasting is almost never the right answer).
</p>

</recommendation>
<example>

<sample src="bool-type-mismatch-return.c" />

</example>
<references>

<li>
CFEngine Contribution guidelines: <a href="https://github.com/cfengine/core/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a>
</li>

</references>
</qhelp>
76 changes: 76 additions & 0 deletions .github/codeql/cpp-queries/bool-type-mismatch-return.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @name Boolean type mismatch between function type and return value
* @description Strict boolean type-checking for return statements.
* Boolean functions must return something boolean.
* Non-boolean functions must not return something boolean.
* Comparisons, logical AND/OR, and true/false macros are bool.
* @kind problem
* @problem.severity warning
* @id cpp/bool-type-mismatch-return
* @tags readability
* correctness
* @precision very-high
*/

import cpp

predicate isBoolExpr(Expr expression){
// Not bool if there is an explicit cast to something else:
not exists(CStyleCast cast |
cast.getType().getName() != "bool"
and
cast.getExplicitlyConverted() = expression.getExplicitlyConverted()
)
and
// One of these imply boolean:
(
// variable of type bool:
expression.getType().getName() = "bool"
// true or false macro:
or exists(MacroInvocation m |
m.getExpr() = expression
and (m.getMacroName() = "true" or m.getMacroName() = "false"))
// && or || operator
or exists(BinaryLogicalOperation b |
b = expression)
// == or != or > or < or >= or <= operator:
or exists(ComparisonOperation cmp |
cmp = expression)
// ! operator:
or exists(NotExpr n |
n = expression
and isBoolExpr(n.getOperand()))
// Recursively check both branches of ternary operator:
or exists(ConditionalExpr c |
c = expression
and isBoolExpr(c.getThen())
and isBoolExpr(c.getElse()))
)
}

string showMacroExpr(Expr e){
not e.isInMacroExpansion()
and result = e.toString()
or
e.isInMacroExpansion() // Show true=1/false=0 in alert
and result = e.findRootCause()
.toString()
.replaceAll("#define ", "")
.replaceAll(" ", "=")
}

from Function f, ReturnStmt r, string rt
where r.getEnclosingFunction() = f
and (
f.getType().getName() = "bool"
and not isBoolExpr(r.getExpr())
and rt = "non-bool"
or
f.getType().getName() != "bool"
and isBoolExpr(r.getExpr())
and rt = "bool"
)
select r, "Function " + f.getName() +
" has return type " + f.getType().getName() +
" and returns " + rt +
"(" + showMacroExpr(r.getExpr()) + ")"
39 changes: 39 additions & 0 deletions .github/codeql/cpp-queries/missing-argument-null-check.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <assert.h>

typedef struct {
char *string;
} StructWithString;

void good_with_assert(StructWithString *data)
{
assert(data != NULL);
char *string = data->string;
}

void good_with_no_deref(StructWithString *data)
{
good_with_assert(data);
}

void good_with_if(StructWithString *data)
{
if (data != NULL)
{
char *string = data->string;
}
}

void bad_deref(StructWithString *data)
{
char *string = data->string;
}

int main(void)
{
StructWithString *data = NULL;
good_with_no_deref(data); // Doesn't dereference, so no problem
good_with_assert(data); // Assert will detect our error
good_with_if(data); // Works with NULL pointers
bad_deref(data); // Blows up - will be detected in alert
return 0;
}
49 changes: 49 additions & 0 deletions .github/codeql/cpp-queries/missing-argument-null-check.qhelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>

<overview>

<p>
Functions which dereference a pointer should test for <code>NULL</code>.
This should be done as an explicit comparison in an <code>assert</code> or <code>if</code> statement.
If the function assumes that an argument is non-null, add an assert at the beginning of the function body.
</p>

<p>
There are some limitations in the current implementation.
It only looks for explicit comparisons, <code>if (ptr == NULL)</code>, but this is the correct way to write it, according to our style guidelines.
Only arrow syntax is detected, <code>ptr->field</code>, so it should be expanded to also detect asterisk syntax, <code>*ptr</code>.
Also, it doesn't check that the comparison is before the dereference, it should be improved to also alert in cases where the check is after the dereference.
There shouldn't be false positives, but it should be expanded to find more problematic cases.
</p>

</overview>
<recommendation>

<p>
Add an assert to the beginning of the function if it assumes the argument is not null: <code>assert(ptr != NULL)</code>.
Add an an explicit comparison somewhere in the function if it is okay for the argument to be NULL.
(Usually this should be an <code>if</code> around the dereference).
Note that in both cases, the comparison <b>must</b> be explicit (using <code>== NULL</code> or <code>!= NULL</code>).
</p>

</recommendation>
<example>

<p>
This example has 2 correct (good) functions, and one incorrect (bad) function:
</p>

<sample src="missing-argument-null-check.c" />

</example>
<references>

<li>
CFEngine Contribution guidelines: <a href="https://github.com/cfengine/core/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a>
</li>

</references>
</qhelp>
37 changes: 37 additions & 0 deletions .github/codeql/cpp-queries/missing-argument-null-check.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @name Pointer argument is dereferenced without checking for NULL
* @description Functions which dereference a pointer should test for NULL.
* This should be done as an explicit comparison in an assert or if statement.
* @kind problem
* @problem.severity recommendation
* @id cpp/missing-argument-null-check
* @tags readability
* correctness
* safety
* @precision very-high
*/

import cpp

predicate hasNullCheck(Function func, Parameter p){
exists(MacroInvocation m |
m.getMacroName() = "assert"
and m.getEnclosingFunction() = func
and m.getUnexpandedArgument(0) = p.getName() + " != NULL")
or
exists(EqualityOperation comparison, MacroInvocation m|
comparison.getEnclosingFunction() = func
and comparison.getLeftOperand().toString() = p.getName()
and comparison.getRightOperand() = m.getExpr()
and m.getMacroName() = "NULL")
}

from Function func, PointerFieldAccess acc, Parameter p, PointerType pt
where acc.getEnclosingFunction() = func
and p.getFunction() = func
and p.getType() = pt
and acc.getQualifier().toString() = p.getName()
and not hasNullCheck(func, p)
select acc, "Parameter " + p.getName() +
" in " + func.getName() +
"() is dereferenced without an explicit null-check"
4 changes: 4 additions & 0 deletions .github/codeql/cpp-queries/qlpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: cfengine/codeql-cpp-queries
version: 1.0.0
dependencies:
codeql/cpp-all: ~0.5.4
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: "daily"
Loading