tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <r...@apache.org>
Subject Re: Writing MemoryUserDatabase on Startup
Date Tue, 02 Aug 2005 18:02:57 GMT
Rainer Jung wrote:
> Hi,
> 
> I wonder, why
> 
> /org/apache/catalina/users/MemoryUserDatabaseFactory.java
> 
> saves the MemoryUserDatabase directly after opening it:
> 
>     public Object getObjectInstance(Object obj, Name name, Context
> nameCtx, Hashtable environment) throws Exception {
> 
> ...
> 
>         // Return the configured database instance
>         database.open();
>         database.save();
>         return (database);
> 
>     }
> 
> That means, the runtime user of tomcat needs write permissions on the
> directory, the file is in (see the implementation of
> MemoryUserDatabase.save()).
> 
> Ogf course in case one likes to administer the user database the save
> function is necessary. But there are two cases where one would prefer to
> have tomcat not trying to save the database during startup:
> 
> 1) Running tomcat from CD
> 2) Having a very secure setup of tomcat, where all the configs are write
> disabled.
> 
> The call to database.save() is in the code since the very first version
> in TC 4, but I can't really see, why it is necessary.
> 
> Another possibility would be to catch the Exception thrown when there is
> no write permission and to simply log a warning.
> 
> Also: there is a save() done in close(). I don't know, where the close
> is called from, but it looks like nowhere in catalina code (eventually
> in admin).
> 
> Any comments? Thanks!

The problem is (mostly) the save in close: the database can't know for 
sure if its stuff was updated so it always saves.

I understand the need for 1), which can be achieved with the other 
equivalent-but-not-management-friendly memory realm. 2) seems unlikely IMO.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message