summaryrefslogtreecommitdiffstats
path: root/modsign.cxx
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-04-28 11:43:05 -0400
committerDave Brolley <brolley@redhat.com>2009-04-28 11:43:05 -0400
commit35e8865695152377e91e387f1568229512ff0989 (patch)
treef4a964c0e0452f5eb612b16aefb68e4ce32bda67 /modsign.cxx
parente84f20287ae21b31c3505dfd0a81176687ad1ec5 (diff)
downloadsystemtap-steved-35e8865695152377e91e387f1568229512ff0989.tar.gz
systemtap-steved-35e8865695152377e91e387f1568229512ff0989.tar.xz
systemtap-steved-35e8865695152377e91e387f1568229512ff0989.zip
Keep the user's stap certificate in stap.cert (was stap-server.cert). Rename
the old cert file to the new name when it is encountered.
Diffstat (limited to 'modsign.cxx')
-rw-r--r--modsign.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/modsign.cxx b/modsign.cxx
index c9307484..34537921 100644
--- a/modsign.cxx
+++ b/modsign.cxx
@@ -56,7 +56,7 @@ init_cert_db_path (const string &cert_db_path) {
static int
check_cert_db_path (const string &cert_db_path) {
static const char* keyFiles[] = {
- "cert8.db", "key3.db", "pw", "secmod.db", "stap-server.cert", NULL
+ "cert8.db", "key3.db", "pw", "secmod.db", "stap.cert", NULL
};
// Does the path exist?
@@ -65,9 +65,22 @@ check_cert_db_path (const string &cert_db_path) {
if (prStatus != PR_SUCCESS || fileInfo.type != PR_FILE_DIRECTORY)
return init_cert_db_path (cert_db_path);
+ // Update the user's cert file if it is old.
+ string fname = cert_db_path + "/stap-server.cert";
+ prStatus = PR_GetFileInfo (fname.c_str (), &fileInfo);
+ if (prStatus == PR_SUCCESS && fileInfo.type == PR_FILE_FILE && fileInfo.size > 0)
+ {
+ string fname1 = cert_db_path + "/stap.cert";
+ prStatus = PR_GetFileInfo (fname1.c_str (), &fileInfo);
+ if (prStatus != PR_SUCCESS)
+ PR_Rename (fname.c_str (), fname1.c_str ());
+ else
+ PR_Delete (fname.c_str ());
+ }
+
// Does it contain the key files?
for (int i = 0; keyFiles[i]; ++i) {
- string fname = cert_db_path + "/" + keyFiles[i];
+ fname = cert_db_path + "/" + keyFiles[i];
prStatus = PR_GetFileInfo (fname.c_str (), &fileInfo);
if (prStatus != PR_SUCCESS || fileInfo.type != PR_FILE_FILE || fileInfo.size < 0)
return init_cert_db_path (cert_db_path);