NCBI C++ ToolKit
|
#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <freetds/tds.h>
#include <freetds/configs.h>
#include <freetds/utils/string.h>
#include <freetds/utils.h>
#include <freetds/replacements.h>
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | tdsvername_t |
Macros | |
#define | TDS_ISSPACE(c) isspace((unsigned char ) (c)) |
#define | option line |
#define | TDS_FIND(k, b, c) tds_find(k, b, TDS_VECTOR_SIZE(b), sizeof(b[0]), c) |
Functions | |
static bool | tds_config_login (TDSLOGIN *connection, TDSLOGIN *login) |
static bool | tds_config_env_tdsdump (TDSLOGIN *login) |
static void | tds_config_env_tdsver (TDSLOGIN *login) |
static void | tds_config_env_tdsport (TDSLOGIN *login) |
static bool | tds_config_env_tdshost (TDSLOGIN *login) |
static bool | tds_read_conf_sections (FILE *in, const char *server, TDSLOGIN *login) |
static bool | tds_read_interfaces (const char *server, TDSLOGIN *login) |
Try to find the IP number and port for a (possibly) logical server name. More... | |
static bool | parse_server_name_for_port (TDSLOGIN *connection, TDSLOGIN *login, bool update_server) |
Check the server name to find port info first Warning: connection-> & login-> are all modified when needed. More... | |
static int | tds_lookup_port (const char *portname) |
Given a portname lookup the port. More... | |
static void | tds_config_encryption (const char *value, TDSLOGIN *login) |
TDSLOGIN * | tds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale) |
tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values More... | |
void | tds_fix_login (TDSLOGIN *login) |
Fix configuration after reading it. More... | |
static bool | tds_try_conf_file (const char *path, const char *how, const char *server, TDSLOGIN *login) |
static char * | tds_get_home_file (const char *file) |
Return filename from HOME directory. More... | |
int | tds_read_conf_file (TDSLOGIN *login, const char *server) |
Read configuration info for given server return 0 on error. More... | |
int | tds_parse_boolean (const char *value, int default_value) |
int | tds_config_boolean (const char *option, const char *value, TDSLOGIN *login) |
int | tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param) |
Read a section of configuration file (INI style file) More... | |
void | tds_parse_conf_section (const char *option, const char *value, void *param) |
static const void * | tds_find (const void *key, const void *base, size_t nelem, size_t width, int(*compar)(const void *, const void *)) |
static int | tds_vername_cmp (const void *key, const void *pelem) |
TDS_USMALLINT * | tds_config_verstr (const char *tdsver, TDSLOGIN *login) |
Set TDS version from given string. More... | |
TDSRET | tds_set_interfaces_file_loc (const char *interf) |
Set the full name of interface file. More... | |
struct addrinfo * | tds_lookup_host (const char *servername) |
Get the IP address for a hostname. More... | |
TDSRET | tds_lookup_host_set (const char *servername, struct addrinfo **addr) |
static int | hexdigit (int c) |
static int | hex2num (char *hex) |
static bool | search_interface_file (TDSLOGIN *login, const char *dir, const char *file, const char *host) |
Open and read the file 'file' searching for a logical server by the name of 'host'. More... | |
const TDS_COMPILETIME_SETTINGS * | tds_get_compiletime_settings (void) |
Return a structure capturing the compile-time settings provided to the configure script. More... | |
Variables | |
static char * | interf_file = NULL |
const char | STD_DATETIME_FMT [] = "%Y-%m-%d %H:%M:%S.%z" |
static const char | pid_config_logpath [] = "/tmp/tdsconfig.log.%d" |
static const char | freetds_conf [] = "%s/etc/freetds.conf" |
static const char | location [] = "(from $FREETDS/etc)" |
static const char | pid_logpath [] = "/tmp/freetds.log.%d" |
static const char | interfaces_path [] = "/etc/freetds" |
struct { | |
char value [7] | |
unsigned char to_return | |
} | boolean_values [] |
#define option line |
Definition at line 1068 of file config.c.
References hex(), and hexdigit().
Referenced by search_interface_file().
|
static |
Open and read the file 'file' searching for a logical server by the name of 'host'.
If one is found then lookup the IP address and port number and store them in 'login'
dir | name of base directory for interface file |
file | name of the interface file |
host | logical host to search for |
Definition at line 1084 of file config.c.
References addrinfo, file, free(), hex2num(), in(), tds_login::ip_addrs, login, NULL, tds_login::port, tds_login::server_host_name, strcat, util::strcmp(), strtok_r, tds_addrinfo2str, tds_config_verstr(), TDS_DBG_INFO1, TDS_DBG_WARN, tds_dstr_copy(), TDS_ISSPACE, tds_lookup_host_set(), tds_lookup_port(), tds_new, TDS_SDIR_SEPARATOR, TDS_SUCCEED, and tdsdump_log.
Referenced by tds_read_interfaces().
Definition at line 473 of file config.c.
References tds_login::encryption_level, login, strcasecmp, TDS_DBG_ERROR, TDS_ENCRYPTION_OFF, TDS_ENCRYPTION_REQUEST, TDS_ENCRYPTION_REQUIRE, TDS_STR_ENCRYPTION, TDS_STR_ENCRYPTION_OFF, TDS_STR_ENCRYPTION_REQUEST, TDS_STR_ENCRYPTION_REQUIRE, tdsdump_log, tds_login::valid_configuration, and value.
Referenced by tds_parse_conf_section().
Definition at line 821 of file config.c.
References asprintf, tds_login::dump_file, free(), login, pid_logpath, TDS_DBG_INFO1, tds_dstr_copy(), tds_dstr_cstr(), tds_dstr_set(), and tdsdump_log.
Referenced by tds_fix_login().
Definition at line 871 of file config.c.
References addrinfo, tds_login::ip_addrs, login, NULL, tds_login::server_host_name, tds_addrinfo2str, TDS_DBG_INFO1, TDS_DBG_WARN, tds_dstr_copy(), TDS_FAILED, tds_lookup_host_set(), tdsdump_log, and tmp.
Referenced by tds_fix_login().
Definition at line 845 of file config.c.
References tds_login::instance_name, login, tds_login::port, TDS_DBG_INFO1, tds_dstr_empty, tds_lookup_port(), and tdsdump_log.
Referenced by tds_fix_login().
Definition at line 857 of file config.c.
References login, tds_config_verstr(), TDS_DBG_INFO1, and tdsdump_log.
Referenced by tds_fix_login().
Definition at line 706 of file config.c.
References tds_login::app_name, tds_login::block_size, tds_login::bulk_copy, tds_login::capabilities, tds_login::check_ssl_hostname, tds_login::client_charset, tds_login::client_host_name, tds_login::connect_timeout, tds_login::database, tds_login::db_filename, tds_login::enable_tls_v1, tds_login::enable_tls_v1_specified, tds_login::encryption_level, tds_login::gssapi_use_delegation, tds_login::language, tds_login::library, login, tds_login::mutual_authentication, tds_login::new_password, NULL, tds_login::openssl_ciphers, tds_login::password, tds_login::port, tds_login::query_timeout, tds_login::readonly_intent, tds_login::server_charset, tds_login::server_name, tds_login::server_spn, tds_login::suppress_language, TDS_DBG_INFO1, tds_dstr_cstr(), tds_dstr_dup(), tds_dstr_isempty(), tds_dstr_zero(), tds_login::tds_version, tdsdump_log, tds_login::use_new_password, tds_login::use_ntlmv2, tds_login::use_ntlmv2_specified, tds_login::use_utf16, and tds_login::user_name.
Referenced by tds_read_config_info().
|
static |
Definition at line 897 of file config.c.
References ncbi::grid::netcache::search::fields::key, n, and NULL.
Given a portname lookup the port.
If we can't determine the port number then return 0.
Definition at line 1046 of file config.c.
References tds_getservice.
Referenced by search_interface_file(), tds_config_env_tdsport(), and tds_read_interfaces().
Definition at line 397 of file config.c.
References DSTR_INITIALIZER, in(), tds_login::instance_name, login, tds_login::port, TDS_DBG_ERROR, tds_dstr_cstr(), tds_dstr_dup(), tds_dstr_free(), tds_dstr_isempty(), tds_parse_conf_section(), tds_read_conf_section(), tdsdump_log, and tds_login::valid_configuration.
Referenced by tds_try_conf_file().
Try to find the IP number and port for a (possibly) logical server name.
Definition at line 1207 of file config.c.
References free(), interf_file, interfaces_path, tds_login::ip_addrs, login, NULL, tds_login::port, search_interface_file(), tds_login::server_host_name, TDS_DBG_INFO1, TDS_DEF_PORT, tds_dstr_copy(), tds_get_home_file(), tds_lookup_host_set(), tds_lookup_port(), TDS_SUCCEED, and tdsdump_log.
Referenced by tds_read_config_info().
|
static |
Definition at line 295 of file config.c.
References in(), login, NULL, TDS_DBG_INFO1, TDS_DBG_INFO2, tds_read_conf_sections(), and tdsdump_log.
Referenced by tds_read_conf_file().
|
static |
Definition at line 98 of file config.c.
Referenced by tds_read_conf_file().
|
static |
Definition at line 90 of file config.c.
Referenced by tds_read_conf_file(), tds_read_interfaces(), and tds_set_interfaces_file_loc().
|
static |
Definition at line 101 of file config.c.
Referenced by tds_read_interfaces().
|
static |
Definition at line 99 of file config.c.
Referenced by tds_read_conf_file().
|
static |
Definition at line 97 of file config.c.
Referenced by tds_read_config_info().
|
static |
Definition at line 100 of file config.c.
Referenced by tds_config_env_tdsdump().