summaryrefslogtreecommitdiff
path: root/server/src/pracrod.cc
diff options
context:
space:
mode:
authordeva <deva>2010-06-01 12:58:32 +0000
committerdeva <deva>2010-06-01 12:58:32 +0000
commit74a28aa7125be6a603128ad600c98c4882f3b5c2 (patch)
tree1a9e4ab74f29d5ff10f2701e4e112f4525c0dcec /server/src/pracrod.cc
parent9b9c1e2dd3e5807ff7714b378b03b9ba31f42df7 (diff)
From new_protocol branch.
Diffstat (limited to 'server/src/pracrod.cc')
-rw-r--r--server/src/pracrod.cc53
1 files changed, 52 insertions, 1 deletions
diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc
index d17001c..e15b0f0 100644
--- a/server/src/pracrod.cc
+++ b/server/src/pracrod.cc
@@ -89,6 +89,7 @@ static const char usage_str[] =
" -h, --help Print this message and exit.\n"
" -D, --debug ddd Enable debug messages on 'ddd'; see documentation for details\n"
" -d --database db Use db as the database backend. Can be one of pgsql or testdb (default pgsql).\n"
+" -s, --ssl keyfile Enable ssl encryption with the key stored in keyfile.\n"
;
ConfigurationParser *configparser = NULL;
@@ -137,6 +138,39 @@ int PracroDaemon::daemon_main()
return 0;
}
+#define CERT "\
+-----BEGIN CERTIFICATE-----\n\
+MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQUFADBVMRswGQYDVQQKExJBcGFj\n\
+aGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9u\n\
+bHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNzA2MjEwODE4MzZaFw0wODA2MjAw\n\
+ODE4MzZaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQ\n\
+VGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3\n\
+DQEBAQUAA4GNADCBiQKBgQDWTACKSoxd5cL06w7RtPIhFqY1l3UE/aRGmPmh8gEo\n\
+w3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lccEoqZsCQECP\n\
+8PWq/eebp09Jo46pplsKh5wBfqNvDuBAa4AVszRiv1pFVcZ52JudZyzX4aezsyhH\n\
+E0OPPYamkDI/+6Hx2KECQHF9xV1XatyXuFmfRAInK2BtfGY5UIvJaLxVD3Z1+i6q\n\
+/enz7/wUwvC6G4FSWNMYgAYJOfwZ3BerdkqcRNxyR/Q=\n\
+-----END RSA PRIVATE KEY-----"
+
int main(int argc, char *argv[])
{
int c;
@@ -163,10 +197,11 @@ int main(int argc, char *argv[])
{"xml-basedir", required_argument, 0, 'x'},
{"debug", required_argument, 0, 'D'},
{"database", required_argument, 0, 'd'},
+ {"ssl", required_argument, 0, 's'},
{0, 0, 0, 0}
};
- c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:", long_options, &option_index);
+ c = getopt_long (argc, argv, "D:hvfc:u:g:x:d:s:", long_options, &option_index);
if (c == -1)
break;
@@ -200,6 +235,17 @@ int main(int argc, char *argv[])
debugstr = strdup(optarg);
break;
+ case 's':
+#ifdef WITHOUT_SSL
+ PRACRO_ERR(server, "Pracro was not compiled with SSL support!\n");
+ return 1;
+#else
+ Conf::use_ssl = true;
+ Conf::ssl_key = KEY;
+ Conf::ssl_cert = CERT;
+#endif
+ break;
+
case '?':
case 'h':
printf("%s", version_str);
@@ -228,6 +274,11 @@ int main(int argc, char *argv[])
Conf::database_backend = database;
}
+ if(Conf::database_backend == "testdb") {
+ // Test db (memory only db) does not work in plural.
+ Conf::database_poolsize = 1;
+ }
+
if(!user) {
user = strdup(Conf::server_user.c_str());
}