#include "includes.h"
#include "lib/param/param.h"
-#include "popt_common.h"
+#include "lib/cmdline/cmdline.h"
#include "libcli/security/security.h"
#include "utils/ntlm_auth.h"
#include "../libcli/auth/libcli_auth.h"
const char *hex_nt_response = NULL;
struct loadparm_context *lp_ctx;
poptContext pc;
+ bool ok;
/* NOTE: DO NOT change this interface without considering the implications!
This is an external interface, which other programs will use to interact
.val = OPT_TARGET_HOSTNAME,
.descrip = "Target hostname",
},
- POPT_COMMON_CONFIGFILE
+ POPT_COMMON_DEBUG_ONLY
+ POPT_COMMON_CONFIG_ONLY
+ POPT_COMMON_OPTION_ONLY
POPT_COMMON_VERSION
- POPT_COMMON_OPTION
POPT_TABLEEND
};
/* Samba client initialisation */
smb_init_locale();
- setup_logging("ntlm_auth", DEBUG_STDERR);
- fault_setup();
-
- /* Parse options */
-
- pc = poptGetContext("ntlm_auth", argc, argv, long_options, 0);
-
- /* Parse command line options */
-
- if (argc == 1) {
- poptPrintHelp(pc, stderr, 0);
- poptFreeContext(pc);
- return 1;
- }
-
- while((opt = poptGetNextOpt(pc)) != -1) {
- /* Get generic config options like --configfile */
+ ok = samba_cmdline_init(frame,
+ SAMBA_CMDLINE_CONFIG_CLIENT,
+ false /* require_smbconf */);
+ if (!ok) {
+ DBG_ERR("Failed to init cmdline parser!\n");
+ TALLOC_FREE(frame);
+ exit(1);
}
- poptFreeContext(pc);
-
- if (!lp_load_global(get_dyn_CONFIGFILE())) {
- d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n",
- get_dyn_CONFIGFILE(), strerror(errno));
+ pc = samba_popt_get_context(getprogname(),
+ argc,
+ argv,
+ long_options,
+ POPT_CONTEXT_KEEP_FIRST);
+ if (pc == NULL) {
+ DBG_ERR("Failed to setup popt context!\n");
+ TALLOC_FREE(frame);
exit(1);
}
- pc = poptGetContext(NULL, argc, (const char **)argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
-
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_CHALLENGE: