]> git.samba.org - tprouty/samba.git/blobdiff - source4/torture/rpc/remact.c
r23792: convert Samba4 to GPLv3
[tprouty/samba.git] / source4 / torture / rpc / remact.c
index 83a881178716782b4c896c1109a83cafed9169c9..d1b0e062c8a8ccc4dd011c4609e8e225f13761c2 100644 (file)
@@ -6,7 +6,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
-#include "librpc/gen_ndr/ndr_remact.h"
-#include "librpc/gen_ndr/ndr_epmapper.h"
-#include "librpc/gen_ndr/com_dcom.h"
+#include "torture/torture.h"
+#include "librpc/gen_ndr/ndr_remact_c.h"
+#include "librpc/gen_ndr/ndr_epmapper_c.h"
+#include "torture/rpc/rpc.h"
+
+#define CLSID_IMAGEDOC "02B01C80-E03D-101A-B294-00DD010F2BF9"
+#define DCERPC_IUNKNOWN_UUID "00000000-0000-0000-c000-000000000046"
+#define DCERPC_ICLASSFACTORY_UUID "00000001-0000-0000-c000-000000000046"
 
 static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
        struct RemoteActivation r;
        NTSTATUS status;
-       struct GUID iids[2];
+       struct GUID iids[1];
        uint16_t protseq[3] = { EPM_PROTOCOL_TCP, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID };
 
        ZERO_STRUCT(r.in);
        r.in.this.version.MajorVersion = 5;
        r.in.this.version.MinorVersion = 1;
        r.in.this.cid = GUID_random();
-       GUID_from_string(CLSID_SIMPLE, &r.in.Clsid);
+       GUID_from_string(CLSID_IMAGEDOC, &r.in.Clsid);
        r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
        r.in.num_protseqs = 3;
        r.in.protseq = protseq;
-       r.in.Interfaces = 2;
+       r.in.Interfaces = 1;
        GUID_from_string(DCERPC_IUNKNOWN_UUID, &iids[0]);
-       GUID_from_string(DCERPC_ISTREAM_UUID, &iids[1]);
        r.in.pIIDs = iids;
 
        status = dcerpc_RemoteActivation(p, mem_ctx, &r);
@@ -55,8 +58,8 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
                return 0;
        }
 
-       if(!W_ERROR_IS_OK(r.out.hr)) {
-               printf("RemoteActivation: %s\n", win_errstr(r.out.hr));
+       if(!W_ERROR_IS_OK(*r.out.hr)) {
+               printf("RemoteActivation: %s\n", win_errstr(*r.out.hr));
                return 0;
        }
 
@@ -80,34 +83,34 @@ static int test_RemoteActivation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
                return 0;
        }
 
-       if(!W_ERROR_IS_OK(r.out.hr)) {
-               printf("RemoteActivation(GetClassObject): %s\n", win_errstr(r.out.hr));
+       if(!W_ERROR_IS_OK(*r.out.hr)) {
+               printf("RemoteActivation(GetClassObject): %s\n", win_errstr(*r.out.hr));
                return 0;
        }
 
        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;
        }
 
        return 1;
 }
 
-BOOL torture_rpc_remact(void)
+BOOL torture_rpc_remact(struct torture_context *torture)
 {
-     NTSTATUS status;
-     struct dcerpc_pipe *p;
+       NTSTATUS status;
+       struct dcerpc_pipe *p;
        TALLOC_CTX *mem_ctx;
        BOOL ret = True;
 
        mem_ctx = talloc_init("torture_rpc_remact");
 
-       status = torture_rpc_connection(&p, 
-                                       DCERPC_IREMOTEACTIVATION_NAME,
-                                       DCERPC_IREMOTEACTIVATION_UUID, 
-                                       DCERPC_IREMOTEACTIVATION_VERSION);
+       status = torture_rpc_connection(mem_ctx,
+                                       &p, 
+                                       &dcerpc_table_IRemoteActivation);
 
        if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(mem_ctx);
                return False;
        }
 
@@ -116,7 +119,5 @@ BOOL torture_rpc_remact(void)
 
        talloc_free(mem_ctx);
 
-    torture_rpc_close(p);
-
        return ret;
 }