adding --noldap startup option
This commit is contained in:
parent
3fe8b2800a
commit
ab906f25b8
2 changed files with 60 additions and 12 deletions
|
|
@ -869,6 +869,9 @@ int nfs41_idmap_name_to_ids(
|
||||||
struct idmap_user user;
|
struct idmap_user user;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (context == NULL)
|
||||||
|
return ERROR_FILE_NOT_FOUND;
|
||||||
|
|
||||||
dprintf(IDLVL, "--> nfs41_idmap_name_to_ids('%s')\n", username);
|
dprintf(IDLVL, "--> nfs41_idmap_name_to_ids('%s')\n", username);
|
||||||
|
|
||||||
lookup.value = username;
|
lookup.value = username;
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,50 @@ VOID ServiceStop()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _nfsd_args {
|
||||||
|
bool_t ldap_enable;
|
||||||
|
int debug_level;
|
||||||
|
} nfsd_args;
|
||||||
|
|
||||||
|
static void PrintUsage()
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: nfsd.exe -d <debug_level> --noldap\n");
|
||||||
|
}
|
||||||
|
static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
|
||||||
|
{
|
||||||
|
DWORD i;
|
||||||
|
|
||||||
|
/* set defaults. */
|
||||||
|
out->debug_level = 2;
|
||||||
|
out->ldap_enable = TRUE;
|
||||||
|
|
||||||
|
/* parse command line */
|
||||||
|
for (i = 1; i < argc; i++) {
|
||||||
|
if (argv[i][0] == TEXT('-')) {
|
||||||
|
if (_tcscmp(argv[i], TEXT("-h")) == 0) { /* help */
|
||||||
|
PrintUsage();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (_tcscmp(argv[i], TEXT("-d")) == 0) { /* debug level */
|
||||||
|
++i;
|
||||||
|
if (i >= argc) {
|
||||||
|
fprintf(stderr, "Missing debug level value\n");
|
||||||
|
PrintUsage();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
out->debug_level = _ttoi(argv[i]);
|
||||||
|
}
|
||||||
|
else if (_tcscmp(argv[i], TEXT("--noldap")) == 0) { /* no LDAP */
|
||||||
|
out->ldap_enable = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Unrecognized option '%s', disregarding.\n", argv[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(stdout, "parse_cmdlineargs: debug_level %d ldap is %d\n",
|
||||||
|
out->debug_level, out->ldap_enable);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef STANDALONE_NFSD
|
#ifdef STANDALONE_NFSD
|
||||||
void __cdecl _tmain(int argc, TCHAR *argv[])
|
void __cdecl _tmain(int argc, TCHAR *argv[])
|
||||||
#else
|
#else
|
||||||
|
|
@ -169,16 +213,15 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
|
||||||
// handle to our drivers
|
// handle to our drivers
|
||||||
HANDLE pipe;
|
HANDLE pipe;
|
||||||
nfs41_process_thread tids[MAX_NUM_THREADS];
|
nfs41_process_thread tids[MAX_NUM_THREADS];
|
||||||
nfs41_idmapper *idmapper;
|
nfs41_idmapper *idmapper = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
nfsd_args cmd_args;
|
||||||
|
|
||||||
if (argc > 2) {
|
if (!parse_cmdlineargs(argc, argv, &cmd_args))
|
||||||
const char *process = strip_path(argv[0], NULL);
|
exit(0);
|
||||||
printf("Usage: %s [#debug level]\n", process);
|
set_debug_level(cmd_args.debug_level);
|
||||||
} else if (argc == 2) {
|
|
||||||
set_debug_level(_ttoi(argv[1]));
|
|
||||||
}
|
|
||||||
open_log_files();
|
open_log_files();
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
/* dump memory leaks to stderr on exit; this requires the debug heap,
|
/* dump memory leaks to stderr on exit; this requires the debug heap,
|
||||||
/* available only when built in debug mode under visual studio -cbodley */
|
/* available only when built in debug mode under visual studio -cbodley */
|
||||||
|
|
@ -190,10 +233,12 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
|
||||||
|
|
||||||
nfs41_server_list_init();
|
nfs41_server_list_init();
|
||||||
|
|
||||||
status = nfs41_idmap_create(&idmapper);
|
if (cmd_args.ldap_enable) {
|
||||||
if (status) {
|
status = nfs41_idmap_create(&idmapper);
|
||||||
eprintf("id mapping initialization failed with %d\n", status);
|
if (status) {
|
||||||
goto out_logs;
|
eprintf("id mapping initialization failed with %d\n", status);
|
||||||
|
goto out_logs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NFS41D_VERSION = GetTickCount();
|
NFS41D_VERSION = GetTickCount();
|
||||||
|
|
@ -248,7 +293,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
|
||||||
out_pipe:
|
out_pipe:
|
||||||
CloseHandle(pipe);
|
CloseHandle(pipe);
|
||||||
out_idmap:
|
out_idmap:
|
||||||
nfs41_idmap_free(idmapper);
|
if (idmapper) nfs41_idmap_free(idmapper);
|
||||||
out_logs:
|
out_logs:
|
||||||
#ifndef STANDALONE_NFSD
|
#ifndef STANDALONE_NFSD
|
||||||
close_log_files();
|
close_log_files();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue