cancel
Showing results for 
Search instead for 
Did you mean: 

Starting CIFS server (JLAN) with programmatic (non-XML) config

gubby
Champ in-the-making
Champ in-the-making
Has anybody successfully run the JLAN CIFS server stand-alone, with all configuration done programmatically rather than via .properties, xml, files, etc?

There doesn't seem to be any documentation on this, and various things I have tried yield NullPointerExceptions deep from the bowels of the server.

The closest I got to a working config is below, which allowed connections, but after authenticating gave an error to the effect that there were no valid shares on this server. The code is a bit of a hacked-up mess, but because I couldn't find any documentation, and there isn't much Javadoc, it was the best I could do.


DiskInterface disk = new JavaFileDiskDriver();

ConfigElement configElement = new ConfigElement("", "") {
   @Override
   public ConfigElement getChild(String name) {
      if ("LocalPath".equals(name)) {
         return new ConfigElement("", "/tmp/cifs");
      }
      throw new IllegalArgumentException("Name " + name);
   }
};

DiskDeviceContext context = (DiskDeviceContext) disk.createContext("theContext", configElement);  // Should be static

ServerConfiguration config = new ServerConfiguration("config");

CIFSConfigSection cifs = new CIFSConfigSection(config);
cifs.setHostAnnouncer(false);
cifs.setNetBIOSSMB(false);
cifs.setNetBIOSDebug(true);
cifs.setTcpipSMB(true);
cifs.setTcpipSMBPort(5000);
cifs.setAuthenticator(new DefaultAuthenticator()); // Allows any user
cifs.setServerName("Test Server");
cifs.setDomainName("Test Domain");

FilesystemsConfigSection filesystems = new FilesystemsConfigSection(config);
final DiskSharedDevice dev = new DiskSharedDevice("TheDisk", disk, context);
filesystems.addShare(dev);

GlobalConfigSection global = new GlobalConfigSection(config);

CoreServerConfigSection core = new CoreServerConfigSection(config);
core.setThreadPool(2, 8);
core.setMemoryPool(DefaultMemoryPoolBufSizes, DefaultMemoryPoolInitAlloc, DefaultMemoryPoolMaxAlloc);

SecurityConfigSection security = new SecurityConfigSection(config);
security.setShareMapper(new DefaultShareMapper() {
   @Override
   public SharedDeviceList getShareList(String host, SrvSession sess, boolean allShares) {
      SharedDeviceList list = new SharedDeviceList();
      list.addShare(dev);
      return list;
   }
});

3 REPLIES 3

mrogers
Star Contributor
Star Contributor
The configuration of JLAN has always been tied into XML.    

Alfresco itself is an example of configuring JLAN programatically.   We don't have any JLAN configuration files in alfresco.

gubby
Champ in-the-making
Champ in-the-making
Could you perhaps assist me in writing a programmatic config? I need to be able to dynamically configure the server (share points, etc) - and don't want to write out to a .xml file and then read it back in.

Is there anything that stands out to you as obviously wrong with what I have done already, that would cause the 'no share points' error on OSX?

Thanks!
James

gubby
Champ in-the-making
Champ in-the-making
Occurs to me the log output might help:


Starting server NetBIOS …
Starting server CIFS …
[SMB] CIFS Server JLANSRV starting
[SMB] Version 6.0.0, Java VM 25.20-b23, OS Mac OS X, version 10.9.4
[SMB] Using authenticator org.alfresco.jlan.server.auth.EnterpriseCifsAuthenticator, mode=USER
[SMB] Server timezone offset = 0hrs
NetBIOSNameServer setup error:java.net.BindException: Permission denied
[SMB] Dialects enabled = [DOS LANMAN 1.0,LANMAN1.0,DOS LANMAN 2.1,LM1.2X002,LANMAN2.1,NT LM 0.12]
[SMB] Shares:
[SMB]  [JLAN,DISK,,[/Users/james/IdeaProjects/.]] [/Users/james/IdeaProjects/.]
[SMB] Added NTServer flag to host announcement
[SMB] Binding TCP-SMB session handler to address : ALL
[SMB] Binding NetBIOS session handler to address : ALL
[SMB] Request handler CIFSRequestHandler_1 waiting for session …
[SMB] Listening for connections on [SMB,TCP-SMB,ALL:5000]
[SMB] Listening for connections on [SMB,NetBIOS,ALL:1139]
[SMB] Waiting for new connection …


(at this point, I log in via cifs://localhost:5000/)


[SMB] Connection from /0:0:0:0:0:0:0:1:55378, handler=[SMB,TCP-SMB,ALL:5000], sess=T1
[SMB] Register session with request handler, handler=CIFSRequestHandler_1, sess=T1
[SMB] Waiting for new connection …
[SMB] Connection from /127.0.0.1:55379, handler=[SMB,TCP-SMB,ALL:5000], sess=T2
[SMB] Waiting for new connection …
[SMB] Connection from /fe80:0:0:0:0:0:0:1%1:55380, handler=[SMB,TCP-SMB,ALL:5000], sess=T3
[SMB] Waiting for new connection …
[SMB] Connection from /0:0:0:0:0:0:0:1:55381, handler=[SMB,TCP-SMB,ALL:5000], sess=T4
[SMB] Waiting for new connection …
[SMB] Register session with request handler, handler=CIFSRequestHandler_1, sess=T2
[SMB] Register session with request handler, handler=CIFSRequestHandler_1, sess=T3
[SMB] Register session with request handler, handler=CIFSRequestHandler_1, sess=T4
Received null packet, closing session sess=T1, addr=0:0:0:0:0:0:0:1
Received null packet, closing session sess=T3, addr=fe80:0:0:0:0:0:0:1%1
[SMB] Closed session 1, sessions=3
      Active sessions [[SMB] Closed session 3, sessions=2
4=0:0:0:0:0:0:0:1,      Active sessions [3=fe80:0:0:0:0:0:0:1%1,4=0:0:0:0:0:0:0:1,2=127.0.0.1,]
2=127.0.0.1,]
Received null packet, closing session sess=T2, addr=127.0.0.1
[SMB] Closed session 2, sessions=1
      Active sessions [4=0:0:0:0:0:0:0:1,]
[T4] Negotiated SMB dialect - NT LM 0.12
[T4] Assigned protocol handler - org.alfresco.jlan.smb.server.NTProtocolHandler
[SMB] NT Session setup NTLMSSP, MID=1, UID=0, PID=1
[SMB] Two stage logon (NTLMSSP)
[SMB] NT Session setup NTLMSSP, MID=2, UID=65535, PID=1
[SMB] Logged on using NTLMSSP/NTLMv2
[SMB] User normal logged on  (type Normal)
[SMB] Allocated UID=1 for VC=[276:1,[normal:null,Mac OS X 10.9,SMBFS 2.0.2,0:0:0:0:0:0:0:1,Normal],Tree=0,Searches=0]
[T4] NT Tree Connect AndX - \\localhost\IPC$, ?????, flags=ExtResponse/0x8
[T4] Tree Connect AndX - Allocated Tree Id = 1, Permission = Writeable, extendedResponse=true