Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/libnet/libnet_dssync.c

    r414 r745  
    2222
    2323#include "includes.h"
    24 #include "libnet/libnet.h"
     24#include "libnet/libnet_dssync.h"
     25#include "rpc_client/cli_pipe.h"
    2526#include "../libcli/drsuapi/drsuapi.h"
    26 #include "../librpc/gen_ndr/cli_drsuapi.h"
     27#include "../librpc/gen_ndr/ndr_drsuapi_c.h"
    2728
    2829/****************************************************************
     
    3132static int libnet_dssync_free_context(struct dssync_context *ctx)
    3233{
     34        WERROR result;
     35        struct dcerpc_binding_handle *b;
     36
    3337        if (!ctx) {
    3438                return 0;
     
    3640
    3741        if (is_valid_policy_hnd(&ctx->bind_handle) && ctx->cli) {
    38                 rpccli_drsuapi_DsUnbind(ctx->cli, ctx, &ctx->bind_handle, NULL);
     42                b = ctx->cli->binding_handle;
     43                dcerpc_drsuapi_DsUnbind(b, ctx, &ctx->bind_handle, &result);
    3944        }
    4045
     
    125130        struct drsuapi_DsBindInfoCtr bind_info;
    126131        struct drsuapi_DsBindInfo28 info28;
     132        struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
    127133
    128134        ZERO_STRUCT(info28);
     
    165171        bind_info.info.info28 = info28;
    166172
    167         status = rpccli_drsuapi_DsBind(ctx->cli, mem_ctx,
     173        status = dcerpc_drsuapi_DsBind(b, mem_ctx,
    168174                                       &bind_guid,
    169175                                       &bind_info,
     
    219225        NTSTATUS status;
    220226        WERROR werr;
    221         int32_t level = 1;
     227        uint32_t level = 1;
    222228        union drsuapi_DsNameRequest req;
    223         int32_t level_out;
     229        uint32_t level_out;
    224230        struct drsuapi_DsNameString names[1];
    225231        union drsuapi_DsNameCtr ctr;
     232        struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
    226233
    227234        names[0].str = talloc_asprintf(mem_ctx, "%s\\", ctx->domain_name);
     
    236243        req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
    237244
    238         status = rpccli_drsuapi_DsCrackNames(ctx->cli, mem_ctx,
     245        status = dcerpc_drsuapi_DsCrackNames(b, mem_ctx,
    239246                                             &ctx->bind_handle,
    240247                                             level,
     
    246253                ctx->error_message = talloc_asprintf(ctx,
    247254                        "Failed to lookup DN for domain name: %s",
     255                        get_friendly_nt_error_msg(status));
     256                return status;
     257        }
     258
     259        if (!W_ERROR_IS_OK(werr)) {
     260                ctx->error_message = talloc_asprintf(ctx,
     261                        "Failed to lookup DN for domain name: %s",
    248262                        get_friendly_werror_msg(werr));
    249                 return status;
    250         }
    251 
    252         if (!W_ERROR_IS_OK(werr)) {
    253263                return werror_to_ntstatus(werr);
    254264        }
     
    301311                                            const char *dn,
    302312                                            struct replUpToDateVectorBlob *utdv,
    303                                             int32_t *plevel,
     313                                            uint32_t *plevel,
    304314                                            union drsuapi_DsGetNCChangesRequest *preq)
    305315{
    306316        NTSTATUS status;
    307317        uint32_t count;
    308         int32_t level;
     318        uint32_t level;
    309319        union drsuapi_DsGetNCChangesRequest req;
    310320        struct dom_sid null_sid;
     
    313323        struct drsuapi_DsReplicaCursorCtrEx *cursors = NULL;
    314324
    315         uint32_t replica_flags  = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE |
    316                                   DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP |
    317                                   DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS |
    318                                   DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS |
    319                                   DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED;
     325        uint32_t replica_flags  = DRSUAPI_DRS_WRIT_REP |
     326                                  DRSUAPI_DRS_INIT_SYNC |
     327                                  DRSUAPI_DRS_PER_SYNC |
     328                                  DRSUAPI_DRS_GET_ANC |
     329                                  DRSUAPI_DRS_NEVER_SYNCED;
    320330
    321331        ZERO_STRUCT(null_sid);
     
    416426static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
    417427                                           struct dssync_context *ctx,
    418                                            int32_t level,
     428                                           uint32_t level,
    419429                                           union drsuapi_DsGetNCChangesRequest *req,
    420430                                           struct replUpToDateVectorBlob **pnew_utdv)
     
    426436        struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
    427437        struct replUpToDateVectorBlob *new_utdv = NULL;
    428         int32_t level_out = 0;
    429         int32_t out_level = 0;
     438        uint32_t level_out = 0;
     439        uint32_t out_level = 0;
    430440        int y;
    431441        bool last_query;
     442        struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
    432443
    433444        if (!ctx->single_object_replication) {
     
    442453                struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL;
    443454                struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL;
     455                uint32_t linked_attributes_count = 0;
     456                struct drsuapi_DsReplicaLinkedAttribute *linked_attributes = NULL;
    444457
    445458                if (level == 8) {
     
    453466                }
    454467
    455                 status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,
     468                status = dcerpc_drsuapi_DsGetNCChanges(b, mem_ctx,
    456469                                                       &ctx->bind_handle,
    457470                                                       level,
     
    463476                        ctx->error_message = talloc_asprintf(ctx,
    464477                                "Failed to get NC Changes: %s",
    465                                 get_friendly_werror_msg(werr));
     478                                get_friendly_nt_error_msg(status));
    466479                        goto out;
    467480                }
     
    469482                if (!W_ERROR_IS_OK(werr)) {
    470483                        status = werror_to_ntstatus(werr);
     484                        ctx->error_message = talloc_asprintf(ctx,
     485                                "Failed to get NC Changes: %s",
     486                                get_friendly_werror_msg(werr));
    471487                        goto out;
    472488                }
     
    525541                        mapping_ctr = &ctr6->mapping_ctr;
    526542
     543                        linked_attributes = ctr6->linked_attributes;
     544                        linked_attributes_count = ctr6->linked_attributes_count;
     545
    527546                        if (ctr6->more_data) {
    528547                                req->req8.highwatermark = ctr6->new_highwatermark;
     
    564583                        }
    565584                }
     585
     586                if (linked_attributes_count == 0) {
     587                        continue;
     588                }
     589
     590                if (ctx->ops->process_links) {
     591                        status = ctx->ops->process_links(ctx, mem_ctx,
     592                                                         linked_attributes_count,
     593                                                         linked_attributes,
     594                                                         mapping_ctr);
     595                        if (!NT_STATUS_IS_OK(status)) {
     596                                ctx->error_message = talloc_asprintf(ctx,
     597                                        "Failed to call processing function: %s",
     598                                        nt_errstr(status));
     599                                goto out;
     600                        }
     601                }
    566602        }
    567603
     
    577613        NTSTATUS status;
    578614
    579         int32_t level = 0;
     615        uint32_t level = 0;
    580616        union drsuapi_DsGetNCChangesRequest req;
    581617        struct replUpToDateVectorBlob *old_utdv = NULL;
Note: See TracChangeset for help on using the changeset viewer.