summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-01-10 20:33:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:50 -0500
commitbd22606da04bffd3b4966c17ad2c98e6dc8b5e35 (patch)
treeea721a558ed50a004e0c1a6a648cd63532081950
parent1ffbe8fec8923a044b0280e230fc224f1a60419f (diff)
downloadsamba-bd22606da04bffd3b4966c17ad2c98e6dc8b5e35.tar.gz
samba-bd22606da04bffd3b4966c17ad2c98e6dc8b5e35.tar.bz2
samba-bd22606da04bffd3b4966c17ad2c98e6dc8b5e35.zip
r4656: Convert the winreg pipe to use WERROR returns (as it should).
Also fix return of NT_STATUS_NO_MORE_ENTRIES should be ERROR_NO_MORE_ITEMS reported by "Marcin Porwit" <mporwit@centeris.com>. Jeremy. (This used to be commit 511cdec60d431d767fb02f68ca5ddd4ddb59e64a)
-rw-r--r--source3/include/rpc_reg.h40
-rw-r--r--source3/rpc_client/cli_reg.c10
-rw-r--r--source3/rpc_parse/parse_reg.c50
-rw-r--r--source3/rpc_server/srv_reg_nt.c90
-rw-r--r--source3/rpcclient/cmd_reg.c4
-rw-r--r--source3/utils/net_rpc.c4
6 files changed, 99 insertions, 99 deletions
diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h
index 46ec88283d..bfb5f1e076 100644
--- a/source3/include/rpc_reg.h
+++ b/source3/include/rpc_reg.h
@@ -158,7 +158,7 @@ typedef struct q_reg_open_hkcr_info
typedef struct r_reg_open_hkcr_info
{
POLICY_HND pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_OPEN_HKCR;
@@ -178,7 +178,7 @@ REG_Q_OPEN_HKLM;
typedef struct r_reg_open_hklm_info
{
POLICY_HND pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
}
REG_R_OPEN_HKLM;
@@ -198,7 +198,7 @@ typedef struct q_reg_open_hku_info
typedef struct r_reg_open_hku_info
{
POLICY_HND pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_OPEN_HKU;
@@ -213,7 +213,7 @@ typedef struct q_reg_open_flush_key_info
/* REG_R_FLUSH_KEY */
typedef struct r_reg_open_flush_key_info
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_FLUSH_KEY;
@@ -234,7 +234,7 @@ typedef struct q_reg_set_key_sec_info
/* REG_R_SET_KEY_SEC */
typedef struct r_reg_set_key_sec_info
{
- NTSTATUS status;
+ WERROR status;
} REG_R_SET_KEY_SEC;
@@ -261,7 +261,7 @@ typedef struct r_reg_get_key_sec_info
BUFHDR hdr_sec; /* header for security data */
SEC_DESC_BUF *data; /* security data */
- NTSTATUS status;
+ WERROR status;
} REG_R_GET_KEY_SEC;
@@ -282,7 +282,7 @@ typedef struct q_reg_create_value_info
/* REG_R_CREATE_VALUE */
typedef struct r_reg_create_value_info
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_CREATE_VALUE;
@@ -329,7 +329,7 @@ typedef struct r_reg_enum_value_info
uint32 ptr2; /* pointer */
uint32 len_value2; /* */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_ENUM_VALUE;
@@ -365,7 +365,7 @@ typedef struct r_reg_create_key_info
POLICY_HND key_pol; /* policy handle */
uint32 unknown; /* 0x0000 0000 */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_CREATE_KEY;
@@ -383,7 +383,7 @@ typedef struct r_reg_delete_key_info
{
POLICY_HND key_pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_DELETE_KEY;
@@ -402,7 +402,7 @@ typedef struct r_reg_delete_val_info
{
POLICY_HND key_pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_DELETE_VALUE;
@@ -430,7 +430,7 @@ typedef struct r_reg_query_key_info
uint32 sec_desc; /* 0x0000 0078 */
NTTIME mod_time; /* modified time */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_QUERY_KEY;
@@ -446,7 +446,7 @@ typedef struct q_reg_unk_1a_info
typedef struct r_reg_unk_1a_info
{
uint32 unknown; /* 0x0500 0000 */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_UNKNOWN_1A;
@@ -468,7 +468,7 @@ typedef struct q_reg_unknown_14
/* REG_R_UNKNOWN_1A */
typedef struct r_reg_unknown_14
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_SAVE_KEY;
@@ -486,7 +486,7 @@ typedef struct reg_r_close_info
{
POLICY_HND pol; /* policy handle. should be all zeros. */
- NTSTATUS status; /* return code */
+ WERROR status; /* return code */
} REG_R_CLOSE;
@@ -531,7 +531,7 @@ typedef struct r_reg_enum_key_info
uint32 ptr3; /* pointer */
NTTIME time; /* current time? */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_ENUM_KEY;
@@ -575,7 +575,7 @@ typedef struct r_reg_info_info
uint32 ptr_len;
uint32 buf_len;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_INFO;
@@ -599,7 +599,7 @@ typedef struct q_reg_open_entry_info
typedef struct r_reg_open_entry_info
{
POLICY_HND pol; /* policy handle */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_OPEN_ENTRY;
@@ -620,7 +620,7 @@ typedef struct q_reg_shutdown_info
/* REG_R_SHUTDOWN */
typedef struct r_reg_shutdown_info
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_SHUTDOWN;
@@ -635,7 +635,7 @@ typedef struct q_reg_abort_shutdown_info
/* REG_R_ABORT_SHUTDOWN */
typedef struct r_reg_abort_shutdown_info
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} REG_R_ABORT_SHUTDOWN;
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c
index 6ed0496030..25f56085ba 100644
--- a/source3/rpc_client/cli_reg.c
+++ b/source3/rpc_client/cli_reg.c
@@ -27,7 +27,7 @@
/* Shutdown a server */
-NTSTATUS cli_reg_shutdown(struct cli_state * cli, TALLOC_CTX *mem_ctx,
+WERROR cli_reg_shutdown(struct cli_state * cli, TALLOC_CTX *mem_ctx,
const char *msg, uint32 timeout, BOOL do_reboot,
BOOL force)
{
@@ -35,9 +35,9 @@ NTSTATUS cli_reg_shutdown(struct cli_state * cli, TALLOC_CTX *mem_ctx,
prs_struct rbuf;
REG_Q_SHUTDOWN q_s;
REG_R_SHUTDOWN r_s;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ WERROR result = WERR_GENERAL_FAILURE;
- if (msg == NULL) return NT_STATUS_INVALID_PARAMETER;
+ if (msg == NULL) return WERR_INVALID_PARAM;
ZERO_STRUCT (q_s);
ZERO_STRUCT (r_s);
@@ -68,13 +68,13 @@ done:
/* Abort a server shutdown */
-NTSTATUS cli_reg_abort_shutdown(struct cli_state * cli, TALLOC_CTX *mem_ctx)
+WERROR cli_reg_abort_shutdown(struct cli_state * cli, TALLOC_CTX *mem_ctx)
{
prs_struct rbuf;
prs_struct qbuf;
REG_Q_ABORT_SHUTDOWN q_s;
REG_R_ABORT_SHUTDOWN r_s;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ WERROR result = WERR_GENERAL_FAILURE;
ZERO_STRUCT (q_s);
ZERO_STRUCT (r_s);
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index 69c0dfc754..a67a3973b9 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -107,7 +107,7 @@ BOOL reg_io_r_open_hkcr(const char *desc, REG_R_OPEN_HKCR *r_r, prs_struct *ps,
if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -176,7 +176,7 @@ BOOL reg_io_r_open_hklm(const char *desc, REG_R_OPEN_HKLM * r_r, prs_struct *ps,
if (!smb_io_pol_hnd("", &r_r->pol, ps, depth))
return False;
- if (!prs_ntstatus("status", ps, depth, &r_r->status))
+ if (!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -230,7 +230,7 @@ BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_r, prs_struct *ps,
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -380,7 +380,7 @@ BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_r, prs_struct *p
if(!prs_uint32("unknown", ps, depth, &r_r->unknown))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -446,7 +446,7 @@ BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_r, prs_struct
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -510,7 +510,7 @@ BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_r, prs_struct *p
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -597,7 +597,7 @@ BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_r, prs_struct *ps,
if(!smb_io_time("mod_time ", &r_r->mod_time, ps, depth))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -651,7 +651,7 @@ BOOL reg_io_r_unknown_1a(const char *desc, REG_R_UNKNOWN_1A *r_r, prs_struct *p
if(!prs_uint32("unknown", ps, depth, &r_r->unknown))
return False;
- if(!prs_ntstatus("status" , ps, depth, &r_r->status))
+ if(!prs_werror("status" , ps, depth, &r_r->status))
return False;
return True;
@@ -702,7 +702,7 @@ BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_r, prs_struct *ps, i
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status" , ps, depth, &r_r->status))
+ if(!prs_werror("status" , ps, depth, &r_r->status))
return False;
return True;
@@ -768,7 +768,7 @@ BOOL reg_io_r_open_hku(const char *desc, REG_R_OPEN_HKU *r_r, prs_struct *ps, i
if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -828,7 +828,7 @@ BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int dep
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_u->status))
+ if(!prs_werror("status", ps, depth, &r_u->status))
return False;
return True;
@@ -893,7 +893,7 @@ BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_q->status))
+ if(!prs_werror("status", ps, depth, &r_q->status))
return False;
return True;
@@ -991,7 +991,7 @@ BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct
return False;
}
- if(!prs_ntstatus("status", ps, depth, &r_q->status))
+ if(!prs_werror("status", ps, depth, &r_q->status))
return False;
return True;
@@ -1092,7 +1092,7 @@ BOOL reg_io_q_info(const char *desc, REG_Q_INFO *r_q, prs_struct *ps, int depth
********************************************************************/
BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
- REGISTRY_VALUE *val, NTSTATUS status)
+ REGISTRY_VALUE *val, WERROR status)
{
uint32 buf_len = 0;
BUFFER2 buf2;
@@ -1136,7 +1136,7 @@ BOOL new_init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
********************************************************************/
BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_r,
- BUFFER2* buf, uint32 type, NTSTATUS status)
+ BUFFER2* buf, uint32 type, WERROR status)
{
if(r_r == NULL)
return False;
@@ -1210,7 +1210,7 @@ BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_r, prs_struct *ps, int depth)
return False;
}
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -1394,7 +1394,7 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_q, prs_struct *ps,
return False;
}
- if(!prs_ntstatus("status", ps, depth, &r_q->status))
+ if(!prs_werror("status", ps, depth, &r_q->status))
return False;
return True;
@@ -1469,7 +1469,7 @@ BOOL reg_io_r_create_val(const char *desc, REG_R_CREATE_VALUE *r_q, prs_struct
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_q->status))
+ if(!prs_werror("status", ps, depth, &r_q->status))
return False;
return True;
@@ -1625,7 +1625,7 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *r_q, prs_struct *ps, i
return False;
}
- if(!prs_ntstatus("status", ps, depth, &r_q->status))
+ if(!prs_werror("status", ps, depth, &r_q->status))
return False;
return True;
@@ -1685,14 +1685,14 @@ BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *r_q, prs_struct *p
********************************************************************/
void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_r,
- POLICY_HND *pol, NTSTATUS status)
+ POLICY_HND *pol, WERROR werr)
{
- if (NT_STATUS_IS_OK(status)) {
+ if (W_ERROR_IS_OK(werr)) {
memcpy(&r_r->pol, pol, sizeof(r_r->pol));
} else {
ZERO_STRUCT(r_r->pol);
}
- r_r->status = status;
+ r_r->status = werr;
}
/*******************************************************************
@@ -1713,7 +1713,7 @@ BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_r, prs_struct *p
if(!smb_io_pol_hnd("", &r_r->pol, ps, depth))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_r->status))
+ if(!prs_werror("status", ps, depth, &r_r->status))
return False;
return True;
@@ -1794,7 +1794,7 @@ BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN * r_s, prs_struct *ps,
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_s->status))
+ if(!prs_werror("status", ps, depth, &r_s->status))
return False;
return True;
@@ -1849,7 +1849,7 @@ BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN * r_s,
if (!prs_align(ps))
return False;
- if (!prs_ntstatus("status", ps, depth, &r_s->status))
+ if (!prs_werror("status", ps, depth, &r_s->status))
return False;
return True;
diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c
index d85a066e34..27cdf1b1b9 100644
--- a/source3/rpc_server/srv_reg_nt.c
+++ b/source3/rpc_server/srv_reg_nt.c
@@ -79,11 +79,11 @@ static REGISTRY_KEY *find_regkey_index_by_hnd(pipes_struct *p, POLICY_HND *hnd)
HK[LM|U]\<key>\<key>\...
*******************************************************************/
-static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY *parent,
+static WERROR open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY *parent,
const char *subkeyname, uint32 access_granted )
{
REGISTRY_KEY *regkey = NULL;
- NTSTATUS result = NT_STATUS_OK;
+ WERROR result = WERR_OK;
REGSUBKEY_CTR subkeys;
pstring subkeyname2;
int subkey_len;
@@ -98,7 +98,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY
subkeyname2[subkey_len-1] = '\0';
if ((regkey=SMB_MALLOC_P(REGISTRY_KEY)) == NULL)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP( regkey );
@@ -126,7 +126,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY
if ( !(regkey->hook = reghook_cache_find( regkey->name )) ) {
DEBUG(0,("open_registry_key: Failed to assigned a REGISTRY_HOOK to [%s]\n",
regkey->name ));
- return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ return WERR_BADFILE;
}
/* check if the path really exists; failed is indicated by -1 */
@@ -139,7 +139,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY
if ( fetch_reg_keys( regkey, &subkeys ) == -1 ) {
/* don't really know what to return here */
- result = NT_STATUS_NO_SUCH_FILE;
+ result = WERR_BADFILE;
}
else {
/*
@@ -148,7 +148,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY
*/
if ( !create_policy_hnd( p, hnd, free_regkey_info, regkey ) )
- result = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ result = WERR_BADFILE;
}
/* clean up */
@@ -276,22 +276,22 @@ static BOOL get_value_information( REGISTRY_KEY *key, uint32 *maxnum,
reg_close
********************************************************************/
-NTSTATUS _reg_close(pipes_struct *p, REG_Q_CLOSE *q_u, REG_R_CLOSE *r_u)
+WERROR _reg_close(pipes_struct *p, REG_Q_CLOSE *q_u, REG_R_CLOSE *r_u)
{
/* set up the REG unknown_1 response */
ZERO_STRUCT(r_u->pol);
/* close the policy handle */
if (!close_registry_key(p, &q_u->pol))
- return NT_STATUS_OBJECT_NAME_INVALID;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
- return NT_STATUS_OK;
+ return WERR_OK;
}
/*******************************************************************
********************************************************************/
-NTSTATUS _reg_open_hklm(pipes_struct *p, REG_Q_OPEN_HKLM *q_u, REG_R_OPEN_HKLM *r_u)
+WERROR _reg_open_hklm(pipes_struct *p, REG_Q_OPEN_HKLM *q_u, REG_R_OPEN_HKLM *r_u)
{
return open_registry_key( p, &r_u->pol, NULL, KEY_HKLM, 0x0 );
}
@@ -299,7 +299,7 @@ NTSTATUS _reg_open_hklm(pipes_struct *p, REG_Q_OPEN_HKLM *q_u, REG_R_OPEN_HKLM *
/*******************************************************************
********************************************************************/
-NTSTATUS _reg_open_hkcr(pipes_struct *p, REG_Q_OPEN_HKCR *q_u, REG_R_OPEN_HKCR *r_u)
+WERROR _reg_open_hkcr(pipes_struct *p, REG_Q_OPEN_HKCR *q_u, REG_R_OPEN_HKCR *r_u)
{
return open_registry_key( p, &r_u->pol, NULL, KEY_HKCR, 0x0 );
}
@@ -307,7 +307,7 @@ NTSTATUS _reg_open_hkcr(pipes_struct *p, REG_Q_OPEN_HKCR *q_u, REG_R_OPEN_HKCR *
/*******************************************************************
********************************************************************/
-NTSTATUS _reg_open_hku(pipes_struct *p, REG_Q_OPEN_HKU *q_u, REG_R_OPEN_HKU *r_u)
+WERROR _reg_open_hku(pipes_struct *p, REG_Q_OPEN_HKU *q_u, REG_R_OPEN_HKU *r_u)
{
return open_registry_key( p, &r_u->pol, NULL, KEY_HKU, 0x0 );
}
@@ -316,17 +316,17 @@ NTSTATUS _reg_open_hku(pipes_struct *p, REG_Q_OPEN_HKU *q_u, REG_R_OPEN_HKU *r_u
reg_reply_open_entry
********************************************************************/
-NTSTATUS _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY *r_u)
+WERROR _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY *r_u)
{
POLICY_HND pol;
fstring name;
REGISTRY_KEY *key = find_regkey_index_by_hnd(p, &q_u->pol);
- NTSTATUS result;
+ WERROR result;
DEBUG(5,("reg_open_entry: Enter\n"));
if ( !key )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
rpcstr_pull(name,q_u->uni_name.buffer,sizeof(name),q_u->uni_name.uni_str_len*2,0);
@@ -343,9 +343,9 @@ NTSTATUS _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTR
reg_reply_info
********************************************************************/
-NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
+WERROR _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
{
- NTSTATUS status = NT_STATUS_NO_SUCH_FILE;
+ WERROR status = WERR_BADFILE;
fstring name;
const char *value_ascii = "";
fstring value;
@@ -358,7 +358,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
DEBUG(5,("_reg_info: Enter\n"));
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
DEBUG(7,("_reg_info: policy key name = [%s]\n", regkey->name));
@@ -377,7 +377,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
if ( (val = SMB_MALLOC_P(REGISTRY_VALUE)) == NULL ) {
DEBUG(0,("_reg_info: malloc() failed!\n"));
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
}
if (!account_policy_get(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue))
@@ -388,7 +388,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
val = dup_registry_value(
regval_ctr_specific_value( &regvals, 0 ) );
- status = NT_STATUS_OK;
+ status = WERR_OK;
goto out;
}
@@ -418,7 +418,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
val = dup_registry_value( regval_ctr_specific_value( &regvals, 0 ) );
- status = NT_STATUS_OK;
+ status = WERR_OK;
goto out;
}
@@ -430,7 +430,7 @@ NTSTATUS _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
DEBUG(10,("_reg_info: Testing value [%s]\n", val->valuename));
if ( StrCaseCmp( val->valuename, name ) == 0 ) {
DEBUG(10,("_reg_info: Found match for value [%s]\n", name));
- status = NT_STATUS_OK;
+ status = WERR_OK;
break;
}
@@ -454,21 +454,21 @@ out:
Implementation of REG_QUERY_KEY
****************************************************************************/
-NTSTATUS _reg_query_key(pipes_struct *p, REG_Q_QUERY_KEY *q_u, REG_R_QUERY_KEY *r_u)
+WERROR _reg_query_key(pipes_struct *p, REG_Q_QUERY_KEY *q_u, REG_R_QUERY_KEY *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
DEBUG(5,("_reg_query_key: Enter\n"));
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
if ( !get_subkey_information( regkey, &r_u->num_subkeys, &r_u->max_subkeylen ) )
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
if ( !get_value_information( regkey, &r_u->num_values, &r_u->max_valnamelen, &r_u->max_valbufsize ) )
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
r_u->sec_desc = 0x00000078; /* size for key's sec_desc */
@@ -488,15 +488,15 @@ NTSTATUS _reg_query_key(pipes_struct *p, REG_Q_QUERY_KEY *q_u, REG_R_QUERY_KEY *
Implementation of REG_UNKNOWN_1A
****************************************************************************/
-NTSTATUS _reg_unknown_1a(pipes_struct *p, REG_Q_UNKNOWN_1A *q_u, REG_R_UNKNOWN_1A *r_u)
+WERROR _reg_unknown_1a(pipes_struct *p, REG_Q_UNKNOWN_1A *q_u, REG_R_UNKNOWN_1A *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
DEBUG(5,("_reg_unknown_1a: Enter\n"));
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
r_u->unknown = 0x00000005; /* seems to be consistent...no idea what it means */
@@ -510,9 +510,9 @@ NTSTATUS _reg_unknown_1a(pipes_struct *p, REG_Q_UNKNOWN_1A *q_u, REG_R_UNKNOWN_1
Implementation of REG_ENUM_KEY
****************************************************************************/
-NTSTATUS _reg_enum_key(pipes_struct *p, REG_Q_ENUM_KEY *q_u, REG_R_ENUM_KEY *r_u)
+WERROR _reg_enum_key(pipes_struct *p, REG_Q_ENUM_KEY *q_u, REG_R_ENUM_KEY *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
char *subkey = NULL;
@@ -520,13 +520,13 @@ NTSTATUS _reg_enum_key(pipes_struct *p, REG_Q_ENUM_KEY *q_u, REG_R_ENUM_KEY *r_u
DEBUG(5,("_reg_enum_key: Enter\n"));
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
DEBUG(8,("_reg_enum_key: enumerating key [%s]\n", regkey->name));
if ( !fetch_reg_keys_specific( regkey, &subkey, q_u->key_index ) )
{
- status = NT_STATUS_NO_MORE_ENTRIES;
+ status = WERR_NO_MORE_ITEMS;
goto done;
}
@@ -547,9 +547,9 @@ done:
Implementation of REG_ENUM_VALUE
****************************************************************************/
-NTSTATUS _reg_enum_value(pipes_struct *p, REG_Q_ENUM_VALUE *q_u, REG_R_ENUM_VALUE *r_u)
+WERROR _reg_enum_value(pipes_struct *p, REG_Q_ENUM_VALUE *q_u, REG_R_ENUM_VALUE *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
REGISTRY_VALUE *val;
@@ -557,13 +557,13 @@ NTSTATUS _reg_enum_value(pipes_struct *p, REG_Q_ENUM_VALUE *q_u, REG_R_ENUM_VALU
DEBUG(5,("_reg_enum_value: Enter\n"));
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
DEBUG(8,("_reg_enum_key: enumerating values for key [%s]\n", regkey->name));
if ( !fetch_reg_values_specific( regkey, &val, q_u->val_index ) )
{
- status = NT_STATUS_NO_MORE_ENTRIES;
+ status = WERR_NO_MORE_ITEMS;
goto done;
}
@@ -591,9 +591,9 @@ done:
#define SHUTDOWN_F_STRING "-f"
-NTSTATUS _reg_shutdown(pipes_struct *p, REG_Q_SHUTDOWN *q_u, REG_R_SHUTDOWN *r_u)
+WERROR _reg_shutdown(pipes_struct *p, REG_Q_SHUTDOWN *q_u, REG_R_SHUTDOWN *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
pstring shutdown_script;
UNISTR2 unimsg = q_u->uni_msg;
pstring message;
@@ -632,9 +632,9 @@ NTSTATUS _reg_shutdown(pipes_struct *p, REG_Q_SHUTDOWN *q_u, REG_R_SHUTDOWN *r_u
reg_abort_shutdwon
********************************************************************/
-NTSTATUS _reg_abort_shutdown(pipes_struct *p, REG_Q_ABORT_SHUTDOWN *q_u, REG_R_ABORT_SHUTDOWN *r_u)
+WERROR _reg_abort_shutdown(pipes_struct *p, REG_Q_ABORT_SHUTDOWN *q_u, REG_R_ABORT_SHUTDOWN *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
pstring abort_shutdown_script;
pstrcpy(abort_shutdown_script, lp_abort_shutdown_script());
@@ -652,7 +652,7 @@ NTSTATUS _reg_abort_shutdown(pipes_struct *p, REG_Q_ABORT_SHUTDOWN *q_u, REG_R_A
REG_SAVE_KEY (0x14)
********************************************************************/
-NTSTATUS _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_u)
+WERROR _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_u)
{
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
@@ -664,12 +664,12 @@ NTSTATUS _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY *q_u, REG_R_SAVE_KEY *r_
*/
if ( !regkey )
- return NT_STATUS_INVALID_HANDLE;
+ return WERR_BADFID; /* This will be reported as an RPC fault anyway. */
DEBUG(8,("_reg_save_key: berifying backup of key [%s]\n", regkey->name));
- return NT_STATUS_OK;
+ return WERR_OK;
}
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c
index bf85d21716..8ec50b894f 100644
--- a/source3/rpcclient/cmd_reg.c
+++ b/source3/rpcclient/cmd_reg.c
@@ -935,7 +935,7 @@ static NTSTATUS cmd_reg_shutdown(struct cli_state *cli, TALLOC_CTX *mem_ctx,
}
/* create an entry */
- result = cli_reg_shutdown(cli, mem_ctx, msg, timeout, reboot, force);
+ result = werror_to_ntstatus(cli_reg_shutdown(cli, mem_ctx, msg, timeout, reboot, force));
if (NT_STATUS_IS_OK(result))
DEBUG(5,("cmd_reg_shutdown: query succeeded\n"));
@@ -954,7 +954,7 @@ static NTSTATUS cmd_reg_abort_shutdown(struct cli_state *cli,
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- result = cli_reg_abort_shutdown(cli, mem_ctx);
+ result = werror_to_ntstatus(cli_reg_abort_shutdown(cli, mem_ctx));
if (NT_STATUS_IS_OK(result))
DEBUG(5,("cmd_reg_abort_shutdown: query succeeded\n"));
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index aa25d6816d..4cbad9bde6 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -4008,7 +4008,7 @@ static NTSTATUS rpc_reg_shutdown_abort_internals(const DOM_SID *domain_sid,
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- result = cli_reg_abort_shutdown(cli, mem_ctx);
+ result = werror_to_ntstatus(cli_reg_abort_shutdown(cli, mem_ctx));
if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown successfully aborted\n");
@@ -4149,7 +4149,7 @@ static NTSTATUS rpc_reg_shutdown_internals(const DOM_SID *domain_sid,
}
/* create an entry */
- result = cli_reg_shutdown(cli, mem_ctx, msg, timeout, opt_reboot, opt_force);
+ result = werror_to_ntstatus(cli_reg_shutdown(cli, mem_ctx, msg, timeout, opt_reboot, opt_force));
if (NT_STATUS_IS_OK(result)) {
d_printf("\nShutdown of remote machine succeeded\n");