Package com.knowgate.jcifs

Examples of com.knowgate.jcifs.UniAddress


    synchronized DfsReferral getDfsReferral( NtlmPasswordAuthentication auth, String path ) throws SmbException {
        String subpath, node, host;
        DfsReferral dr = new DfsReferral();
        int p, n, i, s;
        UniAddress addr;

        SmbTree ipc = getSmbSession( auth ).getSmbTree( "IPC$", null );
        Trans2GetDfsReferralResponse resp = new Trans2GetDfsReferralResponse();
        ipc.sendTransaction( new Trans2GetDfsReferral( path ), resp );
View Full Code Here


        for( ;; ) {
            connect0();
            if( tree.inDfs ) {
                DfsReferral dr = tree.session.transport.lookupReferral( unc );
                if( dr != null ) {
                    UniAddress addr;
                    SmbTransport trans;

                    try {
                        addr = UniAddress.getByName( dr.server );
                    } catch( UnknownHostException uhe ) {
View Full Code Here

        for( ;; ) {
            connect0();
            if( tree.inDfs ) {
                DfsReferral dr = tree.session.transport.lookupReferral( unc );
                if( dr != null ) {
                    UniAddress addr;
                    SmbTransport trans;

                    try {
                        addr = UniAddress.getByName( dr.server );
                    } catch( UnknownHostException uhe ) {
View Full Code Here

* <tt>URLConnection</tt> implementation of <tt>connect()</tt>.
*/
    public void connect() throws IOException {
        SmbTransport trans;
        SmbSession ssn;
        UniAddress addr;

        if( isConnected() ) {
            return;
        }

View Full Code Here

                    type = TYPE_SHARE;
                }
            } else if( url.getAuthority().length() == 0 ) {
                type = TYPE_WORKGROUP;
            } else {
                UniAddress addr;
                try {
                    addr = getAddress();
                } catch( UnknownHostException uhe ) {
                    throw new SmbException( url.toString(), uhe );
                }
                if( addr.getAddress() instanceof NbtAddress ) {
                    int code = ((NbtAddress)addr.getAddress()).getNameType();
                    if( code == 0x1d || code == 0x1b ) {
                        type = TYPE_WORKGROUP;
                        return type;
                    }
                }
View Full Code Here

            type = TYPE_WORKGROUP;
            return true;
        } else {
            getUncPath0();
            if( share == null ) {
                UniAddress addr = getAddress();
                if( addr.getAddress() instanceof NbtAddress ) {
                    int code = ((NbtAddress)addr.getAddress()).getNameType();
                    if( code == 0x1d || code == 0x1b ) {
                        type = TYPE_WORKGROUP;
                        return true;
                    }
                }
View Full Code Here

        if (realm == null) realm = "jCIFS";
    }

    protected void service(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        UniAddress dc;
        boolean offerBasic = enableBasic &&
                (insecureBasic || request.isSecure());
        String msg = request.getHeader("Authorization");
        if (msg != null && (msg.startsWith("NTLM ") ||
                    (offerBasic && msg.startsWith("Basic ")))) {
            if( loadBalance ) {
                dc = new UniAddress( NbtAddress.getByName( domainController, 0x1C, null ));
            } else {
                dc = UniAddress.getByName( domainController, true );
            }
            NtlmPasswordAuthentication ntlm;
            if (msg.startsWith("NTLM ")) {
View Full Code Here

    public void doFilter( ServletRequest request,ServletResponse response, FilterChain chain )
        throws IOException, ServletException {

        HttpServletRequest req;
        HttpServletResponse resp;
        UniAddress dc;
        String msg;

        NtlmPasswordAuthentication ntlm = null;
        req = (HttpServletRequest)request;
        resp = (HttpServletResponse)response;
        msg = req.getHeader( "Authorization" );
        boolean offerBasic = enableBasic && (insecureBasic || req.isSecure());

        if( msg != null && (msg.startsWith( "NTLM " ) ||
                    (offerBasic && msg.startsWith("Basic ")))) {
            if( loadBalance ) {
                dc = new UniAddress( NbtAddress.getByName( domainController, 0x1C, null ));
            } else {
                dc = UniAddress.getByName( domainController, true );
            }
            if (msg.startsWith("NTLM ")) {
                req.getSession();
View Full Code Here

        }
        return new String( out, 0, i );
    }
    public void doGet( HttpServletRequest req,
                HttpServletResponse resp ) throws IOException, ServletException {
        UniAddress dc;
        String msg, pathInfo, server = null;
        boolean offerBasic, possibleWorkgroup = true;
        NtlmPasswordAuthentication ntlm = null;
        HttpSession ssn = req.getSession( false );
View Full Code Here

      String msg = req.getHeader( "Authorization" );

      if (DebugFile.trace) DebugFile.writeln("NtlmHipergateFilter Authorization=" + msg);

      UniAddress dc;
      String user = "", password = "", domain = "";

      boolean offerBasic = enableBasic && (insecureBasic || req.isSecure());

      if (DebugFile.trace) DebugFile.writeln("offerBasic=" + String.valueOf(offerBasic));

      if( msg != null && (msg.startsWith( "NTLM " ) || (offerBasic && msg.startsWith("Basic ")))) {
          if( loadBalance ) {
              if (DebugFile.trace) DebugFile.writeln("new UniAddress(" + NbtAddress.getByName( domainController, 0x1C, null ) + ")");
              dc = new UniAddress( NbtAddress.getByName( domainController, 0x1C, null ));
          } else {
              if (DebugFile.trace) DebugFile.writeln("UniAddress.getByName( " + domainController + ", true)");
              dc = UniAddress.getByName( domainController, true );
          }

          if (msg.startsWith("NTLM ")) {
              req.getSession();
              byte[] challenge = SmbSession.getChallenge( dc );


              if (( ntlm = NtlmSsp.authenticate( req, resp, challenge )) == null ) {
                  if (DebugFile.trace) DebugFile.writeln("NtlmPasswordAuthentication = null");
                  return;
              }
          } else {
              String auth = new String (Base64Decoder.decodeToBytes(msg.substring(6)), "US-ASCII");

              int index = auth.indexOf(':');

              user = (index != -1) ? auth.substring(0, index) : auth;

              if (DebugFile.trace) DebugFile.writeln("user=" + user);

              password = (index != -1) ? auth.substring(index + 1) : "";

              index = user.indexOf('\\');
              if (index == -1) index = user.indexOf('/');
              domain = (index != -1) ? user.substring(0, index) : defaultDomain;

              if (DebugFile.trace) DebugFile.writeln("domain=" + domain);

              user = (index != -1) ? user.substring(index + 1) : user;

              ntlm = new NtlmPasswordAuthentication(domain, user, password);

          } // fi (msg.startsWith("NTLM "))

          try {
              if (DebugFile.trace && (dc!=null) && (ntlm!=null))
                DebugFile.writeln("SmbSession.logon(" + dc.toString() + "," + ntlm.toString());

              SmbSession.logon( dc, ntlm );

          } catch( SmbAuthException sae ) {
              if (DebugFile.trace) DebugFile.writeln("SmbAuthException" + Gadgets.toHexString(sae.getNtStatus(), 8) + " " + sae.getMessage());
View Full Code Here

TOP

Related Classes of com.knowgate.jcifs.UniAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.