Nmap Development mailing list archives

Re: Locking a mutex by name?


From: Kris Katterjohn <katterjohn () gmail com>
Date: Fri, 14 Nov 2008 21:56:12 -0600

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2008 08:04 PM, Ron wrote:
Patrick Donnelly wrote:
On Fri, Nov 14, 2008 at 6:07 PM, Ron <ron () skullsecurity net> wrote:

You really only need to worry that the thread using the mutex keeps a
reference to it from the point it locks it to the point it releases
it. How you decide to keep the reference is up to you. It could be as
simple as:

local mutex;

-- ... other code

function action(host, port)
  mutex = nmap.mutex("SMB-"..host.ip);
  -- do stuff...
end

Good point, I wasn't thinking of it that way.

It still feels cleaner, to me, for the SMB library to look after it,
simply because there will always need to be a lock when SMB is being
used, and only for the parts of the script while a SMB transaction is
going on. This also ensures that programmers don't forget to lock the
mutex when writing scripts (since they won't notice the issue until
running multiple scripts simultaneously).

My thought is that the nselib is a better place for it.

Anybody else have an opinion?


I agree that the library is the best place for handling the mutexes if they're
needed when using the library anyway.  IMO the most you can keep out of the
scripts the better, provided the library doesn't become a nasty kludge in the
process.

Ron


Thanks,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBSR5IWv9K37xXYl36AQKKGg/6AqYTeoIYBm8NjbzWs1gsO0ivyIOFIKrC
vinT8tOCv2N594JhCYMiwHqMGB7f6x/bVq45myr6tHn9JYI7qy361FodmhXEqn4V
+V2gkH6Xya2Kml4CAsYRLGwqNE1gHAOw8ixKapdrqUi1QrWpZ4mRkJrT+x/+fXI6
vYUx8+rLBNIThBb1vYfr/Gt1/SYPqNsTBNc19IczKT1GdPEOAvO87B9F5K8fzLx1
x9myBaS6eQdaCOm1nIgfbbBTF4zX+HhYEfnkDcwZnZzgmCeW1BzQcEeOEcDNZcC7
XFIsA2NMfrlfCmpDPUJ3F9/zX/8h+klt8eYNFz1gpMoghhhQ5daEujw5RU+9AlUR
Wdy0C+bPxpAwiLVYSvxT7wiSKvA69kzd/vz6KYvWsTcWQ0OlMLuaXmUlS2nqS2dC
PUAKeVt7climCWPveqXleui57Bn4ngYfKKitF1eabNPBmJG/0RO1eKwJ5AgVYHhu
Fc8WcBH3bCdTIsK/UvwxBPsGoT7o+w1DLZak4d7kiQ/2Wi9Kpnki3E391GhAs9cz
8PQJGcIQTmPvLmR0EKQq10/yZzcQfjnq8LtCX8Wn4GbqnDw3A4xqAs54Ynm+zWzl
C0EcKZgT61Vi2dKfJd+9HsWXi20Dtnp0tryjDjSzPUWMbYEbrzwISyA4Gft5zNLU
knyAdNmf4bo=
=MT84
-----END PGP SIGNATURE-----

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: