summaryrefslogtreecommitdiffstats
path: root/cache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cache.cxx')
-rw-r--r--cache.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/cache.cxx b/cache.cxx
index 76e9faf8..1e4d7f18 100644
--- a/cache.cxx
+++ b/cache.cxx
@@ -69,7 +69,7 @@ add_to_cache(systemtap_session& s)
}
#if HAVE_NSS
- // This is the name of the cached module signatire.
+ // This is the name of the cached module signature.
string module_signature_dest_path = s.hash_path;
module_signature_dest_path += ".sgn";
@@ -133,6 +133,10 @@ get_from_cache(systemtap_session& s)
string module_dest_path = s.tmpdir + "/" + s.module_name + ".ko";
string c_src_path = s.hash_path;
int fd_stapconf, fd_module, fd_c;
+#if HAVE_NSS
+ string hash_signature_path = s.hash_path + ".sgn";
+ int fd_signature;
+#endif
if (c_src_path.rfind(".ko") == (c_src_path.size() - 3))
c_src_path.resize(c_src_path.size() - 3);
@@ -202,6 +206,24 @@ get_from_cache(systemtap_session& s)
close(fd_c);
return false;
}
+#if HAVE_NSS
+ // See if module signature exists. It's not an error if it doesn't. It just
+ // means that the module is unsigned.
+ fd_signature = open(hash_signature_path.c_str(), O_RDONLY);
+ if (fd_signature != -1) {
+ string signature_dest_path = module_dest_path + ".sgn";
+ close(fd_signature);
+ if (copy_file(hash_signature_path.c_str(), signature_dest_path.c_str()) != 0)
+ {
+ cerr << "Copy failed (\"" << hash_signature_path << "\" to \""
+ << signature_dest_path << "\"): " << strerror(errno) << endl;
+ unlink(c_src_path.c_str());
+ close(fd_module);
+ close(fd_c);
+ return false;
+ }
+ }
+#endif
}
// We're done with these file handles.