diff options
author | Milan Broz <mbroz@redhat.com> | 2012-08-23 19:55:26 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2012-08-24 09:26:59 +0200 |
commit | cce471c9cec7f501614a025e114dd7631ee3a734 (patch) | |
tree | 4026329706bda8a43195265f770d34cf0c230c56 /install | |
parent | 353e7a7ec33baed5a3dff0f66198d73da419b07c (diff) | |
download | dracut-cce471c9cec7f501614a025e114dd7631ee3a734.tar.gz dracut-cce471c9cec7f501614a025e114dd7631ee3a734.tar.bz2 dracut-cce471c9cec7f501614a025e114dd7631ee3a734.zip |
dracut-install: FIPS workaround for fipscheck dir
In recent Fedora distro are all hmac files located in /lib
(to avoid multiarch conflict).
When installing hmac file, also install files from these locations.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Diffstat (limited to 'install')
-rw-r--r-- | install/dracut-install.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/install/dracut-install.c b/install/dracut-install.c index 0571c2a8..f06f5ac3 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -321,7 +321,7 @@ static int resolve_deps(const char *src) } /* Install ".<filename>.hmac" file for FIPS self-checks */ -static int hmac_install(const char *src, const char *dst) +static int hmac_install(const char *src, const char *dst, const char *hmacpath) { char *srcpath = strdup(src); char *dstpath = strdup(dst); @@ -332,10 +332,20 @@ static int hmac_install(const char *src, const char *dst) if (endswith(src, ".hmac")) return 0; + if (!hmacpath) { + hmac_install(src, dst, "/lib/fipscheck"); + hmac_install(src, dst, "/lib64/fipscheck"); + } + srcpath[dlen] = '\0'; dstpath[dir_len(dst)] = '\0'; - asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]); - asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]); + if (hmacpath) { + asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]); + asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]); + } else { + asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]); + asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]); + } log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname); dracut_install(srchmacname, dsthmacname, false, false, true); free(dsthmacname); @@ -480,7 +490,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res free(abspath); if (arg_hmac) { /* copy .hmac files also */ - hmac_install(src, dst); + hmac_install(src, dst, NULL); } return 0; @@ -491,7 +501,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res ret += resolve_deps(src); if (arg_hmac) { /* copy .hmac files also */ - hmac_install(src, dst); + hmac_install(src, dst, NULL); } } |