Commit graph

4777 commits

Author SHA1 Message Date
Lorenz Kästle
be9db2e02f lib: code formatting, perfdata label sanity checking and so on 2025-09-08 15:59:20 +02:00
Lorenz Kästle
87195f5511 check_snmp: refactoring + fixes
This commit moves the state retention logic to check_snmp as it is only
used there and I do not want it to be used at all, so it doesn't get a
place in the lib.

Otherwise this adapts tests and fixes the rate computing in the
refactored version of check_snmp.
Also fixes some bugs detected with the tests
2025-09-08 15:57:06 +02:00
Lorenz Kästle
1aefb1f9df snmp: fix complaint of snmpd about paths 2025-09-08 15:54:08 +02:00
Lorenz Kästle
28bb2fa0a4 lib/utils_base.c: small refactoring 2025-09-01 11:57:36 +02:00
Lorenz Kästle
888cd29202 lib/utils_base.c: clang-format 2025-09-01 11:24:44 +02:00
Lorenz Kästle
41d309d438 check_snmp: improve string quoting in result 2025-09-01 11:22:58 +02:00
Lorenz Kästle
a7c6760cfe check_snmp: Small improvements + fix dereference bug 2025-08-30 14:19:06 +02:00
Lorenz Kästle
7f1877f760 check_snmp: Fix number processing (offset + multiplier) 2025-08-30 14:18:42 +02:00
Lorenz Kästle
77a5db04d7 check_snmp: implement output format setting 2025-08-30 14:16:36 +02:00
Lorenz Kästle
1ca5a6040a check_snmp: Make linter happy 2025-08-29 10:50:53 +02:00
Lorenz Kästle
b4d84ebfee check_snmp: Remove options description for input delimiter 2025-08-29 10:42:19 +02:00
Lorenz Kästle
e4c59440f0 Build check_snmp unconditionally 2025-08-28 15:22:04 +02:00
Lorenz Kästle
ebc2415330 check_snmp: fix DES availability detection(?) 2025-08-28 13:14:29 +02:00
Lorenz Kästle
553a230a28 check_snmp: formatting 2025-08-28 11:52:15 +02:00
Lorenz Kästle
f5ad4275ff check_snmp: Test for availability of DES privacy protocol 2025-08-28 11:52:03 +02:00
Lorenz Kästle
b65f94fe0e Remove testing for SNMPGETNEXT from autotools stuff 2025-08-28 11:24:16 +02:00
Lorenz Kästle
bd6cff7f9c check_snmp: use snmp v2c if community is given 2025-08-27 19:54:09 +02:00
Lorenz Kästle
d3e1c0314d Fix Specfile requires 2025-08-27 19:29:56 +02:00
Lorenz Kästle
334c7e3e13 Add libsnmp-dev dependency to codeql gh action 2025-08-27 19:27:07 +02:00
Lorenz Kästle
f1104f49a4 Fix one more typo 2025-08-27 19:20:41 +02:00
Lorenz Kästle
776c51a66f Add netsnmp lib to specfile 2025-08-27 19:18:15 +02:00
Lorenz Kästle
7ff0e518e4 Add libsnmp-dev to github action dependencies 2025-08-27 19:14:51 +02:00
Lorenz Kästle
78cb7b2288 check_snmp: fix typos 2025-08-27 19:12:56 +02:00
Lorenz Kästle
75f792bc6b check_snmp: declare internal functions static 2025-08-27 16:43:32 +02:00
Lorenz Kästle
faf794b401 check_snmp: remove leftover multiply function 2025-08-27 16:43:11 +02:00
Lorenz Kästle
015e4c0986 check_snmp: fix/adapt tests 2025-08-27 16:42:06 +02:00
Lorenz Kästle
e490c5f969 check_snmp: hopefully fix helpers 2025-08-27 16:41:46 +02:00
Lorenz Kästle
f976155863 check_snmp: Improve error handling 2025-08-27 16:41:02 +02:00
Lorenz Kästle
a27862a9c7 check_snmp: rebuild threshold parsing 2025-08-27 12:17:46 +02:00
Lorenz Kästle
babeb765e5 Fix range comparison and aesthetic improvements 2025-08-27 12:15:45 +02:00
Lorenz Kästle
7fe6ac8d08 rebuild check_snmp 2025-08-25 15:28:04 +02:00
Lorenz Kästle
723e0d3466
Merge pull request #2107 from RincewindsHat/refactor/check_users
Refactor/check users
2025-08-11 23:22:54 +02:00
Lorenz Kästle
7382fa90f8 Merge branch 'master' into refactor/check_users 2025-08-11 21:54:05 +02:00
Lorenz Kästle
fb39f96ac6 check_users: Use sd_get_uids instead of sd_get_session
Previously check_users in combination with systemd used
sd_get_sessions (3) to aquire the number of users, probably
with the idea that every users opens a session.
Turns out, that a user can have multiple sessions and we only really
want to know how many users there are.

This commit changes to sd_get_uids (3) to achieve that target.
2025-08-11 21:49:20 +02:00
waja
2046ae8557
Merge pull request #2139 from waja/ci_fix_rawhide 2025-08-04 10:10:57 +02:00
Jan Wagner
278954117c
(Re)construct PLATFORM_ID as it's droped since Fedora 43
See https://fedoraproject.org/wiki/Changes/Drop_PLATFORM_ID?#Drop_PLATFORM_ID
2025-08-01 21:38:45 +02:00
Lorenz Kästle
1dfb5a0c10
Merge pull request #2138 from RincewindsHat/improvements/check_ssh
Improvements/check ssh
2025-08-01 14:44:44 +02:00
Lorenz Kästle
2757550558 clang-format 2025-08-01 14:35:23 +02:00
Lorenz Kästle
a69dff1522 check_ssh: Put variable in the correct scope 2025-08-01 14:35:13 +02:00
Lorenz Kästle
3c53bf623d check_ssh: Fix format expression 2025-08-01 14:34:29 +02:00
Lorenz Kästle
69925c782b check_ssh: fix data type to allow for error checking 2025-08-01 14:34:01 +02:00
Lorenz Kästle
b05087d9aa
Merge pull request #2133 from rlaager/fix-check_ssh-buffer-overflow
Fix check ssh buffer overflow
2025-08-01 14:27:48 +02:00
waja
7349d6203b
Merge pull request #2137 from waja/ci_dispatch_ssh
Adding tmate optional to manual dispatch
2025-07-24 10:39:03 +02:00
Jan Wagner
61a68da144 Adding tmate optional to manual dispatch 2025-07-24 10:28:03 +02:00
waja
04fa8ae9e2
Merge pull request #2136 from waja/ci_dispatch 2025-07-23 15:43:59 +02:00
Jan Wagner
d2bea1d288 CI: Adding workflow_dispatch 2025-07-23 15:22:45 +02:00
Lorenz Kästle
da810e0dbe
Merge pull request #2134 from RincewindsHat/fix/check_ntp_peer_fmt_conv
check_ntp_peer: fix invalid conversion in printf
2025-07-14 10:03:13 +02:00
Lorenz Kästle
c43135a5e5 check_ntp_peer: fix invalid conversion in printf 2025-07-14 09:37:51 +02:00
Richard Laager
1f2acfd1c6 check_ssh: Correct type on len variable
strlen() returns a size_t.

Signed-off-by: Richard Laager <rlaager@wiktel.com>
2025-07-11 18:44:03 -05:00
Richard Laager
661ecff45c check_ssh: Fix buffer overflow
A buffer overflow was occurring when the server responded with:
Exceeded MaxStartups\r\n

glibc would then abort() with the following output:
*** buffer overflow detected ***: terminated

It was the memset() that was overflowing the buffer.  But the memmove()
needed fixing too.

First off, there was an off-by-one error in both the memmove() and
memset().  byte_offset was already set to the start of the data _past_
the newline (i.e. len + 1).  For the memmove(), incrementing that by 1
again lost the first character of the additional output.  For the
memset(), this causes a buffer overflow.

Second, the memset() has multiple issues.  The comment claims that it
was NULing (sic "null") the "rest".  However, it has no idea how long
the "rest" is, at this point.  It was NULing BUFF_SZ - byte_offset + 1.
After fixing the off-by-one / buffer overflow, it would be NULing
BUFF_SZ - byte_offset.  But that doesn't make any sense.  The length of
the first line has no relation to the length of the second line.

For a quick-and-dirty test, add something like this just inside the
while loop:
memcpy(output,
  "Exceeded MaxStartups\r\nnext blah1 blah2 blah3 blah4\0",
  sizeof("Exceeded MaxStartups\r\nnext blah1 blah2 blah3 blah4\0"));

And, after the memmove(), add:
  printf("output='%s'\n", output);

If you fix the memset() buffer overflow, it will output:
output='ext blah1 blah2 blah3 '

As you can see, the first character is lost.

If you then fix the memmove(), it will output:
output='next blah1 blah2 blah3'

Note that this is still losing the "blah4".

After moving the memset() after byte_offset is set to the new strlen()
of output, then it works correctly:
output='next blah1 blah2 blah3 blah4'

Signed-off-by: Richard Laager <rlaager@wiktel.com>
2025-07-11 18:43:59 -05:00