1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Copy nping, nsock, nbase, zenmap, ncat from their homes in /.

If you have trouble updating after this revision you need to follow
these instructions. You have probably just seen an error like this:

svn: URL 'svn://svn.insecure.org/nping' of existing directory 'nping'
does not match expected URL 'svn://svn.insecure.org/nmap/nping'

This is caused by the replacement of SVN externals.

Here's what you need to do. First, save any local changes you might have
in the nping, nsock, nbase, ncat, and zenmap directories. (For example
by running "cd nping; svn diff > ../nping.diff".) If you don't have any
local changes you can skip this step.

Then run these commands:

rm -rf nping/ nsock/ nbase/ ncat/ zenmap/
svn update
svn cleanup

If all else fails, you can just delete your whole working directory and
check out anew:

svn co --username guest --password "" svn://svn.insecure.org/nmap

There may be further discussion in the mailing list thread at
http://seclists.org/nmap-dev/2011/q4/303.
This commit is contained in:
david
2011-11-16 21:49:44 +00:00
parent 4dabecf3b8
commit ed2ba4e168
619 changed files with 351133 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
/*
This program attempts to run the program EXECUTABLE_NAME in the same
directory as itself using AuthorizationExecuteWithPrivileges. If the
authorization fails or is canceled, EXECUTABLE_NAME is run without
privileges using a plain exec.
This program is the first link in the chain
zenmap_auth -> zenmap_wrapper.py -> zenmap.bin
*/
#include <errno.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <Security/Authorization.h>
#include <Security/AuthorizationTags.h>
#define EXECUTABLE_NAME "zenmap_wrapper.py"
int main(int argc, char *argv[]) {
AuthorizationItem items[] = {
{ kAuthorizationRightExecute, 0, NULL, 0 }
};
AuthorizationRights rights = { 1, items };
AuthorizationRef ref;
AuthorizationFlags flags;
OSStatus status;
char executable_path[1024];
const char *cwd;
size_t len_cwd;
int return_code;
cwd = dirname(argv[0]);
len_cwd = strlen(cwd);
if (sizeof(executable_path) < len_cwd + strlen("/") + strlen(EXECUTABLE_NAME) + 1) {
fprintf(stderr, "Not enough room to store executable path: %s\n", strerror(errno));
exit(1);
}
strcpy(executable_path, cwd);
executable_path[len_cwd] = '/';
strcpy(executable_path + len_cwd + 1, EXECUTABLE_NAME);
flags = kAuthorizationFlagDefaults
| kAuthorizationFlagInteractionAllowed
| kAuthorizationFlagPreAuthorize
| kAuthorizationFlagExtendRights;
status = AuthorizationCreate(&rights, kAuthorizationEmptyEnvironment, flags, &ref);
if (status != errAuthorizationSuccess) {
if (status != errAuthorizationCanceled)
fprintf(stderr, "Couldn't create authorization reference (status code %ld).\n", status);
errno = 0;
execv(executable_path, argv);
fprintf(stderr, "Couldn't exec '%s': %s.\n", executable_path, strerror(errno));
exit(1);
}
status = AuthorizationExecuteWithPrivileges(ref, executable_path,
kAuthorizationFlagDefaults, argv + 1, NULL);
AuthorizationFree(ref, kAuthorizationFlagDefaults);
if (status != errAuthorizationSuccess) {
fprintf(stderr, "Couldn't execute '%s' with privileges (status code %ld).\n", executable_path, status);
errno = 0;
execv(executable_path, argv);
fprintf(stderr, "Couldn't exec '%s': %s.\n", executable_path, strerror(errno));
exit(1);
}
wait(&return_code);
exit(return_code);
}