The whole scheme of mounting a tracking share and triggering scripts to update the firewall and waiting for them to be triggered again on unmounting to reset the firewall rule may be too confusing and loose. It may become even obsolete as the Samba project release new features.
The latest Samba release has the capability of listing the logged users. I used this feature in a script to track the users and update the firewall as they log in and out. This script does not require all the work described on this text. It is very easy to use actually.
You can download the code from the project site at http://sourceforge.net/projects/smbgate/