summaryrefslogtreecommitdiff
path: root/source4/lib/dcom/common/local.c
blob: 3c5405e9dca34548b1da1b3195bd412e7ab2b4ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
   Unix SMB/CIFS implementation.
   Implementation of some of the local COM calls. Interfaces:
    - IUnknown

   Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org>

   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
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   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.
*/

#include "includes.h"
#include "dlinklist.h"
#include "librpc/gen_ndr/ndr_dcom.h"

NTSTATUS dcerpc_IUnknown_AddRef(struct dcom_interface *p, TALLOC_CTX *mem_ctx, struct IUnknown_AddRef *rr) 
{
	struct RemAddRef r;
	struct REMINTERFACEREF ref;
	
	/* This is rather inefficient, but we'll patch it up later */
	r.in.cInterfaceRefs = 1;
	r.in.InterfaceRefs = &ref;

	return dcerpc_RemAddRef(p, mem_ctx, &r);
}

NTSTATUS dcerpc_IUnknown_Release(struct dcom_interface *p, TALLOC_CTX *mem_ctx, struct IUnknown_Release *rr)
{
	struct RemRelease r;
	struct REMINTERFACEREF ref;

	return NT_STATUS_NOT_SUPPORTED;
	
	p->private_references--;

	/* Only do the remote version of this call when all local references have 
	 * been released */
	if (p->private_references == 0) {
		NTSTATUS status;
		r.in.cInterfaceRefs = 1;
		r.in.InterfaceRefs = &ref;

		status = dcerpc_RemRelease(p, mem_ctx, &r);
		
		if (NT_STATUS_IS_OK(status)) {
			talloc_destroy(p);	
		}

		return status;
	}

	return NT_STATUS_OK;
}

NTSTATUS dcerpc_IUnknown_QueryInterface(struct dcom_interface *o, TALLOC_CTX *mem_ctx, struct IUnknown_QueryInterface *rr)
{
	/* FIXME: Ask local server for interface pointer. Local server can then 
	 * call RemQueryInterface if necessary */
	return NT_STATUS_NOT_SUPPORTED;
}