This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new f3441f2fc3 Minor user database fixes
f3441f2fc3 is described below

commit f3441f2fc32ce77b404fc83f20d11814096449f8
Author: remm <[email protected]>
AuthorDate: Tue Sep 1 09:46:19 2026 +0200

    Minor user database fixes
    
    From code review.
---
 java/org/apache/catalina/users/GenericGroup.java       | 14 ++++++++++++++
 java/org/apache/catalina/users/GenericRole.java        |  4 ++--
 java/org/apache/catalina/users/MemoryUserDatabase.java |  2 +-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/users/GenericGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
index e0b6c9b926..b6e87683ce 100644
--- a/java/org/apache/catalina/users/GenericGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -79,6 +79,20 @@ public class GenericGroup<UD extends UserDatabase> extends 
AbstractGroup {
     // ------------------------------------------------------------- Properties
 
 
+    @Override
+    public void setGroupname(String groupname) {
+        // Note: changing the groupname (which is the key) in a database will 
not work
+        // and the group should be removed and added instead
+    }
+
+
+    @Override
+    public void setDescription(String description) {
+        database.modifiedGroup(this);
+        super.setDescription(description);
+    }
+
+
     @Override
     public Iterator<Role> getRoles() {
         return roles.iterator();
diff --git a/java/org/apache/catalina/users/GenericRole.java 
b/java/org/apache/catalina/users/GenericRole.java
index 22f2f28d53..c529d30a06 100644
--- a/java/org/apache/catalina/users/GenericRole.java
+++ b/java/org/apache/catalina/users/GenericRole.java
@@ -77,8 +77,8 @@ public class GenericRole<UD extends UserDatabase> extends 
AbstractRole {
 
     @Override
     public void setRolename(String rolename) {
-        database.modifiedRole(this);
-        super.setRolename(rolename);
+        // Note: changing the rolename (which is the key) in a database will 
not work
+        // and the role should be removed and added instead
     }
 
 
diff --git a/java/org/apache/catalina/users/MemoryUserDatabase.java 
b/java/org/apache/catalina/users/MemoryUserDatabase.java
index f9caa30c58..725329510e 100644
--- a/java/org/apache/catalina/users/MemoryUserDatabase.java
+++ b/java/org/apache/catalina/users/MemoryUserDatabase.java
@@ -546,7 +546,7 @@ public class MemoryUserDatabase implements UserDatabase {
                     writer.print("  <user username=\"");
                     writer.print(Escape.xml(user.getUsername()));
                     writer.print("\" password=\"");
-                    writer.print(Escape.xml(user.getPassword()));
+                    writer.print(Escape.xml("", user.getPassword()));
                     writer.print("\"");
                     if (null != user.getFullName()) {
                         writer.print(" fullName=\"");


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to