1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

merges from SAMBA_2_2

This commit is contained in:
Gerald Carter -
parent bfc3a25b77
commit 91929afbb0

View File

@ -576,7 +576,7 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd)
/* Print usage information */ /* Print usage information */
static void usage(void) static void usage(void)
{ {
printf("Usage: rpcclient server [options]\n"); printf("Usage: rpcclient [options] server\n");
printf("\t-A or --authfile authfile file containing user credentials\n"); printf("\t-A or --authfile authfile file containing user credentials\n");
printf("\t-c or --command \"command string\" execute semicolon separated cmds\n"); printf("\t-c or --command \"command string\" execute semicolon separated cmds\n");
@ -660,52 +660,69 @@ static void usage(void)
pc = poptGetContext(NULL, argc, (const char **) argv, long_options, pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST); POPT_CONTEXT_KEEP_FIRST);
while((opt = poptGetNextOpt(pc)) != -1) { while (argc > optind) {
switch (opt) { while((opt = poptGetNextOpt(pc)) != -1) {
case 'A': switch (opt) {
/* only get the username, password, and domain from the file */ case 'A':
read_authfile (opt_authfile, username, /* only get the username, password, and domain from the file */
password, domain); read_authfile (opt_authfile, username, password, domain);
if (strlen (password)) if (strlen (password))
got_pass = 1; got_pass = 1;
break; break;
case 'l': case 'l':
slprintf(logfile, sizeof(logfile) - 1, "%s.client", slprintf(logfile, sizeof(logfile) - 1, "%s.client",
opt_logfile); opt_logfile);
lp_set_logfile(logfile); lp_set_logfile(logfile);
interactive = False; interactive = False;
break; break;
case 's': case 's':
pstrcpy(dyn_CONFIGFILE, opt_configfile); pstrcpy(dyn_CONFIGFILE, opt_configfile);
break; break;
case 'd': case 'd':
DEBUGLEVEL = opt_debuglevel; DEBUGLEVEL = opt_debuglevel;
break; break;
case 'U': { case 'U': {
char *lp; char *lp;
pstrcpy(username,opt_username); pstrcpy(username,opt_username);
if ((lp=strchr_m(username,'%'))) { if ((lp=strchr_m(username,'%'))) {
*lp = 0; *lp = 0;
pstrcpy(password,lp+1); pstrcpy(password,lp+1);
got_pass = 1; got_pass = 1;
memset(strchr_m(opt_username,'%')+1,'X',strlen(password)); memset(strchr_m(opt_username,'%')+1,'X',strlen(password));
}
break;
} }
break;
}
case 'W': case 'W':
pstrcpy(domain, opt_domain); pstrcpy(domain, opt_domain);
break; break;
case 'h': case 'h':
default: default:
usage(); usage();
exit(1); exit(1);
}
} }
if (argc > optind) {
if (strncmp("//", argv[optind], 2) == 0 ||
strncmp("\\\\", argv[optind], 2) == 0)
{
argv[optind] += 2;
}
pstrcpy(server, argv[optind]);
optind ++;
}
}
if (!server[0]) {
usage();
return 1;
} }
poptFreeContext(pc); poptFreeContext(pc);