# limitations under the License.
memoryUserDatabase.invalidGroup=Invalid group name {0}
+memoryUserDatabase.notPersistable=User database is not persistable - no write permissions on directory
+memoryUserDatabase.nullGroup=Null or zero length group name specified. The group will be ignored.
+memoryUserDatabase.nullRole=Null or zero length role name specified. The role will be ignored.
+memoryUserDatabase.nullUser=Null or zero length user name specified. The user will be ignored.
+memoryUserDatabase.readOnly=User database has been configured to be read only. Changes cannot be saved
memoryUserDatabase.renameOld=Cannot rename original file to {0}
memoryUserDatabase.renameNew=Cannot rename new file to {0}
memoryUserDatabase.writeException=IOException writing to {0}
-memoryUserDatabase.notPersistable=User database is not persistable - no write permissions on directory
-memoryUserDatabase.readOnly=User database has been configured to be read only. Changes cannot be saved
memoryUserDatabase.xmlFeatureEncoding=Exception configuring digester to permit java encoding names in XML files. Only IANA encoding names will be supported.
*/
public Group createGroup(String groupname, String description) {
+ if (groupname == null || groupname.length() == 0) {
+ String msg = sm.getString("memoryUserDatabase.nullGroup");
+ log.warn(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
MemoryGroup group = new MemoryGroup(this, groupname, description);
synchronized (groups) {
groups.put(group.getGroupname(), group);
*/
public Role createRole(String rolename, String description) {
+ if (rolename == null || rolename.length() == 0) {
+ String msg = sm.getString("memoryUserDatabase.nullRole");
+ log.warn(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
MemoryRole role = new MemoryRole(this, rolename, description);
synchronized (roles) {
roles.put(role.getRolename(), role);
public User createUser(String username, String password,
String fullName) {
+ if (username == null || username.length() == 0) {
+ String msg = sm.getString("memoryUserDatabase.nullUser");
+ log.warn(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
MemoryUser user = new MemoryUser(this, username, password, fullName);
synchronized (users) {
users.put(user.getUsername(), user);
}
return (user);
-
}
}
digester.addFactoryCreate
("tomcat-users/group",
- new MemoryGroupCreationFactory(this));
+ new MemoryGroupCreationFactory(this), true);
digester.addFactoryCreate
("tomcat-users/role",
- new MemoryRoleCreationFactory(this));
+ new MemoryRoleCreationFactory(this), true);
digester.addFactoryCreate
("tomcat-users/user",
- new MemoryUserCreationFactory(this));
+ new MemoryUserCreationFactory(this), true);
// Parse the XML input file to load this database
try {
<code>stderr</code> internally so users retain the option to treat the
separately. (markt)
</fix>
+ <add>
+ <bug>18797</bug>: Provide protection against <code>null</code> or zero
+ length names being provided for users, roles and groups in the
+ <code>MemoryRealm</code> and <code>UserDatabaseRealm</code>. (markt)
+ </add>
<update>
Improve fix for <bug>50205</bug> to trigger an error earlier if invalid
configuration is used. (markt)