move text2bool to os_calls
This commit is contained in:
parent
9538ca422b
commit
1a616a1b46
24
common/log.c
24
common/log.c
@ -363,7 +363,7 @@ internal_config_read_logging(int file, struct log_config *lc,
|
|||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
|
||||||
{
|
{
|
||||||
lc->enable_syslog = text2bool((char *)list_get_item(param_v, i));
|
lc->enable_syslog = g_text2bool((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
|
||||||
@ -413,28 +413,6 @@ internalInitAndAllocStruct(void)
|
|||||||
* Here below the public functions
|
* Here below the public functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @brief Reads sesman configuration
|
|
||||||
* @param s translates the strings "1", "true" and "yes" in 1 (true) and other strings in 0
|
|
||||||
* @return 0 on false, 1 on 1,true, yes
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int APP_CC
|
|
||||||
text2bool(char *s)
|
|
||||||
{
|
|
||||||
if ( (g_atoi(s) != 0) ||
|
|
||||||
(0 == g_strcasecmp(s, "true")) ||
|
|
||||||
(0 == g_strcasecmp(s, "on")) ||
|
|
||||||
(0 == g_strcasecmp(s, "yes")))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum logReturns DEFAULT_CC
|
enum logReturns DEFAULT_CC
|
||||||
log_start_from_param(const struct log_config *iniParams)
|
log_start_from_param(const struct log_config *iniParams)
|
||||||
{
|
{
|
||||||
|
@ -2935,3 +2935,18 @@ g_time3(void)
|
|||||||
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
|
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* returns boolean */
|
||||||
|
int APP_CC
|
||||||
|
g_text2bool(const char *s)
|
||||||
|
{
|
||||||
|
if ( (g_atoi(s) != 0) ||
|
||||||
|
(0 == g_strcasecmp(s, "true")) ||
|
||||||
|
(0 == g_strcasecmp(s, "on")) ||
|
||||||
|
(0 == g_strcasecmp(s, "yes")))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -152,5 +152,6 @@ int APP_CC g_check_user_in_group(const char* username, int gid, int* ok);
|
|||||||
int APP_CC g_time1(void);
|
int APP_CC g_time1(void);
|
||||||
int APP_CC g_time2(void);
|
int APP_CC g_time2(void);
|
||||||
int APP_CC g_time3(void);
|
int APP_CC g_time3(void);
|
||||||
|
int APP_CC g_text2bool(const char *s);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,15 +88,15 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
|
|||||||
|
|
||||||
if (g_strcasecmp(item, "bitmap_cache") == 0)
|
if (g_strcasecmp(item, "bitmap_cache") == 0)
|
||||||
{
|
{
|
||||||
client_info->use_bitmap_cache = text2bool(value);
|
client_info->use_bitmap_cache = g_text2bool(value);
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "bitmap_compression") == 0)
|
else if (g_strcasecmp(item, "bitmap_compression") == 0)
|
||||||
{
|
{
|
||||||
client_info->use_bitmap_comp = text2bool(value);
|
client_info->use_bitmap_comp = g_text2bool(value);
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "bulk_compression") == 0)
|
else if (g_strcasecmp(item, "bulk_compression") == 0)
|
||||||
{
|
{
|
||||||
client_info->use_bulk_comp = text2bool(value);
|
client_info->use_bulk_comp = g_text2bool(value);
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "crypt_level") == 0)
|
else if (g_strcasecmp(item, "crypt_level") == 0)
|
||||||
{
|
{
|
||||||
@ -121,7 +121,7 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
|
|||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "allow_channels") == 0)
|
else if (g_strcasecmp(item, "allow_channels") == 0)
|
||||||
{
|
{
|
||||||
client_info->channel_code = text2bool(value);
|
client_info->channel_code = g_text2bool(value);
|
||||||
if (client_info->channel_code == 0)
|
if (client_info->channel_code == 0)
|
||||||
{
|
{
|
||||||
log_message(LOG_LEVEL_DEBUG,"Info - All channels are disabled");
|
log_message(LOG_LEVEL_DEBUG,"Info - All channels are disabled");
|
||||||
@ -133,11 +133,11 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
|
|||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "new_cursors") == 0)
|
else if (g_strcasecmp(item, "new_cursors") == 0)
|
||||||
{
|
{
|
||||||
client_info->pointer_flags = text2bool(value) == 0 ? 2 : 0;
|
client_info->pointer_flags = g_text2bool(value) == 0 ? 2 : 0;
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(item, "require_credentials") == 0)
|
else if (g_strcasecmp(item, "require_credentials") == 0)
|
||||||
{
|
{
|
||||||
client_info->require_credentials = text2bool(value);
|
client_info->require_credentials = g_text2bool(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
|||||||
}
|
}
|
||||||
else if (0 == g_strcasecmp(buf, SESMAN_CFG_ENABLE_USERWM))
|
else if (0 == g_strcasecmp(buf, SESMAN_CFG_ENABLE_USERWM))
|
||||||
{
|
{
|
||||||
cf->enable_user_wm = text2bool((char *)list_get_item(param_v, i));
|
cf->enable_user_wm = g_text2bool((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
else if (0 == g_strcasecmp(buf, SESMAN_CFG_PORT))
|
else if (0 == g_strcasecmp(buf, SESMAN_CFG_PORT))
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ config_read_logging(int file, struct log_config* lc, struct list* param_n,
|
|||||||
}
|
}
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
|
||||||
{
|
{
|
||||||
lc->enable_syslog = text2bool((char*)list_get_item(param_v, i));
|
lc->enable_syslog = g_text2bool((char*)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
|
||||||
{
|
{
|
||||||
@ -261,7 +261,7 @@ config_read_security(int file, struct config_security *sc,
|
|||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_ALLOW_ROOT))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_ALLOW_ROOT))
|
||||||
{
|
{
|
||||||
sc->allow_root = text2bool((char *)list_get_item(param_v, i));
|
sc->allow_root = g_text2bool((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_LOGIN_RETRY))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_LOGIN_RETRY))
|
||||||
@ -288,7 +288,7 @@ config_read_security(int file, struct config_security *sc,
|
|||||||
}
|
}
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_ALWAYSGROUPCHECK))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_SEC_ALWAYSGROUPCHECK))
|
||||||
{
|
{
|
||||||
sc->ts_always_group_check = text2bool((char *)list_get_item(param_v, i));
|
sc->ts_always_group_check = g_text2bool((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ config_read_sessions(int file, struct config_sessions *se, struct list *param_n,
|
|||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_KILL_DISC))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_KILL_DISC))
|
||||||
{
|
{
|
||||||
se->kill_disconnected = text2bool((char *)list_get_item(param_v, i));
|
se->kill_disconnected = g_text2bool((char *)list_get_item(param_v, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_IDLE_LIMIT))
|
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_IDLE_LIMIT))
|
||||||
|
@ -203,19 +203,19 @@ xrdp_listen_get_port_address(char *port, int port_bytes,
|
|||||||
if (g_strcasecmp(val, "fork") == 0)
|
if (g_strcasecmp(val, "fork") == 0)
|
||||||
{
|
{
|
||||||
val = (char *)list_get_item(values, index);
|
val = (char *)list_get_item(values, index);
|
||||||
startup_param->fork = text2bool(val);
|
startup_param->fork = g_text2bool(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_strcasecmp(val, "tcp_nodelay") == 0)
|
if (g_strcasecmp(val, "tcp_nodelay") == 0)
|
||||||
{
|
{
|
||||||
val = (char *)list_get_item(values, index);
|
val = (char *)list_get_item(values, index);
|
||||||
*tcp_nodelay = text2bool(val);
|
*tcp_nodelay = g_text2bool(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_strcasecmp(val, "tcp_keepalive") == 0)
|
if (g_strcasecmp(val, "tcp_keepalive") == 0)
|
||||||
{
|
{
|
||||||
val = (char *)list_get_item(values, index);
|
val = (char *)list_get_item(values, index);
|
||||||
*tcp_keepalive = text2bool(val);
|
*tcp_keepalive = g_text2bool(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2209,7 +2209,7 @@ is_channel_enabled(char *inName, struct list *names, struct list *values)
|
|||||||
if ( index >= 0 )
|
if ( index >= 0 )
|
||||||
{
|
{
|
||||||
val = (char *)list_get_item(values, index);
|
val = (char *)list_get_item(values, index);
|
||||||
reply = text2bool(val);
|
reply = g_text2bool(val);
|
||||||
if (reply == 0)
|
if (reply == 0)
|
||||||
{
|
{
|
||||||
log_message(LOG_LEVEL_INFO,"This channel is disabled: %s", inName);
|
log_message(LOG_LEVEL_INFO,"This channel is disabled: %s", inName);
|
||||||
|
@ -455,7 +455,7 @@ xrdp_wm_load_static_colors_plus(struct xrdp_wm *self, char *autorun_name)
|
|||||||
else if (g_strcasecmp(val, "hidelogwindow") == 0)
|
else if (g_strcasecmp(val, "hidelogwindow") == 0)
|
||||||
{
|
{
|
||||||
val = (char *)list_get_item(values, index);
|
val = (char *)list_get_item(values, index);
|
||||||
self->hide_log_window = text2bool(val);
|
self->hide_log_window = g_text2bool(val);
|
||||||
}
|
}
|
||||||
else if (g_strcasecmp(val, "pamerrortxt") == 0)
|
else if (g_strcasecmp(val, "pamerrortxt") == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user