diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2013-08-24 22:41:44 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2013-08-24 22:41:44 -0700 |
commit | 1a616a1b469a00279ac6d42cffcd2b23da492c60 (patch) | |
tree | f99d7ef5784236dc52089ee3fb592a71ac930066 | |
parent | 9538ca422b03c003d30cba30f3907723a22f3ea1 (diff) | |
download | xrdp-proprietary-1a616a1b469a00279ac6d42cffcd2b23da492c60.tar.gz xrdp-proprietary-1a616a1b469a00279ac6d42cffcd2b23da492c60.zip |
move text2bool to os_calls
-rw-r--r-- | common/log.c | 24 | ||||
-rw-r--r-- | common/os_calls.c | 15 | ||||
-rw-r--r-- | common/os_calls.h | 1 | ||||
-rw-r--r-- | libxrdp/xrdp_rdp.c | 12 | ||||
-rw-r--r-- | sesman/config.c | 10 | ||||
-rw-r--r-- | xrdp/xrdp_listen.c | 6 | ||||
-rw-r--r-- | xrdp/xrdp_mm.c | 2 | ||||
-rw-r--r-- | xrdp/xrdp_wm.c | 2 |
8 files changed, 33 insertions, 39 deletions
diff --git a/common/log.c b/common/log.c index ce0000aa..55353a8f 100644 --- a/common/log.c +++ b/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)) { - 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)) @@ -413,28 +413,6 @@ internalInitAndAllocStruct(void) * 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 log_start_from_param(const struct log_config *iniParams) { diff --git a/common/os_calls.c b/common/os_calls.c index f5f5cd60..1939ddc9 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -2935,3 +2935,18 @@ g_time3(void) return (tp.tv_sec * 1000) + (tp.tv_usec / 1000); #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; +} diff --git a/common/os_calls.h b/common/os_calls.h index cba37588..2dbbe660 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -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_time2(void); int APP_CC g_time3(void); +int APP_CC g_text2bool(const char *s); #endif diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 8ca9f799..2d90485f 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -88,15 +88,15 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) 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) { - client_info->use_bitmap_comp = text2bool(value); + client_info->use_bitmap_comp = g_text2bool(value); } 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) { @@ -121,7 +121,7 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) } 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) { 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) { - 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) { - client_info->require_credentials = text2bool(value); + client_info->require_credentials = g_text2bool(value); } } diff --git a/sesman/config.c b/sesman/config.c index c7c3de24..877a949c 100644 --- a/sesman/config.c +++ b/sesman/config.c @@ -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)) { - 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)) { @@ -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)) { - 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)) { @@ -261,7 +261,7 @@ config_read_security(int file, struct config_security *sc, 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)) @@ -288,7 +288,7 @@ config_read_security(int file, struct config_security *sc, } 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)) { - 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)) diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c index e34fcd8a..2e1617a6 100644 --- a/xrdp/xrdp_listen.c +++ b/xrdp/xrdp_listen.c @@ -203,19 +203,19 @@ xrdp_listen_get_port_address(char *port, int port_bytes, if (g_strcasecmp(val, "fork") == 0) { 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) { val = (char *)list_get_item(values, index); - *tcp_nodelay = text2bool(val); + *tcp_nodelay = g_text2bool(val); } if (g_strcasecmp(val, "tcp_keepalive") == 0) { val = (char *)list_get_item(values, index); - *tcp_keepalive = text2bool(val); + *tcp_keepalive = g_text2bool(val); } } } diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 391ea306..10bea994 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -2209,7 +2209,7 @@ is_channel_enabled(char *inName, struct list *names, struct list *values) if ( index >= 0 ) { val = (char *)list_get_item(values, index); - reply = text2bool(val); + reply = g_text2bool(val); if (reply == 0) { log_message(LOG_LEVEL_INFO,"This channel is disabled: %s", inName); diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index bfcc7548..9dfbb06b 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -455,7 +455,7 @@ xrdp_wm_load_static_colors_plus(struct xrdp_wm *self, char *autorun_name) else if (g_strcasecmp(val, "hidelogwindow") == 0) { 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) { |