]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Reorganize imports in common and address modules
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 19 Oct 2021 17:01:12 +0000 (12:01 -0500)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 19 Oct 2021 17:01:12 +0000 (12:01 -0500)
Was throwing a compilation warning in FreeBSD.

src/address.c
src/address.h
src/common.c
src/common.h
src/object/certificate.c

index 6b5cf8b60cbb07a1587414d556a21672328abaea..3316ae4a6ac8d682110c2d17042034ab4aea8b29 100644 (file)
@@ -1,11 +1,9 @@
 #include "address.h"
 
-#include <string.h>
-#include <errno.h>
-#include <arpa/inet.h> /* inet_ntop */
-#include <sys/types.h> /* AF_INET, AF_INET6 (needed in OpenBSD) */
-#include <sys/socket.h> /* AF_INET, AF_INET6 (needed in OpenBSD) */
-#include "common.h"
+#include <stdlib.h> /* strtoul() */
+#include <string.h> /* memset(), memcpy() */
+#include <arpa/inet.h> /* inet_ntop(), htonl() */
+
 #include "log.h"
 #include "thread_var.h"
 
@@ -515,6 +513,18 @@ ipv6_covered(struct in6_addr *f_addr, uint8_t f_len, struct in6_addr *son_addr)
        return true;
 }
 
+char const *
+addr2str4(struct in_addr const *addr, char *buffer)
+{
+       return inet_ntop(AF_INET, addr, buffer, INET_ADDRSTRLEN);
+}
+
+char const *
+addr2str6(struct in6_addr const *addr, char *buffer)
+{
+       return inet_ntop(AF_INET6, addr, buffer, INET6_ADDRSTRLEN);
+}
+
 /**
  * buffer must length INET6_ADDRSTRLEN.
  */
index 53585ec46550a717c75b7acf7d8470318f0ecc70..8fbf7a71a36406480bf2bb34ac8e26e4c51250a8 100644 (file)
@@ -51,6 +51,8 @@ int ipv6_prefix_validate(struct ipv6_prefix *);
 bool ipv4_covered(struct in_addr *, uint8_t, struct in_addr *);
 bool ipv6_covered(struct in6_addr *, uint8_t, struct in6_addr *);
 
+char const *addr2str4(struct in_addr const *, char *);
+char const *addr2str6(struct in6_addr const *, char *);
 void sockaddr2str(struct sockaddr_storage *, char *buffer);
 
 #endif /* SRC_ADDRESS_H_ */
index f49bb7442a49ae1fc982e5761289b0f6c6b55f81..918e4117984fe7edc9e5fed2411609e93b31d78a 100644 (file)
@@ -1,14 +1,13 @@
 #include "common.h"
 
-#include <errno.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/types.h> /* AF_INET, AF_INET6 (needed in OpenBSD) */
-#include <sys/socket.h> /* AF_INET, AF_INET6 (needed in OpenBSD) */
-#include <sys/stat.h>
+#include <dirent.h> /* readdir(), closedir() */
+#include <limits.h> /* realpath() */
+#include <stdlib.h> /* malloc(), free(), realloc(), realpath() */
+#include <stdio.h> /* remove() */
+#include <string.h> /* strdup(), strrchr(), strcmp(), strcat(), etc */
+#include <unistd.h> /* stat(), rmdir() */
+#include <sys/stat.h> /* stat(), mkdir() */
+#include <sys/types.h> /* stat(), closedir(), mkdir() */
 
 #include "config.h"
 #include "log.h"
@@ -198,18 +197,6 @@ valid_file_or_dir(char const *location, bool check_file, bool check_dir,
        return result;
 }
 
-char const *
-addr2str4(struct in_addr const *addr, char *buffer)
-{
-       return inet_ntop(AF_INET, addr, buffer, INET_ADDRSTRLEN);
-}
-
-char const *
-addr2str6(struct in6_addr const *addr, char *buffer)
-{
-       return inet_ntop(AF_INET6, addr, buffer, INET6_ADDRSTRLEN);
-}
-
 static int
 dir_exists(char const *path, bool *result)
 {
index 1c92c41e9e2f14610e1459f9391292d96efa5c9f..cf21ccc5419854536142a31ce4e8e289591175b9 100644 (file)
@@ -4,7 +4,6 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <time.h>
-#include <netinet/in.h>
 
 /* "I think that this is not supposed to be implemented." */
 #define ENOTSUPPORTED 3172
@@ -54,9 +53,6 @@ int process_file_or_dir(char const *, char const *, bool, process_file_cb,
 typedef int (*pr_errno_cb)(int, const char *, ...);
 bool valid_file_or_dir(char const *, bool, bool, pr_errno_cb);
 
-char const *addr2str4(struct in_addr const *, char *);
-char const *addr2str6(struct in6_addr const *, char *);
-
 int create_dir_recursive(char const *);
 int delete_dir_recursive_bottom_up(char const *);
 
index 7f7ecea1cf4dfa12012bdc913246590766778f9f..ca52f7a581279fdacaf8fd3a41188cb439003bf3 100644 (file)
@@ -1839,19 +1839,16 @@ static int
 get_certificate_type(X509 *cert, bool is_ta, enum cert_type *result)
 {
        if (is_ta) {
-               /* Note: It looks weird if we log the type here. */
                *result = TA;
                return 0;
        }
 
        if (X509_check_ca(cert) == 1) {
-               pr_val_debug("Type: CA");
                *result = CA;
                return 0;
        }
 
        if (has_bgpsec_router_eku(cert)) {
-               pr_val_debug("Type: BGPsec EE");
                *result = BGPSEC;
                return 0;
        }