summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-12 19:55:49 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-15 17:40:19 +0200
commit54437f1e8a9274cb7afa3b850d709568414dff71 (patch)
tree9c5aa6af128b870fd602a9f882405d035ce45148 /source4/lib
parentb91a7fa1661e03549c3526a408f053bd16e06afa (diff)
downloadsamba-54437f1e8a9274cb7afa3b850d709568414dff71.tar.gz
samba-54437f1e8a9274cb7afa3b850d709568414dff71.tar.bz2
samba-54437f1e8a9274cb7afa3b850d709568414dff71.zip
More improvements.
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/wmi/pywmi.i26
-rw-r--r--source4/lib/wmi/tools/wmic.c2
-rw-r--r--source4/lib/wmi/wmi.h2
-rw-r--r--source4/lib/wmi/wmicore.c30
4 files changed, 32 insertions, 28 deletions
diff --git a/source4/lib/wmi/pywmi.i b/source4/lib/wmi/pywmi.i
index c1114c3cee..1889e774ae 100644
--- a/source4/lib/wmi/pywmi.i
+++ b/source4/lib/wmi/pywmi.i
@@ -22,6 +22,8 @@
%include "typemaps.i"
%import "stdint.i"
+%import "libcli/util/errors.i"
+%import "lib/talloc/talloc.i"
%runtime %{
void push_object(PyObject **stack, PyObject *o)
@@ -59,7 +61,6 @@ WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const cha
WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout,uint32_t uCount,
struct WbemClassObject **apObjects, uint32_t *puReturned);
-static PyObject *PyErr_SetFromWERROR(WERROR w);
static PyObject *PyObject_FromCVAR(uint32_t cimtype, union CIMVAR *cvar);
static PyObject *PySWbemObject_FromWbemClassObject(struct WbemClassObject *wco);
@@ -240,23 +241,10 @@ static PyObject *PySWbemObject_FromWbemClassObject(struct WbemClassObject *wco)
%}
-%typemap(out) WERROR {
- if (!W_ERROR_IS_OK($1)) {
- PyErr_SetFromWERROR($1);
- return NULL;
- }
- $result = Py_None;
- Py_INCREF(Py_None);
-}
-
%typemap(in, numinputs=0) struct com_context *ctx {
$1 = com_ctx;
}
-%typemap(in, numinputs=0) TALLOC_CTX *mem_ctx {
- $1 = NULL;
-}
-
%typemap(in, numinputs=0) struct IWbemServices **services (struct IWbemServices *temp) {
$1 = &temp;
}
@@ -329,14 +317,6 @@ WERROR IEnumWbemClassObject_Reset(struct IEnumWbemClassObject *d, TALLOC_CTX *me
if (error) return NULL;
}
-%typemap(out) WERROR {
- if (!W_ERROR_IS_OK($1)) {
- PyErr_SetFromWERROR($1);
- talloc_free(arg5); // FIXME:avg make it properly(how???)
- return NULL;
- }
-}
-
WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount,
struct WbemClassObject **apObjects, uint32_t *puReturned);
@@ -346,8 +326,6 @@ WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX
mod_pywintypes = PyImport_ImportModule("pywintypes");
ComError = PyObject_GetAttrString(mod_pywintypes, "com_error");
-// talloc_enable_leak_report_full();
-
lp_load();
dcerpc_init();
dcerpc_table_init();
diff --git a/source4/lib/wmi/tools/wmic.c b/source4/lib/wmi/tools/wmic.c
index 0e52b5905a..611a2dc36f 100644
--- a/source4/lib/wmi/tools/wmic.c
+++ b/source4/lib/wmi/tools/wmic.c
@@ -36,7 +36,7 @@
struct WBEMCLASS;
struct WBEMOBJECT;
-#include "wmi/proto.h"
+#include "wmi/wmi.h"
struct program_args {
char *hostname;
diff --git a/source4/lib/wmi/wmi.h b/source4/lib/wmi/wmi.h
index 49acf24c9f..32cc88efd5 100644
--- a/source4/lib/wmi/wmi.h
+++ b/source4/lib/wmi/wmi.h
@@ -20,6 +20,8 @@
#ifndef _WMI_H_
#define _WMI_H_
+#include "librpc/gen_ndr/com_wmi.h"
+
/* The following definitions come from lib/wmi/wmicore.c */
diff --git a/source4/lib/wmi/wmicore.c b/source4/lib/wmi/wmicore.c
index cb896f4a5d..cdfe037b69 100644
--- a/source4/lib/wmi/wmicore.c
+++ b/source4/lib/wmi/wmicore.c
@@ -1,7 +1,29 @@
+/*
+ WMI Sample client
+ Copyright (C) 2006 Andrzej Hajda <andrzej.hajda@wp.pl>
+ Copyright (C) 2008 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 "auth/credentials/credentials.h"
#include "librpc/gen_ndr/com_dcom.h"
#include "lib/com/dcom/dcom.h"
+#include "librpc/gen_ndr/wmi.h"
+#include "librpc/gen_ndr/com_wmi.h"
struct IWbemServices;
struct IWbemContext;
@@ -12,9 +34,11 @@ struct IWbemContext;
} else { \
DEBUG(1, ("OK : %s\n", msg)); \
}
-
-WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace, const char *user, const char *password,
- const char *locale, uint32_t flags, const char *authority, struct IWbemContext* wbem_ctx, struct IWbemServices** services)
+/** FIXME: Use credentials struct rather than user/password here */
+WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace,
+ const char *user, const char *password,
+ const char *locale, uint32_t flags, const char *authority,
+ struct IWbemContext* wbem_ctx, struct IWbemServices** services)
{
struct GUID clsid;
struct GUID iid;