summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-09-04 07:13:01 +0000
committerAndrew Tridgell <tridge@samba.org>2001-09-04 07:13:01 +0000
commit19fea3242cf6234786b6cbb60631e0071f31ff9f (patch)
tree1de6e79890a80a1e03cf0dce5813513aaf51bc59 /source3/rpc_client
parent55cf37488f66eba2826dba08e80dd4ab6df33fc3 (diff)
downloadsamba-19fea3242cf6234786b6cbb60631e0071f31ff9f.tar.gz
samba-19fea3242cf6234786b6cbb60631e0071f31ff9f.tar.bz2
samba-19fea3242cf6234786b6cbb60631e0071f31ff9f.zip
the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work
(This used to be commit dcd6e735f709a9231860ceb9682db40ff26c9a66)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_login.c6
-rw-r--r--source3/rpc_client/cli_lsarpc.c45
-rw-r--r--source3/rpc_client/cli_netlogon.c47
-rw-r--r--source3/rpc_client/cli_spoolss_notify.c7
4 files changed, 54 insertions, 51 deletions
diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c
index 0eb5bd1af7..88d3aeda83 100644
--- a/source3/rpc_client/cli_login.c
+++ b/source3/rpc_client/cli_login.c
@@ -103,13 +103,13 @@ NT login - interactive.
password equivalents, protected by the session key) is inherently insecure
given the current design of the NT Domain system. JRA.
****************************************************************************/
-BOOL cli_nt_login_interactive(struct cli_state *cli, char *domain, char *username,
+NTSTATUS cli_nt_login_interactive(struct cli_state *cli, char *domain, char *username,
uint32 smb_userid_low, char *password,
NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3)
{
uchar lm_owf_user_pwd[16];
uchar nt_owf_user_pwd[16];
- BOOL ret;
+ NTSTATUS ret;
DEBUG(5,("cli_nt_login_interactive: %d\n", __LINE__));
@@ -156,7 +156,7 @@ NT login - network.
password equivalents over the network. JRA.
****************************************************************************/
-uint32 cli_nt_login_network(struct cli_state *cli,
+NTSTATUS cli_nt_login_network(struct cli_state *cli,
const auth_usersupplied_info *user_info,
uint32 smb_userid_low, NET_ID_INFO_CTR *ctr,
NET_USER_INFO_3 *user_info3)
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 8b4a4bcc3d..2f4343c957 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -80,7 +80,7 @@ BOOL do_lsa_open_policy(struct cli_state *cli,
return False;
}
- if (r_o.status != 0) {
+ if (!NT_STATUS_IS_OK(r_o.status)) {
/* report error code */
DEBUG(0,("LSA_OPENPOLICY: %s\n", get_nt_error_msg(r_o.status)));
prs_mem_free(&rbuf);
@@ -145,7 +145,7 @@ BOOL do_lsa_query_info_pol(struct cli_state *cli,
return False;
}
- if (r_q.status != 0) {
+ if (!NT_STATUS_IS_OK(r_q.status)) {
/* report error code */
DEBUG(0,("LSA_QUERYINFOPOLICY: %s\n", get_nt_error_msg(r_q.status)));
prs_mem_free(&rbuf);
@@ -238,7 +238,7 @@ BOOL do_lsa_close(struct cli_state *cli, POLICY_HND *hnd)
return False;
}
- if (r_c.status != 0) {
+ if (!NT_STATUS_IS_OK(r_c.status)) {
/* report error code */
DEBUG(0,("LSA_CLOSE: %s\n", get_nt_error_msg(r_c.status)));
prs_mem_free(&rbuf);
@@ -285,7 +285,7 @@ BOOL cli_lsa_get_domain_sid(struct cli_state *cli, char *server)
/****************************************************************************
do a LSA Open Policy
****************************************************************************/
-uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd,
+NTSTATUS lsa_open_policy(const char *system_name, POLICY_HND *hnd,
BOOL sec_qos, uint32 des_access)
{
prs_struct rbuf;
@@ -293,7 +293,7 @@ uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd,
LSA_Q_OPEN_POL q_o;
LSA_SEC_QOS qos;
struct cli_connection *con = NULL;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (!cli_connection_init(system_name, PIPE_LSARPC, &con)) {
return NT_STATUS_UNSUCCESSFUL;
@@ -327,7 +327,7 @@ uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd,
result = r_o.status;
- if (p && r_o.status != 0) {
+ if (p && !NT_STATUS_IS_OK(r_o.status)) {
/* report error code */
DEBUG(0,
("LSA_OPENPOLICY: %s\n",
@@ -356,14 +356,14 @@ uint32 lsa_open_policy(const char *system_name, POLICY_HND *hnd,
/****************************************************************************
do a LSA Close
****************************************************************************/
-uint32 lsa_close(POLICY_HND *hnd)
+NTSTATUS lsa_close(POLICY_HND *hnd)
{
prs_struct rbuf;
prs_struct buf;
LSA_Q_CLOSE q_c;
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- if (hnd == NULL) return False;
+ if (hnd == NULL) return NT_STATUS_INVALID_PARAMETER;
/* Create and send a MSRPC command with api LSA_OPENPOLICY */
@@ -387,7 +387,7 @@ uint32 lsa_close(POLICY_HND *hnd)
p = rbuf.data_offset != 0;
result = r_c.status;
- if (p && r_c.status != 0) {
+ if (p && !NT_STATUS_IS_OK(r_c.status)) {
/* Report error code */
@@ -408,18 +408,19 @@ uint32 lsa_close(POLICY_HND *hnd)
/****************************************************************************
do a LSA Lookup SIDs
****************************************************************************/
-uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids,
+NTSTATUS lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids,
char ***names, uint32 **types, int *num_names)
{
prs_struct rbuf;
prs_struct buf;
LSA_Q_LOOKUP_SIDS q_l;
TALLOC_CTX *ctx = talloc_init();
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
ZERO_STRUCT(q_l);
- if (hnd == NULL || num_sids == 0 || sids == NULL) return False;
+ if (hnd == NULL || num_sids == 0 || sids == NULL)
+ return NT_STATUS_INVALID_PARAMETER;
if (num_names != NULL) {
*num_names = 0;
@@ -459,10 +460,9 @@ uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids,
p = rbuf.data_offset != 0;
result = r_l.status;
- if (p && r_l.status != 0 &&
- r_l.status != 0x107 &&
- r_l.status != (0xC0000000 | NT_STATUS_NONE_MAPPED)) {
-
+ if (p && !NT_STATUS_IS_OK(r_l.status) &&
+ NT_STATUS_V(r_l.status) != 0x107 &&
+ NT_STATUS_V(r_l.status) != NT_STATUS_V(NT_STATUS_NONE_MAPPED)) {
/* Report error code */
DEBUG(1, ("LSA_LOOKUP_SIDS: %s\n",
@@ -564,17 +564,18 @@ uint32 lsa_lookup_sids(POLICY_HND *hnd, int num_sids, DOM_SID *sids,
/****************************************************************************
do a LSA Lookup Names
****************************************************************************/
-uint32 lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names,
- DOM_SID **sids, uint32 **types, int *num_sids)
+NTSTATUS lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names,
+ DOM_SID **sids, uint32 **types, int *num_sids)
{
prs_struct rbuf;
prs_struct buf;
LSA_Q_LOOKUP_NAMES q_l;
BOOL valid_response = False;
TALLOC_CTX *ctx = talloc_init();
- uint32 result = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- if (hnd == NULL || num_sids == 0 || sids == NULL) return False;
+ if (hnd == NULL || num_sids == 0 || sids == NULL)
+ return NT_STATUS_INVALID_PARAMETER;
prs_init(&buf, MAX_PDU_FRAG_LEN, ctx, MARSHALL);
prs_init(&rbuf, 0, ctx, UNMARSHALL);
@@ -603,7 +604,7 @@ uint32 lsa_lookup_names(POLICY_HND *hnd, int num_names, char **names,
lsa_io_r_lookup_names("", &r_l, &rbuf, 0);
p = rbuf.data_offset != 0;
- if (p && r_l.status != 0) {
+ if (p && !NT_STATUS_IS_OK(r_l.status)) {
/* report error code */
DEBUG(1,
("LSA_LOOKUP_NAMES: %s\n",
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 2c30e5ba47..b1f4fe0257 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -154,7 +154,7 @@ BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan,
ok = net_io_r_auth_2("", &r_a, &rbuf, 0);
- if (ok && r_a.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_a.status))
{
/* report error code */
DEBUG(0,("cli_net_auth2: Error %s\n", get_nt_error_msg(r_a.status)));
@@ -243,7 +243,7 @@ BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_
ok = net_io_r_req_chal("", &r_c, &rbuf, 0);
- if (ok && r_c.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_c.status))
{
/* report error code */
DEBUG(0,("cli_net_req_chal: Error %s\n", get_nt_error_msg(r_c.status)));
@@ -308,7 +308,7 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16])
ok = net_io_r_srv_pwset("", &r_s, &rbuf, 0);
- if (ok && r_s.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_s.status))
{
/* report error code */
DEBUG(0,("cli_net_srv_pwset: %s\n", get_nt_error_msg(r_s.status)));
@@ -338,8 +338,9 @@ password ?).\n", cli->desthost ));
returns level 3.
****************************************************************************/
-static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
- NET_USER_INFO_3 *user_info3, uint16 validation_level)
+static NTSTATUS cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+ NET_USER_INFO_3 *user_info3,
+ uint16 validation_level)
{
DOM_CRED new_clnt_cred;
DOM_CRED dummy_rtn_creds;
@@ -347,7 +348,7 @@ static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR
prs_struct buf;
NET_Q_SAM_LOGON q_s;
NET_R_SAM_LOGON r_s;
- uint32 retval = 0;
+ NTSTATUS retval = NT_STATUS_OK;
gen_next_creds( cli, &new_clnt_cred);
@@ -398,38 +399,38 @@ static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR
* the call.
*/
- if (retval == NT_STATUS_INVALID_INFO_CLASS) {
+ if (NT_STATUS_V(retval) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
goto out;
}
- if (retval != 0) {
+ if (!NT_STATUS_IS_OK(retval)) {
/* report error code */
DEBUG(0,("cli_net_sam_logon_internal: %s\n", get_nt_error_msg(r_s.status)));
goto out;
- }
+ }
- /* Update the credentials. */
- if (!clnt_deal_with_creds(cli->sess_key, &cli->clnt_cred, &r_s.srv_creds)) {
+ /* Update the credentials. */
+ if (!clnt_deal_with_creds(cli->sess_key, &cli->clnt_cred, &r_s.srv_creds)) {
/*
* Server replied with bad credential. Fail.
*/
DEBUG(0,("cli_net_sam_logon_internal: server %s replied with bad credential (bad machine \
password ?).\n", cli->desthost ));
retval = NT_STATUS_WRONG_PASSWORD;
- }
-
- if (r_s.switch_value != validation_level) {
+ }
+
+ if (r_s.switch_value != validation_level) {
/* report different switch_value */
DEBUG(0,("cli_net_sam_logon: switch_value of %x expected %x\n", (unsigned int)validation_level,
- (unsigned int)r_s.switch_value));
+ (unsigned int)r_s.switch_value));
retval = NT_STATUS_INVALID_PARAMETER;
- }
+ }
- out:
+out:
prs_mem_free(&buf);
prs_mem_free(&rbuf);
-
+
return retval;
}
@@ -437,18 +438,18 @@ password ?).\n", cli->desthost ));
LSA SAM Logon - interactive or network.
****************************************************************************/
-uint32 cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
+NTSTATUS cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr,
NET_USER_INFO_3 *user_info3)
{
uint16 validation_level=3;
- uint32 result;
+ NTSTATUS result;
result = cli_net_sam_logon_internal(cli, ctr, user_info3,
validation_level);
- if(result == NT_STATUS_OK) {
+ if (NT_STATUS_IS_OK(result)) {
DEBUG(10,("cli_net_sam_logon: Success \n"));
- } else if (result == NT_STATUS_INVALID_INFO_CLASS) {
+ } else if (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_INVALID_INFO_CLASS)) {
DEBUG(10,("cli_net_sam_logon: STATUS INVALID INFO CLASS \n"));
validation_level=2;
@@ -518,7 +519,7 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr)
ok = net_io_r_sam_logoff("", &r_s, &rbuf, 0);
- if (ok && r_s.status != 0)
+ if (ok && !NT_STATUS_IS_OK(r_s.status))
{
/* report error code */
DEBUG(0,("cli_net_sam_logoff: %s\n", get_nt_error_msg(r_s.status)));
diff --git a/source3/rpc_client/cli_spoolss_notify.c b/source3/rpc_client/cli_spoolss_notify.c
index ca2e4f7ec0..ca9f153ec7 100644
--- a/source3/rpc_client/cli_spoolss_notify.c
+++ b/source3/rpc_client/cli_spoolss_notify.c
@@ -132,7 +132,7 @@ BOOL spoolss_connect_to_client( struct cli_state *cli, char *remote_machine)
do a reply open printer
****************************************************************************/
-BOOL cli_spoolss_reply_open_printer(struct cli_state *cli, char *printer, uint32 localprinter, uint32 type, NTSTATUS *status, POLICY_HND *handle)
+BOOL cli_spoolss_reply_open_printer(struct cli_state *cli, char *printer, uint32 localprinter, uint32 type, WERROR *status, POLICY_HND *handle)
{
prs_struct rbuf;
prs_struct buf;
@@ -188,7 +188,7 @@ BOOL cli_spoolss_reply_open_printer(struct cli_state *cli, char *printer, uint32
****************************************************************************/
BOOL cli_spoolss_reply_rrpcn(struct cli_state *cli, POLICY_HND *handle,
- uint32 change_low, uint32 change_high, NTSTATUS *status)
+ uint32 change_low, uint32 change_high, WERROR *status)
{
prs_struct rbuf;
prs_struct buf;
@@ -242,7 +242,8 @@ BOOL cli_spoolss_reply_rrpcn(struct cli_state *cli, POLICY_HND *handle,
do a reply open printer
****************************************************************************/
-BOOL cli_spoolss_reply_close_printer(struct cli_state *cli, POLICY_HND *handle, NTSTATUS *status)
+BOOL cli_spoolss_reply_close_printer(struct cli_state *cli, POLICY_HND *handle,
+ WERROR *status)
{
prs_struct rbuf;
prs_struct buf;