autotools fix and file_loc.h simplified

ulab-original
jsorg71 16 years ago
parent a386eac0f9
commit 23ffdb0c5f

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
lib_LTLIBRARIES = \
libcommon.la

@ -27,20 +27,8 @@
#define XRDP_CFG_PATH "/etc/xrdp"
#endif
#if !defined(XRDP_CFG_FILE)
#define XRDP_CFG_FILE "/etc/xrdp/xrdp.ini"
#endif
#if !defined(XRDP_KEY_FILE)
#define XRDP_KEY_FILE "/etc/xrdp/rsakeys.ini"
#endif
#if !defined(XRDP_KEYMAP_FILE)
#define XRDP_KEYMAP_FILE "/etc/xrdp/km-%4.4x.ini"
#endif
#if !defined(XRDP_PID_FILE)
#define XRDP_PID_FILE "/var/run/xrdp.pid"
#if !defined(XRDP_PID_PATH)
#define XRDP_PID_PATH "/var/run"
#endif
#if !defined(XRDP_SBIN_PATH)
@ -51,12 +39,4 @@
#define XRDP_SHARE_PATH "/usr/local/share/xrdp"
#endif
#if !defined(SESMAN_PID_FILE)
#define SESMAN_PID_FILE "/var/run/sesman.pid"
#endif
#if !defined(SESMAN_CFG_FILE)
#define SESMAN_CFG_FILE "/etc/xrdp/sesman.ini"
#endif
#endif

@ -21,17 +21,8 @@ AC_ARG_ENABLE(pamuserpass, AS_HELP_STRING([--enable-pamuserpass],
AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$pamuserpass = xtrue])
libdir="${libdir}/xrdp/";
if test "x${prefix}" = "xNONE" ; then
sysconfdir="/etc/";
else
AC_DEFINE_UNQUOTED([XRDP_CFG_PATH], ["${prefix}/etc/xrdp"], [xrdp config dir])
AC_DEFINE_UNQUOTED([XRDP_CFG_FILE], ["${prefix}/etc/xrdp/xrdp.ini"], [xrdp config file])
AC_DEFINE_UNQUOTED([XRDP_KEY_FILE], ["${prefix}/etc/xrdp/rsakeys.ini"], [xrdp key file])
AC_DEFINE_UNQUOTED([XRDP_KEYMAP_FILE], ["${prefix}/etc/xrdp/km-%4.4x.ini"], [xrdp keymap file])
AC_DEFINE_UNQUOTED([XRDP_PID_FILE], ["${prefix}/var/run/xrdp.pid"], [xrdp pid file])
AC_DEFINE_UNQUOTED([XRDP_SBIN_PATH], ["${prefix}/sbin"], [xrdp sbin dir])
AC_DEFINE_UNQUOTED([XRDP_SHARE_PATH], ["${prefix}/share/xrdp"], [xrdp share dir])
AC_DEFINE_UNQUOTED([SESMAN_PID_FILE], ["${prefix}/var/run/sesman.pid"], [sesman pid file])
AC_DEFINE_UNQUOTED([SESMAN_CFG_FILE], ["${prefix}/etc/xrdp/sesman.ini"], [sesman config file])
sysconfdir="/etc";
localstatedir="/var";
fi
AC_CONFIG_FILES([Makefile
common/Makefile

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -62,12 +62,14 @@ xrdp_rdp_read_config(struct xrdp_client_info* client_info)
struct list* values;
char* item;
char* value;
char cfg_file[256];
items = list_create();
items->auto_free = 1;
values = list_create();
values->auto_free = 1;
file_by_name_read_section(XRDP_CFG_FILE, "globals", items, values);
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
file_by_name_read_section(cfg_file, "globals", items, values);
for (index = 0; index < items->count; index++)
{
item = (char*)list_get_item(items, index);

@ -901,6 +901,7 @@ xrdp_sec_incoming(struct xrdp_sec* self)
int index;
char* item;
char* value;
char key_file[256];
DEBUG((" in xrdp_sec_incoming"));
g_random(self->server_random, 32);
@ -908,10 +909,11 @@ xrdp_sec_incoming(struct xrdp_sec* self)
items->auto_free = 1;
values = list_create();
values->auto_free = 1;
if (file_by_name_read_section(XRDP_KEY_FILE, "keys", items, values) != 0)
g_snprintf(key_file, 255, "%s/rsakeys.ini", XRDP_CFG_PATH);
if (file_by_name_read_section(key_file, "keys", items, values) != 0)
{
/* this is a show stopper */
g_writeln("xrdp_sec_incoming: error reading %s file", XRDP_KEY_FILE);
g_writeln("xrdp_sec_incoming: error reading %s file", key_file);
list_delete(items);
list_delete(values);
return 1;

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/sesman/libscp

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -60,19 +60,21 @@ config_read(struct config_sesman* cfg)
struct list* sec;
struct list* param_n;
struct list* param_v;
char cfg_file[256];
fd = g_file_open(SESMAN_CFG_FILE);
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file);
if (-1 == fd)
{
if (g_cfg->log.fd >= 0)
{
/* logging is already active */
log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "error opening %s in \
config_read", SESMAN_CFG_FILE);
config_read", cfg_file);
}
else
{
g_printf("error opening %s in config_read", SESMAN_CFG_FILE);
g_printf("error opening %s in config_read", cfg_file);
}
return 1;
}

@ -32,16 +32,6 @@
#include "list.h"
#include "log.h"
/**
*
* @def SESMAN_CFG_FILE
* @brief Configuration file path
*
*/
#ifndef SESMAN_CFG_FILE
#define SESMAN_CFG_FILE "./sesman.ini"
#endif
#define SESMAN_CFG_GLOBALS "Globals"
#define SESMAN_CFG_DEFWM "DefaultWindowManager"
#define SESMAN_CFG_ADDRESS "ListenAddress"

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -134,7 +134,9 @@ main(int argc, char** argv)
int pid;
char pid_s[8];
char text[256];
char pid_file[256];
g_snprintf(pid_file, 255, "%s/xrdp-sesman.pid", XRDP_PID_PATH);
if (1 == argc)
{
/* no options on command line. normal startup */
@ -167,18 +169,17 @@ main(int argc, char** argv)
{
/* killing running sesman */
/* check if sesman is running */
if (!g_file_exist(SESMAN_PID_FILE))
if (!g_file_exist(pid_file))
{
g_printf("sesman is not running (pid file not found - %s)\n",
SESMAN_PID_FILE);
g_printf("sesman is not running (pid file not found - %s)\n", pid_file);
g_exit(1);
}
fd = g_file_open(SESMAN_PID_FILE);
fd = g_file_open(pid_file);
if (-1 == fd)
{
g_printf("error opening pid file[%s]: %s\n", SESMAN_PID_FILE, g_get_strerror());
g_printf("error opening pid file[%s]: %s\n", pid_file, g_get_strerror());
return 1;
}
@ -199,7 +200,7 @@ main(int argc, char** argv)
}
else
{
g_file_delete(SESMAN_PID_FILE);
g_file_delete(pid_file);
}
g_exit(error);
@ -213,11 +214,11 @@ main(int argc, char** argv)
g_exit(1);
}
if (g_file_exist(SESMAN_PID_FILE))
if (g_file_exist(pid_file))
{
g_printf("sesman is already running.\n");
g_printf("if it's not running, try removing ");
g_printf(SESMAN_PID_FILE);
g_printf(pid_file);
g_printf("\n");
g_exit(1);
}
@ -298,17 +299,17 @@ main(int argc, char** argv)
if (daemon)
{
/* writing pid file */
fd = g_file_open(SESMAN_PID_FILE);
fd = g_file_open(pid_file);
if (-1 == fd)
{
log_message(&(g_cfg->log), LOG_LEVEL_ERROR,
"error opening pid file[%s]: %s",
SESMAN_PID_FILE, g_get_strerror());
pid_file, g_get_strerror());
log_end(&(g_cfg->log));
g_exit(1);
}
g_sprintf(pid_s, "%d", g_pid);
g_file_write(fd, pid_s, g_strlen(pid_s) + 1);
g_file_write(fd, pid_s, g_strlen(pid_s));
g_file_close(fd);
}

@ -51,8 +51,4 @@
#include "libscp.h"
#ifndef SESMAN_PID_FILE
#define SESMAN_PID_FILE "./sesman.pid"
#endif
#endif

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -38,6 +38,8 @@ extern tbus g_term_event;
void DEFAULT_CC
sig_sesman_shutdown(int sig)
{
char pid_file[256];
log_message(&(g_cfg->log), LOG_LEVEL_INFO, "shutting down sesman %d", 1);
if (g_getpid() != g_pid)
@ -54,7 +56,8 @@ sig_sesman_shutdown(int sig)
session_sigkill_all();
g_file_delete(SESMAN_PID_FILE);
g_snprintf(pid_file, 255, "%s/xrdp-sesman.pid", XRDP_PID_PATH);
g_file_delete(pid_file);
}
/******************************************************************************/

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/sesman/libscp \

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libxrdp

@ -1178,7 +1178,7 @@ get_keymaps(int keylayout, struct xrdp_keymap* keymap)
break;
}
/* check if there is a keymap file */
g_snprintf(filename, 255, XRDP_KEYMAP_FILE, keylayout);
g_snprintf(filename, 255, "%s/km-%4.4x.ini", XRDP_CFG_PATH, keylayout);
if (g_file_exist(filename))
{
fd = g_file_open(filename);

@ -281,6 +281,7 @@ main(int argc, char** argv)
int fd;
int no_daemon;
char text[256];
char pid_file[256];
#endif
g_init();
@ -413,6 +414,7 @@ main(int argc, char** argv)
}
WSAStartup(2, &w);
#else /* _WIN32 */
g_snprintf(pid_file, 255, "%s/xrdp.pid", XRDP_PID_PATH);
no_daemon = 0;
if (argc == 2)
{
@ -423,9 +425,9 @@ main(int argc, char** argv)
g_writeln("stopping xrdp");
/* read the xrdp.pid file */
fd = -1;
if (g_file_exist(XRDP_PID_FILE)) /* xrdp.pid */
if (g_file_exist(pid_file)) /* xrdp.pid */
{
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
fd = g_file_open(pid_file); /* xrdp.pid */
}
if (fd == -1)
{
@ -497,7 +499,7 @@ main(int argc, char** argv)
g_writeln("");
g_exit(0);
}
if (g_file_exist(XRDP_PID_FILE)) /* xrdp.pid */
if (g_file_exist(pid_file)) /* xrdp.pid */
{
g_writeln("It looks like xrdp is allready running,");
g_writeln("if not delete the xrdp.pid file and try again");
@ -506,7 +508,7 @@ main(int argc, char** argv)
if (!no_daemon)
{
/* make sure we can write to pid file */
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
fd = g_file_open(pid_file); /* xrdp.pid */
if (fd == -1)
{
g_writeln("running in daemon mode with no access to pid files, quitting");
@ -518,7 +520,7 @@ main(int argc, char** argv)
g_exit(0);
}
g_file_close(fd);
g_file_delete(XRDP_PID_FILE);
g_file_delete(pid_file);
}
if (!no_daemon)
{
@ -548,7 +550,7 @@ main(int argc, char** argv)
{
/* write the pid to file */
pid = g_getpid();
fd = g_file_open(XRDP_PID_FILE); /* xrdp.pid */
fd = g_file_open(pid_file); /* xrdp.pid */
if (fd == -1)
{
g_writeln("trying to write process id to xrdp.pid");
@ -557,7 +559,7 @@ main(int argc, char** argv)
}
else
{
g_set_file_rights(XRDP_PID_FILE, 1, 1); /* xrdp.pid */
g_set_file_rights(pid_file, 1, 1); /* xrdp.pid */
g_sprintf(text, "%d", pid);
g_file_write(fd, text, g_strlen(text));
g_file_close(fd);
@ -593,7 +595,7 @@ main(int argc, char** argv)
WSACleanup();
#else
/* delete the xrdp.pid file */
g_file_delete(XRDP_PID_FILE);
g_file_delete(pid_file);
#endif
return 0;
}

@ -118,11 +118,13 @@ xrdp_listen_get_port(char* port, int port_bytes)
char* val;
struct list* names;
struct list* values;
char cfg_file[256];
/* default to port 3389 */
g_strncpy(port, "3389", port_bytes - 1);
/* see if port is in xrdp.ini file */
fd = g_file_open(XRDP_CFG_FILE);
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file);
if (fd > 0)
{
names = list_create();

@ -390,6 +390,7 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
char* q;
char* r;
char name[256];
char cfg_file[256];
struct xrdp_mod_data* mod_data;
sections = list_create();
@ -398,7 +399,8 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
section_names->auto_free = 1;
section_values = list_create();
section_values->auto_free = 1;
fd = g_file_open(XRDP_CFG_FILE); /* xrdp.ini */
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file); /* xrdp.ini */
file_read_sections(fd, sections);
for (i = 0; i < sections->count; i++)
{

@ -371,13 +371,15 @@ xrdp_wm_init(struct xrdp_wm* self)
char* q;
char* r;
char section_name[256];
char cfg_file[256];
xrdp_wm_load_static_colors(self);
xrdp_wm_load_static_pointers(self);
self->screen->bg_color = self->black;
if (self->session->client_info->rdp_autologin)
{
fd = g_file_open(XRDP_CFG_FILE); /* xrdp.ini */
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file); /* xrdp.ini */
if (fd > 0)
{
names = list_create();

@ -1,3 +1,10 @@
AM_CFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\"
INCLUDES = \
-I$(top_srcdir)/common

Loading…
Cancel
Save