[jcifs] NTML and dynamic domain controller

Michael B Allen ioplex at gmail.com
Tue Jan 6 00:18:28 GMT 2009


On Mon, Jan 5, 2009 at 6:40 PM, shibaram <dunumania at yahoo.co.in> wrote:
>
> I am facing the same problem too using infact using jcifs-1.3.1.jar  also.
> I have tried all the ways.. Setting the System property
>
>  as
> -Djcifs.properties=C:\Workspace\JCIFS\WebContent\WEB-INF\opt\jcifs.properties
>
> in the tomcat (version 6) command line system proerty setup fileds. (By
> setting under Java options: by editing the "Java" tab running "tomcat6w.exe"
> file existing under  <TOMCAT_HOME>/bin/  )
>
> Tried also creating a own Filter class extending from NtlmHttpFilter as
> below code:
>
> public class NtlmCustomisedHttpFilter extends NtlmHttpFilter {
>
>         public void init( FilterConfig filterConfig ) throws ServletException {
>
>                 super.init(filterConfig);
>                 Config.setProperty( "jcifs.smb.lmCompatibility", "3" );
>                 String propFile = filterConfig.getInitParameter("jcifs.properties");
>                 System.setProperty( "jcifs.properties", propFile );

Again, as stated previously this is not reliable and the specific code
above will NOT work because the jcifs.properties property is read in
the static initializer of the jcifs.Config class so you cannot
reference that class before you set the property. If you call
System.setProperty("jcifs.properties", path) *before* you call
jcifs.Config (and super.init calls jcifs.Config), it will probably
work (provided some other code doesn't load JCIFS before the filter is
loaded).

Technically the only safe place to set JCIFS properties
programmatically is very early on like in main(). I realize that is
not optimal for something like a servlet container but for now that's
how this works.

Mike

PS: I don't think jcifs.smb.lmCompatibility to 3 is going to do
anything as the JCIFS NTLM HTTP Filter does not support NTLMv2.

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


More information about the jcifs mailing list