コード例 #1
0
ファイル: Exclude.cs プロジェクト: xcrash/rsync.net
        public void ReceiveExcludeList(IOStream f)
        {
            string line = "";
            int    l;

            while ((l = f.readInt()) != 0)
            {
                if (l >= Options.MAXPATHLEN + 3)
                {
                    Log.Write("overflow: recv_exclude_list");
                    continue;
                }

                line = f.ReadSBuf(l);
                AddExclude(ref options.excludeList, line, 0);
            }
        }
コード例 #2
0
ファイル: Exclude.cs プロジェクト: santosh-mnrec/rsync.net
		public void ReceiveExcludeList(IOStream f)		
		{			
			string line = "";
			int l;
			while ((l = f.readInt()) != 0) 
			{
				if (l >= Options.MAXPATHLEN+3)
				{
					Log.Write("overflow: recv_exclude_list");
					continue;
				}

				line = f.ReadSBuf(l);
				AddExclude(ref options.excludeList, line, 0);				
			}
		}
コード例 #3
0
        public FileStruct receiveFileEntry(UInt32 flags, ClientInfo cInfo)
        {
            if (cInfo == null)
            {
                lastName = "";
                return(null);
            }
            IOStream f = cInfo.IoStream;

            int l1 = 0, l2 = 0;

            if ((flags & Options.XMIT_SAME_NAME) != 0)
            {
                l1 = f.readByte();
            }

            if ((flags & Options.XMIT_LONG_NAME) != 0)
            {
                l2 = f.readInt();
            }
            else
            {
                l2 = f.readByte();
            }
            if (l2 >= Options.MAXPATHLEN - l1)
            {
                MainClass.Exit("overflow: lastname=" + lastName, cInfo);
            }

            string thisName = lastName.Substring(0, l1);

            thisName += f.ReadSBuf(l2);
            lastName  = thisName;

            thisName = Util.cleanFileName(thisName, false);
            if (options.sanitizePath)
            {
                thisName = Util.sanitizePath(thisName, "", 0);
            }

            string baseName = "";
            string dirName  = "";

            if (thisName.LastIndexOf("/") != -1)
            {
                baseName = Path.GetFileName(thisName);
                dirName  = FileSystem.Directory.GetDirectoryName(thisName).Replace(@"\", "/").Replace(":", "");
            }
            else
            {
                baseName = thisName;
                dirName  = null;
            }

            Int64 fileLength = f.ReadLongInt();

            if ((flags & Options.XMIT_SAME_TIME) == 0)
            {
                modTime = DateTime.FromFileTime(f.readInt());
            }
            if ((flags & Options.XMIT_SAME_MODE) == 0)
            {
                mode = (UInt32)f.readInt();
            }

            if (options.preserveUID && (flags & Options.XMIT_SAME_UID) == 0)
            {
                int uid = f.readInt();
            }
            if (options.preserveGID && (flags & Options.XMIT_SAME_GID) == 0)
            {
                int gid = f.readInt();
            }

            byte[] sum = new byte[0];
            if (options.alwaysChecksum && !Util.S_ISDIR(mode))
            {
                sum = new byte[CheckSum.MD4_SUM_LENGTH];
                sum = f.ReadBuf(options.protocolVersion < 21 ? 2 : CheckSum.MD4_SUM_LENGTH);
            }

            FileStruct fs = new FileStruct();

            fs.length   = (int)fileLength;
            fs.baseName = baseName;
            fs.dirName  = dirName;
            fs.sum      = sum;
            fs.mode     = mode;
            fs.modTime  = modTime;
            fs.flags    = flags;
            return(fs);
        }