diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-04-20 16:53:02 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-04-20 16:53:02 +0200 |
commit | 6c9caed48187a0d18becf59ab636af44cbe521b0 (patch) | |
tree | c47170169077be6f8ae60aed739803ab4ba861b7 /source3/utils | |
parent | 53765c81f726a8c056cc4e57004592dd489975c9 (diff) | |
parent | 31120c9eacafd93e0f2c6b0f906af21adadd318a (diff) | |
download | samba-6c9caed48187a0d18becf59ab636af44cbe521b0.tar.gz samba-6c9caed48187a0d18becf59ab636af44cbe521b0.tar.bz2 samba-6c9caed48187a0d18becf59ab636af44cbe521b0.zip |
Merge commit 'origin/master' into libcli-auth-merge-without-netlogond
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net.c | 1 | ||||
-rw-r--r-- | source3/utils/net.h | 1 | ||||
-rw-r--r-- | source3/utils/net_conf.c | 8 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 19 | ||||
-rw-r--r-- | source3/utils/net_rpc_join.c | 2 | ||||
-rw-r--r-- | source3/utils/net_util.c | 2 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 16 |
7 files changed, 32 insertions, 17 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 7823a98219..bd5107af53 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -651,6 +651,7 @@ static struct functable net_func[] = { {"force", 'f', POPT_ARG_NONE, &c->opt_force}, {"stdin", 'i', POPT_ARG_NONE, &c->opt_stdin}, {"timeout", 't', POPT_ARG_INT, &c->opt_timeout}, + {"request-timeout",0,POPT_ARG_INT, &c->opt_request_timeout}, {"machine-pass",'P', POPT_ARG_NONE, &c->opt_machine_pass}, {"kerberos", 'k', POPT_ARG_NONE, &c->opt_kerberos}, {"myworkgroup", 'W', POPT_ARG_STRING, &c->opt_workgroup}, diff --git a/source3/utils/net.h b/source3/utils/net.h index 2d72756def..d88f962d41 100644 --- a/source3/utils/net.h +++ b/source3/utils/net.h @@ -43,6 +43,7 @@ struct net_context { const char *opt_container; int opt_flags; int opt_timeout; + int opt_request_timeout; const char *opt_target_workgroup; int opt_machine_pass; int opt_localgroup; diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 3fa547baf4..663c5925c7 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -340,6 +340,14 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx, if (!W_ERROR_IS_OK(werr)) { goto cancel; } + + werr = smbconf_transaction_start(conf_ctx); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error starting transaction: %s\n", + win_errstr(werr)); + goto done; + } + werr = import_process_service(c, conf_ctx, service); if (!W_ERROR_IS_OK(werr)) { goto cancel; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 2651a8d034..5dd3df9a69 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -121,6 +121,7 @@ int run_rpc_command(struct net_context *c, NTSTATUS nt_status; DOM_SID *domain_sid; const char *domain_name; + int ret = -1; /* make use of cli_state handed over as an argument, if possible */ if (!cli_arg) { @@ -142,15 +143,13 @@ int run_rpc_command(struct net_context *c, if (!(mem_ctx = talloc_init("run_rpc_command"))) { DEBUG(0, ("talloc_init() failed\n")); - cli_shutdown(cli); - return -1; + goto fail; } nt_status = net_get_remote_domain_sid(cli, mem_ctx, &domain_sid, &domain_name); if (!NT_STATUS_IS_OK(nt_status)) { - cli_shutdown(cli); - return -1; + goto fail; } if (!(conn_flags & NET_FLAGS_NO_PIPE)) { @@ -165,8 +164,7 @@ int run_rpc_command(struct net_context *c, if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("Could not initialise schannel netlogon pipe. Error was %s\n", nt_errstr(nt_status) )); - cli_shutdown(cli); - return -1; + goto fail; } } else { if (conn_flags & NET_FLAGS_SEAL) { @@ -184,8 +182,7 @@ int run_rpc_command(struct net_context *c, DEBUG(0, ("Could not initialise pipe %s. Error was %s\n", get_pipe_name_from_iface(interface), nt_errstr(nt_status) )); - cli_shutdown(cli); - return -1; + goto fail; } } } @@ -195,6 +192,7 @@ int run_rpc_command(struct net_context *c, if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(1, ("rpc command function failed! (%s)\n", nt_errstr(nt_status))); } else { + ret = 0; DEBUG(5, ("rpc command function succedded\n")); } @@ -204,13 +202,14 @@ int run_rpc_command(struct net_context *c, } } +fail: /* close the connection only if it was opened here */ if (!cli_arg) { cli_shutdown(cli); } talloc_destroy(mem_ctx); - return (!NT_STATUS_IS_OK(nt_status)); + return ret; } /** @@ -6105,7 +6104,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv) /* SamrConnect2 */ nt_status = rpccli_samr_Connect2(pipe_hnd, mem_ctx, pipe_hnd->desthost, - SAMR_ACCESS_OPEN_DOMAIN, + SAMR_ACCESS_LOOKUP_DOMAIN, &connect_hnd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("Couldn't open SAMR policy handle. Error was %s\n", diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 1587793bdc..78bbce3dfc 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -245,7 +245,7 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv) CHECK_RPC_ERR(rpccli_samr_Connect2(pipe_hnd, mem_ctx, pipe_hnd->desthost, SAMR_ACCESS_ENUM_DOMAINS - | SAMR_ACCESS_OPEN_DOMAIN, + | SAMR_ACCESS_LOOKUP_DOMAIN, &sam_pol), "could not connect to SAM database"); diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c index c6b6ee9e80..2915ffb809 100644 --- a/source3/utils/net_util.c +++ b/source3/utils/net_util.c @@ -521,6 +521,8 @@ NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain, d_fprintf(stderr, "Connection failed: %s\n", nt_errstr(nt_status)); cli = NULL; + } else if (c->opt_request_timeout) { + cli_set_timeout(cli, c->opt_request_timeout * 1000); } done: diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 4cd0d55f56..8cca93f5de 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -430,14 +430,18 @@ static int process_root(int local_flags) } if((local_flags & LOCAL_SET_PASSWORD) && (new_passwd == NULL)) { - struct passwd *passwd = getpwnam_alloc(NULL, user_name); + struct passwd *passwd; - if (!passwd) { - fprintf(stderr, "Cannot locate Unix account for " - "'%s'!\n", user_name); - exit(1); + if (remote_machine == NULL) { + passwd = getpwnam_alloc(NULL, user_name); + + if (!passwd) { + fprintf(stderr, "Cannot locate Unix account for " + "'%s'!\n", user_name); + exit(1); + } + TALLOC_FREE(passwd); } - TALLOC_FREE(passwd); new_passwd = prompt_for_new_password(stdin_passwd_get); |