GetDfsReferrals() private method

private GetDfsReferrals ( NtlmPasswordAuthentication auth, string path, int rn ) : DfsReferral
auth NtlmPasswordAuthentication
path string
rn int
return DfsReferral
Ejemplo n.º 1
0
 /// <exception cref="SharpCifs.Smb.SmbAuthException"></exception>
 public virtual DfsReferral GetReferral(SmbTransport trans, string domain, string
                                        root, string path, NtlmPasswordAuthentication auth)
 {
     if (Disabled)
     {
         return(null);
     }
     try
     {
         string p = "\\" + domain + "\\" + root;
         if (path != null)
         {
             p += path;
         }
         DfsReferral dr = trans.GetDfsReferrals(auth, p, 0);
         if (dr != null)
         {
             return(dr);
         }
     }
     catch (IOException ioe)
     {
         if (Log.Level >= 4)
         {
             Runtime.PrintStackTrace(ioe, Log);
         }
         if (StrictView && ioe is SmbAuthException)
         {
             throw (SmbAuthException)ioe;
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 /// <exception cref="SharpCifs.Smb.SmbAuthException"></exception>
 public virtual Hashtable GetTrustedDomains(NtlmPasswordAuthentication auth)
 {
     if (Disabled || auth.Domain == "?")
     {
         return(null);
     }
     if (Domains != null && Runtime.CurrentTimeMillis() > Domains.Expiration)
     {
         Domains = null;
     }
     if (Domains != null)
     {
         return(Domains.Map);
     }
     try
     {
         UniAddress   addr  = UniAddress.GetByName(auth.Domain, true);
         SmbTransport trans = SmbTransport.GetSmbTransport(addr, 0);
         CacheEntry   entry = new CacheEntry(Ttl * 10L);
         DfsReferral  dr    = trans.GetDfsReferrals(auth, string.Empty, 0);
         if (dr != null)
         {
             DfsReferral start = dr;
             do
             {
                 string domain = dr.Server.ToLower();
                 entry.Map.Put(domain, new Hashtable());
                 dr = dr.Next;
             }while (dr != start);
             Domains = entry;
             return(Domains.Map);
         }
     }
     catch (IOException ioe)
     {
         if (Log.Level >= 3)
         {
             Runtime.PrintStackTrace(ioe, Log);
         }
         if (StrictView && ioe is SmbAuthException)
         {
             throw (SmbAuthException)ioe;
         }
     }
     return(null);
 }
Ejemplo n.º 3
0
 /// <exception cref="SharpCifs.Smb.SmbAuthException"></exception>
 public virtual SmbTransport GetDc(string domain, NtlmPasswordAuthentication auth)
 {
     if (Disabled)
     {
         return(null);
     }
     try
     {
         UniAddress   addr  = UniAddress.GetByName(domain, true);
         SmbTransport trans = SmbTransport.GetSmbTransport(addr, 0);
         DfsReferral  dr    = trans.GetDfsReferrals(auth, "\\" + domain, 1);
         if (dr != null)
         {
             DfsReferral start = dr;
             IOException e     = null;
             do
             {
                 try
                 {
                     addr = UniAddress.GetByName(dr.Server);
                     return(SmbTransport.GetSmbTransport(addr, 0));
                 }
                 catch (IOException ioe)
                 {
                     e = ioe;
                 }
                 dr = dr.Next;
             }while (dr != start);
             throw e;
         }
     }
     catch (IOException ioe)
     {
         if (Log.Level >= 3)
         {
             Runtime.PrintStackTrace(ioe, Log);
         }
         if (StrictView && ioe is SmbAuthException)
         {
             throw (SmbAuthException)ioe;
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
		/// <exception cref="SharpCifs.Smb.SmbAuthException"></exception>
		public virtual DfsReferral GetReferral(SmbTransport trans, string domain, string 
			root, string path, NtlmPasswordAuthentication auth)
		{
			if (Disabled)
			{
				return null;
			}
			try
			{
				string p = "\\" + domain + "\\" + root;
				if (path != null)
				{
					p += path;
				}
				DfsReferral dr = trans.GetDfsReferrals(auth, p, 0);
				if (dr != null)
				{
					return dr;
				}
			}
			catch (IOException ioe)
			{
				if (Log.Level >= 4)
				{
					Runtime.PrintStackTrace(ioe, Log);
				}
				if (StrictView && ioe is SmbAuthException)
				{
					throw (SmbAuthException)ioe;
				}
			}
			return null;
		}