Nmap Development mailing list archives

[PATCH] nmap-4.01 init change


From: "Dmitry V. Levin" <ldv () altlinux org>
Date: Sun, 5 Mar 2006 03:51:21 +0300

Hi,

There is a change I usually apply to run nmap chrooted.  It is not
related to chroot support per se, but helps to implement privileges
lowering on top of it.

The idea is to change initialization code from

static int initialized = 0;
void foo_init()
{
  initialized = 1;
  /* initialization code */
}
foo_user()
{
  if (!initialized) foo_init();
}

to

void foo_init()
{
  static int initialized = 0;
  if (initialized) return;
  initialized = 1;
  /* initialization code */
}
foo_user()
{
  foo_init();
}

Second method allows to do early initialization which could be used to
make nmap run with lowered privileges.

Proposed patch is attached.


-- 
ldv

Attachment: nmap-4.01-alt-init.patch
Description:



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

Current thread: