struct program_options {
char *hostname;
+ int port;
char *cmd;
struct cli_credentials *credentials;
char *runas;
int argc_new;
char **argv_new;
+ int port = 445;
+ char *port_str = NULL;
+
int flag_interactive = SVC_IGNORE_INTERACTIVE;
int flag_ostype = 2;
int flag_reinstall = 0;
pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,
0);
- poptSetOtherOptionHelp(pc, "[OPTION]... //HOST COMMAND\nOptions:");
+ poptSetOtherOptionHelp(pc, "[OPTION]... //HOST[:PORT] COMMAND\nOptions:");
if (((opt = poptGetNextOpt(pc)) != -1) || flag_help || flag_version) {
fprintf(stderr, version_message_fmt, SAMBA_VERSION_MAJOR,
exit(1);
}
+ port_str = strchr(argv_new[0], ':');
+ if (port_str) {
+ if (sscanf(port_str + 1, "%d", &port) != 1 || port <= 0) {
+ fprintf(stderr, version_message_fmt,
+ SAMBA_VERSION_MAJOR, SAMBA_VERSION_MINOR);
+ poptPrintHelp(pc, stdout, 0);
+ exit(1);
+ }
+ *port_str = '\0';
+ }
+
if (opt_debuglevel) {
lp_set_cmdline("log level", opt_debuglevel);
}
options->credentials = cred;
options->hostname = argv_new[0] + 2;
+ options->port = port;
options->cmd = argv_new[1];
options->flags = flag_interactive;
static NTSTATUS winexe_svc_upload(
const char *hostname,
+ int port,
const char *service_filename,
const DATA_BLOB *svc32_exe,
const DATA_BLOB *svc64_exe,
NULL,
hostname,
NULL,
- 445,
+ port,
"ADMIN$",
"?????",
credentials,
static NTSTATUS winexe_svc_install(
struct cli_state *cli,
const char *hostname,
+ int port,
const char *service_name,
const char *service_filename,
const DATA_BLOB *svc32_exe,
if (need_start) {
status = winexe_svc_upload(
hostname,
+ port,
service_filename,
svc32_exe,
svc64_exe,
NULL,
options.hostname,
NULL,
- 445,
+ options.port,
"IPC$",
"?????",
options.credentials,
status = winexe_svc_install(
cli,
options.hostname,
+ options.port,
service_name,
service_filename,
winexesvc32_exe,