- Good is not compliant with our default authentication mechanism. Disable it for...
[jelmer/openchange.git] / mapiproxy / servers / default / rfr / dcesrv_exchange_ds_rfr.c
index d7fffb4954e6657992681f3d0fbf6510952336fd..287f18ab3cd57698adefe92cb3a29f8760b549c8 100644 (file)
  */
 
 /**
-   \file dcesrv_exchange_rfr.c
+   \file dcesrv_exchange_ds_rfr.c
 
    \brief OpenChange RFR Server implementation
  */
 
 #include "mapiproxy/dcesrv_mapiproxy.h"
-#include "mapiproxy/libmapiproxy.h"
 #include "dcesrv_exchange_ds_rfr.h"
 
 /**
@@ -49,21 +48,22 @@ static enum MAPISTATUS dcesrv_RfrGetNewDSA(struct dcesrv_call_state *dce_call,
        const char              *realm = NULL;
        char                    *fqdn = NULL;
 
-       DEBUG(3, ("exchange_ds_rfr: RfrGetNewDSA (0x0)\n"));
+       DEBUG(5, ("exchange_ds_rfr: RfrGetNewDSA (0x0)\n"));
 
+       /* HACK: Disable authentication */
        /* Step 0. Ensure incoming user is authenticated */
-       if (!NTLM_AUTH_IS_OK(dce_call)) {
-               DEBUG(1, ("No challenge requested by client, cannot authenticate\n"));
-
-               r->out.ppszUnused = NULL;
-               r->out.ppszServer = NULL;
-               r->out.result = MAPI_E_LOGON_FAILED;
-               return MAPI_E_LOGON_FAILED;
-       }
+//     if (!dcesrv_call_authenticated(dce_call)) {
+//             DEBUG(1, ("No challenge requested by client, cannot authenticate\n"));
+//
+//             r->out.ppszUnused = NULL;
+//             r->out.ppszServer = NULL;
+//             r->out.result = MAPI_E_LOGON_FAILED;
+//             return MAPI_E_LOGON_FAILED;
+//     }
 
        /* Step 1. We don't have load-balancing support yet, just return Samba FQDN name */
-       netbiosname = lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx);
-       realm = lp_realm(dce_call->conn->dce_ctx->lp_ctx);
+       netbiosname = lpcfg_netbios_name(dce_call->conn->dce_ctx->lp_ctx);
+       realm = lpcfg_realm(dce_call->conn->dce_ctx->lp_ctx);
        if (!netbiosname || !realm) {
                r->out.ppszUnused = NULL;
                r->out.ppszServer = NULL;
@@ -95,8 +95,35 @@ static enum MAPISTATUS dcesrv_RfrGetFQDNFromLegacyDN(struct dcesrv_call_state *d
                                                     TALLOC_CTX *mem_ctx,
                                                     struct RfrGetFQDNFromLegacyDN *r)
 {
-       DEBUG(3, ("exchange_ds_rfr: RfrGetFQDNFromLegacyDN (0x1) not implemented\n"));
-       DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+       char            *fqdn;
+       const char      *netbiosname;
+       const char      *realm;
+
+       DEBUG(3, ("exchange_ds_rfr: RfrGetFQDNFromLegacyDN (0x1)\n"));
+
+//     if (!dcesrv_call_authenticated(dce_call)) {
+//             DEBUG(1, ("No challenge requested by client, cannot authenticate\n"));
+
+//     failure:
+//             r->out.ppszServerFQDN = talloc_array(mem_ctx, const char *, 2);
+//             r->out.ppszServerFQDN[0] = NULL;
+//             r->out.result = MAPI_E_LOGON_FAILED;
+//             return MAPI_E_LOGON_FAILED;
+//     }
+
+//     netbiosname = lpcfg_netbios_name(dce_call->conn->dce_ctx->lp_ctx);
+//     realm = lpcfg_realm(dce_call->conn->dce_ctx->lp_ctx);
+//     if (!netbiosname || !realm) {
+//             goto failure;
+//     }
+
+       fqdn = talloc_asprintf(mem_ctx, "%s.%s", netbiosname, realm);
+       r->out.ppszServerFQDN = talloc_array(mem_ctx, const char *, 2);
+       r->out.ppszServerFQDN[0] = strlower_talloc(mem_ctx, fqdn);
+       talloc_free(fqdn);
+       r->out.result = MAPI_E_SUCCESS;
+
+       return MAPI_E_SUCCESS;
 }
 
 
@@ -119,7 +146,7 @@ static NTSTATUS dcesrv_exchange_ds_rfr_dispatch(struct dcesrv_call_state *dce_ca
        const struct ndr_interface_table        *table;
        uint16_t                                opnum;
 
-       table = (const struct ndr_interface_table *) dce_call->context->iface->private;
+       table = (const struct ndr_interface_table *) dce_call->context->iface->private_data;
        opnum = dce_call->pkt.u.request.opnum;
 
        /* Sanity checks */