summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-14 05:53:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:59 -0500
commit350673b2d0106191e6bdb65772f70cae5abafacb (patch)
tree1581712d5b1069d14e222dd85508be4ac77811b8 /source4
parentdd4a93dfa0af2b5a0006769d6c97efa24beb4974 (diff)
downloadsamba-350673b2d0106191e6bdb65772f70cae5abafacb.tar.gz
samba-350673b2d0106191e6bdb65772f70cae5abafacb.tar.bz2
samba-350673b2d0106191e6bdb65772f70cae5abafacb.zip
r1818: _really_ fixed epmapper this time, it was using more than one old rpc interface method.
(This used to be commit ec41c73ae136bffea4285ade8be322b3c4cf3629)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/epmapper.idl39
-rw-r--r--source4/rpc_server/epmapper/rpc_epmapper.c60
-rw-r--r--source4/torture/rpc/epmapper.c10
3 files changed, 50 insertions, 59 deletions
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index 07508b7840..6a58dcfd7a 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -26,6 +26,8 @@ interface epmapper
*/
const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
+ const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
+ const int EPMAPPER_STATUS_OK = 0;
/* this guid indicates NDR encoding in a protocol tower */
@@ -106,24 +108,22 @@ interface epmapper
/**********************/
/* Function 0x0 */
- void epm_Insert(
+ error_status_t epm_Insert(
[in] uint32 num_ents,
[in,size_is(num_ents)] epm_entry_t entries[],
- [in] uint32 replace,
- [out] error_status_t status
+ [in] uint32 replace
);
/**********************/
/* Function 0x1 */
- void epm_Delete(
+ error_status_t epm_Delete(
[in] uint32 num_ents,
- [in, size_is(num_ents)] epm_entry_t entries[],
- [out] error_status_t status
+ [in, size_is(num_ents)] epm_entry_t entries[]
);
/**********************/
/* Function 0x02 */
- void epm_Lookup(
+ error_status_t epm_Lookup(
[in] uint32 inquiry_type,
[in] GUID *object,
[in] rpc_if_id_t *interface_id,
@@ -131,8 +131,7 @@ interface epmapper
[in,out,ref] policy_handle *entry_handle,
[in] uint32 max_ents,
[out] uint32 num_ents,
- [out, length_is(num_ents), size_is(max_ents)] epm_entry_t entries[],
- [out] error_status_t status
+ [out, length_is(num_ents), size_is(max_ents)] epm_entry_t entries[]
);
@@ -143,42 +142,38 @@ interface epmapper
epm_twr_t *twr;
} epm_twr_p_t;
- void epm_Map(
+ error_status_t epm_Map(
[in] GUID *object,
[in] epm_twr_t *map_tower,
[in,out,ref] policy_handle *entry_handle,
[in] uint32 max_towers,
[out] uint32 num_towers,
- [out, length_is(num_towers), size_is(max_towers)] epm_twr_p_t towers[],
- [out] error_status_t status
+ [out, length_is(num_towers), size_is(max_towers)] epm_twr_p_t towers[]
);
/**********************/
/* Function 0x04 */
- void epm_LookupHandleFree(
- [in,out,ref] policy_handle *entry_handle,
- [out] error_status_t status
+ error_status_t epm_LookupHandleFree(
+ [in,out,ref] policy_handle *entry_handle
);
/**********************/
/* Function 0x05 */
- void epm_InqObject(
- [out] GUID *epm_object,
- [out] error_status_t status
+ error_status_t epm_InqObject(
+ [out] GUID *epm_object
);
/**********************/
/* Function 0x06 */
- void epm_MgmtDelete(
+ error_status_t epm_MgmtDelete(
[in] uint32 object_speced,
[in] GUID *object,
- [in] epm_twr_t *tower,
- [out] error_status_t status
+ [in] epm_twr_t *tower
);
/**********************/
/* Function 0x07 */
- void epm_MapAuth();
+ error_status_t epm_MapAuth();
}
diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c
index eec804e116..f2c7b78335 100644
--- a/source4/rpc_server/epmapper/rpc_epmapper.c
+++ b/source4/rpc_server/epmapper/rpc_epmapper.c
@@ -21,7 +21,9 @@
*/
#include "includes.h"
+#include "rpc_server/common/common.h"
+typedef uint32_t error_status_t;
/* handle types for this module */
enum handle_types {HTYPE_LOOKUP};
@@ -145,14 +147,14 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
}
-static NTSTATUS epm_Insert(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_Insert *r)
+static error_status_t epm_Insert(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_Insert *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
-static NTSTATUS epm_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_Delete *r)
+static error_status_t epm_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_Delete *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
@@ -162,8 +164,8 @@ static NTSTATUS epm_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
implement epm_Lookup. This call is used to enumerate the interfaces
available on a rpc server
*/
-static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_Lookup *r)
+static error_status_t epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_Lookup *r)
{
struct dcesrv_handle *h;
struct rpc_eps {
@@ -174,9 +176,7 @@ static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
int i;
h = dcesrv_handle_fetch(dce_call->conn, r->in.entry_handle, HTYPE_LOOKUP);
- if (!h) {
- return NT_STATUS_INVALID_HANDLE;
- }
+ DCESRV_CHECK_HANDLE(h);
eps = h->data;
@@ -185,7 +185,7 @@ static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
will feed from this list, stored in the handle */
eps = talloc_p(h->mem_ctx, struct rpc_eps);
if (!eps) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
h->data = eps;
@@ -200,19 +200,17 @@ static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
*r->out.entry_handle = h->wire_handle;
r->out.num_ents = num_ents;
- r->out.status = 0;
if (num_ents == 0) {
r->out.entries = NULL;
- r->out.status = EPMAPPER_STATUS_NO_MORE_ENTRIES;
ZERO_STRUCTP(r->out.entry_handle);
dcesrv_handle_destroy(dce_call->conn, h);
- return NT_STATUS_OK;
+ return EPMAPPER_STATUS_NO_MORE_ENTRIES;
}
r->out.entries = talloc_array_p(mem_ctx, struct epm_entry_t, num_ents);
if (!r->out.entries) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
for (i=0;i<num_ents;i++) {
@@ -220,18 +218,18 @@ static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
r->out.entries[i].annotation = eps->e[i].name;
r->out.entries[i].tower = talloc_p(mem_ctx, struct epm_twr_t);
if (!r->out.entries[i].tower) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
if (!fill_protocol_tower(mem_ctx, &r->out.entries[i].tower->towers, &eps->e[i])) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
}
eps->count -= num_ents;
eps->e += num_ents;
- return NT_STATUS_OK;
+ return EPMAPPER_STATUS_OK;
}
@@ -239,8 +237,8 @@ static NTSTATUS epm_Lookup(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
implement epm_Map. This is used to find the specific endpoint to talk to given
a generic protocol tower
*/
-static NTSTATUS epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_Map *r)
+static error_status_t epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_Map *r)
{
uint32_t count;
int i;
@@ -251,14 +249,13 @@ static NTSTATUS epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(*r->out.entry_handle);
r->out.num_towers = 1;
- r->out.status = 0;
r->out.towers = talloc_p(mem_ctx, struct epm_twr_p_t);
if (!r->out.towers) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
r->out.towers->twr = talloc_p(mem_ctx, struct epm_twr_t);
if (!r->out.towers->twr) {
- return NT_STATUS_NO_MEMORY;
+ return EPMAPPER_STATUS_NO_MEMORY;
}
if (!r->in.map_tower || r->in.max_towers == 0 ||
@@ -297,40 +294,39 @@ static NTSTATUS epm_Map(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
}
fill_protocol_tower(mem_ctx, &r->out.towers->twr->towers, &eps[i]);
r->out.towers->twr->tower_length = 0;
- return NT_STATUS_OK;
+ return EPMAPPER_STATUS_OK;
}
failed:
r->out.num_towers = 0;
- r->out.status = EPMAPPER_STATUS_NO_MORE_ENTRIES;
r->out.towers->twr = NULL;
- return NT_STATUS_OK;
+ return EPMAPPER_STATUS_NO_MORE_ENTRIES;
}
-static NTSTATUS epm_LookupHandleFree(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_LookupHandleFree *r)
+static error_status_t epm_LookupHandleFree(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_LookupHandleFree *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
-static NTSTATUS epm_InqObject(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct epm_InqObject *r)
+static error_status_t epm_InqObject(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct epm_InqObject *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
-static NTSTATUS epm_MgmtDelete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+static error_status_t epm_MgmtDelete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct epm_MgmtDelete *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
-static NTSTATUS epm_MapAuth(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+static error_status_t epm_MapAuth(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct epm_MapAuth *r)
{
- return NT_STATUS_NOT_IMPLEMENTED;
+ DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
/* include the generated boilerplate */
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index 2af4e449b4..9f5c337f15 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -162,7 +162,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
twr->towers.floors[4].rhs.rhs_data = data_blob_talloc_zero(p->mem_ctx, 4);
status = dcerpc_epm_Map(p, mem_ctx, &r);
- if (NT_STATUS_IS_OK(status) && r.out.status == 0) {
+ if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
display_tower(mem_ctx, &r.out.towers[i].twr->towers);
@@ -175,7 +175,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
twr->towers.floors[3].rhs.rhs_data = data_blob_talloc_zero(p->mem_ctx, 2);
status = dcerpc_epm_Map(p, mem_ctx, &r);
- if (NT_STATUS_IS_OK(status) && r.out.status == 0) {
+ if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
display_tower(mem_ctx, &r.out.towers[i].twr->towers);
@@ -192,7 +192,7 @@ static BOOL test_Map(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
twr->towers.floors[4].rhs.rhs_data = data_blob_talloc_zero(p->mem_ctx, 2);
status = dcerpc_epm_Map(p, mem_ctx, &r);
- if (NT_STATUS_IS_OK(status) && r.out.status == 0) {
+ if (NT_STATUS_IS_OK(status) && r.out.result == 0) {
for (i=0;i<r.out.num_towers;i++) {
if (r.out.towers[i].twr) {
display_tower(mem_ctx, &r.out.towers[i].twr->towers);
@@ -226,7 +226,7 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
do {
int i;
status = dcerpc_epm_Lookup(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) || r.out.status != 0) {
+ if (!NT_STATUS_IS_OK(status) || r.out.result != 0) {
break;
}
for (i=0;i<r.out.num_ents;i++) {
@@ -235,7 +235,7 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
test_Map(p, mem_ctx, r.out.entries[i].tower);
}
} while (NT_STATUS_IS_OK(status) &&
- r.out.status == 0 &&
+ r.out.result == 0 &&
r.out.num_ents == r.in.max_ents);
if (!NT_STATUS_IS_OK(status)) {