We can improve code readability by using conf_get_bool() from libnfsconf instead of comparing the string values ourselves Signed-off-by: Justin Mitchell <jumitche@xxxxxxxxxx> --- libnfsidmap.c | 6 +----- umich_ldap.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/libnfsidmap.c b/libnfsidmap.c index afe84ef..bacb0e3 100644 --- a/libnfsidmap.c +++ b/libnfsidmap.c @@ -339,7 +339,6 @@ int nfs4_init_name_mapping(char *conffile) struct conf_list *nfs4_methods, *gss_methods; char *nobody_user, *nobody_group; char *nostrip; - char *reformatgroup; char *conf_path; /* XXX: need to be able to reload configurations... */ @@ -424,10 +423,7 @@ int nfs4_init_name_mapping(char *conffile) no_strip = 0; if (no_strip & IDTYPE_GROUP) { - reformatgroup = conf_get_str_with_def("General", "Reformat-Group", "false"); - if ((strcasecmp(reformatgroup, "true") == 0) || - (strcasecmp(reformatgroup, "on") == 0) || - (strcasecmp(reformatgroup, "yes") == 0)) + if (conf_get_bool("General", "Reformat-Group", false)) reformat_group = 1; else reformat_group = 0; diff --git a/umich_ldap.c b/umich_ldap.c index 6e01cc3..6ddce32 100644 --- a/umich_ldap.c +++ b/umich_ldap.c @@ -1095,9 +1095,9 @@ out_err: static int umichldap_init(void) { - char *tssl, *canonicalize, *memberof; char missing_msg[128] = ""; char *server_in, *canon_name; + bool canonicalize = false; server_in = conf_get_str(LDAP_SECTION, "LDAP_server"); ldap_info.base = conf_get_str(LDAP_SECTION, "LDAP_base"); @@ -1105,10 +1105,7 @@ umichldap_init(void) ldap_info.group_tree = conf_get_str(LDAP_SECTION, "LDAP_group_base"); ldap_info.user_dn = conf_get_str(LDAP_SECTION, "LDAP_user_dn"); ldap_info.passwd = conf_get_str(LDAP_SECTION, "LDAP_passwd"); - tssl = conf_get_str_with_def(LDAP_SECTION, "LDAP_use_ssl", "false"); - if ((strcasecmp(tssl, "true") == 0) || - (strcasecmp(tssl, "on") == 0) || - (strcasecmp(tssl, "yes") == 0)) + if (conf_get_bool(LDAP_SECTION, "LDAP_use_ssl", false)) ldap_info.use_ssl = 1; else ldap_info.use_ssl = 0; @@ -1130,10 +1127,8 @@ umichldap_init(void) } ldap_info.server = server_in; - canonicalize = conf_get_str_with_def(LDAP_SECTION, "LDAP_canonicalize_name", "yes"); - if ((strcasecmp(canonicalize, "true") == 0) || - (strcasecmp(canonicalize, "on") == 0) || - (strcasecmp(canonicalize, "yes") == 0)) { + if (conf_get_bool(LDAP_SECTION, "LDAP_canonicalize_name", true)) { + canonicalize = true; canon_name = get_canonical_hostname(server_in); if (canon_name == NULL) IDMAP_LOG(0, ("umichldap_init: Warning! Unable to " @@ -1202,11 +1197,7 @@ umichldap_init(void) * will use the memberof lists of the account and search through * only those groups to obtain gids. */ - memberof = conf_get_str_with_def(LDAP_SECTION, - "LDAP_use_memberof_for_groups", "false"); - if ((strcasecmp(memberof, "true") == 0) || - (strcasecmp(memberof, "on") == 0) || - (strcasecmp(memberof, "yes") == 0)) + if (conf_get_bool(LDAP_SECTION, "LDAP_use_memberof_for_groups", false)) ldap_info.memberof_for_groups = 1; else ldap_info.memberof_for_groups = 0; @@ -1233,7 +1224,7 @@ umichldap_init(void) /* print out some good debugging info */ IDMAP_LOG(1, ("umichldap_init: canonicalize_name: %s", - canonicalize)); + canonicalize ? "yes" : "no")); IDMAP_LOG(1, ("umichldap_init: server : %s (from config value '%s')", ldap_info.server, server_in)); IDMAP_LOG(1, ("umichldap_init: port : %d", ldap_info.port)); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html