=== modified file 'Makefile' --- Makefile 2018-02-12 15:03:06 +0000 +++ Makefile 2018-02-22 09:20:19 +0000 @@ -253,8 +253,12 @@ --expression='s/\(mandos_\)[0-9.]\+\(\.orig\.tar\.gz\)/\1$(version)\2/' \ $@) +# Need to add the GnuTLS, Avahi and GPGME libraries, and can't use +# -fsanitize=leak because GnuTLS and GPGME both leak memory. plugins.d/mandos-client: plugins.d/mandos-client.c - $(LINK.c) $^ -lrt $(GNUTLS_LIBS) $(AVAHI_LIBS) $(strip\ + $(CC) $(filter-out -fsanitize=leak,$(CFLAGS)) $(strip\ + ) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(strip\ + ) -lrt $(GNUTLS_LIBS) $(AVAHI_LIBS) $(strip\ ) $(GPGME_LIBS) $(LOADLIBES) $(LDLIBS) -o $@ plugin-helpers/mandos-client-iprouteadddel: plugin-helpers/mandos-client-iprouteadddel.c === modified file 'plugin-helpers/mandos-client-iprouteadddel.c' --- plugin-helpers/mandos-client-iprouteadddel.c 2018-02-08 10:23:55 +0000 +++ plugin-helpers/mandos-client-iprouteadddel.c 2018-02-18 01:29:21 +0000 @@ -23,8 +23,7 @@ * Contact the authors at . */ -#define _GNU_SOURCE /* asprintf(), - program_invocation_short_name */ +#define _GNU_SOURCE /* program_invocation_short_name */ #include /* bool, false, true */ #include /* fprintf(), stderr, FILE, vfprintf */ #include /* program_invocation_short_name, @@ -244,7 +243,7 @@ } /* Set interface index number on nexthop object */ rtnl_route_nh_set_ifindex(nexthop, ifindex); - /* Set route tu use nexthop object */ + /* Set route to use nexthop object */ rtnl_route_add_nexthop(route, nexthop); /* Add or delete route? */ if(arguments.add){ === modified file 'plugin-runner.c' --- plugin-runner.c 2018-02-12 14:54:58 +0000 +++ plugin-runner.c 2018-02-22 18:15:57 +0000 @@ -583,6 +583,7 @@ if(arg[0] == '\0'){ break; } + /* FALLTHROUGH */ default: return ARGP_ERR_UNKNOWN; } === modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2018-02-08 10:23:55 +0000 +++ plugins.d/mandos-client.c 2018-02-22 14:34:19 +0000 @@ -613,6 +613,10 @@ } params.size += (unsigned int)bytes_read; } + ret = close(dhpfile); + if(ret == -1){ + perror_plus("close"); + } if(params.data == NULL){ dhparamsfilename = NULL; } @@ -1655,8 +1659,18 @@ perror_plus("ioctl SIOCGIFFLAGS"); errno = old_errno; } + if((close(s) == -1) and debug){ + old_errno = errno; + perror_plus("close"); + errno = old_errno; + } return false; } + if((close(s) == -1) and debug){ + old_errno = errno; + perror_plus("close"); + errno = old_errno; + } return true; } @@ -1923,19 +1937,20 @@ return; } } + int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY)); + if(devnull == -1){ + perror_plus("open(\"/dev/null\", O_RDONLY)"); + return; + } int numhooks = scandirat(hookdir_fd, ".", &direntries, runnable_hook, alphasort); if(numhooks == -1){ perror_plus("scandir"); + close(devnull); return; } struct dirent *direntry; int ret; - int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY)); - if(devnull == -1){ - perror_plus("open(\"/dev/null\", O_RDONLY)"); - return; - } for(int i = 0; i < numhooks; i++){ direntry = direntries[i]; if(debug){ @@ -3061,6 +3076,7 @@ | O_PATH)); if(dir_fd == -1){ perror_plus("open"); + return; } int numentries = scandirat(dir_fd, ".", &direntries, notdotentries, alphasort); @@ -3083,7 +3099,7 @@ clean_dir_at(dir_fd, direntries[i]->d_name, level+1); dret = 0; } - if(dret == -1){ + if((dret == -1) and (errno != ENOENT)){ fprintf_plus(stderr, "unlink(\"%s/%s\"): %s\n", dirname, direntries[i]->d_name, strerror(errno)); } @@ -3093,9 +3109,6 @@ /* need to clean even if 0 because man page doesn't specify */ free(direntries); - if(numentries == -1){ - perror_plus("scandirat"); - } dret = unlinkat(base, dirname, AT_REMOVEDIR); if(dret == -1 and errno != ENOENT){ perror_plus("rmdir");