Samba plugin : Code cleanup and issues fix