Blob Blame History Raw
diff -u -d -p -r1.36 system.cpp
--- common/system.cpp	1 Nov 2008 02:38:32 -0000	1.36
+++ common/system.cpp	3 Nov 2008 16:55:02 -0000
@@ -76,6 +76,13 @@ const std::string get_hostname()
 #endif // HAVE_UNAME
 }
 
+unsigned int security_init()
+{
+    gcry_check_version(0);
+
+    return 0;
+}
+
 unsigned int security_check()
 {
 #ifdef HAVE_GETUID
@@ -97,7 +104,6 @@ static int security_new_key(const std::s
         return -1;
     }
 
-    gcry_check_version(0);
     gcry_control( GCRYCTL_INIT_SECMEM, 16384, 0 );
 
     gcry_sexp_t key_parameters, key;
diff -u -d -p -r1.14 system.h
--- common/system.h	12 Aug 2008 20:40:14 -0000	1.14
+++ common/system.h	3 Nov 2008 16:55:02 -0000
@@ -40,6 +40,7 @@
 #include <string>
 
 const std::string get_hostname();
+unsigned int security_init();
 unsigned int security_check();
 unsigned int security_setup();
 void reduce_priority(int);
diff -u -d -p -r1.164 server.cpp
--- server/server.cpp	27 Oct 2008 00:53:29 -0000	1.164
+++ server/server.cpp	3 Nov 2008 16:55:02 -0000
@@ -61,6 +61,11 @@ static const bool debug_flag = false;
 
 int main(int argc, char ** argv)
 {
+    if (security_init() != 0) {
+        log(CRITICAL, "Security initialisation Error. Exiting.");
+        return EXIT_SECURITY_ERROR;
+    }
+
     if (security_check() != SECURITY_OKAY) {
         log(CRITICAL, "Security Error. Exiting.");
         return EXIT_SECURITY_ERROR;
diff -u -d -p -r1.7 systemtest.cpp
--- tests/systemtest.cpp	23 Apr 2007 11:22:15 -0000	1.7
+++ tests/systemtest.cpp	3 Nov 2008 16:55:02 -0000
@@ -40,7 +40,13 @@ int main()
     std::string hostname = get_hostname();
     assert(!hostname.empty());
 
-    assert(security_check() == SECURITY_OKAY);
+    int res;
+
+    res = security_init();
+    assert(res == 0);
+
+    res = security_check();
+    assert(res == SECURITY_OKAY);
 
     reduce_priority(1);
     
diff -u -d -p -r1.38 cypasswd.cpp
--- tools/cypasswd.cpp	14 Nov 2007 22:40:18 -0000	1.38
+++ tools/cypasswd.cpp	3 Nov 2008 16:55:02 -0000
@@ -33,6 +33,7 @@
 #include "common/accountbase.h"
 #include "common/globals.h"
 #include "common/log.h"
+#include "common/system.h"
 
 #include <string>
 #include <iostream>
@@ -128,6 +129,11 @@ int main(int argc, char ** argv)
         return 1;
     }
 
+    if (security_init() != 0) {
+        log(CRITICAL, "Security initialisation Error. Exiting.");
+        return EXIT_SECURITY_ERROR;
+    }
+
     AccountBase db;
 
     if (db.init() != 0) {