Merge pull request #1096 from metalefty/version_info
Show OpenSSL version to --version
This commit is contained in:
commit
f52f632e21
@ -33,6 +33,7 @@
|
|||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/dh.h>
|
#include <openssl/dh.h>
|
||||||
|
#include <openssl/crypto.h>
|
||||||
|
|
||||||
#include "os_calls.h"
|
#include "os_calls.h"
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
@ -1064,3 +1065,15 @@ ssl_get_protocols_from_string(const char *str, long *ssl_protocols)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
const char
|
||||||
|
*get_openssl_version()
|
||||||
|
{
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
return SSLeay_version(SSLEAY_VERSION);
|
||||||
|
#else
|
||||||
|
return OpenSSL_version(OPENSSL_VERSION);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -114,5 +114,7 @@ const char *
|
|||||||
ssl_get_cipher_name(const struct ssl_st *ssl);
|
ssl_get_cipher_name(const struct ssl_st *ssl);
|
||||||
int
|
int
|
||||||
ssl_get_protocols_from_string(const char *str, long *ssl_protocols);
|
ssl_get_protocols_from_string(const char *str, long *ssl_protocols);
|
||||||
|
const char *
|
||||||
|
get_openssl_version();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
71
xrdp/xrdp.c
71
xrdp/xrdp.c
@ -45,6 +45,31 @@ static long g_sync_param1 = 0;
|
|||||||
static long g_sync_param2 = 0;
|
static long g_sync_param2 = 0;
|
||||||
static long (*g_sync_func)(long param1, long param2);
|
static long (*g_sync_func)(long param1, long param2);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void
|
||||||
|
print_version(void)
|
||||||
|
{
|
||||||
|
g_writeln("xrdp %s", PACKAGE_VERSION);
|
||||||
|
g_writeln(" A Remote Desktop Protocol Server.");
|
||||||
|
g_writeln(" Copyright (C) 2004-2018 Jay Sorg, "
|
||||||
|
"Neutrino Labs, and all contributors.");
|
||||||
|
g_writeln(" See https://github.com/neutrinolabs/xrdp for more information.");
|
||||||
|
g_writeln("%s", "");
|
||||||
|
g_writeln(" Compiled with %s", get_openssl_version());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
void
|
||||||
|
print_help(void)
|
||||||
|
{
|
||||||
|
g_writeln("Usage: xrdp [options]");
|
||||||
|
g_writeln(" -h, --help show help");
|
||||||
|
g_writeln(" -n, --nodaemon don't fork into background");
|
||||||
|
g_writeln(" -k, --kill shut down xrdp");
|
||||||
|
g_writeln(" -p, --port tcp listen port");
|
||||||
|
g_writeln(" -f, --fork fork on new connection");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* This function is used to run a function from the main thread.
|
/* This function is used to run a function from the main thread.
|
||||||
Sync_func is the function pointer that will run from main thread
|
Sync_func is the function pointer that will run from main thread
|
||||||
@ -217,6 +242,14 @@ g_process_waiting_function(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Command line argument parser
|
||||||
|
* @param number of command line arguments
|
||||||
|
* @param pointer array of commandline arguments
|
||||||
|
* @return 0 on success, n on nth argument is unknown
|
||||||
|
*
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
xrdp_process_params(int argc, char **argv,
|
xrdp_process_params(int argc, char **argv,
|
||||||
struct xrdp_startup_params *startup_params)
|
struct xrdp_startup_params *startup_params)
|
||||||
@ -290,9 +323,9 @@ xrdp_process_params(int argc, char **argv,
|
|||||||
startup_params->fork = 1;
|
startup_params->fork = 1;
|
||||||
g_writeln("--fork parameter found, ini override");
|
g_writeln("--fork parameter found, ini override");
|
||||||
}
|
}
|
||||||
else
|
else /* unknown option */
|
||||||
{
|
{
|
||||||
return 1;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
@ -377,6 +410,7 @@ main(int argc, char **argv)
|
|||||||
int no_daemon;
|
int no_daemon;
|
||||||
char text[256];
|
char text[256];
|
||||||
char pid_file[256];
|
char pid_file[256];
|
||||||
|
int errored_argc;
|
||||||
|
|
||||||
g_init("xrdp");
|
g_init("xrdp");
|
||||||
ssl_init();
|
ssl_init();
|
||||||
@ -391,13 +425,17 @@ main(int argc, char **argv)
|
|||||||
startup_params = (struct xrdp_startup_params *)
|
startup_params = (struct xrdp_startup_params *)
|
||||||
g_malloc(sizeof(struct xrdp_startup_params), 1);
|
g_malloc(sizeof(struct xrdp_startup_params), 1);
|
||||||
|
|
||||||
if (xrdp_process_params(argc, argv, startup_params) != 0)
|
errored_argc = xrdp_process_params(argc, argv, startup_params);
|
||||||
|
if (errored_argc > 0)
|
||||||
{
|
{
|
||||||
g_writeln("Unknown Parameter");
|
print_version();
|
||||||
g_writeln("xrdp -h for help");
|
|
||||||
g_writeln("%s", "");
|
g_writeln("%s", "");
|
||||||
|
print_help();
|
||||||
|
g_writeln("%s", "");
|
||||||
|
|
||||||
|
g_writeln("Unknown option: %s", argv[errored_argc]);
|
||||||
g_deinit();
|
g_deinit();
|
||||||
g_exit(0);
|
g_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_snprintf(pid_file, 255, "%s/xrdp.pid", XRDP_PID_PATH);
|
g_snprintf(pid_file, 255, "%s/xrdp.pid", XRDP_PID_PATH);
|
||||||
@ -405,30 +443,17 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (startup_params->help)
|
if (startup_params->help)
|
||||||
{
|
{
|
||||||
|
print_version();
|
||||||
g_writeln("%s", "");
|
g_writeln("%s", "");
|
||||||
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
print_help();
|
||||||
g_writeln("Copyright (C) Jay Sorg 2004-2014");
|
|
||||||
g_writeln("See http://www.xrdp.org for more information.");
|
|
||||||
g_writeln("%s", "");
|
|
||||||
g_writeln("Usage: xrdp [options]");
|
|
||||||
g_writeln(" -h, --help show help");
|
|
||||||
g_writeln(" -n, --nodaemon don't fork into background");
|
|
||||||
g_writeln(" -k, --kill shut down xrdp");
|
|
||||||
g_writeln(" -p, --port tcp listen port");
|
|
||||||
g_writeln(" -f, --fork fork on new connection");
|
|
||||||
g_writeln("%s", "");
|
|
||||||
g_deinit();
|
g_deinit();
|
||||||
g_exit(0);
|
g_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startup_params->version)
|
if (startup_params->version)
|
||||||
{
|
{
|
||||||
g_writeln("%s", "");
|
print_version();
|
||||||
g_writeln("xrdp: A Remote Desktop Protocol server.");
|
|
||||||
g_writeln("Copyright (C) Jay Sorg 2004-2014");
|
|
||||||
g_writeln("See http://www.xrdp.org for more information.");
|
|
||||||
g_writeln("Version %s", PACKAGE_VERSION);
|
|
||||||
g_writeln("%s", "");
|
|
||||||
g_deinit();
|
g_deinit();
|
||||||
g_exit(0);
|
g_exit(0);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,10 @@ tbus
|
|||||||
g_get_sync_event(void);
|
g_get_sync_event(void);
|
||||||
void
|
void
|
||||||
g_process_waiting_function(void);
|
g_process_waiting_function(void);
|
||||||
|
void
|
||||||
|
print_version(void);
|
||||||
|
void
|
||||||
|
print_help(void);
|
||||||
|
|
||||||
/* xrdp_cache.c */
|
/* xrdp_cache.c */
|
||||||
struct xrdp_cache*
|
struct xrdp_cache*
|
||||||
|
Loading…
Reference in New Issue
Block a user