check_ssh: Move default SSH constant around a bit

This commit is contained in:
Lorenz Kästle 2025-02-25 11:32:18 +01:00
parent 5ee9a5eadd
commit add5bfb1e4
2 changed files with 5 additions and 6 deletions

View file

@ -44,7 +44,6 @@ const char *email = "devel@monitoring-plugins.org";
# define MSG_DONTWAIT 0
#endif
#define SSH_DFL_PORT 22
#define BUFF_SZ 256
static bool verbose = false;
@ -219,9 +218,7 @@ process_arguments_wrapper process_arguments(int argc, char **argv) {
result.errorcode = ERROR;
return result;
}
if (result.config.port == -1) { /* funky, but allows -p to override stray integer in args */
result.config.port = SSH_DFL_PORT;
}
return result;
}
@ -398,7 +395,7 @@ int ssh_connect(mp_check *overall, char *haddr, int hport, char *desired_remote_
void print_help(void) {
char *myport;
xasprintf(&myport, "%d", SSH_DFL_PORT);
xasprintf(&myport, "%d", default_ssh_port);
print_revision(progname, NP_VERSION);

View file

@ -3,6 +3,8 @@
#include <stddef.h>
#include "../../lib/monitoringplug.h"
const int default_ssh_port = 22;
typedef struct check_ssh_config {
int port;
char *server_name;
@ -15,7 +17,7 @@ typedef struct check_ssh_config {
check_ssh_config check_ssh_config_init(void) {
check_ssh_config tmp = {
.port = -1,
.port = default_ssh_port,
.server_name = NULL,
.remote_version = NULL,
.remote_protocol = NULL,