Nmap Development mailing list archives

Re: Locking a mutex by name?


From: Ron <ron () skullsecurity net>
Date: Fri, 14 Nov 2008 20:04:25 -0600

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?

Ron

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


Current thread: