if (got_domain_sid) return;
- if (!(mem_ctx=talloc_init()))
+ if (!(mem_ctx=talloc_init("fetch_machine_sid")))
{
DEBUG(0,("fetch_machine_sid: talloc_init returned NULL!\n"));
goto error;
static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry,
char *cmd)
{
- char *p = cmd, **argv = NULL;
+ char **argv = NULL;
+ const char *p = cmd;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
pstring buf;
int argc = 0, i;
/* Create mem_ctx */
- if (!(mem_ctx = talloc_init())) {
+ if (!(mem_ctx = talloc_init("do_cmd"))) {
DEBUG(0, ("talloc_init() failed\n"));
goto done;
}
struct cmd_list *temp_list;
BOOL found = False;
pstring buf;
- char *p = cmd;
+ const char *p = cmd;
NTSTATUS result = NT_STATUS_OK;
int len = 0;
int main(int argc, char *argv[])
{
- extern pstring global_myname;
static int got_pass = 0;
BOOL interactive = True;
int opt;
static char *opt_authfile=NULL,
*opt_username=NULL,
*opt_domain=NULL,
- *opt_configfile=NULL,
*opt_logfile=NULL,
*opt_ipaddr=NULL;
pstring logfile;
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
- {"authfile", 'A', POPT_ARG_STRING, &opt_authfile, 'A', "File containing user credentials"},
- {"conf", 's', POPT_ARG_STRING, &opt_configfile, 's', "Specify an alternative config file"},
+ {"authfile", 'A', POPT_ARG_STRING, &opt_authfile, 'A', "File containing user credentials", "AUTHFILE"},
{"nopass", 'N', POPT_ARG_NONE, &got_pass, 'N', "Don't ask for a password"},
- {"user", 'U', POPT_ARG_STRING, &opt_username, 'U', "Set the network username"},
- {"workgroup", 'W', POPT_ARG_STRING, &opt_domain, 'W', "Set the domain name for user account"},
- {"command", 'c', POPT_ARG_STRING, &cmdstr, 'c', "Execute semicolon separated cmds"},
- {"logfile", 'l', POPT_ARG_STRING, &opt_logfile, 'l', "Logfile to use instead of stdout"},
- {"dest-ip", 'I', POPT_ARG_STRING, &opt_ipaddr, 'I', "Specify destination IP address"},
+ {"user", 'U', POPT_ARG_STRING, &opt_username, 'U', "Set the network username", "USER"},
+ {"workgroup", 'W', POPT_ARG_STRING, &opt_domain, 'W', "Set the domain name for user account", "DOMAIN"},
+ {"command", 'c', POPT_ARG_STRING, &cmdstr, 'c', "Execute semicolon separated cmds", "COMMANDS"},
+ {"logfile", 'l', POPT_ARG_STRING, &opt_logfile, 'l', "Logfile to use instead of stdout", "LOGFILE" },
+ {"dest-ip", 'I', POPT_ARG_STRING, &opt_ipaddr, 'I', "Specify destination IP address", "IP"},
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
+ { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile },
{ NULL }
};
interactive = False;
break;
- case 's':
- pstrcpy(dyn_CONFIGFILE, opt_configfile);
- break;
-
case 'U': {
char *lp;
- pstrcpy(username,opt_username);
+ fstrcpy(username,opt_username);
if ((lp=strchr_m(username,'%'))) {
*lp = 0;
- pstrcpy(password,lp+1);
+ fstrcpy(password,lp+1);
got_pass = 1;
memset(strchr_m(opt_username,'%') + 1, 'X',
strlen(password));
return 1;
}
case 'W':
- pstrcpy(domain, opt_domain);
+ fstrcpy(domain, opt_domain);
break;
}
}
load_interfaces();
- get_myname((*global_myname)?NULL:global_myname);
- strupper(global_myname);
+ if (!init_names())
+ return 1;
/* Resolve the IP address */
if (!strlen(username) && !got_pass)
get_username(username);
- nt_status = cli_full_connection(&cli, global_myname, server,
+ nt_status = cli_full_connection(&cli, global_myname(), server,
&server_ip, 0,
"IPC$", "IPC",
username, domain,
- password, 0);
+ password, 0, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("Cannot connect to server. Error was %s\n", nt_errstr(nt_status)));