nuggetman / smb-connector

SMB Connector
Other
1 stars 2 forks source link

Get Alway STATUS_ACCESS_DENIED (0xc0000022) #20

Open holiday-sunrise opened 4 years ago

holiday-sunrise commented 4 years ago

we try to use the SMB Connector without success.

What doing we in a wrong way ?

If we establish a SMB connection with the Mac/Finder we can do everything in that directory. Create and delete files/folders.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:smb="http://www.mulesoft.org/schema/mule/smb" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/smb http://www.mulesoft.org/schema/mule/smb/current/mule-smb.xsd">

<smb:config name="SMB_Connector__Configuration" domain="DENET" host="fileservice.xx" share="Germany" username="xxx" password="xx" doc:name="SMB Connector: Configuration"/>

<flow name="testsmbFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <smb:file-write config-ref="SMB_Connector__Configuration" dirName="/xxx/DEVTEST" fileName="foo.txt" doc:name="SMB Connector"/>
 </flow>

INFO 2020-02-05 17:01:26,878 [Mule.app.deployer.monitor.1.thread.1] com.mulesoft.module.policies.manager.DefaultPoliciesManager: Policy Request/response Logging was not applied to application testsmb. Make sure that your flow has auto-discovery correctly configured, note that the attribute apikit-ref is required in the api tag for RAML applications. INFO 2020-02-05 17:05:03,396 [[testsmb].HTTP_Listener_Configuration.worker.01] com.hierynomus.smbj.connection.Connection: Successfully connected to: fileservice.de.obi.net INFO 2020-02-05 17:05:03,456 [[testsmb].HTTP_Listener_Configuration.worker.01] com.hierynomus.smbj.connection.Connection: Successfully authenticated xxx on fileservice.XXX, session is 281476855879937 INFO 2020-02-05 17:05:03,457 [[testsmb].HTTP_Listener_Configuration.worker.01] com.hierynomus.smbj.session.Session: Connecting to \fileservice.XXX\Germany on session 281476855879937 ERROR 2020-02-05 17:05:03,481 [[testsmb].HTTP_Listener_Configuration.worker.01] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: STATUS_ACCESS_DENIED (0xc0000022): Create failed for \fileservice.XXX\Germany\X\DEVTEST\foo.txt. Type: class com.hierynomus.mssmb2.SMBApiException ERROR 2020-02-05 17:05:03,485 [[testsmb].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:


Message : Failed to invoke fileWrite. Payload : org.glassfish.grizzly.utils.BufferInputStream@789ddeff Element : /testsmbFlow/processors/0 @ testsmb

Root Exception stack trace: com.hierynomus.mssmb2.SMBApiException: STATUS_ACCESS_DENIED (0xc0000022): Create failed for \fileservice.XXX\Germany\X\foo.txt at com.hierynomus.smbj.share.Share.receive(Share.java:366) at com.hierynomus.smbj.share.Share.sendReceive(Share.java:346) at com.hierynomus.smbj.share.Share.createFile(Share.java:159) at com.hierynomus.smbj.share.DiskShare.createFileAndResolve(DiskShare.java:97) at com.hierynomus.smbj.share.DiskShare.resolveAndCreateFile(DiskShare.java:79) at com.hierynomus.smbj.share.DiskShare.open(DiskShare.java:66) at com.hierynomus.smbj.share.DiskShare.openFile(DiskShare.java:148) at org.mule.modules.smb.internal.SmbClient.writeFile(SmbClient.java:228) at org.mule.modules.smb.SmbConnector.fileWrite(SmbConnector.java:64) at org.mule.modules.smb.generated.processors.FileWriteMessageProcessor$1.process(FileWriteMessageProcessor.java:166)

nuggetman commented 4 years ago

Can you provide more details on the share you are connecting to? The exception STATUS_ACCESS_DENIED (0xc0000022) appears to manifest for DFS shares or situations where the Domain controller is doing some form of pass through authentication.

inv3r53 commented 4 years ago

The issue can occur if the smb user is not having full permissions on server side. The writeFile method in the connector could be fixed to use SMB2ShareAccess.FILE_SHARE_WRITE instead of SMB2ShareAccess.ALL.

nuggetman commented 4 years ago

I don't have a DFS sandbox, but will re-work the permissions in the Mule 4 release (as per issue #22) to see if that resolves the issue.

holiday-sunrise commented 4 years ago

Can you provide more details on the share you are connecting to? The exception STATUS_ACCESS_DENIED (0xc0000022) appears to manifest for DFS shares or situations where the Domain controller is doing some form of pass through authentication.

Hi, soory for my late reply. Its an fileshare in our company and i have admin rights on the folder. I Could that the folder is a link to the real location. kind regards rainer