Code

Fix compilation with GCC when _GNU_SOURCE isn't defined.
[sysdb.git] / src / tools / sysdb / main.c
index e9e2202635d1d89dcb238a6e6c18dd7b295695cb..f502027f04353e115dd427cdd429816569a16116 100644 (file)
 #include "utils/llist.h"
 #include "utils/strbuf.h"
 #include "utils/os.h"
+#include "utils/ssl.h"
 
 #include <errno.h>
+#include <time.h>
 
 #if HAVE_LIBGEN_H
 #      include <libgen.h>
@@ -77,9 +79,6 @@
 #      endif
 #endif /* READLINEs */
 
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
 #ifndef DEFAULT_SOCKET
 #      define DEFAULT_SOCKET "unix:"LOCALSTATEDIR"/run/sysdbd.sock"
 #endif
@@ -299,8 +298,8 @@ main(int argc, char **argv)
        if (! input.user)
                exit(1);
 
-       SSL_load_error_strings();
-       OpenSSL_add_ssl_algorithms();
+       if (sdb_ssl_init())
+               exit(1);
 
        input.client = sdb_client_create(host);
        if (! input.client) {
@@ -332,8 +331,10 @@ main(int argc, char **argv)
        }
 
        sdb_log(SDB_LOG_INFO, "SysDB client "SDB_CLIENT_VERSION_STRING
-                       SDB_CLIENT_VERSION_EXTRA" (libsysdbclient %s%s)\n",
+                       SDB_CLIENT_VERSION_EXTRA" (libsysdbclient %s%s)",
                        sdb_client_version_string(), sdb_client_version_extra());
+       sdb_command_print_server_version(&input);
+       printf("\n");
 
        using_history();
 
@@ -372,8 +373,7 @@ main(int argc, char **argv)
        }
 
        sdb_input_reset(&input);
-
-       ERR_free_strings();
+       sdb_ssl_shutdown();
        return 0;
 } /* main */