icewind1991 / SMB

PHP wrapper for smbclient
MIT License
132 stars 53 forks source link

Notify do not work on smbclient 4.7.3 #62

Open ariselseng opened 6 years ago

ariselseng commented 6 years ago

Using latest wonderfall/nextcloud docker image (smbclient version 4.7.x). There is no notify events working. When I test with ubuntu 17.10, smbclient version 4.6.7-Ubuntu , it works perfect.

I am using the example in the readme for checking notify output of a windows share.

smb.conf: [global] client NTLMv2 auth = no client lanman auth = yes client use spnego = no client min protocol = CORE client max protocol = NT1

running smbclient on both machines works good, so maybe icewind1991/SMB just is isn't compatible with latest smbclient. $ smbclient -U USER -W WORKGROUP //IP/SHARE smb: > notify Testfolder

EDIT: mentioned version of smbclient in docker image. EDIT: TLDR: IT seems like there is something in smbclient 4.7.x that does not work with icewind1991/SMB and notify events.

ariselseng commented 6 years ago

I have tracked down some of the problem. The notify command is not written to smbclient. It all stops after the function clearTillPrompt() has been called.

icewind1991 commented 6 years ago

Are you testing with the latest version? https://github.com/icewind1991/SMB/commit/0ef64a9156f0be62504ae25cee35af431531df1e should fix this issue

ariselseng commented 6 years ago

@icewind1991 Yes I do, I made some adjustment to the function to make it work, at least good enough.

        public function clearTillPrompt() {
                $this->write('');
                $promptLine = $this->readLine();

                if (!$this->isPrompt($promptLine)) {
                        $this->write('');
                } else {
                        $this->write('');
                        $this->readLine();
                }
        }

With this code, the very first notify event does not get registered but the ones after does. This only happens on 4.7.x though.

ariselseng commented 6 years ago

With these adjustments, this function does not block forever on 4.7.x.

ariselseng commented 6 years ago

@icewind1991 Does my code make any sense? Maybe you see why the first event does not get reported on 4.7 ?

ariselseng commented 6 years ago

Tested on latest 2.0.5. With the same issue. @icewind1991 Is there anything I can do to help you debug this?

theroch commented 5 years ago

It is related to #56?

joshtrichards commented 1 year ago

Fixed in #108 awhile ago. This should be closed out.