]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fipshmac: always use realpaths
authorZoltan Fridrich <zfridric@redhat.com>
Wed, 9 Nov 2022 15:10:58 +0000 (16:10 +0100)
committerZoltan Fridrich <zfridric@redhat.com>
Tue, 15 Nov 2022 14:16:07 +0000 (15:16 +0100)
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
bootstrap.conf
lib/fipshmac.c

index bfbc7e0962f84547225615fc035b4863e7cc5bd1..ad8d7cd51e9bdbb7ee3f3d82b319fd3224e6f7ab 100644 (file)
@@ -27,7 +27,7 @@ required_submodules="tests/suite/tls-fuzzer/python-ecdsa tests/suite/tls-fuzzer/
 
 # Those modules are common to lib/ and src/.
 common_modules="
-alloca attribute byteswap c-ctype c-strcase explicit_bzero fopen-gnu func getline gettext-h gettimeofday hash hash-pjw-bare arpa_inet inet_ntop inet_pton intprops linkedhash-list lock memmem-simple minmax netdb netinet_in read-file secure_getenv setsockopt snprintf stdint stpcpy strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types threadlib time_r tls unistd valgrind-tests vasprintf verify vsnprintf xalloc-oversized
+alloca attribute byteswap c-ctype c-strcase canonicalize-lgpl explicit_bzero fopen-gnu func getline gettext-h gettimeofday hash hash-pjw-bare arpa_inet inet_ntop inet_pton intprops linkedhash-list lock memmem-simple minmax netdb netinet_in read-file secure_getenv setsockopt snprintf stdint stpcpy strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types threadlib time_r tls unistd valgrind-tests vasprintf verify vsnprintf xalloc-oversized
 "
 gnulib_modules="
 $common_modules dirname-lgpl extensions gendocs havelib ldd lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings pmccabe2html warnings
index b091572bdf063d3a50ffb0fe82147f10e01c5644..13051dfdab68cdd224997d6981d8a0b718692f03 100644 (file)
@@ -102,20 +102,30 @@ static int get_hmac(const char *path, char *hmac, size_t hmac_size)
 static int print_lib_path(const char *path)
 {
        int ret;
+       char *real_path = NULL;
        char hmac[HMAC_STR_SIZE];
 
-       ret = get_hmac(path, hmac, sizeof(hmac));
+       real_path = canonicalize_file_name(path);
+       if (real_path == NULL) {
+               fprintf(stderr, "Could not get realpath from %s\n", path);
+               ret = GNUTLS_E_FILE_ERROR;
+               goto cleanup;
+       }
+
+       ret = get_hmac(real_path, hmac, sizeof(hmac));
        if (ret < 0) {
                fprintf(stderr, "Could not calculate HMAC for %s: %s\n",
-                        last_component(path), gnutls_strerror(ret));
-               return ret;
+                        last_component(real_path), gnutls_strerror(ret));
+               goto cleanup;
        }
 
        printf("[%s]\n", last_component(path));
-       printf("path = %s\n", path);
+       printf("path = %s\n", real_path);
        printf("hmac = %s\n", hmac);
 
-       return 0;
+cleanup:
+       free(real_path);
+       return ret;
 }
 
 static int print_lib_dl(const char *lib, const char *sym)