summaryrefslogtreecommitdiff
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
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)
-rw-r--r--source3/auth/auth_domain.c5
-rw-r--r--source3/client/client.c5
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/include/rpc_dce.h2
-rw-r--r--source3/lib/netapi/cm.c5
-rw-r--r--source3/libnet/libnet_join.c15
-rw-r--r--source3/librpc/rpc/dcerpc.c13
-rw-r--r--source3/libsmb/libsmb_dir.c5
-rw-r--r--source3/libsmb/libsmb_server.c7
-rw-r--r--source3/libsmb/passchange.c10
-rw-r--r--source3/libsmb/trusts_util.c5
-rw-r--r--source3/rpc_client/cli_pipe.c65
-rw-r--r--source3/rpc_parse/parse_rpc.c10
-rw-r--r--source3/rpc_parse/parse_spoolss.c1
-rw-r--r--source3/rpc_server/srv_spoolss.c9
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c3
-rw-r--r--source3/rpcclient/cmd_spoolss.c5
-rw-r--r--source3/rpcclient/cmd_test.c18
-rw-r--r--source3/rpcclient/rpcclient.c13
-rw-r--r--source3/smbd/change_trust_pw.c5
-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
-rw-r--r--source3/winbindd/winbindd_cm.c33
30 files changed, 204 insertions, 152 deletions
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index f483718552..2c67bf9f1c 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -112,10 +112,11 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
netlogon_pipe = cli_rpc_pipe_open_schannel(*cli, PI_NETLOGON,
PIPE_AUTH_LEVEL_PRIVACY, domain, &result);
} else {
- netlogon_pipe = cli_rpc_pipe_open_noauth(*cli, PI_NETLOGON, &result);
+ result = cli_rpc_pipe_open_noauth(
+ *cli, &ndr_table_netlogon.syntax_id, &netlogon_pipe);
}
- if(!netlogon_pipe) {
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("connect_to_domain_password_server: unable to open the domain client session to \
machine %s. Error was : %s.\n", dc_name, nt_errstr(result)));
cli_shutdown(*cli);
diff --git a/source3/client/client.c b/source3/client/client.c
index 149b530369..18b286324b 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3634,9 +3634,10 @@ static bool browse_host_rpc(bool sort)
uint32_t total_entries = 0;
int i;
- 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(frame);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ab923830bc..1395ec524b 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -7101,7 +7101,9 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
const struct ndr_syntax_id *abstract_syntax,
struct rpc_pipe_client **presult);
-struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe_idx, NTSTATUS *perr);
+NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
+ const struct ndr_syntax_id *interface,
+ struct rpc_pipe_client **presult);
struct rpc_pipe_client *cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
int pipe_idx,
enum pipe_auth_level auth_level,
@@ -7910,6 +7912,7 @@ bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
const char *cli_get_pipe_name(int pipe_idx);
int cli_get_pipe_idx(const RPC_IFACE *syntax);
+const struct ndr_syntax_id *cli_get_iface(int pipe_idx);
void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags,
uint32 call_id, int data_len, int auth_len);
bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth);
diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h
index 580b14f1d8..b63f0eac5e 100644
--- a/source3/include/rpc_dce.h
+++ b/source3/include/rpc_dce.h
@@ -159,6 +159,8 @@ enum schannel_direction {
/* RPC_IFACE */
typedef struct ndr_syntax_id RPC_IFACE;
+extern const struct ndr_syntax_id syntax_spoolss;
+
#define RPC_IFACE_LEN (UUID_SIZE + 4)
/* RPC_HDR - dce rpc header */
diff --git a/source3/lib/netapi/cm.c b/source3/lib/netapi/cm.c
index ae1091c504..fe5490c73b 100644
--- a/source3/lib/netapi/cm.c
+++ b/source3/lib/netapi/cm.c
@@ -132,8 +132,9 @@ static struct rpc_pipe_client *pipe_cm_connect(TALLOC_CTX *mem_ctx,
return NULL;
}
- p->pipe = cli_rpc_pipe_open_noauth(cli, pipe_idx, status);
- if (!p->pipe) {
+ *status = cli_rpc_pipe_open_noauth(cli, cli_get_iface(pipe_idx),
+ &p->pipe);
+ if (!NT_STATUS_IS_OK(*status)) {
TALLOC_FREE(p);
return NULL;
}
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index bb21bc4989..40637afabd 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -668,8 +668,9 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
goto done;
}
- pipe_hnd = cli_rpc_pipe_open_noauth(*cli, PI_LSARPC, &status);
- if (!pipe_hnd) {
+ status = cli_rpc_pipe_open_noauth(*cli, &ndr_table_lsarpc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Error connecting to LSA pipe. Error was %s\n",
nt_errstr(status)));
goto done;
@@ -750,8 +751,9 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
/* Open the domain */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status);
- if (!pipe_hnd) {
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Error connecting to SAM pipe. Error was %s\n",
nt_errstr(status)));
goto done;
@@ -1136,8 +1138,9 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
/* Open the domain */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &status);
- if (!pipe_hnd) {
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Error connecting to SAM pipe. Error was %s\n",
nt_errstr(status)));
goto done;
diff --git a/source3/librpc/rpc/dcerpc.c b/source3/librpc/rpc/dcerpc.c
index c8bca8d3eb..58d676a9d9 100644
--- a/source3/librpc/rpc/dcerpc.c
+++ b/source3/librpc/rpc/dcerpc.c
@@ -131,7 +131,6 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe
struct dcerpc_pipe *p = talloc(parent_ctx, struct dcerpc_pipe);
struct dcerpc_binding *binding;
NTSTATUS nt_status;
- int idx;
nt_status = dcerpc_parse_binding(p, binding_string, &binding);
@@ -165,16 +164,10 @@ _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe
return nt_status;
}
- idx = cli_get_pipe_idx(&table->syntax_id);
- if (idx < 0) {
- DEBUG(0, ("Unable to find interface index"));
- talloc_free(p);
- return NT_STATUS_OBJECT_PATH_INVALID;
- }
-
- p->rpc_cli = cli_rpc_pipe_open_noauth(p->cli, idx, &nt_status);
+ nt_status = cli_rpc_pipe_open_noauth(p->cli, &table->syntax_id,
+ &p->rpc_cli);
- if (p->rpc_cli == NULL) {
+ if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(p);
return nt_status;
}
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index aea4f103b6..aa313f2c05 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -273,8 +273,9 @@ net_share_enum_rpc(struct cli_state *cli,
uint32_t total_entries = 0;
/* Open the server service pipe */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id,
+ &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(1, ("net_share_enum_rpc pipe open fail!\n"));
return -1;
}
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 7af5ca3a24..0a3287bc82 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -646,10 +646,9 @@ SMBC_attr_server(TALLOC_CTX *ctx,
ZERO_STRUCTP(ipc_srv);
ipc_srv->cli = ipc_cli;
- pipe_hnd = cli_rpc_pipe_open_noauth(ipc_srv->cli,
- PI_LSARPC,
- &nt_status);
- if (!pipe_hnd) {
+ nt_status = cli_rpc_pipe_open_noauth(
+ ipc_srv->cli, &ndr_table_lsarpc.syntax_id, &pipe_hnd);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(1, ("cli_nt_session_open fail!\n"));
errno = ENOTSUP;
cli_shutdown(ipc_srv->cli);
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 3b82e5767f..86c7b52160 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -152,10 +152,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
* will just fail. So we do it anonymously, there's no other
* way.
*/
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result);
+ result = cli_rpc_pipe_open_noauth(
+ cli, &ndr_table_samr.syntax_id, &pipe_hnd);
}
- if (!pipe_hnd) {
+ if (!NT_STATUS_IS_OK(result)) {
if (lp_client_lanman_auth()) {
/* Use the old RAP method. */
if (!cli_oem_change_password(cli, user_name, new_passwd, old_passwd)) {
@@ -204,9 +205,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
result = NT_STATUS_UNSUCCESSFUL;
/* OK, this is ugly, but... try an anonymous pipe. */
- pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SAMR, &result);
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id,
+ &pipe_hnd);
- if ( pipe_hnd &&
+ if ( NT_STATUS_IS_OK(result) &&
(NT_STATUS_IS_OK(result = rpccli_samr_chgpasswd_user2(
pipe_hnd, talloc_tos(), user_name,
new_passwd, old_passwd)))) {
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 6b3bbaf1d8..f4fdf9eb6f 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -201,8 +201,9 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
/* open the LSARPC_PIPE */
- 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)) {
goto done;
}
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 1a55bc20da..6fe3a0831a 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -27,15 +27,6 @@
interface/version dce/rpc pipe identification
********************************************************************/
-static const struct ndr_syntax_id syntax_spoolss = {
- {
- 0x12345678, 0x1234, 0xabcd,
- { 0xef, 0x00 },
- { 0x01, 0x23,
- 0x45, 0x67, 0x89, 0xab }
- }, 0x01
-};
-
#define PIPE_SRVSVC "\\PIPE\\srvsvc"
#define PIPE_SAMR "\\PIPE\\samr"
#define PIPE_WINREG "\\PIPE\\winreg"
@@ -131,6 +122,15 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax)
}
/********************************************************************
+ LEGACY function to ease transition from pipe_idx to interface
+ ********************************************************************/
+const struct ndr_syntax_id *cli_get_iface(int pipe_idx)
+{
+ SMB_ASSERT((pipe_idx >= 0) && (pipe_idx < PI_MAX_PIPES));
+ return pipe_names[pipe_idx].abstr_syntax;
+}
+
+/********************************************************************
Map internal value to wire value.
********************************************************************/
@@ -2985,23 +2985,25 @@ static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
Open a named pipe to an SMB server and bind anonymously.
****************************************************************************/
-struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe_idx, NTSTATUS *perr)
+NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
+ const struct ndr_syntax_id *interface,
+ struct rpc_pipe_client **presult)
{
struct rpc_pipe_client *result;
struct cli_pipe_auth_data *auth;
+ NTSTATUS status;
- *perr = cli_rpc_pipe_open(cli, pipe_names[pipe_idx].abstr_syntax,
- &result);
- if (!NT_STATUS_IS_OK(*perr)) {
- return NULL;
+ status = cli_rpc_pipe_open(cli, interface, &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
- *perr = rpccli_anon_bind_data(result, &auth);
- if (!NT_STATUS_IS_OK(*perr)) {
+ status = rpccli_anon_bind_data(result, &auth);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("rpccli_anon_bind_data returned %s\n",
- nt_errstr(*perr)));
+ nt_errstr(status)));
TALLOC_FREE(result);
- return NULL;
+ return status;
}
/*
@@ -3017,30 +3019,34 @@ struct rpc_pipe_client *cli_rpc_pipe_open_noauth(struct cli_state *cli, int pipe
auth->domain = talloc_strdup(auth, cli->domain);
if ((auth->user_name == NULL) || (auth->domain == NULL)) {
- *perr = NT_STATUS_NO_MEMORY;
TALLOC_FREE(result);
- return NULL;
+ return NT_STATUS_NO_MEMORY;
}
- *perr = rpc_pipe_bind(result, auth);
- if (!NT_STATUS_IS_OK(*perr)) {
+ status = rpc_pipe_bind(result, auth);
+ if (!NT_STATUS_IS_OK(status)) {
int lvl = 0;
- if (rpccli_is_pipe_idx(result, PI_DSSETUP)) {
+ if (ndr_syntax_id_equal(interface,
+ &ndr_table_dssetup.syntax_id)) {
/* non AD domains just don't have this pipe, avoid
* level 0 statement in that case - gd */
lvl = 3;
}
- DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe %s failed with error %s\n",
- cli_get_pipe_name(pipe_idx), nt_errstr(*perr) ));
+ DEBUG(lvl, ("cli_rpc_pipe_open_noauth: rpc_pipe_bind for pipe "
+ "%s failed with error %s\n",
+ cli_get_pipe_name_from_iface(debug_ctx(), cli,
+ interface),
+ nt_errstr(status) ));
TALLOC_FREE(result);
- return NULL;
+ return status;
}
DEBUG(10,("cli_rpc_pipe_open_noauth: opened pipe %s to machine "
"%s and bound anonymously.\n", result->trans.np.pipe_name,
cli->desthost ));
- return result;
+ *presult = result;
+ return NT_STATUS_OK;
}
/****************************************************************************
@@ -3204,8 +3210,9 @@ struct rpc_pipe_client *get_schannel_session_key(struct cli_state *cli,
{
struct rpc_pipe_client *netlogon_pipe = NULL;
- netlogon_pipe = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, perr);
- if (!netlogon_pipe) {
+ *perr = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
+ &netlogon_pipe);
+ if (!NT_STATUS_IS_OK(*perr)) {
return NULL;
}
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index 14a4effbf0..1477a4c81e 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -639,3 +639,13 @@ bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len,
return True;
}
+
+const struct ndr_syntax_id syntax_spoolss = {
+ {
+ 0x12345678, 0x1234, 0xabcd,
+ { 0xef, 0x00 },
+ { 0x01, 0x23,
+ 0x45, 0x67, 0x89, 0xab }
+ }, 0x01
+};
+
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index ec6d44293d..f2d3b53772 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -7724,4 +7724,3 @@ bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf )
return True;
}
-
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 4744b90263..22b3a7607e 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -1630,15 +1630,6 @@ void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns )
*n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
}
-static const struct ndr_syntax_id syntax_spoolss = {
- {
- 0x12345678, 0x1234, 0xabcd,
- { 0xef, 0x00 },
- { 0x01, 0x23,
- 0x45, 0x67, 0x89, 0xab }
- }, 0x01
-};
-
NTSTATUS rpc_spoolss_init(void)
{
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index ca2574f984..f80240042c 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2617,7 +2617,8 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
* Now start the NT Domain stuff :-).
*/
- if ( !(*pp_pipe = cli_rpc_pipe_open_noauth(the_cli, PI_SPOOLSS, &ret)) ) {
+ ret = cli_rpc_pipe_open_noauth(the_cli, &syntax_spoolss, pp_pipe);
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(2,("spoolss_connect_to_client: unable to open the spoolss pipe on machine %s. Error was : %s.\n",
remote_machine, nt_errstr(ret)));
cli_shutdown(the_cli);
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 0876d82878..d9cc3c67f5 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -2680,8 +2680,9 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
if ( !NT_STATUS_IS_OK(nt_status) )
return WERR_GENERAL_FAILURE;
- cli2 = cli_rpc_pipe_open_noauth(cli_server2, PI_SPOOLSS, &nt_status);
- if (!cli2) {
+ nt_status = cli_rpc_pipe_open_noauth(cli_server2, &syntax_spoolss,
+ &cli2);
+ if (!NT_STATUS_IS_OK(nt_status)) {
printf("failed to open spoolss pipe on server %s (%s)\n",
servername2, nt_errstr(nt_status));
return WERR_GENERAL_FAILURE;
diff --git a/source3/rpcclient/cmd_test.c b/source3/rpcclient/cmd_test.c
index dd956604cc..599e4c255d 100644
--- a/source3/rpcclient/cmd_test.c
+++ b/source3/rpcclient/cmd_test.c
@@ -30,13 +30,19 @@ static NTSTATUS cmd_testme(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
d_printf("testme\n");
- lsa_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
- PI_LSARPC, &status);
- if (lsa_pipe == NULL) goto done;
+ status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
+ &ndr_table_lsarpc.syntax_id,
+ &lsa_pipe);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
- samr_pipe = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
- PI_SAMR, &status);
- if (samr_pipe == NULL) goto done;
+ status = cli_rpc_pipe_open_noauth(rpc_pipe_np_smb_conn(cli),
+ &ndr_table_samr.syntax_id,
+ &samr_pipe);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
status = rpccli_lsa_open_policy(lsa_pipe, mem_ctx, False,
SEC_RIGHTS_QUERY_VALUE, &pol);
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 35ff14ef2d..ff98a24fba 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -145,7 +145,9 @@ static void fetch_machine_sid(struct cli_state *cli)
goto error;
}
- if ((lsapipe = cli_rpc_pipe_open_noauth(cli, PI_LSARPC, &result)) == NULL) {
+ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc.syntax_id,
+ &lsapipe);
+ if (!NT_STATUS_IS_OK(result)) {
fprintf(stderr, "could not initialise lsa pipe. Error was %s\n", nt_errstr(result) );
goto error;
}
@@ -578,9 +580,10 @@ static NTSTATUS do_cmd(struct cli_state *cli,
if (cmd_entry->pipe_idx != -1 && cmd_entry->rpc_pipe == NULL) {
switch (pipe_default_auth_type) {
case PIPE_AUTH_TYPE_NONE:
- cmd_entry->rpc_pipe = cli_rpc_pipe_open_noauth(cli,
- cmd_entry->pipe_idx,
- &ntresult);
+ ntresult = cli_rpc_pipe_open_noauth(
+ cli,
+ cli_get_iface(cmd_entry->pipe_idx),
+ &cmd_entry->rpc_pipe);
break;
case PIPE_AUTH_TYPE_SPNEGO_NTLMSSP:
cmd_entry->rpc_pipe = cli_rpc_pipe_open_spnego_ntlmssp(cli,
@@ -613,7 +616,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
pipe_default_auth_type ));
return NT_STATUS_UNSUCCESSFUL;
}
- if (!cmd_entry->rpc_pipe) {
+ if (!NT_STATUS_IS_OK(ntresult)) {
DEBUG(0, ("Could not initialise %s. Error was %s\n",
cli_get_pipe_name(cmd_entry->pipe_idx),
nt_errstr(ntresult) ));
diff --git a/source3/smbd/change_trust_pw.c b/source3/smbd/change_trust_pw.c
index 227b2d6899..72a72a78b5 100644
--- a/source3/smbd/change_trust_pw.c
+++ b/source3/smbd/change_trust_pw.c
@@ -73,8 +73,9 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m
/* Shouldn't we open this with schannel ? JRA. */
- netlogon_pipe = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, &nt_status);
- if (!netlogon_pipe) {
+ nt_status = cli_rpc_pipe_open_noauth(
+ cli, &ndr_table_netlogon.syntax_id, &netlogon_pipe);
+ if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("modify_trust_password: unable to open the domain client session to machine %s. Error was : %s.\n",
dc_name, nt_errstr(nt_status)));
cli_shutdown(cli);
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);
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 51ef14b708..b7e2f086fc 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1712,10 +1712,11 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
DEBUG(5, ("set_dc_type_and_flags_connect: domain %s\n", domain->name ));
- cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_DSSETUP,
- &result);
+ result = cli_rpc_pipe_open_noauth(domain->conn.cli,
+ &ndr_table_dssetup.syntax_id,
+ &cli);
- if (cli == NULL) {
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(5, ("set_dc_type_and_flags_connect: Could not bind to "
"PI_DSSETUP on domain %s: (%s)\n",
domain->name, nt_errstr(result)));
@@ -1759,9 +1760,10 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
}
no_dssetup:
- cli = cli_rpc_pipe_open_noauth(domain->conn.cli, PI_LSARPC, &result);
+ result = cli_rpc_pipe_open_noauth(domain->conn.cli,
+ &ndr_table_lsarpc.syntax_id, &cli);
- if (cli == NULL) {
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(5, ("set_dc_type_and_flags_connect: Could not bind to "
"PI_LSARPC on domain %s: (%s)\n",
domain->name, nt_errstr(result)));
@@ -2031,11 +2033,10 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
anonymous:
/* Finally fall back to anonymous. */
- conn->samr_pipe = cli_rpc_pipe_open_noauth(conn->cli, PI_SAMR,
- &result);
+ result = cli_rpc_pipe_open_noauth(conn->cli, &ndr_table_samr.syntax_id,
+ &conn->samr_pipe);
- if (conn->samr_pipe == NULL) {
- result = NT_STATUS_PIPE_NOT_AVAILABLE;
+ if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -2167,9 +2168,10 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
anonymous:
- conn->lsa_pipe = cli_rpc_pipe_open_noauth(conn->cli, PI_LSARPC,
- &result);
- if (conn->lsa_pipe == NULL) {
+ result = cli_rpc_pipe_open_noauth(conn->cli,
+ &ndr_table_lsarpc.syntax_id,
+ &conn->lsa_pipe);
+ if (!NT_STATUS_IS_OK(result)) {
result = NT_STATUS_PIPE_NOT_AVAILABLE;
goto done;
}
@@ -2219,9 +2221,10 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
return NT_STATUS_OK;
}
- netlogon_pipe = cli_rpc_pipe_open_noauth(conn->cli, PI_NETLOGON,
- &result);
- if (netlogon_pipe == NULL) {
+ result = cli_rpc_pipe_open_noauth(conn->cli,
+ &ndr_table_netlogon.syntax_id,
+ &netlogon_pipe);
+ if (!NT_STATUS_IS_OK(result)) {
return result;
}