Jump to content

Recommended Posts

Posted

Hi, could anyone please tell me how to block certain file types using the smb block. What's stopping the students uploading anything to this? What is the securoty like for this block?

 

Thanks

Posted

Security is defined by permissions set on the shares on your windows servers. If a student doesn't have access to a share over the regular network, then they don't have access to a share over the SMB client. If you have ClamAV installed on your moodle host server, then it'll run uploads thru that also.

 

Line 2383 of class_smbwebclient.php is where the upload function begins.

 

function UploadFile ($file)

{

$this->_SmbClient('put "'.$file.'" "'.$this->name.'"', $this->parent);

}

 

 

You could expand on this easily enough via various relatively basic (depends on your php knowledge ultimately) methods to restrict filetype...

 

function UploadFile ($file)

{
            $allowable_ext = array('avi','mpg','mov','3gp','3GP','wmv');
            $pieces = explode('.', $file);
            $ext = $pieces[count($pieces) - 1];
            if  (in_array($ext, $allowable_ext))
    { $this->_SmbClient('put "'.$file.'" "'.$this->name.'"', $this->parent); }

}

 

 

Or (better and more secure, as it won't be long til they work out to just rename the file) you could go by mimetype...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...