r5775: Remove some unused functions (unions are no longer as special as they used...
authorJelmer Vernooij <jelmer@samba.org>
Sat, 12 Mar 2005 17:12:52 +0000 (17:12 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:11:02 +0000 (13:11 -0500)
Add oxid mapping table support in DCOM
(This used to be commit e193555f0eec2dda8c8760e9668181200fef0a1e)

source4/build/pidl/ndr.pm
source4/lib/com/dcom/main.c
source4/libnet/userinfo.c
source4/librpc/idl/winreg.idl
source4/librpc/ndr/libndr.h
source4/librpc/ndr/ndr.c
source4/torture/rpc/oxidresolve.c
source4/torture/rpc/remact.c

index 1e862f5c231602203687004bec2cc14ad07679b1..b4f02048a20718a359ccf4452840b5e1ac2b0024 100644 (file)
@@ -549,7 +549,7 @@ sub ParseArrayPull($$$$)
        my $size = $length;
 
        if (is_conformant_array($e)) {
-               $size = "ndr_get_array_size($ndr, &$var_prefix$e->{NAME})";
+               $length = $size = "ndr_get_array_size($ndr, &$var_prefix$e->{NAME})";
        }
 
        # if this is a conformant array then we use that size to allocate, and make sure
index 8ef2060eb74f785a71ca15f6deaab18ca1284e25..4d9c635be84840b3c636cf3fdc14261b5caa5298 100644 (file)
@@ -119,7 +119,14 @@ static NTSTATUS dcom_connect_host(struct com_context *ctx, struct dcerpc_pipe **
 
 struct dcom_object_exporter *object_exporter_by_oxid(struct com_context *ctx, uint64_t oxid)
 {
-       return NULL; /* FIXME */
+       struct dcom_object_exporter *ox;
+       for (ox = ctx->dcom->object_exporters; ox; ox = ox->next) {
+               if (ox->oxid == oxid) {
+                       return ox;
+               }
+       }
+
+       return NULL; 
 }
 
 struct dcom_object_exporter *object_exporter_by_ip(struct com_context *ctx, struct IUnknown *ip)
index 350bc26202086fb8f299d666a0737bc5f443248e..67a1710dc8ae4dc8c606c419a949df9fca5bb83a 100644 (file)
@@ -183,6 +183,7 @@ struct composite_context* rpc_composite_userinfo_send(struct dcerpc_pipe *p,
        
 failure:
        talloc_free(c);
+       return NULL;
 }
 
 
index a58a62f62fcea015770b4b457e4ccdff04fb0b92..3d11af790bf6cd774cbe4cf023822db293129f85 100644 (file)
@@ -4,7 +4,8 @@
   winreg interface definition
 */
 
-[ uuid("338cd001-2244-31f1-aaaa-900038001003"),
+[ 
+  uuid("338cd001-2244-31f1-aaaa-900038001003"),
   version(1.0),
   endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
   pointer_default(unique),
index 19d43566815c4f0a24f87763b268bfccb78777bd..4df3e7f248a37fc603ad481de582a0b6f7a66dae 100644 (file)
@@ -137,7 +137,6 @@ struct ndr_print {
 
 /* useful macro for debugging */
 #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
-#define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_union_fn_t)ndr_print_ ##type, #p, level, p)
 #define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
 #define NDR_PRINT_BOTH_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_BOTH, p)
 #define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
@@ -242,8 +241,6 @@ enum ndr_err_code {
 typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, void *);
 typedef NTSTATUS (*ndr_push_const_fn_t)(struct ndr_push *, int ndr_flags, const void *);
 typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
-typedef NTSTATUS (*ndr_push_union_fn_t)(struct ndr_push *, int ndr_flags, uint32_t, void *);
-typedef NTSTATUS (*ndr_pull_union_fn_t)(struct ndr_pull *, int ndr_flags, uint32_t, void *);
 typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *);
 typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, void *);
 typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32_t, void *);
index f3394d1e442a7595a09a10ff109fac1911b81878..b96a231a90889a49870ef2b2bab4bf283492a94a 100644 (file)
@@ -644,12 +644,12 @@ NTSTATUS ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length)
 /*
   store a switch value
  */
-NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, void *p, uint32_t val)
+NTSTATUS ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val)
 {
        return ndr_token_store(ndr, &ndr->switch_list, p, val);
 }
 
-NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, void *p, uint32_t val)
+NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val)
 {
        return ndr_token_store(ndr, &ndr->switch_list, p, val);
 }
@@ -657,12 +657,12 @@ NTSTATUS ndr_pull_set_switch_value(struct ndr_pull *ndr, void *p, uint32_t val)
 /*
   retrieve a switch value
  */
-uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, void *p)
+uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p)
 {
        return ndr_token_peek(&ndr->switch_list, p);
 }
 
-uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, void *p)
+uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p)
 {
        return ndr_token_peek(&ndr->switch_list, p);
 }
@@ -729,21 +729,6 @@ NTSTATUS ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p)
        return NT_STATUS_OK;
 }
 
-
-/*
-  pull a union from a blob using NDR
-*/
-NTSTATUS ndr_pull_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, uint32_t level, void *p,
-                            ndr_pull_union_fn_t fn)
-{
-       struct ndr_pull *ndr;
-       ndr = ndr_pull_init_blob(blob, mem_ctx);
-       if (!ndr) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       return fn(ndr, NDR_SCALARS|NDR_BUFFERS, level, p);
-}
-
 /*
   pull a struct from a blob using NDR
 */
@@ -807,7 +792,7 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
 /*
   generic ndr_size_*() handler for unions
 */
-size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_union_fn_t push)
+size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push)
 {
        struct ndr_push *ndr;
        NTSTATUS status;
@@ -819,7 +804,8 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_union_f
        ndr = ndr_push_init_ctx(NULL);
        if (!ndr) return 0;
        ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
-       status = push(ndr, NDR_SCALARS|NDR_BUFFERS, level, discard_const(p));
+       ndr_push_set_switch_value(ndr, p, level);
+       status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
        if (!NT_STATUS_IS_OK(status)) {
                return 0;
        }
index 3ff90e3a01ff5e052e8d8fddc44de5c50a7668f8..2caf3512d5525f46f6d42f8cb9b6eb6ff5027f74 100644 (file)
@@ -232,24 +232,28 @@ BOOL torture_rpc_oxidresolve(void)
                return False;
        }
 
-       status = dcerpc_secondary_connection(premact, &p, 
+       status = torture_rpc_connection(&p, 
                                        DCERPC_IOXIDRESOLVER_NAME, 
                                        DCERPC_IOXIDRESOLVER_UUID, 
                                        DCERPC_IOXIDRESOLVER_VERSION);
 
-       if(!test_RemoteActivation(premact, mem_ctx, &oxid, &oid))
+       if (!NT_STATUS_IS_OK(status)) {
                return False;
+       }
 
        if(!test_ServerAlive(p, mem_ctx))
                ret = False;
 
-       if(!test_ComplexPing(p, mem_ctx, &setid, oid))
+       if(!test_ServerAlive2(p, mem_ctx))
                ret = False;
 
-       if(!test_SimplePing(p, mem_ctx, setid))
+       if(!test_RemoteActivation(premact, mem_ctx, &oxid, &oid))
+               return False;
+
+       if(!test_ComplexPing(p, mem_ctx, &setid, oid))
                ret = False;
 
-       if(!test_ServerAlive2(p, mem_ctx))
+       if(!test_SimplePing(p, mem_ctx, setid))
                ret = False;
 
        if(!test_ResolveOxid(p, mem_ctx, oxid))
index 83a881178716782b4c896c1109a83cafed9169c9..a8dff5f50b0e2dfc7b841945390422221e4a7700 100644 (file)
@@ -86,7 +86,7 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
        }
 
        if(!W_ERROR_IS_OK(r.out.results[0])) {
-               printf("RemoteActivation: %s\n", win_errstr(r.out.results[0]));
+               printf("RemoteActivation(GetClassObject): %s\n", win_errstr(r.out.results[0]));
                return 0;
        }