General developer forum

 
 
Picture of Ted Owens
Modifying Blocks
 
I have been looking at the Windows Share Web Client block and have noticed that it is calling ../../auth/ldap/lib.php which is no longer used in Moodle 1.8 and 1.9.

However the functions being used all exist in ../../auth/ldap/auth.php so I have modified the code to use the functions in the class defined in auth.php.

I am wondering if anyone would be interested in this fix to that block once I have completed testing and if so how would I go about submitting it?
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
Normally, submit your mod to the maintainer of that block, but since no one is listed I'd add a new record to the modules and plugins database and explain in the notes that your file should be added as the 1.8/1.9 version.

Personally, I would happily gnaw my own leg off to get that block to work with win2K3 as its perfect for my users. Any idea how much work/effort would be required for me to get that to happen, or would it mean writing a new block from scratch?

Matt
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
Oops, just saw Guy Thomas was the person who submitted the record. Message him, I reckon.
 
Average of ratings: -
Picture of Guy Thomas
Re: Modifying Blocks
 
Hi Matt. The reason that SMB web client only works with linux is because it uses the linux smbclient to read windows directories as a user. This is far more secure than a windows solution where we would probably have to do something stupid like add apache or IIS as a user with full privileges to all student home dirs and then get php to simply read off the files (or write to them if you want uploads). Imagine if you had a security hole in your web server that let people upload php files - hackers could start uploading php files that attacked user home directories - oouuuuch!!! SMB client gets round this issue because every time you request a directory it does it just as if a user was sat at an individual PC at school browsing their home directory. Even if a hacker could upload a php file they would not be able to attack home directories because the authentication is done on a per dir access session basis!

If you really don't want Linux as your web server, an alternative solution for you this - Get a cheep separate linux box (doesn't have to be a super spec) and then get the block to use this separate linux box just for the windows share reading. You wouldn't have to put moodle on it or install anything as most linux boxes come with smbclient pre-installed. You need this linux box on the network and with a DNS entry - and it has to be accessible by your windows IIS webserver (i.e. you can ping it from there)

All you need to do then is modify blocks/config_smb_web_client.php with the default server to point at your linux box. Replace 'localhost' with the DNS name of your new linux box:

$smb_cfg->cfgDefaultServer = 'localhost';

change to

$smb_cfg->cfgDefaultServer = 'MyShinyNewLinuxBox';

Ta ta for now

Guy

 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
Guy, that's brilliant news! I'm going to look into that now.
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
Looks like it might be possible to run samba on windows. If so, maybe the separate box would not be needed?
 
Average of ratings: -
Picture of Guy Thomas
Re: Modifying Blocks
 

IMPORTANT

Sorry Matt, I've just realised that the smbwebclient class (that bit is not developed by me) executes smbclient commands on the host machines shell to get the files.

This means I don't think it will work with windows even if you have a separate linux box.

Apologies for this big oversight.

Maybe you will be able to get it working with the win32 version of smbclient though.
 
Average of ratings: -
Picture of Ted Owens
Re: Modifying Blocks
 
You wouldn't believe how happy my users are with this. They have been looking for this ability for several years

Since this relies mainly on Samba and smbclient this would require a significant rewrite, so writing a new block would probably a better bet.
 
Average of ratings: -
Capt. Moodle
Re: Modifying Blocks
Group DevelopersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Ted - Definitely try to contact the maintainer of the block. Ideally what we should do is create a version of the block for the 18STABLE branch in contrib that uses your files. Then we can create links on the Modules and Plugins to the automatically created zip files for each version. We are really just setting up a better structure for handling contributed code. Ideally, the maintainer of the block will contact me about getting CVS access to maintain it on CVS and to setup components in the tracker so that issues like this can be managed using the Moodle Tracker. I'll message the maintainer of the code and see if we can get the ball rolling. From your perspective, it would ideally just be a matter of creating an issue in the tracker and uploading your patches there. Then the maintainer could use that work and update CVS and the automatically created zip files would be of the latest and greatest code. Thanks for sharing your experience and fixes with the rest of the community. Peace - Anthony
 
Average of ratings: -
Picture of Ted Owens
Re: Modifying Blocks
 
Thanks. I will try and contact the maintainer. I created an issue in the tracker http://tracker.moodle.org/browse/CONTRIB-287 with my fixes in it on Friday as I was at a bit of a loss as to what to do. Thanks.
 
Average of ratings: -
Capt. Moodle
Re: Modifying Blocks
Group DevelopersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Ted - Thanks for creating the tracker issue and providing your fixes. I see it is assigned to me so it will be on my to do list of things to follow up on. FYI, you can save some time with referring to issues in the tracker as they will autolink if you type the issue number. For example, CONTRIB-287. Issues related to Moodle core will begin with MDL- and then a number. Peace - Anthony
 
Average of ratings: -
Picture of Guy Thomas
Re: Modifying Blocks
 
Many thanks Ted, you were correct about the auth lib.
The reason that this happened is because I accidentally linked the 1.7 version of the block (which did use ldap/lib.php) as the 1.8 version! I am an idiot.
The version that has been on there as the correct 1.8 version has been there since the 22nd January.
If you use a proxy server where you work it may have cached the page with a wrong link. The correct link should have 1.8 in the url-

http://ossett.schools.wakefield.gov.uk/web/media/files/moodlegpl/1.8/smb_web_client.zip

Sorry about that guys!
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
I have tentatively managed to get smbwebclient working on win2k3 using cygwin and might actually get this working. I have an error though:

Warning: fopen(data/languages.csv) [function.fopen]: failed to open stream: No such file or directory in E:\Moodle_webserver\moodle\blocks\smb_web_client\class_smbwebclient.php on line 353

followed by a load more. What is this folder it wants to open?

Someone seems to have the same problem on Linux - I've found the same problem on IE6 and firefox.
 
Average of ratings: -
Picture of Hassani Hachim
Re: Modifying Blocks
 
Hi Matt,
I don't know if this is the right place to ask my question...but i was looking a solution to run cygin (on vista) and intall a php server on it. For the moment, i have my cygwin runing... but i can't get my server runing (php & mysql)... i got problems installing php and mysql. As you're working on cygwin, do you have an idea about how i'd proceed( a simple tutorial) ?
Thanks
 
Average of ratings: -
Picture of Matt Gibson relaxing in the Alps
Re: Modifying Blocks
 
No idea I'm afraid. I installed the cygwin package linked to above and it mangled the servers networking settings, so I had to get someone else to sort it out. Seems OK now, but I'm no cygwin expert!

I run php, mysql etc using the xampp package from the downloads page. It seems quite stable and is a lot easier than the cygwin option.
 
Average of ratings: -
Picture of Hassani Hachim
Re: Modifying Blocks
 
Thanks for your answer. I was using xampp on my vista, but sometimes i got file permission problems. So i thought using cygwin would resolve the problem (chmod etc). Now i keep using xampp under vista (with litle problems) and fedora (without any problem)...
 
Average of ratings: -