Inheritance: SmbComTransactionResponse
コード例 #1
0
        /// <exception cref="SharpCifs.Smb.SmbException"></exception>
        internal virtual DfsReferral GetDfsReferrals(NtlmPasswordAuthentication auth,
                                                     string path,
                                                     int rn)
        {
            SmbTree ipc = GetSmbSession(auth).GetSmbTree("IPC$", null);
            Trans2GetDfsReferralResponse resp = new Trans2GetDfsReferralResponse();

            ipc.Send(new Trans2GetDfsReferral(path), resp);
            if (resp.NumReferrals == 0)
            {
                return(null);
            }
            if (rn == 0 || resp.NumReferrals < rn)
            {
                rn = resp.NumReferrals;
            }
            DfsReferral dr = new DfsReferral();

            string[] arr        = new string[4];
            long     expiration = Runtime.CurrentTimeMillis() + Dfs.Ttl * 1000;
            int      di         = 0;

            for (;;)
            {
                dr.ResolveHashes = auth.HashesExternal;
                dr.Ttl           = resp.Referrals[di].Ttl;
                dr.Expiration    = expiration;
                if (path.Equals(string.Empty))
                {
                    dr.Server = Runtime.Substring(resp.Referrals[di].Path, 1).ToLower();
                }
                else
                {
                    DfsPathSplit(resp.Referrals[di].Node, arr);
                    dr.Server = arr[1];
                    dr.Share  = arr[2];
                    dr.Path   = arr[3];
                }
                dr.PathConsumed = resp.PathConsumed;
                di++;
                if (di == rn)
                {
                    break;
                }
                dr.Append(new DfsReferral());
                dr = dr.Next;
            }
            return(dr.Next);
        }
コード例 #2
0
 internal Referral(Trans2GetDfsReferralResponse enclosing)
 {
     this._enclosing = enclosing;
 }
コード例 #3
0
ファイル: SmbTransport.cs プロジェクト: istupakov/SharpCifs
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 internal virtual DfsReferral[] __getDfsReferrals(NtlmPasswordAuthentication auth,
     string path, int rn)
 {
     SmbTree ipc = GetSmbSession(auth).GetSmbTree("IPC$", null);
     Trans2GetDfsReferralResponse resp = new Trans2GetDfsReferralResponse();
     ipc.Send(new Trans2GetDfsReferral(path), resp);
     if (rn == 0 || resp.NumReferrals < rn)
     {
         rn = resp.NumReferrals;
     }
     DfsReferral[] drs = new DfsReferral[rn];
     string[] arr = new string[4];
     long expiration = Runtime.CurrentTimeMillis() + Dfs.Ttl * 1000;
     for (int di = 0; di < drs.Length; di++)
     {
         DfsReferral dr = new DfsReferral();
         dr.ResolveHashes = auth.HashesExternal;
         dr.Ttl = resp.Referrals[di].Ttl;
         dr.Expiration = expiration;
         if (path.Equals(string.Empty))
         {
             dr.Server = Runtime.Substring(resp.Referrals[di].Path, 1).ToLower();
         }
         else
         {
             DfsPathSplit(resp.Referrals[di].Node, arr);
             dr.Server = arr[1];
             dr.Share = arr[2];
             dr.Path = arr[3];
         }
         dr.PathConsumed = resp.PathConsumed;
         drs[di] = dr;
     }
     return drs;
 }
コード例 #4
0
			internal Referral(Trans2GetDfsReferralResponse enclosing)
			{
				this._enclosing = enclosing;
			}