public static string GetFilePortableSDDL(string path, PreserveSMBPermissions preserveSMBPermissions)
 {
     try
     {
         path = DMLibTestConstants.SupportUNCPath ?
                LongPath.GetFullPath(LongPath.ToUncPath(path)) :
                LongPath.GetFullPath(path);
     }
     catch (Exception)
     { }
     return(FileSecurityOperations.GetFilePortableSDDL(path, preserveSMBPermissions));
 }
Exemple #2
0
        private void SetChunkFinish()
        {
            if (1 == Interlocked.Read(ref this.readCompleted))
            {
                if (0 == Interlocked.Exchange(ref this.setCompletionDone, 1))
                {
                    this.state = State.Finished;
                    if (!this.md5HashStream.SucceededSeparateMd5Calculator)
                    {
                        return;
                    }

                    var md5 = this.md5HashStream.MD5HashTransformFinalBlock();
                    this.CloseOwnStream();

                    Attributes attributes = new Attributes()
                    {
                        ContentMD5   = md5,
                        OverWriteAll = false
                    };

                    if (this.transferJob.Transfer.PreserveSMBAttributes)
                    {
                        if (!string.IsNullOrEmpty(this.filePath))
                        {
                            DateTimeOffset?creationTime;
                            DateTimeOffset?lastWriteTime;
                            FileAttributes?fileAttributes;

                            LongPathFile.GetFileProperties(this.filePath, out creationTime, out lastWriteTime, out fileAttributes);

                            attributes.CloudFileNtfsAttributes = Utils.LocalAttributesToAzureFileNtfsAttributes(fileAttributes.Value);
                            attributes.CreationTime            = creationTime;
                            attributes.LastWriteTime           = lastWriteTime;
                        }
                    }

                    if (PreserveSMBPermissions.None != this.transferJob.Transfer.PreserveSMBPermissions)
                    {
                        if (!string.IsNullOrEmpty(this.filePath))
                        {
                            attributes.PortableSDDL = FileSecurityOperations.GetFilePortableSDDL(filePath, this.transferJob.Transfer.PreserveSMBPermissions);
                        }
                    }

                    this.SharedTransferData.Attributes = attributes;
                }
            }
        }
Exemple #3
0
 public static string GetFilePortableSDDL(string path, PreserveSMBPermissions preserveSMBPermissions)
 {
     return(FileSecurityOperations.GetFilePortableSDDL(path, preserveSMBPermissions));
 }