samldb: Allow automatic generation of mAPIIDs
[sfrench/samba-autobuild/.git] / source4 / lib / wmi / wmicore.c
index fbd6b339bf10972073d00ec802f16bc663d1f161..dc9fee40b212d9c4c34d7cbfa260629b767ca272 100644 (file)
@@ -26,7 +26,6 @@
 #include "librpc/gen_ndr/com_wmi.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/ndr/ndr_table.h"
-#include "param/param.h"
 
 struct IWbemServices;
 struct IWbemContext;
@@ -38,9 +37,10 @@ struct IWbemContext;
                             DEBUG(1, ("OK   : %s\n", msg)); \
                         }
 
-void wmi_init(struct com_context **ctx, struct cli_credentials *credentials)
+void wmi_init(struct com_context **ctx, struct cli_credentials *credentials,
+                         struct loadparm_context *lp_ctx)
 {
-       dcerpc_init();
+       dcerpc_init(lp_ctx);
        ndr_table_init();
 
        /* FIXME: Register DCOM proxies? */
@@ -51,28 +51,17 @@ void wmi_init(struct com_context **ctx, struct cli_credentials *credentials)
 
 /** FIXME: Use credentials struct rather than user/password here */
 WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const uint16_t *nspace, 
-                         const char *user, const char *password, 
+                         struct cli_credentials *credentials,
                          const char *locale, uint32_t flags, const char *authority, 
                          struct IWbemContext* wbem_ctx, struct IWbemServices** services)
 {
         struct GUID clsid;
         struct GUID iid;
-        WERROR result, coresult;
+        WERROR result;
+       HRESULT coresult;
         struct IUnknown **mqi;
         struct IWbemLevel1Login *pL;
 
-        if (user) {
-                char *cred;
-                struct cli_credentials *cc;
-
-                cred = talloc_asprintf(NULL, "%s%%%s", user, password);
-                cc = cli_credentials_init(cred);
-                cli_credentials_set_conf(cc, global_loadparm);
-                cli_credentials_parse_string(cc, cred, CRED_SPECIFIED);
-                dcom_set_server_credentials(ctx, server, cc);
-                talloc_free(cred);
-        }
-
         GUID_from_string(CLSID_WBEMLEVEL1LOGIN, &clsid);
         GUID_from_string(COM_IWBEMLEVEL1LOGIN_UUID, &iid);
         result = dcom_create_object(ctx, &clsid, server, 1, &iid, &mqi, &coresult);