diff options
Diffstat (limited to 'src/util/taler-exchange-secmod-rsa.c')
-rw-r--r-- | src/util/taler-exchange-secmod-rsa.c | 79 |
1 files changed, 19 insertions, 60 deletions
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c index 0b2da99d7..b6729b66b 100644 --- a/src/util/taler-exchange-secmod-rsa.c +++ b/src/util/taler-exchange-secmod-rsa.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <sys/eventfd.h> | 40 | #include <sys/eventfd.h> |
41 | #include "taler_error_codes.h" | 41 | #include "taler_error_codes.h" |
42 | #include "taler_signatures.h" | 42 | #include "taler_signatures.h" |
43 | #include "secmod_common.h" | ||
43 | 44 | ||
44 | 45 | ||
45 | /** | 46 | /** |
@@ -1895,69 +1896,27 @@ run (void *cls, | |||
1895 | return; | 1896 | return; |
1896 | } | 1897 | } |
1897 | 1898 | ||
1898 | /* open socket */ | 1899 | if (GNUNET_OK != |
1900 | GNUNET_CONFIGURATION_get_value_filename (kcfg, | ||
1901 | "taler-exchange-secmod-rsa", | ||
1902 | "UNIXPATH", | ||
1903 | &unixpath)) | ||
1899 | { | 1904 | { |
1900 | int sock; | 1905 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1906 | "taler-exchange-secmod-rsa", | ||
1907 | "UNIXPATH"); | ||
1908 | global_ret = 3; | ||
1909 | return; | ||
1910 | } | ||
1901 | 1911 | ||
1902 | sock = socket (PF_UNIX, | 1912 | GNUNET_assert (NULL != unixpath); |
1903 | SOCK_DGRAM, | 1913 | unix_sock = TES_open_socket (unixpath); |
1904 | 0); | ||
1905 | if (-1 == sock) | ||
1906 | { | ||
1907 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, | ||
1908 | "socket"); | ||
1909 | global_ret = 2; | ||
1910 | return; | ||
1911 | } | ||
1912 | { | ||
1913 | struct sockaddr_un un; | ||
1914 | 1914 | ||
1915 | if (GNUNET_OK != | 1915 | if (NULL == unix_sock) |
1916 | GNUNET_CONFIGURATION_get_value_filename (kcfg, | 1916 | { |
1917 | "taler-exchange-secmod-rsa", | 1917 | GNUNET_free (unixpath); |
1918 | "UNIXPATH", | 1918 | global_ret = 2; |
1919 | &unixpath)) | 1919 | return; |
1920 | { | ||
1921 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | ||
1922 | "taler-exchange-secmod-rsa", | ||
1923 | "UNIXPATH"); | ||
1924 | global_ret = 3; | ||
1925 | return; | ||
1926 | } | ||
1927 | if (GNUNET_OK != | ||
1928 | GNUNET_DISK_directory_create_for_file (unixpath)) | ||
1929 | { | ||
1930 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | ||
1931 | "mkdir(dirname)", | ||
1932 | unixpath); | ||
1933 | } | ||
1934 | if (0 != unlink (unixpath)) | ||
1935 | { | ||
1936 | if (ENOENT != errno) | ||
1937 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | ||
1938 | "unlink", | ||
1939 | unixpath); | ||
1940 | } | ||
1941 | memset (&un, | ||
1942 | 0, | ||
1943 | sizeof (un)); | ||
1944 | un.sun_family = AF_UNIX; | ||
1945 | strncpy (un.sun_path, | ||
1946 | unixpath, | ||
1947 | sizeof (un.sun_path) - 1); | ||
1948 | if (0 != bind (sock, | ||
1949 | (const struct sockaddr *) &un, | ||
1950 | sizeof (un))) | ||
1951 | { | ||
1952 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1953 | "bind", | ||
1954 | unixpath); | ||
1955 | global_ret = 3; | ||
1956 | GNUNET_break (0 == close (sock)); | ||
1957 | return; | ||
1958 | } | ||
1959 | } | ||
1960 | unix_sock = GNUNET_NETWORK_socket_box_native (sock); | ||
1961 | } | 1920 | } |
1962 | 1921 | ||
1963 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 1922 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |