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/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;
  • vendor/current/source3/libnet/libnet_dssync.h

    r414 r740  
    1919 */
    2020
     21#include "../librpc/gen_ndr/drsuapi.h"
     22#include "../librpc/gen_ndr/drsblobs.h"
     23
    2124struct dssync_context;
    2225
     
    2831                                    struct drsuapi_DsReplicaObjectListItemEx *objects,
    2932                                    struct drsuapi_DsReplicaOIDMapping_Ctr *mappings);
     33        NTSTATUS (*process_links)(struct dssync_context *ctx,
     34                                  TALLOC_CTX *mem_ctx,
     35                                  uint32_t count,
     36                                  struct drsuapi_DsReplicaLinkedAttribute *links,
     37                                  struct drsuapi_DsReplicaOIDMapping_Ctr *mappings);
    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;
     66extern const struct dssync_ops libnet_dssync_passdb_ops;
     67
     68/* The following definitions come from libnet/libnet_dssync.c  */
     69
     70NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx,
     71                                    struct dssync_context **ctx_p);
     72NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx,
     73                       struct dssync_context *ctx);
  • 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_ATTID_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_ATTID_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_ATTID_ntPwdHistory:
    320322                                pwd_history_len = blob->length / 16;
    321323                                pwd_history = blob->data;
    322324                                break;
    323                         case DRSUAPI_ATTRIBUTE_userPrincipalName:
     325                        case DRSUAPI_ATTID_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_ATTID_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_ATTID_sAMAccountType:
    334336                                sam_type = IVAL(blob->data, 0);
    335337                                break;
    336                         case DRSUAPI_ATTRIBUTE_userAccountControl:
     338                        case DRSUAPI_ATTID_userAccountControl:
    337339                                uacc = IVAL(blob->data, 0);
    338340                                break;
    339                         case DRSUAPI_ATTRIBUTE_supplementalCredentials:
     341                        case DRSUAPI_ATTID_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 HAVE_ADS
    93109
    94110/****************************************************************
     
    630646        return ADS_SUCCESS;
    631647}
    632 #endif /* WITH_ADS */
     648#endif /* HAVE_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, result;
    701717        union lsa_PolicyInformation *info = NULL;
     718        struct dcerpc_binding_handle *b;
    702719
    703720        status = libnet_join_connect_dc_ipc(r->in.dc_name,
     
    718735        }
    719736
     737        b = pipe_hnd->binding_handle;
     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 = dcerpc_lsa_QueryInfoPolicy2(b, 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 = dom_sid_dup(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 = dcerpc_lsa_QueryInfoPolicy(b, 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                if (!NT_STATUS_IS_OK(result)) {
     769                        status = result;
     770                        goto done;
     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 = dom_sid_dup(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        dcerpc_lsa_Close(b, mem_ctx, &lsa_pol, &result);
    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, result;
    821846        char *acct_name;
    822847        struct lsa_String lsa_acct_name;
     
    826851        struct samr_Ids name_types;
    827852        union samr_UserInfo user_info;
     853        struct dcerpc_binding_handle *b = NULL;
    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 = dcerpc_samr_CreateUser2(b, 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                        dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
     983                }
     984        }
     985
     986        status = dcerpc_samr_LookupNames(b, 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 = dcerpc_samr_OpenUser(b, 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        }
     
    9731027
    9741028        acct_flags |= ACB_PWNOEXP;
    975         if (r->out.domain_is_ad) {
    976 #if !defined(ENCTYPE_ARCFOUR_HMAC)
    977                 acct_flags |= ACB_USE_DES_KEY_ONLY;
    978 #endif
    979                 ;;
    980         }
    9811029
    9821030        /* Set account flags on machine account */
     
    9841032        user_info.info16.acct_flags = acct_flags;
    9851033
    986         status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
     1034        status = dcerpc_samr_SetUserInfo(b, mem_ctx,
    9871035                                         &user_pol,
    9881036                                         16,
    989                                          &user_info);
    990 
    991         if (!NT_STATUS_IS_OK(status)) {
    992 
    993                 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
    994                                        &user_pol);
     1037                                         &user_info,
     1038                                         &result);
     1039        if (!NT_STATUS_IS_OK(status)) {
     1040                dcerpc_samr_DeleteUser(b, mem_ctx,
     1041                                       &user_pol,
     1042                                       &result);
    9951043
    9961044                libnet_join_set_error_string(mem_ctx, r,
     
    10001048        }
    10011049
     1050        if (!NT_STATUS_IS_OK(result)) {
     1051                status = result;
     1052
     1053                dcerpc_samr_DeleteUser(b, mem_ctx,
     1054                                       &user_pol,
     1055                                       &result);
     1056
     1057                libnet_join_set_error_string(mem_ctx, r,
     1058                        "Failed to set account flags for machine account (%s)\n",
     1059                        nt_errstr(status));
     1060                goto done;
     1061        }
     1062
    10021063        /* Set password on machine account - first try level 26 */
    10031064
     
    10091070        user_info.info26.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON;
    10101071
    1011         status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
     1072        status = dcerpc_samr_SetUserInfo2(b, mem_ctx,
    10121073                                          &user_pol,
    10131074                                          26,
    1014                                           &user_info);
    1015 
    1016         if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) {
     1075                                          &user_info,
     1076                                          &result);
     1077
     1078        if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) {
    10171079
    10181080                /* retry with level 24 */
     
    10251087                user_info.info24.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON;
    10261088
    1027                 status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
     1089                status = dcerpc_samr_SetUserInfo2(b, mem_ctx,
    10281090                                                  &user_pol,
    10291091                                                  24,
    1030                                                   &user_info);
    1031         }
    1032 
    1033         if (!NT_STATUS_IS_OK(status)) {
    1034 
    1035                 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
    1036                                        &user_pol);
     1092                                                  &user_info,
     1093                                                  &result);
     1094        }
     1095
     1096        if (!NT_STATUS_IS_OK(status)) {
     1097
     1098                dcerpc_samr_DeleteUser(b, mem_ctx,
     1099                                       &user_pol,
     1100                                       &result);
    10371101
    10381102                libnet_join_set_error_string(mem_ctx, r,
     
    10411105                goto done;
    10421106        }
     1107        if (!NT_STATUS_IS_OK(result)) {
     1108                status = result;
     1109
     1110                dcerpc_samr_DeleteUser(b, mem_ctx,
     1111                                       &user_pol,
     1112                                       &result);
     1113
     1114                libnet_join_set_error_string(mem_ctx, r,
     1115                        "Failed to set password for machine account (%s)\n",
     1116                        nt_errstr(status));
     1117                goto done;
     1118        }
    10431119
    10441120        status = NT_STATUS_OK;
     
    10501126
    10511127        if (is_valid_policy_hnd(&sam_pol)) {
    1052                 rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
     1128                dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result);
    10531129        }
    10541130        if (is_valid_policy_hnd(&domain_pol)) {
    1055                 rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
     1131                dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result);
    10561132        }
    10571133        if (is_valid_policy_hnd(&user_pol)) {
    1058                 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
     1134                dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
    10591135        }
    10601136        TALLOC_FREE(pipe_hnd);
     
    11051181                                     machine_password,
    11061182                                     0,
    1107                                      Undefined, NULL);
     1183                                     Undefined);
    11081184        free(machine_account);
    11091185        free(machine_password);
     
    11181194                                             "",
    11191195                                             0,
    1120                                              Undefined, NULL);
     1196                                             Undefined);
    11211197        }
    11221198
     
    12101286        struct rpc_pipe_client *pipe_hnd = NULL;
    12111287        struct policy_handle sam_pol, domain_pol, user_pol;
    1212         NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
     1288        NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result;
    12131289        char *acct_name;
    12141290        uint32_t user_rid;
     
    12171293        struct samr_Ids name_types;
    12181294        union samr_UserInfo *info = NULL;
     1295        struct dcerpc_binding_handle *b = NULL;
    12191296
    12201297        ZERO_STRUCT(sam_pol);
     
    12411318        }
    12421319
    1243         status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
     1320        b = pipe_hnd->binding_handle;
     1321
     1322        status = dcerpc_samr_Connect2(b, mem_ctx,
    12441323                                      pipe_hnd->desthost,
    12451324                                      SEC_FLAG_MAXIMUM_ALLOWED,
    1246                                       &sam_pol);
    1247         if (!NT_STATUS_IS_OK(status)) {
    1248                 goto done;
    1249         }
    1250 
    1251         status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
     1325                                      &sam_pol,
     1326                                      &result);
     1327        if (!NT_STATUS_IS_OK(status)) {
     1328                goto done;
     1329        }
     1330        if (!NT_STATUS_IS_OK(result)) {
     1331                status = result;
     1332                goto done;
     1333        }
     1334
     1335        status = dcerpc_samr_OpenDomain(b, mem_ctx,
    12521336                                        &sam_pol,
    12531337                                        SEC_FLAG_MAXIMUM_ALLOWED,
    12541338                                        r->in.domain_sid,
    1255                                         &domain_pol);
    1256         if (!NT_STATUS_IS_OK(status)) {
     1339                                        &domain_pol,
     1340                                        &result);
     1341        if (!NT_STATUS_IS_OK(status)) {
     1342                goto done;
     1343        }
     1344        if (!NT_STATUS_IS_OK(result)) {
     1345                status = result;
    12571346                goto done;
    12581347        }
     
    12651354        init_lsa_String(&lsa_acct_name, acct_name);
    12661355
    1267         status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
     1356        status = dcerpc_samr_LookupNames(b, mem_ctx,
    12681357                                         &domain_pol,
    12691358                                         1,
    12701359                                         &lsa_acct_name,
    12711360                                         &user_rids,
    1272                                          &name_types);
    1273 
    1274         if (!NT_STATUS_IS_OK(status)) {
     1361                                         &name_types,
     1362                                         &result);
     1363
     1364        if (!NT_STATUS_IS_OK(status)) {
     1365                goto done;
     1366        }
     1367        if (!NT_STATUS_IS_OK(result)) {
     1368                status = result;
    12751369                goto done;
    12761370        }
     
    12871381        /* Open handle on user */
    12881382
    1289         status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
     1383        status = dcerpc_samr_OpenUser(b, mem_ctx,
    12901384                                      &domain_pol,
    12911385                                      SEC_FLAG_MAXIMUM_ALLOWED,
    12921386                                      user_rid,
    1293                                       &user_pol);
    1294         if (!NT_STATUS_IS_OK(status)) {
     1387                                      &user_pol,
     1388                                      &result);
     1389        if (!NT_STATUS_IS_OK(status)) {
     1390                goto done;
     1391        }
     1392        if (!NT_STATUS_IS_OK(result)) {
     1393                status = result;
    12951394                goto done;
    12961395        }
     
    12981397        /* Get user info */
    12991398
    1300         status = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,
     1399        status = dcerpc_samr_QueryUserInfo(b, mem_ctx,
    13011400                                           &user_pol,
    13021401                                           16,
    1303                                            &info);
    1304         if (!NT_STATUS_IS_OK(status)) {
    1305                 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
     1402                                           &info,
     1403                                           &result);
     1404        if (!NT_STATUS_IS_OK(status)) {
     1405                dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
     1406                goto done;
     1407        }
     1408        if (!NT_STATUS_IS_OK(result)) {
     1409                status = result;
     1410                dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
    13061411                goto done;
    13071412        }
     
    13111416        info->info16.acct_flags |= ACB_DISABLED;
    13121417
    1313         status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
     1418        status = dcerpc_samr_SetUserInfo(b, mem_ctx,
    13141419                                         &user_pol,
    13151420                                         16,
    1316                                          info);
    1317 
    1318         rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
     1421                                         info,
     1422                                         &result);
     1423        if (!NT_STATUS_IS_OK(status)) {
     1424                dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
     1425                goto done;
     1426        }
     1427        if (!NT_STATUS_IS_OK(result)) {
     1428                status = result;
     1429                dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
     1430                goto done;
     1431        }
     1432        status = result;
     1433        dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
    13191434
    13201435done:
    1321         if (pipe_hnd) {
     1436        if (pipe_hnd && b) {
    13221437                if (is_valid_policy_hnd(&domain_pol)) {
    1323                         rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
     1438                        dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result);
    13241439                }
    13251440                if (is_valid_policy_hnd(&sam_pol)) {
    1326                         rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
     1441                        dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result);
    13271442                }
    13281443                TALLOC_FREE(pipe_hnd);
     
    13411456static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r)
    13421457{
    1343         WERROR werr;
     1458        WERROR werr = WERR_OK;
     1459        sbcErr err;
    13441460        struct smbconf_ctx *ctx;
    13451461
    1346         werr = smbconf_init_reg(r, &ctx, NULL);
    1347         if (!W_ERROR_IS_OK(werr)) {
     1462        err = smbconf_init_reg(r, &ctx, NULL);
     1463        if (!SBC_ERROR_IS_OK(err)) {
     1464                werr = WERR_NO_SUCH_SERVICE;
    13481465                goto done;
    13491466        }
     
    13511468        if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) {
    13521469
    1353                 werr = smbconf_set_global_parameter(ctx, "security", "user");
    1354                 W_ERROR_NOT_OK_GOTO_DONE(werr);
    1355 
    1356                 werr = smbconf_set_global_parameter(ctx, "workgroup",
    1357                                                     r->in.domain_name);
     1470                err = smbconf_set_global_parameter(ctx, "security", "user");
     1471                if (!SBC_ERROR_IS_OK(err)) {
     1472                        werr = WERR_NO_SUCH_SERVICE;
     1473                        goto done;
     1474                }
     1475
     1476                err = smbconf_set_global_parameter(ctx, "workgroup",
     1477                                                   r->in.domain_name);
     1478                if (!SBC_ERROR_IS_OK(err)) {
     1479                        werr = WERR_NO_SUCH_SERVICE;
     1480                        goto done;
     1481                }
    13581482
    13591483                smbconf_delete_global_parameter(ctx, "realm");
     
    13611485        }
    13621486
    1363         werr = smbconf_set_global_parameter(ctx, "security", "domain");
    1364         W_ERROR_NOT_OK_GOTO_DONE(werr);
    1365 
    1366         werr = smbconf_set_global_parameter(ctx, "workgroup",
    1367                                             r->out.netbios_domain_name);
    1368         W_ERROR_NOT_OK_GOTO_DONE(werr);
     1487        err = smbconf_set_global_parameter(ctx, "security", "domain");
     1488        if (!SBC_ERROR_IS_OK(err)) {
     1489                werr = WERR_NO_SUCH_SERVICE;
     1490                goto done;
     1491        }
     1492
     1493        err = smbconf_set_global_parameter(ctx, "workgroup",
     1494                                           r->out.netbios_domain_name);
     1495        if (!SBC_ERROR_IS_OK(err)) {
     1496                werr = WERR_NO_SUCH_SERVICE;
     1497                goto done;
     1498        }
    13691499
    13701500        if (r->out.domain_is_ad) {
    1371                 werr = smbconf_set_global_parameter(ctx, "security", "ads");
    1372                 W_ERROR_NOT_OK_GOTO_DONE(werr);
    1373 
    1374                 werr = smbconf_set_global_parameter(ctx, "realm",
    1375                                                     r->out.dns_domain_name);
    1376                 W_ERROR_NOT_OK_GOTO_DONE(werr);
     1501                err = smbconf_set_global_parameter(ctx, "security", "ads");
     1502                if (!SBC_ERROR_IS_OK(err)) {
     1503                        werr = WERR_NO_SUCH_SERVICE;
     1504                        goto done;
     1505                }
     1506
     1507                err = smbconf_set_global_parameter(ctx, "realm",
     1508                                                   r->out.dns_domain_name);
     1509                if (!SBC_ERROR_IS_OK(err)) {
     1510                        werr = WERR_NO_SUCH_SERVICE;
     1511                        goto done;
     1512                }
    13771513        }
    13781514
     
    13881524{
    13891525        WERROR werr = WERR_OK;
     1526        sbcErr err;
    13901527        struct smbconf_ctx *ctx;
    13911528
    1392         werr = smbconf_init_reg(r, &ctx, NULL);
    1393         if (!W_ERROR_IS_OK(werr)) {
     1529        err = smbconf_init_reg(r, &ctx, NULL);
     1530        if (!SBC_ERROR_IS_OK(err)) {
     1531                werr = WERR_NO_SUCH_SERVICE;
    13941532                goto done;
    13951533        }
     
    13971535        if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
    13981536
    1399                 werr = smbconf_set_global_parameter(ctx, "security", "user");
    1400                 W_ERROR_NOT_OK_GOTO_DONE(werr);
    1401 
    1402                 werr = smbconf_delete_global_parameter(ctx, "workgroup");
    1403                 W_ERROR_NOT_OK_GOTO_DONE(werr);
     1537                err = smbconf_set_global_parameter(ctx, "security", "user");
     1538                if (!SBC_ERROR_IS_OK(err)) {
     1539                        werr = WERR_NO_SUCH_SERVICE;
     1540                        goto done;
     1541                }
     1542
     1543                err = smbconf_delete_global_parameter(ctx, "workgroup");
     1544                if (!SBC_ERROR_IS_OK(err)) {
     1545                        werr = WERR_NO_SUCH_SERVICE;
     1546                        goto done;
     1547                }
    14041548
    14051549                smbconf_delete_global_parameter(ctx, "realm");
     
    15991743        }
    16001744
    1601 #ifdef WITH_ADS
     1745#ifdef HAVE_ADS
    16021746        if (r->out.domain_is_ad &&
    16031747            !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) {
     
    16091753                }
    16101754        }
    1611 #endif /* WITH_ADS */
     1755#endif /* HAVE_ADS */
    16121756
    16131757        libnet_join_add_dom_rids_to_builtins(r->out.domain_sid);
     
    18171961        WERROR werr;
    18181962        struct cli_state *cli = NULL;
    1819 #ifdef WITH_ADS
     1963#ifdef HAVE_ADS
    18201964        ADS_STATUS ads_status;
    1821 #endif /* WITH_ADS */
     1965#endif /* HAVE_ADS */
    18221966
    18231967        if (!r->in.dc_name) {
     
    18602004        }
    18612005
    1862 #ifdef WITH_ADS
     2006#ifdef HAVE_ADS
     2007
     2008        create_local_private_krb5_conf_for_domain(
     2009                r->out.dns_domain_name, r->out.netbios_domain_name,
     2010                NULL, &cli->dest_ss, cli->desthost);
     2011
    18632012        if (r->out.domain_is_ad && r->in.account_ou &&
    18642013            !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) {
     
    18802029                r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE;
    18812030        }
    1882 #endif /* WITH_ADS */
     2031#endif /* HAVE_ADS */
    18832032
    18842033        if ((r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE) &&
     
    19552104        }
    19562105
     2106        ZERO_STRUCT(r->out);
     2107
    19572108        werr = libnet_join_pre_processing(mem_ctx, r);
    19582109        if (!W_ERROR_IS_OK(werr)) {
     
    20032154                        return WERR_SETUP_NOT_JOINED;
    20042155                }
    2005                 r->in.domain_sid = sid_dup_talloc(mem_ctx, &sid);
     2156                r->in.domain_sid = dom_sid_dup(mem_ctx, &sid);
    20062157                W_ERROR_HAVE_NO_MEMORY(r->in.domain_sid);
    20072158        }
     
    20382189        }
    20392190
    2040 #ifdef WITH_ADS
     2191#ifdef HAVE_ADS
    20412192        /* for net ads leave, try to delete the account.  If it works,
    20422193           no sense in disabling.  If it fails, we can still try to
    20432194           disable it. jmcd */
    2044            
     2195
    20452196        if (r->in.delete_machine_account) {
    20462197                ADS_STATUS ads_status;
     
    20652216                }
    20662217        }
    2067 #endif /* WITH_ADS */
     2218#endif /* HAVE_ADS */
    20682219
    20692220        /* The WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag really means
     
    20802231                        return ntstatus_to_werror(status);
    20812232                }
    2082                
     2233
    20832234                r->out.disabled_machine_account = true;
    20842235        }
  • vendor/current/source3/libnet/libnet_keytab.c

    r414 r740  
    2121
    2222#include "includes.h"
    23 #include "libnet/libnet.h"
     23#include "smb_krb5.h"
     24#include "ads.h"
     25#include "libnet/libnet_keytab.h"
    2426
    2527#ifdef HAVE_KRB5
  • vendor/current/source3/libnet/libnet_keytab.h

    r414 r740  
    4040};
    4141
     42/* The following definitions come from libnet/libnet_keytab.c  */
     43
     44krb5_error_code libnet_keytab_init(TALLOC_CTX *mem_ctx,
     45                                   const char *keytab_name,
     46                                   struct libnet_keytab_context **ctx);
     47krb5_error_code libnet_keytab_add(struct libnet_keytab_context *ctx);
     48
     49struct libnet_keytab_entry *libnet_keytab_search(struct libnet_keytab_context *ctx,
     50                                                 const char *principal, int kvno,
     51                                                 const krb5_enctype enctype,
     52                                                 TALLOC_CTX *mem_ctx);
     53NTSTATUS libnet_keytab_add_to_keytab_entries(TALLOC_CTX *mem_ctx,
     54                                             struct libnet_keytab_context *ctx,
     55                                             uint32_t kvno,
     56                                             const char *name,
     57                                             const char *prefix,
     58                                             const krb5_enctype enctype,
     59                                             DATA_BLOB blob);
    4260#endif /* HAVE_KRB5 */
  • vendor/current/source3/libnet/libnet_samsync.c

    r414 r740  
    2323
    2424#include "includes.h"
    25 #include "libnet/libnet.h"
    26 #include "../lib/crypto/crypto.h"
     25#include "libnet/libnet_samsync.h"
    2726#include "../libcli/samsync/samsync.h"
    2827#include "../libcli/auth/libcli_auth.h"
    29 #include "../librpc/gen_ndr/cli_netlogon.h"
     28#include "rpc_client/rpc_client.h"
     29#include "../librpc/gen_ndr/ndr_netlogon.h"
     30#include "../librpc/gen_ndr/ndr_netlogon_c.h"
     31#include "../libcli/security/security.h"
     32#include "messages.h"
    3033
    3134/**
     
    7275
    7376        if (domain_sid) {
    74                 ctx->domain_sid = sid_dup_talloc(mem_ctx, domain_sid);
     77                ctx->domain_sid = dom_sid_dup(mem_ctx, domain_sid);
    7578                NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid);
    7679
     
    7881                NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid_str);
    7982        }
     83
     84        ctx->msg_ctx = messaging_init(ctx, procid_self(),
     85                                      event_context_init(ctx));
     86        NT_STATUS_HAVE_NO_MEMORY(ctx->msg_ctx);
    8087
    8188        *ctx_p = ctx;
     
    194201                                     struct netr_ChangeLogEntry *e)
    195202{
    196         NTSTATUS result;
     203        NTSTATUS result, status;
    197204        NTSTATUS callback_status;
    198205        const char *logon_server = ctx->cli->desthost;
     
    202209        uint16_t restart_state = 0;
    203210        uint32_t sync_context = 0;
     211        struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
    204212
    205213        ZERO_STRUCT(return_authenticator);
     
    212220                if (ctx->single_object_replication &&
    213221                    !ctx->force_full_replication) {
    214                         result = rpccli_netr_DatabaseRedo(ctx->cli, mem_ctx,
     222                        status = dcerpc_netr_DatabaseRedo(b, mem_ctx,
    215223                                                          logon_server,
    216224                                                          computername,
     
    219227                                                          *e,
    220228                                                          0,
    221                                                           &delta_enum_array);
     229                                                          &delta_enum_array,
     230                                                          &result);
    222231                } else if (!ctx->force_full_replication &&
    223232                           sequence_num && (*sequence_num > 0)) {
    224                         result = rpccli_netr_DatabaseDeltas(ctx->cli, mem_ctx,
     233                        status = dcerpc_netr_DatabaseDeltas(b, mem_ctx,
    225234                                                            logon_server,
    226235                                                            computername,
     
    230239                                                            sequence_num,
    231240                                                            &delta_enum_array,
    232                                                             0xffff);
     241                                                            0xffff,
     242                                                            &result);
    233243                } else {
    234                         result = rpccli_netr_DatabaseSync2(ctx->cli, mem_ctx,
     244                        status = dcerpc_netr_DatabaseSync2(b, mem_ctx,
    235245                                                           logon_server,
    236246                                                           computername,
     
    241251                                                           &sync_context,
    242252                                                           &delta_enum_array,
    243                                                            0xffff);
    244                 }
    245 
    246                 if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) {
    247                         return result;
     253                                                           0xffff,
     254                                                           &result);
     255                }
     256
     257                if (!NT_STATUS_IS_OK(status)) {
     258                        return status;
    248259                }
    249260
     
    253264                        DEBUG(0,("credentials chain check failed\n"));
    254265                        return NT_STATUS_ACCESS_DENIED;
     266                }
     267
     268                if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_SUPPORTED)) {
     269                        return result;
    255270                }
    256271
     
    397412        blob = data_blob_const(r->array, r->length);
    398413
    399         ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, str,
     414        ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, str,
    400415                       (ndr_pull_flags_fn_t)ndr_pull_netr_AcctLockStr);
    401416
  • vendor/current/source3/libnet/libnet_samsync.h

    r414 r740  
    1818 */
    1919
     20#include "../librpc/gen_ndr/netlogon.h"
    2021
    2122enum net_samsync_mode {
     
    7576
    7677        struct rpc_pipe_client *cli;
     78        struct messaging_context *msg_ctx;
    7779
    7880        const struct samsync_ops *ops;
     
    8587extern const struct samsync_ops libnet_samsync_display_ops;
    8688extern const struct samsync_ops libnet_samsync_passdb_ops;
     89
     90/* The following definitions come from libnet/libnet_samsync.c  */
     91
     92NTSTATUS libnet_samsync_init_context(TALLOC_CTX *mem_ctx,
     93                                     const struct dom_sid *domain_sid,
     94                                     struct samsync_context **ctx_p);
     95NTSTATUS libnet_samsync(enum netr_SamDatabaseID database_id,
     96                        struct samsync_context *ctx);
     97NTSTATUS pull_netr_AcctLockStr(TALLOC_CTX *mem_ctx,
     98                               struct lsa_BinaryString *r,
     99                               struct netr_AcctLockStr **str_p);
  • vendor/current/source3/libnet/libnet_samsync_display.c

    r414 r740  
    2525
    2626#include "includes.h"
    27 #include "libnet/libnet.h"
     27#include "libnet/libnet_samsync.h"
     28#include "passdb.h"
    2829
    2930static void display_group_mem_info(uint32_t rid,
     
    207208                break;
    208209        case NETR_DELTA_POLICY:
    209                 printf("Policy\n");
     210                printf("Policy: %s\n",
     211                        sid_string_dbg(id.sid));
    210212                break;
    211213        case NETR_DELTA_TRUSTED_DOMAIN:
     
    214216                break;
    215217        case NETR_DELTA_DELETE_TRUST:
    216                 printf("Delete Trust: %d\n",
    217                         u.delete_trust.unknown);
     218                printf("Delete Trust: %s\n",
     219                        sid_string_dbg(id.sid));
    218220                break;
    219221        case NETR_DELTA_ACCOUNT:
    220                 printf("Account\n");
     222                printf("Account: %s\n",
     223                        sid_string_dbg(id.sid));
    221224                break;
    222225        case NETR_DELTA_DELETE_ACCOUNT:
    223                 printf("Delete Account: %d\n",
    224                         u.delete_account.unknown);
     226                printf("Delete Account: %s\n",
     227                        sid_string_dbg(id.sid));
    225228                break;
    226229        case NETR_DELTA_SECRET:
    227                 printf("Secret\n");
     230                printf("Secret: %s\n",
     231                        id.name);
    228232                break;
    229233        case NETR_DELTA_DELETE_SECRET:
    230                 printf("Delete Secret: %d\n",
    231                         u.delete_secret.unknown);
     234                printf("Delete Secret: %s\n",
     235                        id.name);
    232236                break;
    233237        case NETR_DELTA_DELETE_GROUP2:
  • vendor/current/source3/libnet/libnet_samsync_keytab.c

    r414 r740  
    2020
    2121#include "includes.h"
    22 #include "libnet/libnet.h"
    23 
    24 #if defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC)
     22#include "smb_krb5.h"
     23#include "ads.h"
     24#include "libnet/libnet_keytab.h"
     25#include "libnet/libnet_samsync.h"
     26#include "krb5_env.h"
     27
     28#if defined(HAVE_ADS)
    2529
    2630/****************************************************************
     
    2933static NTSTATUS keytab_ad_connect(TALLOC_CTX *mem_ctx,
    3034                                  const char *domain_name,
     35                                  const char *dc,
    3136                                  const char *username,
    3237                                  const char *password,
    3338                                  struct libnet_keytab_context *ctx)
    3439{
    35         NTSTATUS status;
    3640        ADS_STATUS ad_status;
    3741        ADS_STRUCT *ads;
    38         struct netr_DsRGetDCNameInfo *info = NULL;
    39         const char *dc;
    40 
    41         status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, NULL, 0, &info);
    42         if (!NT_STATUS_IS_OK(status)) {
    43                 return status;
    44         }
    45 
    46         dc = strip_hostname(info->dc_unc);
    4742
    4843        ads = ads_init(NULL, domain_name, dc);
     
    116111        uint64_t old_sequence_num = 0;
    117112        const char *principal = NULL;
     113        struct netr_DsRGetDCNameInfo *info = NULL;
     114        const char *dc;
    118115
    119116        ret = libnet_keytab_init(mem_ctx, ctx->output_filename, &keytab_ctx);
     
    122119        }
    123120
     121        status = dsgetdcname(mem_ctx, ctx->msg_ctx,
     122                             ctx->domain_name, NULL, NULL, 0, &info);
     123        if (!NT_STATUS_IS_OK(status)) {
     124                return status;
     125        }
     126
     127        dc = strip_hostname(info->dc_unc);
     128
    124129        keytab_ctx->clean_old_entries = ctx->clean_old_entries;
    125130        ctx->private_data = keytab_ctx;
     
    127132        status = keytab_ad_connect(mem_ctx,
    128133                                   ctx->domain_name,
     134                                   dc,
    129135                                   ctx->username,
    130136                                   ctx->password,
     
    294300}
    295301
    296 #endif /* defined(HAVE_ADS) && defined(ENCTYPE_ARCFOUR_HMAC) */
     302#endif /* defined(HAVE_ADS) */
    297303
    298304const struct samsync_ops libnet_samsync_keytab_ops = {
  • vendor/current/source3/libnet/libnet_samsync_ldif.c

    r478 r740  
    2626#include "includes.h"
    2727#include "libnet/libnet_samsync.h"
     28#include "smbldap.h"
     29#include "transfer_file.h"
     30#include "passdb.h"
    2831
    2932#ifdef HAVE_LDAP
     
    8487                len = strlen(suffix);
    8588                suffix_attr = (char*)SMB_MALLOC(len+1);
     89                if (!suffix_attr) {
     90                        return NT_STATUS_NO_MEMORY;
     91                }
    8692                memcpy(suffix_attr, suffix, len);
    8793                suffix_attr[len] = '\0';
  • vendor/current/source3/libnet/libnet_samsync_passdb.c

    r414 r740  
    2525
    2626#include "includes.h"
    27 #include "libnet/libnet.h"
     27#include "system/passwd.h"
     28#include "libnet/libnet_samsync.h"
     29#include "../libcli/security/security.h"
     30#include "passdb.h"
    2831
    2932/* Convert a struct samu_DELTA to a struct samu. */
     
    179182                pdb_sethexhours(newstr, r->logon_hours.bits);
    180183                if (!strequal(oldstr, newstr))
    181                         pdb_set_hours(account, r->logon_hours.bits, PDB_CHANGED);
     184                        pdb_set_hours(account, r->logon_hours.bits,
     185                                      pdb_get_hours_len(account), PDB_CHANGED);
    182186        }
    183187
     
    300304        GROUP_MAP map;
    301305        struct group *grp;
    302         DOM_SID user_sid;
    303         DOM_SID group_sid;
     306        struct dom_sid user_sid;
     307        struct dom_sid group_sid;
    304308        struct passwd *passwd = NULL;
    305309        fstring sid_string;
     
    319323        }
    320324
    321         sid_copy(&user_sid, get_global_sam_sid());
    322         sid_append_rid(&user_sid, r->rid);
     325        sid_compose(&user_sid, get_global_sam_sid(), r->rid);
    323326
    324327        DEBUG(3, ("Attempting to find SID %s for user %s in the passdb\n",
     
    387390        fstring comment;
    388391        struct group *grp = NULL;
    389         DOM_SID group_sid;
     392        struct dom_sid group_sid;
    390393        fstring sid_string;
    391394        GROUP_MAP map;
     
    396399
    397400        /* add the group to the mapping table */
    398         sid_copy(&group_sid, get_global_sam_sid());
    399         sid_append_rid(&group_sid, rid);
     401        sid_compose(&group_sid, get_global_sam_sid(), rid);
    400402        sid_to_fstring(sid_string, &group_sid);
    401403
     
    452454        char **nt_members = NULL;
    453455        char **unix_members;
    454         DOM_SID group_sid;
     456        struct dom_sid group_sid;
    455457        GROUP_MAP map;
    456458        struct group *grp;
     
    460462        }
    461463
    462         sid_copy(&group_sid, get_global_sam_sid());
    463         sid_append_rid(&group_sid, rid);
     464        sid_compose(&group_sid, get_global_sam_sid(), rid);
    464465
    465466        if (!get_domain_group_from_sid(group_sid, &map)) {
     
    486487        for (i=0; i < r->num_rids; i++) {
    487488                struct samu *member = NULL;
    488                 DOM_SID member_sid;
     489                struct dom_sid member_sid;
    489490
    490491                if ( !(member = samu_new(mem_ctx)) ) {
     
    492493                }
    493494
    494                 sid_copy(&member_sid, get_global_sam_sid());
    495                 sid_append_rid(&member_sid, r->rids[i]);
     495                sid_compose(&member_sid, get_global_sam_sid(), r->rids[i]);
    496496
    497497                if (!pdb_getsampwsid(member, &member_sid)) {
     
    574574                                 uint32_t rid,
    575575                                 struct netr_DELTA_ALIAS *r,
    576                                  const DOM_SID *dom_sid)
     576                                 const struct dom_sid *dom_sid)
    577577{
    578578        fstring name;
    579579        fstring comment;
    580580        struct group *grp = NULL;
    581         DOM_SID alias_sid;
     581        struct dom_sid alias_sid;
    582582        fstring sid_string;
    583583        GROUP_MAP map;
     
    588588
    589589        /* Find out whether the group is already mapped */
    590         sid_copy(&alias_sid, dom_sid);
    591         sid_append_rid(&alias_sid, rid);
     590        sid_compose(&alias_sid, dom_sid, rid);
    592591        sid_to_fstring(sid_string, &alias_sid);
    593592
     
    614613        map.sid = alias_sid;
    615614
    616         if (sid_equal(dom_sid, &global_sid_Builtin))
     615        if (dom_sid_equal(dom_sid, &global_sid_Builtin))
    617616                map.sid_name_use = SID_NAME_WKN_GRP;
    618617        else
     
    636635                                uint32_t rid,
    637636                                struct netr_DELTA_ALIAS_MEMBER *r,
    638                                 const DOM_SID *dom_sid)
     637                                const struct dom_sid *dom_sid)
    639638{
    640639        return NT_STATUS_OK;
Note: See TracChangeset for help on using the changeset viewer.