Valeriy Ak created CAMEL-22611:
----------------------------------

             Summary: SmbComponent: file move error if the user does not have 
"Full Control" permissions
                 Key: CAMEL-22611
                 URL: https://issues.apache.org/jira/browse/CAMEL-22611
             Project: Camel
          Issue Type: Improvement
          Components: camel-smb
    Affects Versions: 4.10.0
            Reporter: Valeriy Ak


I’m using an SMB component to work with difrent shared folders.

In one case the user doesn’t have full permissions - only the minimum required 
ones for reading, writing, and deleting files.

When I configure *move* action, it calls 
[renameFile|https://github.com/apache/camel/blob/main/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbOperations.java#L194]
 method

That method opens the file with a *{{GENERIC_ALL}}* access mask, but the user 
has only {{GENERIC_READ }}and {{DELETE}} permissions, which results in the 
following error:
{code:java}
com.hierynomus.mssmb2.SMBApiException - STATUS_ACCESS_DENIED (0xc0000022) {code}
 

So I think it would be better to use the correct permissions on the source 
file: 
{code:java}
 ...
try (File src
         = share.openFile(from, EnumSet.of(AccessMask.GENERIC_READ, 
AccessMask.DELETE), null,
    SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null)) {
...{code}
 
In this case, everything should work correctly without requiring full rights.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to