diff options
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 323379d3e..8e6eff072 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -1868,61 +1868,47 @@ server_load_file (const char *file) | |||
1868 | * Load ssl certificate | 1868 | * Load ssl certificate |
1869 | * | 1869 | * |
1870 | * @param plugin the plugin | 1870 | * @param plugin the plugin |
1871 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 1871 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1872 | */ | 1872 | */ |
1873 | static int | 1873 | static int |
1874 | server_load_certificate (struct HTTP_Server_Plugin *plugin) | 1874 | server_load_certificate (struct HTTP_Server_Plugin *plugin) |
1875 | { | 1875 | { |
1876 | int res = GNUNET_OK; | 1876 | int res = GNUNET_OK; |
1877 | |||
1878 | char *sh; | ||
1879 | char *key_file; | 1877 | char *key_file; |
1880 | char *cert_file; | 1878 | char *cert_file; |
1881 | 1879 | ||
1882 | /* Get crypto init string from config | ||
1883 | * If not present just use default values */ | ||
1884 | |||
1885 | if (GNUNET_OK != | ||
1886 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, | ||
1887 | "PATHS", | ||
1888 | "SERVICEHOME", | ||
1889 | &sh)) | ||
1890 | { | ||
1891 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
1892 | "Failed to get servicehome!\n"); | ||
1893 | return GNUNET_SYSERR; | ||
1894 | } | ||
1895 | |||
1896 | |||
1897 | if (GNUNET_OK == | ||
1898 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, | ||
1899 | plugin->name, | ||
1900 | "CRYPTO_INIT", | ||
1901 | &plugin->crypto_init)) | ||
1902 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
1903 | "Using crypto init string `%s'\n", | ||
1904 | plugin->crypto_init); | ||
1905 | else | ||
1906 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
1907 | "Using default crypto init string \n"); | ||
1908 | 1880 | ||
1909 | if (GNUNET_OK != | 1881 | if (GNUNET_OK != |
1910 | GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name, | 1882 | GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name, |
1911 | "KEY_FILE", &key_file)) | 1883 | "KEY_FILE", &key_file)) |
1912 | { | 1884 | { |
1913 | GNUNET_break (0); | 1885 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1914 | GNUNET_asprintf (&key_file, "%s/%s", sh, "https_key.key"); | 1886 | plugin->name, "CERT_FILE"); |
1887 | return GNUNET_SYSERR; | ||
1915 | } | 1888 | } |
1916 | |||
1917 | |||
1918 | if (GNUNET_OK != | 1889 | if (GNUNET_OK != |
1919 | GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name, | 1890 | GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg, plugin->name, |
1920 | "CERT_FILE", &cert_file)) | 1891 | "CERT_FILE", &cert_file)) |
1921 | { | 1892 | { |
1922 | GNUNET_break (0); | 1893 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1923 | GNUNET_asprintf (&cert_file, "%s/%s", sh, "https_cert.crt"); | 1894 | plugin->name, "CERT_FILE"); |
1895 | GNUNET_free (key_file); | ||
1896 | return GNUNET_SYSERR; | ||
1924 | } | 1897 | } |
1925 | GNUNET_free (sh); | 1898 | /* Get crypto init string from config. If not present, use |
1899 | * default values */ | ||
1900 | if (GNUNET_OK == | ||
1901 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, | ||
1902 | plugin->name, | ||
1903 | "CRYPTO_INIT", | ||
1904 | &plugin->crypto_init)) | ||
1905 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
1906 | "Using crypto init string `%s'\n", | ||
1907 | plugin->crypto_init); | ||
1908 | else | ||
1909 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
1910 | "Using default crypto init string \n"); | ||
1911 | |||
1926 | /* read key & certificates from file */ | 1912 | /* read key & certificates from file */ |
1927 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1913 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1928 | "Trying to loading TLS certificate from key-file `%s' cert-file`%s'\n", | 1914 | "Trying to loading TLS certificate from key-file `%s' cert-file`%s'\n", |