summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-11-01 12:40:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:10 -0500
commit6ef03e7a846a4b858eec0b9953f03306f46b77e3 (patch)
tree2a4e9b7650cc7de99711b475b5e511dc8f51e70f /source4
parenta78c26beaa22aa655b6c094475019d29825dd77c (diff)
downloadsamba-6ef03e7a846a4b858eec0b9953f03306f46b77e3.tar.gz
samba-6ef03e7a846a4b858eec0b9953f03306f46b77e3.tar.bz2
samba-6ef03e7a846a4b858eec0b9953f03306f46b77e3.zip
r3432: Support WERROR's in arguments (not just as return type). Some of
the DCOM calls are wrappers around several local calls, so you get things like: WERROR foobar ( [in] int num_ifaces, [in,size_is(num_ifaces)] IID *ifaces, [out,size_is(num_ifaces)] WERROR *results); (This used to be commit 0873bf2cbe3589988e518cf68ad4d14343b9240b)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/util.pm2
-rw-r--r--source4/librpc/idl/dcom.idl39
-rw-r--r--source4/librpc/idl/remact.idl5
-rw-r--r--source4/librpc/ndr/ndr_basic.c54
-rw-r--r--source4/torture/rpc/remact.c4
5 files changed, 76 insertions, 28 deletions
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 5fbca25220..c49e956e50 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -191,7 +191,7 @@ sub is_scalar_type($)
}
if ($type =~ /char|short|long|NTTIME|
time_t|error_status_t|boolean32|unsigned32|
- HYPER_T|wchar_t|DATA_BLOB/x) {
+ HYPER_T|wchar_t|DATA_BLOB|WERROR/x) {
return 1;
}
diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl
index 864a764705..c7a714a488 100644
--- a/source4/librpc/idl/dcom.idl
+++ b/source4/librpc/idl/dcom.idl
@@ -5,7 +5,6 @@
http://www.grimes.demon.co.uk/DCOM/DCOMSpec.htm
*/
-#define HRESULT uint32
#define OLESTR unistr
[
@@ -279,7 +278,7 @@ interface IUnknown
/* Function 0x00 */
/* Returns the interface with the specified IID
if implemented by this object */
- HRESULT QueryInterface([in] IID *riid
+ WERROR QueryInterface([in] IID *riid
/*FIXME, [out] void **data*/);
/*****************/
@@ -298,17 +297,17 @@ interface IUnknown
pointer_default(unique)
] interface IClassFactory : IUnknown
{
- HRESULT CreateInstance(/*FIXME[in] IUnknown *pUnknown,
+ WERROR CreateInstance(/*FIXME[in] IUnknown *pUnknown,
[in] IID *riid,
[out, iid_is(riid)] void **ppv*/);
- HRESULT RemoteCreateInstance();
+ WERROR RemoteCreateInstance();
/* Set lock to TRUE when you want to do a lock
and set it to FALSE when you want to unlock */
- HRESULT LockServer([in] uint8 lock);
+ WERROR LockServer([in] uint8 lock);
- HRESULT RemoteLockServer();
+ WERROR RemoteLockServer();
}
/*//////////////////////////////////////////////////////////////// */
@@ -329,12 +328,12 @@ interface IRemUnknown : IUnknown
{
typedef [public] struct
{
- HRESULT hResult; /* result of call */
+ WERROR hResult; /* result of call */
STDOBJREF std; /* data for returned interface */
}
REMQIRESULT;
- HRESULT RemQueryInterface (
+ WERROR RemQueryInterface (
[in] IPID *ripid, /* interface to QI on */
[in] uint32 cRefs, /* count of AddRefs requested */
[in] uint16 cIids, /* count of IIDs that follow */
@@ -349,13 +348,13 @@ interface IRemUnknown : IUnknown
uint32 cPrivateRefs;
} REMINTERFACEREF;
- HRESULT RemAddRef (
+ WERROR RemAddRef (
[in] uint16 cInterfaceRefs,
[in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[],
- [out, size_is(cInterfaceRefs)] HRESULT* pResults
+ [out, size_is(cInterfaceRefs)] WERROR* pResults
);
- HRESULT RemRelease (
+ WERROR RemRelease (
[in] uint16 cInterfaceRefs,
[in, size_is(cInterfaceRefs)] REMINTERFACEREF InterfaceRefs[]
);
@@ -381,7 +380,7 @@ interface IRemUnknown : IUnknown
]
interface ISystemActivator : IClassActivator
{
- HRESULT ISystemActivatorRemoteCreateInstance([in] HYPER_T unknown1, /* IPID ? */
+ WERROR ISystemActivatorRemoteCreateInstance([in] HYPER_T unknown1, /* IPID ? */
[in] MInterfacePointer iface,
[in] HYPER_T unknown2,
[out] uint32 unknown3,
@@ -400,11 +399,11 @@ interface IRemUnknown : IUnknown
interface IRemUnknown2 : IRemUnknown
{
- HRESULT RemQueryInterface2 (
+ WERROR RemQueryInterface2 (
[in] IPID *ripid,
[in] uint16 cIids,
[in, size_is(cIids)] IID *iids,
- [out, size_is(cIids)] HRESULT *phr,
+ [out, size_is(cIids)] WERROR *phr,
[out, size_is(cIids)] MInterfacePointer *ppMIF
);
}
@@ -425,7 +424,7 @@ object,
{
/*****************/
/* Function 0x03 */
- HRESULT GetTypeInfoCount(
+ WERROR GetTypeInfoCount(
[out] uint16 *pctinfo);
typedef struct {
@@ -438,14 +437,14 @@ object,
/*****************/
/* Function 0x04 */
- HRESULT GetTypeInfo (
+ WERROR GetTypeInfo (
[in] uint16 iTInfo,
[in] LCID lcid,
[out] REF_ITypeInfo *ppTInfo);
/*****************/
/* Function 0x05 */
- HRESULT GetIDsOfNames(
+ WERROR GetIDsOfNames(
[in] IID *riid,
/*FIXME[in,size_is(cNames)] OLESTR *rgszNames[], */
[in] uint16 cNames,
@@ -468,7 +467,7 @@ object,
/*****************/
/* Function 0x06 */
- HRESULT Invoke(
+ WERROR Invoke(
[in] DISPID dispIdMember,
[in] IID *riid,
[in] LCID lcid,
@@ -484,6 +483,6 @@ object,
uuid("00000003-0000-0000-C000-000000000046")
] interface IMarshal : IUnknown
{
- HRESULT MarshalInterface();
- HRESULT UnMarshalInterface();
+ WERROR MarshalInterface();
+ WERROR UnMarshalInterface();
}
diff --git a/source4/librpc/idl/remact.idl b/source4/librpc/idl/remact.idl
index 51e2b6d735..1d54148f5e 100644
--- a/source4/librpc/idl/remact.idl
+++ b/source4/librpc/idl/remact.idl
@@ -6,7 +6,6 @@
*/
#define IPID GUID
-#define HRESULT uint32
[
uuid("4d9f4ab8-7d1c-11cf-861e-0020af6e7c57"),
@@ -42,8 +41,8 @@ interface IRemoteActivation
[out] IPID ipidRemUnknown,
[out] uint32 AuthnHint,
[out] COMVERSION ServerVersion,
- [out] HRESULT hr,
+ [out] WERROR hr,
[out,size_is(Interfaces)] MInterfacePointer ifaces[],
- [out,size_is(Interfaces)] HRESULT results[]
+ [out,size_is(Interfaces)] WERROR results[]
);
}
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 19db8c99a3..95d8c28e75 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -190,9 +190,9 @@ NTSTATUS ndr_push_WERROR(struct ndr_push *ndr, WERROR status)
return ndr_push_uint32(ndr, W_ERROR_V(status));
}
-void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR *r)
+void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r)
{
- ndr->print(ndr, "%-25s: %s", name, win_errstr(*r));
+ ndr->print(ndr, "%-25s: %s", name, win_errstr(r));
}
/*
@@ -264,6 +264,23 @@ NTSTATUS ndr_pull_array_HYPER_T(struct ndr_pull *ndr, int ndr_flags, HYPER_T *da
}
/*
+ pull a const array of WERROR
+*/
+NTSTATUS ndr_pull_array_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *data, uint32_t n)
+{
+ uint32_t i;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NT_STATUS_OK;
+ }
+ for (i=0;i<n;i++) {
+ NDR_CHECK(ndr_pull_WERROR(ndr, &data[i]));
+ }
+ return NT_STATUS_OK;
+}
+
+
+
+/*
push a uint8
*/
NTSTATUS ndr_push_uint8(struct ndr_push *ndr, uint8_t v)
@@ -431,6 +448,21 @@ NTSTATUS ndr_push_array_HYPER_T(struct ndr_push *ndr, int ndr_flags, const HYPER
}
/*
+ push an array of HYPER_T
+*/
+NTSTATUS ndr_push_array_WERROR(struct ndr_push *ndr, int ndr_flags, const WERROR *data, uint32_t n)
+{
+ int i;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NT_STATUS_OK;
+ }
+ for (i=0;i<n;i++) {
+ NDR_CHECK(ndr_push_WERROR(ndr, data[i]));
+ }
+ return NT_STATUS_OK;
+}
+
+/*
save the current position
*/
void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save)
@@ -966,6 +998,24 @@ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level
ndr->print(ndr, "UNKNOWN LEVEL %u", level);
}
+void ndr_print_array_WERROR(struct ndr_print *ndr, const char *name,
+ const WERROR *data, uint32_t count)
+{
+ int i;
+
+ ndr->print(ndr, "%s: ARRAY(%d)", name, count);
+ ndr->depth++;
+ for (i=0;i<count;i++) {
+ char *idx=NULL;
+ asprintf(&idx, "[%d]", i);
+ if (idx) {
+ ndr_print_WERROR(ndr, idx, data[i]);
+ free(idx);
+ }
+ }
+ ndr->depth--;
+}
+
void ndr_print_array_HYPER_T(struct ndr_print *ndr, const char *name,
const HYPER_T *data, uint32_t count)
{
diff --git a/source4/torture/rpc/remact.c b/source4/torture/rpc/remact.c
index 2fbb5de33e..9d725893c9 100644
--- a/source4/torture/rpc/remact.c
+++ b/source4/torture/rpc/remact.c
@@ -57,8 +57,8 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return 0;
}
- if(!W_ERROR_IS_OK(W_ERROR(r.out.hr))) {
- fprintf(stderr, "RemoteActivation: %s\n", win_errstr(W_ERROR(r.out.hr)));
+ if(!W_ERROR_IS_OK(r.out.hr)) {
+ fprintf(stderr, "RemoteActivation: %s\n", win_errstr(r.out.hr));
return 0;
}