Пример #1
0
 static {
   DEFAULT_FLAGS =
       NTLMSSP_NEGOTIATE_NTLM
           | (Config.getBoolean("jcifs.smb.client.useUnicode", true)
               ? NTLMSSP_NEGOTIATE_UNICODE
               : NTLMSSP_NEGOTIATE_OEM);
   DEFAULT_DOMAIN = Config.getProperty("jcifs.smb.client.domain", null);
   byte[] domain = new byte[0];
   if (DEFAULT_DOMAIN != null) {
     try {
       domain = DEFAULT_DOMAIN.getBytes(UNI_ENCODING);
     } catch (IOException ex) {
     }
   }
   int domainLength = domain.length;
   byte[] server = new byte[0];
   try {
     String host = NbtAddress.getLocalHost().getHostName();
     if (host != null) {
       try {
         server = host.getBytes(UNI_ENCODING);
       } catch (IOException ex) {
       }
     }
   } catch (UnknownHostException ex) {
   }
   int serverLength = server.length;
   byte[] targetInfo =
       new byte
           [(domainLength > 0 ? domainLength + 4 : 0)
               + (serverLength > 0 ? serverLength + 4 : 0)
               + 4];
   int offset = 0;
   if (domainLength > 0) {
     writeUShort(targetInfo, offset, 2);
     offset += 2;
     writeUShort(targetInfo, offset, domainLength);
     offset += 2;
     System.arraycopy(domain, 0, targetInfo, offset, domainLength);
     offset += domainLength;
   }
   if (serverLength > 0) {
     writeUShort(targetInfo, offset, 1);
     offset += 2;
     writeUShort(targetInfo, offset, serverLength);
     offset += 2;
     System.arraycopy(server, 0, targetInfo, offset, serverLength);
   }
   DEFAULT_TARGET_INFORMATION = targetInfo;
 }
Пример #2
0
 static {
   DEFAULT_FLAGS =
       NTLMSSP_NEGOTIATE_NTLM
           | (Config.getBoolean("jcifs.smb.client.useUnicode", true)
               ? NTLMSSP_NEGOTIATE_UNICODE
               : NTLMSSP_NEGOTIATE_OEM);
   DEFAULT_DOMAIN = Config.getProperty("jcifs.smb.client.domain", null);
   DEFAULT_USER = Config.getProperty("jcifs.smb.client.username", null);
   DEFAULT_PASSWORD = Config.getProperty("jcifs.smb.client.password", null);
   String defaultWorkstation = null;
   try {
     defaultWorkstation = NbtAddress.getLocalHost().getHostName();
   } catch (UnknownHostException ex) {
   }
   DEFAULT_WORKSTATION = defaultWorkstation;
   LM_COMPATIBILITY = Config.getInt("jcifs.smb.lmCompatibility", 0);
 }