summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-20 11:04:31 +0200
committerVolker Lendecke <vl@samba.org>2008-07-20 17:37:11 +0200
commit1335da2a7cc639310e5d389e8e8dbe67c4e7ca25 (patch)
treeccc12b50a8eb04039345c082168c9cc823696b05 /source3/utils
parent18fb7e09776e26dacfa2329607f8a20699ad2969 (diff)
downloadsamba-1335da2a7cc639310e5d389e8e8dbe67c4e7ca25.tar.gz
samba-1335da2a7cc639310e5d389e8e8dbe67c4e7ca25.tar.bz2
samba-1335da2a7cc639310e5d389e8e8dbe67c4e7ca25.zip
Refactoring: Change calling conventions for cli_rpc_pipe_open_noauth
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS (This used to be commit 9abc9dc4dc13bd3e42f98eff64eacf24b51f5779)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c4
-rw-r--r--source3/utils/net_rpc.c53
-rw-r--r--source3/utils/net_rpc_join.c15
-rw-r--r--source3/utils/net_rpc_shell.c6
-rw-r--r--source3/utils/net_util.c10
-rw-r--r--source3/utils/netlookup.c8
-rw-r--r--source3/utils/smbcacls.c10
-rw-r--r--source3/utils/smbcquotas.c6
-rw-r--r--source3/utils/smbtree.c5
9 files changed, 70 insertions, 47 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 4d37e2bf8d..934ac1da1e 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1633,8 +1633,8 @@ static int net_ads_printer_publish(struct net_context *c, int argc, const char *
SAFE_FREE(srv_cn_escaped);
SAFE_FREE(printername_escaped);
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SPOOLSS, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &syntax_spoolss, &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
d_fprintf(stderr, "Unable to open a connnection to the spoolss pipe on %s\n",
servername);
SAFE_FREE(prt_dn);
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index d777018b5d..783dda1998 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -59,8 +59,9 @@ NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
NTSTATUS result = NT_STATUS_OK;
union lsa_PolicyInformation *info = NULL;
- lsa_pipe = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result);
- if (!lsa_pipe) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &lsa_pipe);
+ if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Could not initialise lsa pipe\n");
return result;
}
@@ -173,9 +174,11 @@ int run_rpc_command(struct net_context *c,
c->opt_password,
&nt_status);
} else {
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, pipe_idx, &nt_status);
+ nt_status = cli_rpc_pipe_open_noauth(
+ cli, cli_get_iface(pipe_idx),
+ &pipe_hnd);
}
- if (!pipe_hnd) {
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise pipe %s. Error was %s\n",
cli_get_pipe_name(pipe_idx),
nt_errstr(nt_status) ));
@@ -296,8 +299,9 @@ static NTSTATUS rpc_oldjoin_internals(struct net_context *c,
NTSTATUS result;
uint32 sec_channel_type;
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &result);
- if (!pipe_hnd) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("rpc_oldjoin_internals: netlogon pipe open to machine %s failed. "
"error was %s\n",
cli->desthost,
@@ -2000,8 +2004,9 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli,
POLICY_HND lsa_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result);
- if (!pipe_hnd) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -2813,9 +2818,10 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
return NT_STATUS_OK;
}
- lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(pipe_hnd),
- PI_LSARPC, &result);
- if (!lsa_pipe) {
+ result = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(pipe_hnd),
+ &ndr_table_lsarpc.syntax_id,
+ &lsa_pipe);
+ if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Couldn't open LSA pipe. Error was %s\n",
nt_errstr(result) );
return result;
@@ -5962,8 +5968,9 @@ static NTSTATUS rpc_trustdom_get_pdc(struct net_context *c,
/* Try netr_GetDcName */
- netr = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &status);
- if (!netr) {
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
+ &netr);
+ if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -6091,8 +6098,9 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
* Call LsaOpenPolicy and LsaQueryInfo
*/
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise lsa pipe. Error was %s\n", nt_errstr(nt_status) ));
cli_shutdown(cli);
talloc_destroy(mem_ctx);
@@ -6345,8 +6353,9 @@ static int rpc_trustdom_vampire(struct net_context *c, int argc,
return -1;
};
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise lsa pipe. Error was %s\n",
nt_errstr(nt_status) ));
cli_shutdown(cli);
@@ -6501,8 +6510,9 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
return -1;
};
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise lsa pipe. Error was %s\n",
nt_errstr(nt_status) ));
cli_shutdown(cli);
@@ -6591,8 +6601,9 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
/*
* Open \PIPE\samr and get needed policy handles
*/
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Could not initialise samr pipe. Error was %s\n", nt_errstr(nt_status)));
cli_shutdown(cli);
talloc_destroy(mem_ctx);
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index 5b31e6e100..609068e3d0 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -199,8 +199,9 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
/* Fetch domain sid */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result);
- if (!pipe_hnd) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0, ("Error connecting to LSA pipe. Error was %s\n",
nt_errstr(result) ));
goto done;
@@ -231,8 +232,9 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
}
/* Create domain user */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result);
- if (!pipe_hnd) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0, ("Error connecting to SAM pipe. Error was %s\n",
nt_errstr(result) ));
goto done;
@@ -373,8 +375,9 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
/* Now check the whole process from top-to-bottom */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &result);
- if (!pipe_hnd) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("Error connecting to NETLOGON pipe. Error was %s\n",
nt_errstr(result) ));
goto done;
diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c
index dee7a9f9c7..6abdb03c48 100644
--- a/source3/utils/net_rpc_shell.c
+++ b/source3/utils/net_rpc_shell.c
@@ -78,8 +78,10 @@ static NTSTATUS net_sh_run(struct net_context *c,
return NT_STATUS_NO_MEMORY;
}
- pipe_hnd = cli_rpc_pipe_open_noauth(ctx->cli, cmd->pipe_idx, &status);
- if (pipe_hnd == NULL) {
+ status = cli_rpc_pipe_open_noauth(ctx->cli,
+ cli_get_iface(cmd->pipe_idx),
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "Could not open pipe: %s\n",
nt_errstr(status));
return status;
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index ae1d4ea2b6..b976c65970 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -36,8 +36,9 @@ NTSTATUS net_rpc_lookup_name(struct net_context *c,
ZERO_STRUCT(pol);
- lsa_pipe = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result);
- if (lsa_pipe == NULL) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &lsa_pipe);
+ if (!NT_STATUS_IS_OK(result)) {
d_fprintf(stderr, "Could not initialise lsa pipe\n");
return result;
}
@@ -303,8 +304,9 @@ NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
return nt_status;
}
- pipe_hnd = cli_rpc_pipe_open_noauth(cli_tmp, pipe_num, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli_tmp, cli_get_iface(pipe_num),
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("couldn't not initialize pipe\n"));
cli_shutdown(cli_tmp);
SAFE_FREE(server_name);
diff --git a/source3/utils/netlookup.c b/source3/utils/netlookup.c
index 844db51fc0..14f2dddebc 100644
--- a/source3/utils/netlookup.c
+++ b/source3/utils/netlookup.c
@@ -118,11 +118,11 @@ static struct con_struct *create_cs(struct net_context *c,
return NULL;
}
- cs->lsapipe = cli_rpc_pipe_open_noauth(cs->cli,
- PI_LSARPC,
- &nt_status);
+ nt_status = cli_rpc_pipe_open_noauth(cs->cli,
+ &ndr_table_lsarpc.syntax_id,
+ &cs->lsapipe);
- if (cs->lsapipe == NULL) {
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(2,("create_cs: open LSA pipe failed. Error was %s\n", nt_errstr(nt_status)));
cs->failed_connect = true;
cs->err = nt_status;
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 4d38793a23..d488ce2187 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -80,8 +80,9 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
return cli_nt_error(cli);
}
- p = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &status);
- if (p == NULL) {
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &p);
+ if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
@@ -127,8 +128,9 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
return cli_nt_error(cli);
}
- p = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &status);
- if (p == NULL) {
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &p);
+ if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index a73c3b49df..11f8776a0e 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -49,8 +49,10 @@ static bool cli_open_policy_hnd(void)
if (!cli_ipc) {
NTSTATUS ret;
cli_ipc = connect_one("IPC$");
- global_pipe_hnd = cli_rpc_pipe_open_noauth(cli_ipc, PI_LSARPC, &ret);
- if (!global_pipe_hnd) {
+ ret = cli_rpc_pipe_open_noauth(cli_ipc,
+ &ndr_table_lsarpc.syntax_id,
+ &global_pipe_hnd);
+ if (!NT_STATUS_IS_OK(ret)) {
return False;
}
}
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index e975a1c8a2..ce2de4d7fe 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -163,9 +163,10 @@ static bool get_rpc_shares(struct cli_state *cli,
return False;
}
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status);
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id,
+ &pipe_hnd);
- if (pipe_hnd == NULL) {
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("Could not connect to srvsvc pipe: %s\n",
nt_errstr(status)));
TALLOC_FREE(mem_ctx);