mirror of
https://github.com/haiwen/ccnet-server.git
synced 2025-09-09 00:29:13 +00:00
Remove trailing spaces from values when reading config file.
This commit is contained in:
@@ -389,7 +389,7 @@ ccnet_util_key_file_get_string (GKeyFile *keyf,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return v;
|
||||
return g_strchomp(v);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -739,7 +739,7 @@ ccnet_key_file_get_string (GKeyFile *keyf,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return v;
|
||||
return g_strchomp(v);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -189,7 +189,7 @@ static int try_load_ldap_settings (CcnetUserManager *manager)
|
||||
{
|
||||
GKeyFile *config = manager->session->keyf;
|
||||
|
||||
manager->ldap_host = g_key_file_get_string (config, "LDAP", "HOST", NULL);
|
||||
manager->ldap_host = ccnet_key_file_get_string (config, "LDAP", "HOST");
|
||||
if (!manager->ldap_host)
|
||||
return 0;
|
||||
|
||||
@@ -199,18 +199,18 @@ static int try_load_ldap_settings (CcnetUserManager *manager)
|
||||
manager->use_ssl = g_key_file_get_boolean (config, "LDAP", "USE_SSL", NULL);
|
||||
#endif
|
||||
|
||||
char *base_list = g_key_file_get_string (config, "LDAP", "BASE", NULL);
|
||||
char *base_list = ccnet_key_file_get_string (config, "LDAP", "BASE");
|
||||
if (!base_list) {
|
||||
ccnet_warning ("LDAP: BASE not found in config file.\n");
|
||||
return -1;
|
||||
}
|
||||
manager->base_list = g_strsplit (base_list, ";", -1);
|
||||
|
||||
manager->filter = g_key_file_get_string (config, "LDAP", "FILTER", NULL);
|
||||
manager->filter = ccnet_key_file_get_string (config, "LDAP", "FILTER");
|
||||
|
||||
manager->user_dn = g_key_file_get_string (config, "LDAP", "USER_DN", NULL);
|
||||
manager->user_dn = ccnet_key_file_get_string (config, "LDAP", "USER_DN");
|
||||
if (manager->user_dn) {
|
||||
manager->password = g_key_file_get_string (config, "LDAP", "PASSWORD", NULL);
|
||||
manager->password = ccnet_key_file_get_string (config, "LDAP", "PASSWORD");
|
||||
if (!manager->password) {
|
||||
ccnet_warning ("LDAP: PASSWORD not found in config file.\n");
|
||||
return -1;
|
||||
@@ -218,7 +218,7 @@ static int try_load_ldap_settings (CcnetUserManager *manager)
|
||||
}
|
||||
/* Use anonymous if user_dn is not set. */
|
||||
|
||||
manager->login_attr = g_key_file_get_string (config, "LDAP", "LOGIN_ATTR", NULL);
|
||||
manager->login_attr = ccnet_key_file_get_string (config, "LDAP", "LOGIN_ATTR");
|
||||
if (!manager->login_attr)
|
||||
manager->login_attr = g_strdup("mail");
|
||||
|
||||
|
Reference in New Issue
Block a user