diff --git a/check-users.c b/check-users.c index 4ded587..8444b65 100644 --- a/check-users.c +++ b/check-users.c @@ -21,7 +21,7 @@ void check_users() { struct passwd *res; errno = 0; res = getpwnam(CHECK_USERS_CANARY_USER); - if(res == NULL) { + if(res == NULL || getenv("NEST_SANITY_CHECK_USERS_DEBUG")!=NULL) { /* If we've already reported it, let's not report it again */ if(check_users_state == 1) return; int res_errno; @@ -37,6 +37,7 @@ void check_users() { snprintf(notification_payload, notification_payload_len, notification_payload_fmt, res_err_txt, res_errno); int send_alarm_result; send_alarm_result = send_alarm(notification_payload); + free(notification_payload); /* We only set this to 1 if we successfully reported the issue. */ if(send_alarm_result == 0) check_users_state = 1; } diff --git a/configure.ac b/configure.ac index 429ca23..0077c8e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,11 +15,14 @@ PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES([LIBCURL], [libcurl]) # Checks for header files. +AC_CHECK_HEADER_STDBOOL +AC_CHECK_HEADERS([unistd.h]) # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_FUNC_MALLOC +AC_CHECK_FUNCS([strerror]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/notify.c b/notify.c index 5b9e8d4..af5e34d 100644 --- a/notify.c +++ b/notify.c @@ -56,8 +56,8 @@ const char *build_prefixed_report(const char *report) { * adds prefixes and calls the report send function */ int report_len = strlen(report); int notification_prefix_len = strlen(NOTIFICATION_PREFIX); - int post_payload_len = report_len + notification_prefix_len + 1; - char *post_payload = malloc(post_payload_len); + int post_payload_len = report_len + notification_prefix_len; + char *post_payload = malloc(post_payload_len+1); for(int a=0;a