Fix parsing set-to-nothing options in ldap section

If the user wants to "unset" the ldap.accountFullName property we
need to allow them to set it to the empty string, because no entry
in the configuration file implies the default.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-08-19 09:55:08 -07:00
parent 37dc1f816d
commit 71f7174a6e

View File

@@ -153,15 +153,15 @@ class LdapRealm implements Realm {
}
private static String optdef(final Config c, final String n, final String d) {
final String v = c.getString("ldap", null, n);
if (v == null) {
final String[] v = c.getStringList("ldap", null, n);
if (v == null || v.length == 0) {
return d;
} else if ("".equals(v)) {
} else if (v[0] == null || "".equals(v[0])) {
return null;
} else {
return v;
return v[0];
}
}