Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

Location:
vendor/current/source3/libnet
Files:
2 added
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libnet/libnet_dssync.c

    r414 r740  
    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/.h"
    2728
    2829/****************************************************************
     
    3132static int libnet_dssync_free_context(struct dssync_context *ctx)
    3233{
     34
     35
     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
    127133
    128134        ZERO_STRUCT(info28);
     
    165171        bind_info.info.info28 = info28;
    166172
    167         status = rpccli_drsuapi_DsBind(ctx->cli, mem_ctx,
     173        status = , mem_ctx,
    168174                                       &bind_guid,
    169175                                       &bind_info,
     
    219225        NTSTATUS status;
    220226        WERROR werr;
    221         int32_t level = 1;
     227        int32_t level = 1;
    222228        union drsuapi_DsNameRequest req;
    223         int32_t level_out;
     229        int32_t level_out;
    224230        struct drsuapi_DsNameString names[1];
    225231        union drsuapi_DsNameCtr ctr;
     232
    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 = , 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
     256
     257
     258
     259
     260
     261
    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                                            int32_t *plevel,
    304314                                            union drsuapi_DsGetNCChangesRequest *preq)
    305315{
    306316        NTSTATUS status;
    307317        uint32_t count;
    308         int32_t level;
     318        int32_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_D |
     326                                  DRSUAPI_D |
     327                                  DRSUAPI_D |
     328                                  DRSUAPI_D |
     329                                  DRSUAPI_D_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                                           int32_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        int32_t level_out = 0;
     439        int32_t out_level = 0;
    430440        int y;
    431441        bool last_query;
     442
    432443
    433444        if (!ctx->single_object_replication) {
     
    442453                struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL;
    443454                struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL;
     455
     456
    444457
    445458                if (level == 8) {
     
    453466                }
    454467
    455                 status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,
     468                status = , 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_));
    466479                        goto out;
    467480                }
     
    469482                if (!W_ERROR_IS_OK(werr)) {
    470483                        status = werror_to_ntstatus(werr);
     484
     485
     486
    471487                        goto out;
    472488                }
     
    525541                        mapping_ctr = &ctr6->mapping_ctr;
    526542
     543
     544
     545
    527546                        if (ctr6->more_data) {
    528547                                req->req8.highwatermark = ctr6->new_highwatermark;
     
    564583                        }
    565584                }
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
    566602        }
    567603
     
    577613        NTSTATUS status;
    578614
    579         int32_t level = 0;
     615        int32_t level = 0;
    580616        union drsuapi_DsGetNCChangesRequest req;
    581617        struct replUpToDateVectorBlob *old_utdv = NULL;
  • vendor/current/source3/libnet/libnet_dssync.h

    r414 r740  
    1919 */
    2020
     21
     22
     23
    2124struct dssync_context;
    2225
     
    2831                                    struct drsuapi_DsReplicaObjectListItemEx *objects,
    2932                                    struct drsuapi_DsReplicaOIDMapping_Ctr *mappings);
     33
     34
     35
     36
     37
    3038        NTSTATUS (*finish)(struct dssync_context *ctx, TALLOC_CTX *mem_ctx,
    3139                           struct replUpToDateVectorBlob *new_utdv);
     
    5664
    5765extern const struct dssync_ops libnet_dssync_keytab_ops;
     66
     67
     68
     69
     70
     71
     72
     73
  • vendor/current/source3/libnet/libnet_dssync_keytab.c

    r414 r740  
    2020
    2121#include "includes.h"
    22 #include "libnet/libnet.h"
     22#include "smb_krb5.h"
     23#include "ads.h"
     24#include "libnet/libnet_dssync.h"
     25#include "libnet/libnet_keytab.h"
    2326#include "librpc/gen_ndr/ndr_drsblobs.h"
    2427
    25 #if defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC)
     28#if defined(HAVE_ADS)
    2629
    2730static NTSTATUS keytab_startup(struct dssync_context *ctx, TALLOC_CTX *mem_ctx,
     
    5356                old_utdv = talloc(mem_ctx, struct replUpToDateVectorBlob);
    5457
    55                 ndr_err = ndr_pull_struct_blob(&entry->password, old_utdv,
    56                                 NULL, old_utdv,
     58                ndr_err = ndr_pull_struct_blob(&entry->password, old_utdv, old_utdv,
    5759                                (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
    5860                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    9294                }
    9395
    94                 ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, new_utdv,
     96                ndr_err = ndr_push_struct_blob(&blob, mem_ctx, new_utdv,
    9597                                (ndr_push_flags_fn_t)ndr_push_replUpToDateVectorBlob);
    9698                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    147149        uint32_t j;
    148150
    149         ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, NULL, &scb,
     151        ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, &scb,
    150152                        (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
    151153        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    204206                goto done;
    205207        }
    206         ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, NULL, pkb,
     208        ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, pkb,
    207209                        (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
    208210        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    272274                attr = &cur->object.attribute_ctr.attributes[i];
    273275
    274                 if (attr->attid == DRSUAPI_ATTRIBUTE_servicePrincipalName) {
     276                if (attr->attid == DRSUAPI_ATT_servicePrincipalName) {
    275277                        uint32_t count;
    276278                        num_spns = attr->value_ctr.num_values;
     
    296298
    297299                switch (attr->attid) {
    298                         case DRSUAPI_ATTRIBUTE_unicodePwd:
     300                        case DRSUAPI_ATT_unicodePwd:
    299301
    300302                                if (blob->length != 16) {
     
    317319                                kvno = cur->meta_data_ctr->meta_data[i].version;
    318320                                break;
    319                         case DRSUAPI_ATTRIBUTE_ntPwdHistory:
     321                        case DRSUAPI_ATT_ntPwdHistory:
    320322                                pwd_history_len = blob->length / 16;
    321323                                pwd_history = blob->data;
    322324                                break;
    323                         case DRSUAPI_ATTRIBUTE_userPrincipalName:
     325                        case DRSUAPI_ATT_userPrincipalName:
    324326                                pull_string_talloc(mem_ctx, NULL, 0, &upn,
    325327                                                   blob->data, blob->length,
    326328                                                   STR_UNICODE);
    327329                                break;
    328                         case DRSUAPI_ATTRIBUTE_sAMAccountName:
     330                        case DRSUAPI_ATT_sAMAccountName:
    329331                                pull_string_talloc(mem_ctx, NULL, 0, &name,
    330332                                                   blob->data, blob->length,
    331333                                                   STR_UNICODE);
    332334                                break;
    333                         case DRSUAPI_ATTRIBUTE_sAMAccountType:
     335                        case DRSUAPI_ATT_sAMAccountType:
    334336                                sam_type = IVAL(blob->data, 0);
    335337                                break;
    336                         case DRSUAPI_ATTRIBUTE_userAccountControl:
     338                        case DRSUAPI_ATT_userAccountControl:
    337339                                uacc = IVAL(blob->data, 0);
    338340                                break;
    339                         case DRSUAPI_ATTRIBUTE_supplementalCredentials:
     341                        case DRSUAPI_ATT_supplementalCredentials:
    340342                                status = parse_supplemental_credentials(mem_ctx,
    341343                                                                        blob,
     
    600602        return NT_STATUS_NOT_SUPPORTED;
    601603}
    602 #endif /* defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC) */
     604#endif /* defined(HAVE_ADS) */
    603605
    604606const struct dssync_ops libnet_dssync_keytab_ops = {
  • vendor/current/source3/libnet/libnet_join.c

    r597 r740  
    2020
    2121#include "includes.h"
    22 #include "libnet/libnet.h"
     22#include "ads.h"
     23#include "librpc/gen_ndr/ndr_libnet_join.h"
     24#include "libnet/libnet_join.h"
    2325#include "libcli/auth/libcli_auth.h"
    24 #include "../librpc/gen_ndr/cli_samr.h"
    25 #include "../librpc/gen_ndr/cli_lsa.h"
     26#include "../librpc/gen_ndr/ndr_samr_c.h"
     27#include "rpc_client/init_samr.h"
     28#include "../librpc/gen_ndr/ndr_lsa_c.h"
     29#include "rpc_client/cli_lsarpc.h"
     30#include "../librpc/gen_ndr/ndr_netlogon.h"
     31#include "rpc_client/cli_netlogon.h"
     32#include "lib/smbconf/smbconf.h"
     33#include "lib/smbconf/smbconf_reg.h"
     34#include "../libds/common/flags.h"
     35#include "secrets.h"
     36#include "rpc_client/init_lsa.h"
     37#include "rpc_client/cli_pipe.h"
     38#include "krb5_env.h"
     39#include "../libcli/security/security.h"
     40#include "passdb.h"
     41#include "libsmb/libsmb.h"
    2642
    2743/****************************************************************
     
    90106}
    91107
    92 #ifdef WITH_ADS
     108#ifdef _ADS
    93109
    94110/****************************************************************
     
    630646        return ADS_SUCCESS;
    631647}
    632 #endif /* WITH_ADS */
     648#endif /* _ADS */
    633649
    634650/****************************************************************
     
    685701                                   pass,
    686702                                   flags,
    687                                    Undefined, NULL);
     703                                   Undefined);
    688704}
    689705
     
    698714        struct rpc_pipe_client *pipe_hnd = NULL;
    699715        struct policy_handle lsa_pol;
    700         NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
     716        NTSTATUS status;
    701717        union lsa_PolicyInformation *info = NULL;
     718
    702719
    703720        status = libnet_join_connect_dc_ipc(r->in.dc_name,
     
    718735        }
    719736
     737
     738
    720739        status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
    721740                                        SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol);
     
    724743        }
    725744
    726         status = rpccli_lsa_QueryInfoPolicy2(pipe_hnd, mem_ctx,
     745        status = , mem_ctx,
    727746                                             &lsa_pol,
    728747                                             LSA_POLICY_INFO_DNS,
    729                                              &info);
    730         if (NT_STATUS_IS_OK(status)) {
     748                                             &info,
     749                                             &result);
     750        if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(result)) {
    731751                r->out.domain_is_ad = true;
    732752                r->out.netbios_domain_name = info->dns.name.string;
    733753                r->out.dns_domain_name = info->dns.dns_domain.string;
    734754                r->out.forest_name = info->dns.dns_forest.string;
    735                 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->dns.sid);
     755                r->out.domain_sid = (mem_ctx, info->dns.sid);
    736756                NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid);
    737757        }
    738758
    739759        if (!NT_STATUS_IS_OK(status)) {
    740                 status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
     760                status = , mem_ctx,
    741761                                                    &lsa_pol,
    742762                                                    LSA_POLICY_INFO_ACCOUNT_DOMAIN,
    743                                                     &info);
     763                                                    &info,
     764                                                    &result);
    744765                if (!NT_STATUS_IS_OK(status)) {
    745766                        goto done;
    746767                }
     768
     769
     770
     771
    747772
    748773                r->out.netbios_domain_name = info->account_domain.name.string;
    749                 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->account_domain.sid);
     774                r->out.domain_sid = (mem_ctx, info->account_domain.sid);
    750775                NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid);
    751776        }
    752777
    753         rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
     778        );
    754779        TALLOC_FREE(pipe_hnd);
    755780
     
    818843        struct rpc_pipe_client *pipe_hnd = NULL;
    819844        struct policy_handle sam_pol, domain_pol, user_pol;
    820         NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
     845        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
    821846        char *acct_name;
    822847        struct lsa_String lsa_acct_name;
     
    826851        struct samr_Ids name_types;
    827852        union samr_UserInfo user_info;
     853
    828854
    829855        struct samr_CryptPassword crypt_pwd;
     
    860886        }
    861887
    862         status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
     888        b = pipe_hnd->binding_handle;
     889
     890        status = dcerpc_samr_Connect2(b, mem_ctx,
    863891                                      pipe_hnd->desthost,
    864892                                      SAMR_ACCESS_ENUM_DOMAINS
    865893                                      | SAMR_ACCESS_LOOKUP_DOMAIN,
    866                                       &sam_pol);
    867         if (!NT_STATUS_IS_OK(status)) {
    868                 goto done;
    869         }
    870 
    871         status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
     894                                      &sam_pol,
     895                                      &result);
     896        if (!NT_STATUS_IS_OK(status)) {
     897                goto done;
     898        }
     899        if (!NT_STATUS_IS_OK(result)) {
     900                status = result;
     901                goto done;
     902        }
     903
     904        status = dcerpc_samr_OpenDomain(b, mem_ctx,
    872905                                        &sam_pol,
    873906                                        SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1
     
    875908                                        | SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
    876909                                        r->out.domain_sid,
    877                                         &domain_pol);
    878         if (!NT_STATUS_IS_OK(status)) {
     910                                        &domain_pol,
     911                                        &result);
     912        if (!NT_STATUS_IS_OK(status)) {
     913                goto done;
     914        }
     915        if (!NT_STATUS_IS_OK(result)) {
     916                status = result;
    879917                goto done;
    880918        }
     
    899937                        access_desired));
    900938
    901                 status = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
     939                status = , mem_ctx,
    902940                                                 &domain_pol,
    903941                                                 &lsa_acct_name,
     
    906944                                                 &user_pol,
    907945                                                 &access_granted,
    908                                                  &user_rid);
     946                                                 &user_rid,
     947                                                 &result);
     948                if (!NT_STATUS_IS_OK(status)) {
     949                        goto done;
     950                }
     951
     952                status = result;
    909953                if (!NT_STATUS_IS_OK(status) &&
    910954                    !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
     
    936980
    937981                if (NT_STATUS_IS_OK(status)) {
    938                         rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
    939                 }
    940         }
    941 
    942         status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
     982                        );
     983                }
     984        }
     985
     986        status = , mem_ctx,
    943987                                         &domain_pol,
    944988                                         1,
    945989                                         &lsa_acct_name,
    946990                                         &user_rids,
    947                                          &name_types);
    948         if (!NT_STATUS_IS_OK(status)) {
     991                                         &name_types,
     992                                         &result);
     993        if (!NT_STATUS_IS_OK(status)) {
     994                goto done;
     995        }
     996        if (!NT_STATUS_IS_OK(result)) {
     997                status = result;
    949998                goto done;
    950999        }
     
    9611010        /* Open handle on user */
    9621011
    963         status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
     1012        status = , mem_ctx,
    9641013                                      &domain_pol,
    9651014                                      SEC_FLAG_MAXIMUM_ALLOWED,
    9661015                                      user_rid,
    967                                       &user_pol);
    968         if (!NT_STATUS_IS_OK(status)) {
     1016                                      &user_pol,
     1017                                      &result);
     1018        if (!NT_STATUS_IS_OK(status)) {
     1019                goto done;
     1020        }
     1021        if (!NT_STATUS_IS_OK(result)) {
     1022                status = result;
    9691023                goto done;
    9701024        }