From 487d64a4e4122ca7b389b5e26b6cdf156c877c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 3 Mar 2016 21:23:49 +0200 Subject: allow checking 0-sized resource (ex. IPC$) patch by Marek Marczykowski diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 9899226..4e46397 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl @@ -212,7 +212,8 @@ if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) { my ($total_bytes) = $1 * $2; my ($occupied_bytes) = $1 * $2 - $avail_bytes; my ($avail) = $avail_bytes/1024; - my ($capper) = int(($3/$1)*100); + my ($capper); + if ($1!=0) { $capper = int(($3/$1)*100) } else { $capper=100 }; my ($mountpt) = "\\\\$host\\$share"; # TODO : why is the kB the standard unit for args ? -- cgit v0.10-9-g596f From e695a81b137e50ebbdf3d78a371a3e2201835440 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 13:40:50 +0200 Subject: Remove unnecessary type defines diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 2d22619..312de54 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -98,10 +98,6 @@ static struct strbuf dat = {AREA_SZ, 0, (char *)dat_area}; #define GOT_INTR 4 #define GOT_ERR 128 -#define u_int8_t uint8_t -#define u_int16_t uint16_t -#define u_int32_t uint32_t - static int get_msg(int); static int check_ctrl(int); static int put_ctrl(int, int, int); @@ -132,13 +128,13 @@ long mac_addr_dlpi( const char *, int, u_char *); typedef struct dhcp_packet_struct{ - u_int8_t op; /* packet type */ - u_int8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ - u_int8_t hlen; /* length of hardware address (of this machine) */ - u_int8_t hops; /* hops */ - u_int32_t xid; /* random transaction id number - chosen by this machine */ - u_int16_t secs; /* seconds used in timing */ - u_int16_t flags; /* flags */ + uint8_t op; /* packet type */ + uint8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ + uint8_t hlen; /* length of hardware address (of this machine) */ + uint8_t hops; /* hops */ + uint32_t xid; /* random transaction id number - chosen by this machine */ + uint16_t secs; /* seconds used in timing */ + uint16_t flags; /* flags */ struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ struct in_addr siaddr; /* IP address of next server */ @@ -153,9 +149,9 @@ typedef struct dhcp_packet_struct{ typedef struct dhcp_offer_struct{ struct in_addr server_address; /* address of DHCP server that sent this offer */ struct in_addr offered_address; /* the IP address that was offered to us */ - u_int32_t lease_time; /* lease time in seconds */ - u_int32_t renewal_time; /* renewal time in seconds */ - u_int32_t rebinding_time; /* rebinding time in seconds */ + uint32_t lease_time; /* lease time in seconds */ + uint32_t renewal_time; /* renewal time in seconds */ + uint32_t rebinding_time; /* rebinding time in seconds */ struct dhcp_offer_struct *next; }dhcp_offer; @@ -198,7 +194,7 @@ typedef struct requested_server_struct{ #define ETHERNET_HARDWARE_ADDRESS 1 /* used in htype field of dhcp packet */ #define ETHERNET_HARDWARE_ADDRESS_LENGTH 6 /* length of Ethernet hardware addresses */ -u_int8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ +uint8_t unicast = 0; /* unicast mode: mimic a DHCP relay */ struct in_addr my_ip; /* our address (required for relay) */ struct in_addr dhcp_ip; /* server to query (if in unicast mode) */ unsigned char client_hardware_address[MAX_DHCP_CHADDR_LENGTH]=""; @@ -206,11 +202,11 @@ unsigned char *user_specified_mac=NULL; char network_interface_name[IFNAMSIZ]="eth0"; -u_int32_t packet_xid=0; +uint32_t packet_xid=0; -u_int32_t dhcp_lease_time=0; -u_int32_t dhcp_renewal_time=0; -u_int32_t dhcp_rebinding_time=0; +uint32_t dhcp_lease_time=0; +uint32_t dhcp_renewal_time=0; +uint32_t dhcp_rebinding_time=0; int dhcpoffer_timeout=2; @@ -948,7 +944,7 @@ int get_results(void){ dhcp_offer *temp_offer; requested_server *temp_server; int result; - u_int32_t max_lease_time=0; + uint32_t max_lease_time=0; received_requested_address=FALSE; -- cgit v0.10-9-g596f From 07510639189539817cee805caa5b6471427b7964 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 13:55:22 +0200 Subject: Homogenize whitespace usage diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 312de54..99df3d2 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -1,37 +1,37 @@ /***************************************************************************** -* -* Monitoring check_dhcp plugin -* -* License: GPL -* Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org) -* Copyright (c) 2001-2007 Monitoring Plugins Development Team -* -* Description: -* -* This file contains the check_dhcp plugin -* -* This plugin tests the availability of DHCP servers on a network. -* -* Unicast mode was originally implemented by Heiti of Boras Kommun with -* general improvements as well as usability fixes and "forward"-porting by -* Andreas Ericsson of OP5 AB. -* -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* -*****************************************************************************/ + * + * Monitoring check_dhcp plugin + * + * License: GPL + * Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org) + * Copyright (c) 2001-2007 Monitoring Plugins Development Team + * + * Description: + * + * This file contains the check_dhcp plugin + * + * This plugin tests the availability of DHCP servers on a network. + * + * Unicast mode was originally implemented by Heiti of Boras Kommun with + * general improvements as well as usability fixes and "forward"-porting by + * Andreas Ericsson of OP5 AB. + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + *****************************************************************************/ const char *progname = "check_dhcp"; const char *copyright = "2001-2007"; @@ -128,22 +128,22 @@ long mac_addr_dlpi( const char *, int, u_char *); typedef struct dhcp_packet_struct{ - uint8_t op; /* packet type */ - uint8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ - uint8_t hlen; /* length of hardware address (of this machine) */ - uint8_t hops; /* hops */ - uint32_t xid; /* random transaction id number - chosen by this machine */ - uint16_t secs; /* seconds used in timing */ - uint16_t flags; /* flags */ - struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ - struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ - struct in_addr siaddr; /* IP address of next server */ - struct in_addr giaddr; /* IP address of DHCP relay */ - unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */ - char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */ - char file [MAX_DHCP_FILE_LENGTH]; /* boot file name (used for diskless booting?) */ + uint8_t op; /* packet type */ + uint8_t htype; /* type of hardware address for this machine (Ethernet, etc) */ + uint8_t hlen; /* length of hardware address (of this machine) */ + uint8_t hops; /* hops */ + uint32_t xid; /* random transaction id number - chosen by this machine */ + uint16_t secs; /* seconds used in timing */ + uint16_t flags; /* flags */ + struct in_addr ciaddr; /* IP address of this machine (if we already have one) */ + struct in_addr yiaddr; /* IP address of this machine (offered by the DHCP server) */ + struct in_addr siaddr; /* IP address of next server */ + struct in_addr giaddr; /* IP address of DHCP relay */ + unsigned char chaddr [MAX_DHCP_CHADDR_LENGTH]; /* hardware address of this machine */ + char sname [MAX_DHCP_SNAME_LENGTH]; /* name of DHCP server */ + char file [MAX_DHCP_FILE_LENGTH]; /* boot file name (used for diskless booting?) */ char options[MAX_DHCP_OPTIONS_LENGTH]; /* options */ - }dhcp_packet; +}dhcp_packet; typedef struct dhcp_offer_struct{ @@ -153,14 +153,14 @@ typedef struct dhcp_offer_struct{ uint32_t renewal_time; /* renewal time in seconds */ uint32_t rebinding_time; /* rebinding time in seconds */ struct dhcp_offer_struct *next; - }dhcp_offer; +}dhcp_offer; typedef struct requested_server_struct{ struct in_addr server_address; int answered; struct requested_server_struct *next; - }requested_server; +}requested_server; #define BOOTREQUEST 1 @@ -264,7 +264,7 @@ int main(int argc, char **argv){ if(process_arguments(argc,argv)!=OK){ usage4 (_("Could not parse arguments")); - } + } /* create socket for DHCP communications */ dhcp_socket=create_dhcp_socket(); @@ -295,7 +295,7 @@ int main(int argc, char **argv){ free_requested_server_list(); return result; - } +} @@ -310,83 +310,83 @@ int get_hardware_address(int sock,char *interface_name){ /* try and grab hardware address of requested interface */ if(ioctl(sock,SIOCGIFHWADDR,&ifr)<0){ - printf(_("Error: Could not get hardware address of interface '%s'\n"),interface_name); + printf(_("Error: Could not get hardware address of interface '%s'\n"),interface_name); exit(STATE_UNKNOWN); - } + } memcpy(&client_hardware_address[0],&ifr.ifr_hwaddr.sa_data,6); #elif defined(__bsd__) - /* King 2004 see ACKNOWLEDGEMENTS */ - - size_t len; - int mib[6]; - char *buf; - unsigned char *ptr; - struct if_msghdr *ifm; - struct sockaddr_dl *sdl; - - mib[0] = CTL_NET; - mib[1] = AF_ROUTE; - mib[2] = 0; - mib[3] = AF_LINK; - mib[4] = NET_RT_IFLIST; - - if((mib[5] = if_nametoindex(interface_name)) == 0){ - printf(_("Error: if_nametoindex error - %s.\n"), strerror(errno)); - exit(STATE_UNKNOWN); - } + /* King 2004 see ACKNOWLEDGEMENTS */ + + size_t len; + int mib[6]; + char *buf; + unsigned char *ptr; + struct if_msghdr *ifm; + struct sockaddr_dl *sdl; + + mib[0] = CTL_NET; + mib[1] = AF_ROUTE; + mib[2] = 0; + mib[3] = AF_LINK; + mib[4] = NET_RT_IFLIST; + + if((mib[5] = if_nametoindex(interface_name)) == 0){ + printf(_("Error: if_nametoindex error - %s.\n"), strerror(errno)); + exit(STATE_UNKNOWN); + } - if(sysctl(mib, 6, NULL, &len, NULL, 0) < 0){ - printf(_("Error: Couldn't get hardware address from %s. sysctl 1 error - %s.\n"), interface_name, strerror(errno)); - exit(STATE_UNKNOWN); - } + if(sysctl(mib, 6, NULL, &len, NULL, 0) < 0){ + printf(_("Error: Couldn't get hardware address from %s. sysctl 1 error - %s.\n"), interface_name, strerror(errno)); + exit(STATE_UNKNOWN); + } - if((buf = malloc(len)) == NULL){ - printf(_("Error: Couldn't get hardware address from interface %s. malloc error - %s.\n"), interface_name, strerror(errno)); - exit(4); - } + if((buf = malloc(len)) == NULL){ + printf(_("Error: Couldn't get hardware address from interface %s. malloc error - %s.\n"), interface_name, strerror(errno)); + exit(4); + } - if(sysctl(mib, 6, buf, &len, NULL, 0) < 0){ - printf(_("Error: Couldn't get hardware address from %s. sysctl 2 error - %s.\n"), interface_name, strerror(errno)); - exit(STATE_UNKNOWN); - } + if(sysctl(mib, 6, buf, &len, NULL, 0) < 0){ + printf(_("Error: Couldn't get hardware address from %s. sysctl 2 error - %s.\n"), interface_name, strerror(errno)); + exit(STATE_UNKNOWN); + } - ifm = (struct if_msghdr *)buf; - sdl = (struct sockaddr_dl *)(ifm + 1); - ptr = (unsigned char *)LLADDR(sdl); - memcpy(&client_hardware_address[0], ptr, 6) ; - /* King 2004 */ + ifm = (struct if_msghdr *)buf; + sdl = (struct sockaddr_dl *)(ifm + 1); + ptr = (unsigned char *)LLADDR(sdl); + memcpy(&client_hardware_address[0], ptr, 6) ; + /* King 2004 */ #elif defined(__sun__) || defined(__solaris__) - /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ + /* Kompf 2000-2003 see ACKNOWLEDGEMENTS */ long stat; char dev[20] = "/dev/"; char *p; int unit; - /* get last number from interfacename, eg lnc0, e1000g0*/ - int i; - p = interface_name + strlen(interface_name) -1; + /* get last number from interfacename, eg lnc0, e1000g0*/ + int i; + p = interface_name + strlen(interface_name) -1; for(i = strlen(interface_name) -1; i > 0; p--) { if(isalpha(*p)) - break; - } - p++; + break; + } + p++; if( p != interface_name ){ unit = atoi(p) ; strncat(dev, interface_name, 6) ; - } + } else{ printf(_("Error: can't find unit number in interface_name (%s) - expecting TypeNumber eg lnc0.\n"), interface_name); exit(STATE_UNKNOWN); - } + } stat = mac_addr_dlpi(dev, unit, client_hardware_address); if(stat != 0){ printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), dev, unit); exit(STATE_UNKNOWN); - } + } #elif defined(__hpux__) @@ -398,8 +398,8 @@ int get_hardware_address(int sock,char *interface_name){ if(stat != 0){ printf(_("Error: can't read MAC address from DLPI streams interface for device %s unit %d.\n"), dev, unit); exit(STATE_UNKNOWN); - } - /* Kompf 2000-2003 */ + } + /* Kompf 2000-2003 */ #else printf(_("Error: can't get MAC address for this architecture. Use the --mac option.\n")); @@ -410,7 +410,7 @@ int get_hardware_address(int sock,char *interface_name){ print_hardware_address(client_hardware_address); return OK; - } +} /* determines IP address of the client interface */ int get_ip_address(int sock,char *interface_name){ @@ -422,9 +422,9 @@ int get_ip_address(int sock,char *interface_name){ if(ioctl(sock,SIOCGIFADDR,&ifr)<0){ printf(_("Error: Cannot determine IP address of interface %s\n"), - interface_name); + interface_name); exit(STATE_UNKNOWN); - } + } my_ip=((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; @@ -437,13 +437,13 @@ int get_ip_address(int sock,char *interface_name){ printf(_("Pretending to be relay client %s\n"),inet_ntoa(my_ip)); return OK; - } +} /* sends a DHCPDISCOVER broadcast message in an attempt to find DHCP servers */ int send_dhcp_discover(int sock){ dhcp_packet discover_packet; struct sockaddr_in sockaddr_broadcast; - unsigned short opts; + unsigned short opts; /* clear the packet data structure */ @@ -484,7 +484,7 @@ int send_dhcp_discover(int sock){ discover_packet.options[2]='\x53'; discover_packet.options[3]='\x63'; - opts = 4; + opts = 4; /* DHCP message type is embedded in options field */ discover_packet.options[opts++]=DHCP_OPTION_MESSAGE_TYPE; /* DHCP message type option identifier */ discover_packet.options[opts++]='\x01'; /* DHCP message option length in bytes */ @@ -496,7 +496,7 @@ int send_dhcp_discover(int sock){ discover_packet.options[opts++]='\x04'; memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); opts += sizeof(requested_address); - } + } discover_packet.options[opts++]=DHCP_OPTION_END; /* unicast fields */ @@ -507,8 +507,8 @@ int send_dhcp_discover(int sock){ discover_packet.hops = unicast ? 1 : 0; /* send the DHCPDISCOVER packet to broadcast address */ - sockaddr_broadcast.sin_family=AF_INET; - sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); + sockaddr_broadcast.sin_family=AF_INET; + sockaddr_broadcast.sin_port=htons(DHCP_SERVER_PORT); sockaddr_broadcast.sin_addr.s_addr = unicast ? dhcp_ip.s_addr : INADDR_BROADCAST; bzero(&sockaddr_broadcast.sin_zero,sizeof(sockaddr_broadcast.sin_zero)); @@ -520,7 +520,7 @@ int send_dhcp_discover(int sock){ printf("DHCDISCOVER yiaddr: %s\n",inet_ntoa(discover_packet.yiaddr)); printf("DHCDISCOVER siaddr: %s\n",inet_ntoa(discover_packet.siaddr)); printf("DHCDISCOVER giaddr: %s\n",inet_ntoa(discover_packet.giaddr)); - } + } /* send the DHCPDISCOVER packet out */ send_dhcp_packet(&discover_packet,sizeof(discover_packet),sock,&sockaddr_broadcast); @@ -529,7 +529,7 @@ int send_dhcp_discover(int sock){ printf("\n\n"); return OK; - } +} @@ -569,13 +569,13 @@ int get_dhcp_offer(int sock){ printf(_("Result=ERROR\n")); continue; - } + } else{ if(verbose) printf(_("Result=OK\n")); responses++; - } + } /* The "source" is either a server or a relay. */ /* Save a copy of "source" into "via" even if it's via itself */ @@ -585,7 +585,7 @@ int get_dhcp_offer(int sock){ printf(_("DHCPOFFER from IP address %s"),inet_ntoa(source.sin_addr)); printf(_(" via %s\n"),inet_ntoa(via.sin_addr)); printf("DHCPOFFER XID: %u (0x%X)\n",ntohl(offer_packet.xid),ntohl(offer_packet.xid)); - } + } /* check packet xid to see if its the same as the one we used in the discover packet */ if(ntohl(offer_packet.xid)!=packet_xid){ @@ -593,7 +593,7 @@ int get_dhcp_offer(int sock){ printf(_("DHCPOFFER XID (%u) did not match DHCPDISCOVER XID (%u) - ignoring packet\n"),ntohl(offer_packet.xid),packet_xid); continue; - } + } /* check hardware address */ result=OK; @@ -606,7 +606,7 @@ int get_dhcp_offer(int sock){ if(offer_packet.chaddr[x]!=client_hardware_address[x]) result=ERROR; - } + } if(verbose) printf("\n"); @@ -615,27 +615,27 @@ int get_dhcp_offer(int sock){ printf(_("DHCPOFFER hardware address did not match our own - ignoring packet\n")); continue; - } + } if(verbose){ printf("DHCPOFFER ciaddr: %s\n",inet_ntoa(offer_packet.ciaddr)); printf("DHCPOFFER yiaddr: %s\n",inet_ntoa(offer_packet.yiaddr)); printf("DHCPOFFER siaddr: %s\n",inet_ntoa(offer_packet.siaddr)); printf("DHCPOFFER giaddr: %s\n",inet_ntoa(offer_packet.giaddr)); - } + } add_dhcp_offer(source.sin_addr,&offer_packet); valid_responses++; - } + } if(verbose){ printf(_("Total responses seen on the wire: %d\n"),responses); printf(_("Valid responses for this machine: %d\n"),valid_responses); - } + } return OK; - } +} @@ -652,14 +652,14 @@ int send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in return ERROR; return OK; - } +} /* receives a DHCP packet */ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, struct sockaddr_in *address){ - struct timeval tv; - fd_set readfds; + struct timeval tv; + fd_set readfds; fd_set oobfds; int recv_result; socklen_t address_size; @@ -667,88 +667,88 @@ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, st int nfound; - /* wait for data to arrive (up time timeout) */ - tv.tv_sec=timeout; - tv.tv_usec=0; - FD_ZERO(&readfds); - FD_ZERO(&oobfds); - FD_SET(sock,&readfds); - FD_SET(sock,&oobfds); - nfound = select(sock+1,&readfds,NULL,&oobfds,&tv); + /* wait for data to arrive (up time timeout) */ + tv.tv_sec=timeout; + tv.tv_usec=0; + FD_ZERO(&readfds); + FD_ZERO(&oobfds); + FD_SET(sock,&readfds); + FD_SET(sock,&oobfds); + nfound = select(sock+1,&readfds,NULL,&oobfds,&tv); - /* make sure some data has arrived */ - if(!FD_ISSET(sock,&readfds)){ + /* make sure some data has arrived */ + if(!FD_ISSET(sock,&readfds)){ if(verbose) - printf(_("No (more) data received (nfound: %d)\n"), nfound); - return ERROR; - } + printf(_("No (more) data received (nfound: %d)\n"), nfound); + return ERROR; + } - else{ + else{ bzero(&source_address,sizeof(source_address)); address_size=sizeof(source_address); - recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size); + recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size); if(verbose) printf("recv_result: %d\n",recv_result); - if(recv_result==-1){ + if(recv_result==-1){ if(verbose){ printf(_("recvfrom() failed, ")); printf("errno: (%d) -> %s\n",errno,strerror(errno)); - } - return ERROR; - } + } + return ERROR; + } else{ if(verbose){ printf(_("receive_dhcp_packet() result: %d\n"),recv_result); printf(_("receive_dhcp_packet() source: %s\n"),inet_ntoa(source_address.sin_addr)); - } + } memcpy(address,&source_address,sizeof(source_address)); return OK; - } - } + } + } return OK; - } +} /* creates a socket for DHCP communication */ int create_dhcp_socket(void){ - struct sockaddr_in myname; + struct sockaddr_in myname; struct ifreq interface; - int sock; - int flag=1; + int sock; + int flag=1; - /* Set up the address we're going to bind to. */ + /* Set up the address we're going to bind to. */ bzero(&myname,sizeof(myname)); - myname.sin_family=AF_INET; - /* listen to DHCP server port if we're in unicast mode */ - myname.sin_port = htons(unicast ? DHCP_SERVER_PORT : DHCP_CLIENT_PORT); - myname.sin_addr.s_addr = unicast ? my_ip.s_addr : INADDR_ANY; - bzero(&myname.sin_zero,sizeof(myname.sin_zero)); + myname.sin_family=AF_INET; + /* listen to DHCP server port if we're in unicast mode */ + myname.sin_port = htons(unicast ? DHCP_SERVER_PORT : DHCP_CLIENT_PORT); + myname.sin_addr.s_addr = unicast ? my_ip.s_addr : INADDR_ANY; + bzero(&myname.sin_zero,sizeof(myname.sin_zero)); - /* create a socket for DHCP communications */ + /* create a socket for DHCP communications */ sock=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); - if(sock<0){ + if(sock<0){ printf(_("Error: Could not create socket!\n")); exit(STATE_UNKNOWN); - } + } if(verbose) printf("DHCP socket: %d\n",sock); - /* set the reuse address flag so we don't get errors when restarting */ - flag=1; - if(setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char *)&flag,sizeof(flag))<0){ + /* set the reuse address flag so we don't get errors when restarting */ + flag=1; + if(setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(char *)&flag,sizeof(flag))<0){ printf(_("Error: Could not set reuse address option on DHCP socket!\n")); exit(STATE_UNKNOWN); - } + } - /* set the broadcast option - we need this to listen to DHCP broadcast messages */ - if(!unicast && setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){ + /* set the broadcast option - we need this to listen to DHCP broadcast messages */ + if(!unicast && setsockopt(sock,SOL_SOCKET,SO_BROADCAST,(char *)&flag,sizeof flag)<0){ printf(_("Error: Could not set broadcast option on DHCP socket!\n")); exit(STATE_UNKNOWN); - } + } /* bind socket to interface */ #if defined(__linux__) @@ -757,21 +757,21 @@ int create_dhcp_socket(void){ if(setsockopt(sock,SOL_SOCKET,SO_BINDTODEVICE,(char *)&interface,sizeof(interface))<0){ printf(_("Error: Could not bind socket to interface %s. Check your privileges...\n"),network_interface_name); exit(STATE_UNKNOWN); - } + } #else strncpy(interface.ifr_name,network_interface_name,IFNAMSIZ-1); interface.ifr_name[IFNAMSIZ-1]='\0'; #endif - /* bind the socket */ - if(bind(sock,(struct sockaddr *)&myname,sizeof(myname))<0){ + /* bind the socket */ + if(bind(sock,(struct sockaddr *)&myname,sizeof(myname))<0){ printf(_("Error: Could not bind to DHCP socket (port %d)! Check your privileges...\n"),DHCP_CLIENT_PORT); exit(STATE_UNKNOWN); - } + } - return sock; - } + return sock; +} /* closes DHCP socket */ @@ -780,7 +780,7 @@ int close_dhcp_socket(int sock){ close(sock); return OK; - } +} /* adds a requested server address to list in memory */ @@ -803,7 +803,7 @@ int add_requested_server(struct in_addr server_address){ printf(_("Requested server address: %s\n"),inet_ntoa(new_server->server_address)); return OK; - } +} @@ -836,29 +836,29 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ /* get option data */ switch(option_type){ - case DHCP_OPTION_LEASE_TIME: - memcpy(&dhcp_lease_time, &offer_packet->options[x],sizeof(dhcp_lease_time)); - dhcp_lease_time = ntohl(dhcp_lease_time); - break; - case DHCP_OPTION_RENEWAL_TIME: - memcpy(&dhcp_renewal_time, &offer_packet->options[x],sizeof(dhcp_renewal_time)); - dhcp_renewal_time = ntohl(dhcp_renewal_time); - break; - case DHCP_OPTION_REBINDING_TIME: - memcpy(&dhcp_rebinding_time, &offer_packet->options[x],sizeof(dhcp_rebinding_time)); - dhcp_rebinding_time = ntohl(dhcp_rebinding_time); - break; - case DHCP_OPTION_SERVER_IDENTIFIER: - memcpy(&serv_ident.s_addr, &offer_packet->options[x],sizeof(serv_ident.s_addr)); - break; - } + case DHCP_OPTION_LEASE_TIME: + memcpy(&dhcp_lease_time, &offer_packet->options[x],sizeof(dhcp_lease_time)); + dhcp_lease_time = ntohl(dhcp_lease_time); + break; + case DHCP_OPTION_RENEWAL_TIME: + memcpy(&dhcp_renewal_time, &offer_packet->options[x],sizeof(dhcp_renewal_time)); + dhcp_renewal_time = ntohl(dhcp_renewal_time); + break; + case DHCP_OPTION_REBINDING_TIME: + memcpy(&dhcp_rebinding_time, &offer_packet->options[x],sizeof(dhcp_rebinding_time)); + dhcp_rebinding_time = ntohl(dhcp_rebinding_time); + break; + case DHCP_OPTION_SERVER_IDENTIFIER: + memcpy(&serv_ident.s_addr, &offer_packet->options[x],sizeof(serv_ident.s_addr)); + break; + } /* skip option data we're ignoring */ if(option_type==0) /* "pad" option, see RFC 2132 (3.1) */ x+=1; else x+=option_length; - } + } if(verbose){ if(dhcp_lease_time==DHCP_INFINITE_TIME) @@ -872,7 +872,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ if(dhcp_rebinding_time==DHCP_INFINITE_TIME) printf(_("Rebinding Time: Infinite\n")); printf(_("Rebinding Time: %lu seconds\n"),(unsigned long)dhcp_rebinding_time); - } + } new_offer=(dhcp_offer *)malloc(sizeof(dhcp_offer)); @@ -901,14 +901,14 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){ if(verbose){ printf(_("Added offer from server @ %s"),inet_ntoa(new_offer->server_address)); printf(_(" of IP address %s\n"),inet_ntoa(new_offer->offered_address)); - } + } /* add new offer to head of list */ new_offer->next=dhcp_offer_list; dhcp_offer_list=new_offer; return OK; - } +} /* frees memory allocated to DHCP OFFER list */ @@ -919,10 +919,10 @@ int free_dhcp_offer_list(void){ for(this_offer=dhcp_offer_list;this_offer!=NULL;this_offer=next_offer){ next_offer=this_offer->next; free(this_offer); - } + } return OK; - } +} /* frees memory allocated to requested server list */ @@ -933,10 +933,10 @@ int free_requested_server_list(void){ for(this_server=requested_server_list;this_server!=NULL;this_server=next_server){ next_server=this_server->next; free(this_server); - } + } return OK; - } +} /* gets state and plugin output to return */ @@ -972,16 +972,16 @@ int get_results(void){ if(temp_server->answered) printf(_(" (duplicate)")); printf(_("\n")); - } + } if(temp_server->answered == FALSE){ requested_responses++; temp_server->answered=TRUE; - } - } - } - } + } + } + } + } - } + } /* else check and see if we got our requested address from any server */ else{ @@ -995,8 +995,8 @@ int get_results(void){ /* see if we got the address we requested */ if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) received_requested_address=TRUE; - } - } + } + } result=STATE_OK; if(valid_responses==0) @@ -1021,7 +1021,7 @@ int get_results(void){ if(dhcp_offer_list==NULL){ printf(_("No DHCPOFFERs were received.\n")); return result; - } + } printf(_("Received %d DHCPOFFER(s)"),valid_responses); @@ -1040,7 +1040,7 @@ int get_results(void){ printf(".\n"); return result; - } +} /* process command-line arguments */ @@ -1083,71 +1083,71 @@ int call_getopt(int argc, char **argv){ switch(c){ - case 's': /* DHCP server address */ - resolve_host(optarg,&dhcp_ip); - add_requested_server(dhcp_ip); - break; + case 's': /* DHCP server address */ + resolve_host(optarg,&dhcp_ip); + add_requested_server(dhcp_ip); + break; - case 'r': /* address we are requested from DHCP servers */ - resolve_host(optarg,&requested_address); - request_specific_address=TRUE; - break; + case 'r': /* address we are requested from DHCP servers */ + resolve_host(optarg,&requested_address); + request_specific_address=TRUE; + break; - case 't': /* timeout */ - - /* - if(is_intnonneg(optarg)) - */ - if(atoi(optarg)>0) - dhcpoffer_timeout=atoi(optarg); - /* - else - usage("Time interval must be a nonnegative integer\n"); - */ - break; + case 't': /* timeout */ - case 'm': /* MAC address */ + /* + if(is_intnonneg(optarg)) + */ + if(atoi(optarg)>0) + dhcpoffer_timeout=atoi(optarg); + /* + else + usage("Time interval must be a nonnegative integer\n"); + */ + break; - if((user_specified_mac=mac_aton(optarg)) == NULL) - usage("Cannot parse MAC address.\n"); - if(verbose) - print_hardware_address(user_specified_mac); + case 'm': /* MAC address */ - break; + if((user_specified_mac=mac_aton(optarg)) == NULL) + usage("Cannot parse MAC address.\n"); + if(verbose) + print_hardware_address(user_specified_mac); - case 'i': /* interface name */ + break; - strncpy(network_interface_name,optarg,sizeof(network_interface_name)-1); - network_interface_name[sizeof(network_interface_name)-1]='\x0'; + case 'i': /* interface name */ - break; + strncpy(network_interface_name,optarg,sizeof(network_interface_name)-1); + network_interface_name[sizeof(network_interface_name)-1]='\x0'; - case 'u': /* unicast testing */ - unicast=1; - break; + break; - case 'V': /* version */ - print_revision(progname, NP_VERSION); - exit(STATE_UNKNOWN); + case 'u': /* unicast testing */ + unicast=1; + break; - case 'h': /* help */ - print_help(); - exit(STATE_UNKNOWN); + case 'V': /* version */ + print_revision(progname, NP_VERSION); + exit(STATE_UNKNOWN); - case 'v': /* verbose */ - verbose=1; - break; + case 'h': /* help */ + print_help(); + exit(STATE_UNKNOWN); - case '?': /* help */ - usage5 (); - break; + case 'v': /* verbose */ + verbose=1; + break; - default: - break; - } - } + case '?': /* help */ + usage5 (); + break; + + default: + break; + } + } return optind; - } +} int validate_arguments(int argc){ @@ -1174,21 +1174,21 @@ static int get_msg(int fd){ if(res < 0){ if(errno == EINTR){ return(GOT_INTR); - } + } else{ printf("%s\n", "get_msg FAILED."); return(GOT_ERR); - } } + } if(ctl.len > 0){ ret |= GOT_CTRL; - } + } if(dat.len > 0){ ret |= GOT_DATA; - } + } return(ret); - } +} /* verify that dl_primitive in ctl_area = prim */ static int check_ctrl(int prim){ @@ -1197,10 +1197,10 @@ static int check_ctrl(int prim){ if(err_ack->dl_primitive != prim){ printf(_("Error: DLPI stream API failed to get MAC in check_ctrl: %s.\n"), strerror(errno)); exit(STATE_UNKNOWN); - } + } return 0; - } +} /* put a control message on a stream */ static int put_ctrl(int fd, int len, int pri){ @@ -1209,10 +1209,10 @@ static int put_ctrl(int fd, int len, int pri){ if(putmsg(fd, &ctl, 0, pri) < 0){ printf(_("Error: DLPI stream API failed to get MAC in put_ctrl/putmsg(): %s.\n"), strerror(errno)); exit(STATE_UNKNOWN); - } + } return 0; - } +} /* put a control + data message on a stream */ static int put_both(int fd, int clen, int dlen, int pri){ @@ -1222,10 +1222,10 @@ static int put_both(int fd, int clen, int dlen, int pri){ if(putmsg(fd, &ctl, &dat, pri) < 0){ printf(_("Error: DLPI stream API failed to get MAC in put_both/putmsg().\n"), strerror(errno)); exit(STATE_UNKNOWN); - } + } return 0; - } +} /* open file descriptor and attach */ static int dl_open(const char *dev, int unit, int *fd){ @@ -1234,13 +1234,13 @@ static int dl_open(const char *dev, int unit, int *fd){ if((*fd = open(dev, O_RDWR)) == -1){ printf(_("Error: DLPI stream API failed to get MAC in dl_attach_req/open(%s..): %s.\n"), dev, strerror(errno)); exit(STATE_UNKNOWN); - } + } attach_req->dl_primitive = DL_ATTACH_REQ; attach_req->dl_ppa = unit; put_ctrl(*fd, sizeof(dl_attach_req_t), 0); get_msg(*fd); return check_ctrl(DL_OK_ACK); - } +} /* send DL_BIND_REQ */ static int dl_bind(int fd, int sap, u_char *addr){ @@ -1258,12 +1258,12 @@ static int dl_bind(int fd, int sap, u_char *addr){ if (GOT_ERR == check_ctrl(DL_BIND_ACK)){ printf(_("Error: DLPI stream API failed to get MAC in dl_bind/check_ctrl(): %s.\n"), strerror(errno)); exit(STATE_UNKNOWN); - } + } bcopy((u_char *)bind_ack + bind_ack->dl_addr_offset, addr, - bind_ack->dl_addr_length); + bind_ack->dl_addr_length); return 0; - } +} /*********************************************************************** * interface: @@ -1282,15 +1282,15 @@ long mac_addr_dlpi( const char *dev, int unit, u_char *addr){ u_char mac_addr[25]; if(GOT_ERR != dl_open(dev, unit, &fd)){ - if(GOT_ERR != dl_bind(fd, INSAP, mac_addr)){ - bcopy( mac_addr, addr, 6); - return 0; - } + if(GOT_ERR != dl_bind(fd, INSAP, mac_addr)){ + bcopy( mac_addr, addr, 6); + return 0; } - close(fd); + } + close(fd); return -1; - } +} /* Kompf 2000-2003 */ #endif @@ -1307,7 +1307,7 @@ void resolve_host(const char *in,struct in_addr *out){ memcpy(out,&((struct sockaddr_in *)ai->ai_addr)->sin_addr,sizeof(*out)); freeaddrinfo(ai); - } +} /* parse MAC address string, return 6 bytes (unterminated) or NULL */ @@ -1326,10 +1326,10 @@ unsigned char *mac_aton(const char *string){ result[j]=strtol(tmp,(char **)NULL,16); i++; j++; - } + } return (j==6) ? result : NULL; - } +} void print_hardware_address(const unsigned char *address){ @@ -1340,7 +1340,7 @@ void print_hardware_address(const unsigned char *address){ printf("%2.2x:", address[i]); printf("%2.2x", address[i]); putchar('\n'); - } +} /* print usage help */ @@ -1353,7 +1353,7 @@ void print_help(void){ printf("%s\n", _("This plugin tests the availability of DHCP servers on a network.")); - printf ("\n\n"); + printf ("\n\n"); print_usage(); @@ -1363,32 +1363,32 @@ void print_help(void){ printf (UT_VERBOSE); printf (" %s\n", "-s, --serverip=IPADDRESS"); - printf (" %s\n", _("IP address of DHCP server that we must hear from")); - printf (" %s\n", "-r, --requestedip=IPADDRESS"); - printf (" %s\n", _("IP address that should be offered by at least one DHCP server")); - printf (" %s\n", "-t, --timeout=INTEGER"); - printf (" %s\n", _("Seconds to wait for DHCPOFFER before timeout occurs")); - printf (" %s\n", "-i, --interface=STRING"); - printf (" %s\n", _("Interface to to use for listening (i.e. eth0)")); - printf (" %s\n", "-m, --mac=STRING"); - printf (" %s\n", _("MAC address to use in the DHCP request")); - printf (" %s\n", "-u, --unicast"); - printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); - - printf (UT_SUPPORT); + printf (" %s\n", _("IP address of DHCP server that we must hear from")); + printf (" %s\n", "-r, --requestedip=IPADDRESS"); + printf (" %s\n", _("IP address that should be offered by at least one DHCP server")); + printf (" %s\n", "-t, --timeout=INTEGER"); + printf (" %s\n", _("Seconds to wait for DHCPOFFER before timeout occurs")); + printf (" %s\n", "-i, --interface=STRING"); + printf (" %s\n", _("Interface to to use for listening (i.e. eth0)")); + printf (" %s\n", "-m, --mac=STRING"); + printf (" %s\n", _("MAC address to use in the DHCP request")); + printf (" %s\n", "-u, --unicast"); + printf (" %s\n", _("Unicast testing: mimic a DHCP relay, requires -s")); + + printf (UT_SUPPORT); return; - } +} void print_usage(void){ - printf ("%s\n", _("Usage:")); - printf (" %s [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]\n",progname); - printf (" [-i interface] [-m mac]\n"); + printf ("%s\n", _("Usage:")); + printf (" %s [-v] [-u] [-s serverip] [-r requestedip] [-t timeout]\n",progname); + printf (" [-i interface] [-m mac]\n"); return; - } +} -- cgit v0.10-9-g596f From 1aaa2385031da8de6c9d74cecf589482a56b9e35 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 13:59:00 +0200 Subject: Use real booleans diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 99df3d2..0c18d5f 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -115,9 +115,6 @@ long mac_addr_dlpi( const char *, int, u_char *); #define OK 0 #define ERROR -1 -#define FALSE 0 -#define TRUE 1 - /**** DHCP definitions ****/ @@ -158,7 +155,7 @@ typedef struct dhcp_offer_struct{ typedef struct requested_server_struct{ struct in_addr server_address; - int answered; + bool answered; struct requested_server_struct *next; }requested_server; @@ -217,8 +214,8 @@ int valid_responses=0; /* number of valid DHCPOFFERs we received */ int requested_servers=0; int requested_responses=0; -int request_specific_address=FALSE; -int received_requested_address=FALSE; +bool request_specific_address=false; +bool received_requested_address=false; int verbose=0; struct in_addr requested_address; @@ -491,7 +488,7 @@ int send_dhcp_discover(int sock){ discover_packet.options[opts++]=DHCPDISCOVER; /* the IP address we're requesting */ - if(request_specific_address==TRUE){ + if(request_specific_address){ discover_packet.options[opts++]=DHCP_OPTION_REQUESTED_ADDRESS; discover_packet.options[opts++]='\x04'; memcpy(&discover_packet.options[opts],&requested_address,sizeof(requested_address)); @@ -792,7 +789,7 @@ int add_requested_server(struct in_addr server_address){ return ERROR; new_server->server_address=server_address; - new_server->answered=FALSE; + new_server->answered=false; new_server->next=requested_server_list; requested_server_list=new_server; @@ -946,7 +943,7 @@ int get_results(void){ int result; uint32_t max_lease_time=0; - received_requested_address=FALSE; + received_requested_address=false; /* checks responses from requested servers */ requested_responses=0; @@ -962,7 +959,7 @@ int get_results(void){ /* see if we got the address we requested */ if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) - received_requested_address=TRUE; + received_requested_address=true; /* see if the servers we wanted a response from talked to us or not */ if(!memcmp(&temp_offer->server_address,&temp_server->server_address,sizeof(temp_server->server_address))){ @@ -973,9 +970,9 @@ int get_results(void){ printf(_(" (duplicate)")); printf(_("\n")); } - if(temp_server->answered == FALSE){ + if(!temp_server->answered){ requested_responses++; - temp_server->answered=TRUE; + temp_server->answered=true; } } } @@ -994,7 +991,7 @@ int get_results(void){ /* see if we got the address we requested */ if(!memcmp(&requested_address,&temp_offer->offered_address,sizeof(requested_address))) - received_requested_address=TRUE; + received_requested_address=true; } } @@ -1005,7 +1002,7 @@ int get_results(void){ result=STATE_CRITICAL; else if(requested_responses0) printf(_(", %s%d of %d requested servers responded"),((requested_responses0)?"only ":"",requested_responses,requested_servers); - if(request_specific_address==TRUE) - printf(_(", requested address (%s) was %soffered"),inet_ntoa(requested_address),(received_requested_address==TRUE)?"":_("not ")); + if(request_specific_address) + printf(_(", requested address (%s) was %soffered"),inet_ntoa(requested_address),(received_requested_address)?"":_("not ")); printf(_(", max lease time = ")); if(max_lease_time==DHCP_INFINITE_TIME) @@ -1090,7 +1087,7 @@ int call_getopt(int argc, char **argv){ case 'r': /* address we are requested from DHCP servers */ resolve_host(optarg,&requested_address); - request_specific_address=TRUE; + request_specific_address=true; break; case 't': /* timeout */ -- cgit v0.10-9-g596f From 11487d161c6ca3152ab3fa6dbece8d0e2d18ea46 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:03:34 +0200 Subject: Comment some endifs to make comprehension easier diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 0c18d5f..d74d4ac 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -57,9 +57,10 @@ const char *email = "devel@monitoring-plugins.org"; #include #include #include + #if HAVE_SYS_SOCKIO_H #include -#endif +#endif // HAVE_SYS_SOCKIO_H #if defined( __linux__ ) @@ -106,7 +107,7 @@ static int dl_open(const char *, int, int *); static int dl_bind(int, int, u_char *); long mac_addr_dlpi( const char *, int, u_char *); -#endif +#endif // __sun__ || __solaris__ || __hpux -- cgit v0.10-9-g596f From f2ed728823276fc3f861ce909953c318f83aef74 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:03:44 +0200 Subject: Remove trailing lines diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index d74d4ac..4d16772 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -1387,6 +1387,3 @@ print_usage(void){ return; } - - - -- cgit v0.10-9-g596f From 9f9f5fd9b22e6e6d6415be3c3ecde9f795b55fe2 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:05:59 +0200 Subject: Update copyright diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 4d16772..0ddace5 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c @@ -34,7 +34,7 @@ *****************************************************************************/ const char *progname = "check_dhcp"; -const char *copyright = "2001-2007"; +const char *copyright = "2001-2023"; const char *email = "devel@monitoring-plugins.org"; #include "common.h" -- cgit v0.10-9-g596f From e1e1291b72e2f1df81d0346d77e65da677e57878 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:22:51 +0200 Subject: Fix some more typos diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eda2790..0f845de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: uses: codespell-project/actions-codespell@v2 with: skip: "./.git,./.gitignore,./ABOUT-NLS,*.po,./gl,./po,./tools/squid.conf,./build-aux/ltmain.sh" - ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners + ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners,esponse check_filenames: true check_hidden: true # super-linter: diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4 index 9f533ea..9fe38ac 100644 --- a/m4/np_mysqlclient.m4 +++ b/m4/np_mysqlclient.m4 @@ -13,7 +13,7 @@ dnl np_mysql_libs = flags for libs, from mysql_config --libs dnl np_mysql_cflags = flags for cflags, from mysql_config --cflags dnl Also sets in config.h: dnl HAVE_MYSQLCLIENT -dnl Copile your code with: +dnl Compile your code with: dnl $(CC) $(np_mysql_include) code.c $(np_mysql_libs) AC_DEFUN([np_mysqlclient], diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 3614650..99537c8 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c @@ -486,7 +486,7 @@ double offset_request(const char *host, int *status){ } /* cleanup */ - /* FIXME: Not closing the socket to avoid re-use of the local port + /* FIXME: Not closing the socket to avoid reuse of the local port * which can cause old NTP packets to be read instead of NTP control * packets in jitter_request(). THERE MUST BE ANOTHER WAY... * for(j=0; jtestCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e cmp_ok( $t->return_code, '==', 0, "Check old parameter options" ); $t = NPTest->testCmd( "./check_imap $host_nonresponsive" ); -cmp_ok( $t->return_code, '==', 2, "Get error with non reponsive host" ); +cmp_ok( $t->return_code, '==', 2, "Get error with non responsive host" ); $t = NPTest->testCmd( "./check_imap $hostname_invalid" ); cmp_ok( $t->return_code, '==', 2, "Invalid hostname" ); diff --git a/plugins/t/check_users.t b/plugins/t/check_users.t index 088f3b5..9ebc2fc 100644 --- a/plugins/t/check_users.t +++ b/plugins/t/check_users.t @@ -2,7 +2,7 @@ # # Logged in Users Tests via check_users # -# Trick: This ckeck requires at least 1 user logged in. These commands should +# Trick: This check requires at least 1 user logged in. These commands should # leave a session open forever in the background: # # $ ssh -tt localhost /dev/null 2>/dev/null & diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t index 72f2b7c..3c91483 100755 --- a/plugins/tests/check_curl.t +++ b/plugins/tests/check_curl.t @@ -9,7 +9,7 @@ # Country Name (2 letter code) [AU]:DE # State or Province Name (full name) [Some-State]:Bavaria # Locality Name (eg, city) []:Munich -# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins +# Organization Name (eg, company) [Internet Widgets Pty Ltd]:Monitoring Plugins # Organizational Unit Name (eg, section) []: # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins # Email Address []:devel@monitoring-plugins.org -- cgit v0.10-9-g596f