Changeset 989 for vendor/current/source4


Ignore:
Timestamp:
Nov 25, 2016, 8:04:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.7

Location:
vendor/current/source4
Files:
2 added
37 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/dns_server/dns_crypto.c

    r988 r989  
    147147        tkey = dns_find_tkey(dns->tkeys, state->tsig->name);
    148148        if (tkey == NULL) {
     149                /*
     150                 * We must save the name for use in the TSIG error
     151                 * response and have no choice here but to save the
     152                 * keyname from the TSIG request.
     153                 */
     154                state->key_name = talloc_strdup(state->mem_ctx,
     155                                                state->tsig->name);
     156                if (state->key_name == NULL) {
     157                        return WERR_NOMEM;
     158                }
    149159                state->tsig_error = DNS_RCODE_BADKEY;
    150160                return DNS_ERR(NOTAUTH);
     161        }
     162
     163        /*
     164         * Remember the keyname that found an existing tkey, used
     165         * later to fetch the key with dns_find_tkey() when signing
     166         * and adding a TSIG record with MAC.
     167         */
     168        state->key_name = talloc_strdup(state->mem_ctx, tkey->name);
     169        if (state->key_name == NULL) {
     170                return WERR_NOMEM;
    151171        }
    152172
     
    208228        }
    209229
    210         /*FIXME: Why is there too much padding? */
    211         buffer_len -= 2;
    212 
    213230        /* Now we also need to count down the additional record counter */
    214231        arcount = RSVAL(buffer, 10);
     
    218235                                    buffer, buffer_len, &sig);
    219236        if (NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) {
    220                 return DNS_ERR(BADKEY);
     237                state->tsig_error = DNS_RCODE_BADSIG;
     238                return DNS_ERR(NOTAUTH);
    221239        }
    222240
     
    227245
    228246        state->authenticated = true;
    229         state->key_name = talloc_strdup(state->mem_ctx, tkey->name);
    230         if (state->key_name == NULL) {
    231                 return WERR_NOMEM;
    232         }
    233 
     247
     248        return WERR_OK;
     249}
     250
     251static WERROR dns_tsig_compute_mac(TALLOC_CTX *mem_ctx,
     252                                   struct dns_request_state *state,
     253                                   struct dns_name_packet *packet,
     254                                   struct dns_server_tkey *tkey,
     255                                   time_t current_time,
     256                                   DATA_BLOB *_psig)
     257{
     258        NTSTATUS status;
     259        enum ndr_err_code ndr_err;
     260        DATA_BLOB packet_blob, tsig_blob, sig;
     261        uint8_t *buffer = NULL;
     262        uint8_t *p = NULL;
     263        size_t buffer_len = 0;
     264        struct dns_fake_tsig_rec *check_rec = talloc_zero(mem_ctx,
     265                        struct dns_fake_tsig_rec);
     266        size_t mac_size = 0;
     267
     268        if (check_rec == NULL) {
     269                return WERR_NOMEM;
     270        }
     271
     272        /* first build and verify check packet */
     273        check_rec->name = talloc_strdup(check_rec, tkey->name);
     274        if (check_rec->name == NULL) {
     275                return WERR_NOMEM;
     276        }
     277        check_rec->rr_class = DNS_QCLASS_ANY;
     278        check_rec->ttl = 0;
     279        check_rec->algorithm_name = talloc_strdup(check_rec, tkey->algorithm);
     280        if (check_rec->algorithm_name == NULL) {
     281                return WERR_NOMEM;
     282        }
     283        check_rec->time_prefix = 0;
     284        check_rec->time = current_time;
     285        check_rec->fudge = 300;
     286        check_rec->error = state->tsig_error;
     287        check_rec->other_size = 0;
     288        check_rec->other_data = NULL;
     289
     290        ndr_err = ndr_push_struct_blob(&packet_blob, mem_ctx, packet,
     291                (ndr_push_flags_fn_t)ndr_push_dns_name_packet);
     292        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     293                DEBUG(1, ("Failed to push packet: %s!\n",
     294                          ndr_errstr(ndr_err)));
     295                return DNS_ERR(SERVER_FAILURE);
     296        }
     297
     298        ndr_err = ndr_push_struct_blob(&tsig_blob, mem_ctx, check_rec,
     299                (ndr_push_flags_fn_t)ndr_push_dns_fake_tsig_rec);
     300        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     301                DEBUG(1, ("Failed to push packet: %s!\n",
     302                          ndr_errstr(ndr_err)));
     303                return DNS_ERR(SERVER_FAILURE);
     304        }
     305
     306        if (state->tsig != NULL) {
     307                mac_size = state->tsig->rdata.tsig_record.mac_size;
     308        }
     309
     310        buffer_len = mac_size;
     311
     312        buffer_len += packet_blob.length;
     313        if (buffer_len < packet_blob.length) {
     314                return WERR_INVALID_PARAM;
     315        }
     316        buffer_len += tsig_blob.length;
     317        if (buffer_len < tsig_blob.length) {
     318                return WERR_INVALID_PARAM;
     319        }
     320
     321        buffer = talloc_zero_array(mem_ctx, uint8_t, buffer_len);
     322        if (buffer == NULL) {
     323                return WERR_NOMEM;
     324        }
     325
     326        p = buffer;
     327
     328        /*
     329         * RFC 2845 "4.2 TSIG on Answers", how to lay out the buffer
     330         * that we're going to sign:
     331         * 1. MAC of request (if present)
     332         * 2. Outgoing packet
     333         * 3. TSIG record
     334         */
     335        if (mac_size > 0) {
     336                memcpy(p, state->tsig->rdata.tsig_record.mac, mac_size);
     337                p += mac_size;
     338        }
     339
     340        memcpy(p, packet_blob.data, packet_blob.length);
     341        p += packet_blob.length;
     342
     343        memcpy(p, tsig_blob.data, tsig_blob.length);
     344
     345        status = gensec_sign_packet(tkey->gensec, mem_ctx, buffer, buffer_len,
     346                                    buffer, buffer_len, &sig);
     347        if (!NT_STATUS_IS_OK(status)) {
     348                return ntstatus_to_werror(status);
     349        }
     350
     351        *_psig = sig;
    234352        return WERR_OK;
    235353}
     
    242360{
    243361        WERROR werror;
    244         NTSTATUS status;
    245         enum ndr_err_code ndr_err;
    246362        time_t current_time = time(NULL);
    247         DATA_BLOB packet_blob, tsig_blob, sig;
    248         uint8_t *buffer = NULL;
    249         size_t buffer_len = 0;
    250         struct dns_server_tkey * tkey = NULL;
    251         struct dns_res_rec *tsig = talloc_zero(mem_ctx, struct dns_res_rec);
    252 
    253         struct dns_fake_tsig_rec *check_rec = talloc_zero(mem_ctx,
    254                         struct dns_fake_tsig_rec);
    255 
     363        struct dns_res_rec *tsig = NULL;
     364        DATA_BLOB sig = (DATA_BLOB) {
     365                .data = NULL,
     366                .length = 0
     367        };
     368
     369        tsig = talloc_zero(mem_ctx, struct dns_res_rec);
    256370        if (tsig == NULL) {
    257371                return WERR_NOMEM;
    258372        }
    259373
    260         if (check_rec == NULL) {
    261                 return WERR_NOMEM;
    262         }
    263 
    264         tkey = dns_find_tkey(dns->tkeys, state->key_name);
    265         if (tkey == NULL) {
    266                 /* FIXME: read up on what to do when we can't find a key */
    267                 return WERR_OK;
    268         }
    269 
    270         /* first build and verify check packet */
    271         check_rec->name = talloc_strdup(check_rec, tkey->name);
    272         if (check_rec->name == NULL) {
    273                 return WERR_NOMEM;
    274         }
    275         check_rec->rr_class = DNS_QCLASS_ANY;
    276         check_rec->ttl = 0;
    277         check_rec->algorithm_name = talloc_strdup(check_rec, tkey->algorithm);
    278         if (check_rec->algorithm_name == NULL) {
    279                 return WERR_NOMEM;
    280         }
    281         check_rec->time_prefix = 0;
    282         check_rec->time = current_time;
    283         check_rec->fudge = 300;
    284         check_rec->error = state->tsig_error;
    285         check_rec->other_size = 0;
    286         check_rec->other_data = NULL;
    287 
    288         ndr_err = ndr_push_struct_blob(&packet_blob, mem_ctx, packet,
    289                 (ndr_push_flags_fn_t)ndr_push_dns_name_packet);
    290         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    291                 DEBUG(1, ("Failed to push packet: %s!\n",
    292                           ndr_errstr(ndr_err)));
    293                 return DNS_ERR(SERVER_FAILURE);
    294         }
    295 
    296         ndr_err = ndr_push_struct_blob(&tsig_blob, mem_ctx, check_rec,
    297                 (ndr_push_flags_fn_t)ndr_push_dns_fake_tsig_rec);
    298         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    299                 DEBUG(1, ("Failed to push packet: %s!\n",
    300                           ndr_errstr(ndr_err)));
    301                 return DNS_ERR(SERVER_FAILURE);
    302         }
    303 
    304         buffer_len = packet_blob.length + tsig_blob.length;
    305         buffer = talloc_zero_array(mem_ctx, uint8_t, buffer_len);
    306         if (buffer == NULL) {
    307                 return WERR_NOMEM;
    308         }
    309 
    310         memcpy(buffer, packet_blob.data, packet_blob.length);
    311         memcpy(buffer+packet_blob.length, tsig_blob.data, tsig_blob.length);
    312 
    313 
    314         status = gensec_sign_packet(tkey->gensec, mem_ctx, buffer, buffer_len,
    315                                     buffer, buffer_len, &sig);
    316         if (!NT_STATUS_IS_OK(status)) {
    317                 return ntstatus_to_werror(status);
    318         }
    319 
    320         tsig->name = talloc_strdup(tsig, check_rec->name);
     374        if (state->tsig_error == DNS_RCODE_OK) {
     375                struct dns_server_tkey *tkey = dns_find_tkey(
     376                        dns->tkeys, state->key_name);
     377                if (tkey == NULL) {
     378                        return DNS_ERR(SERVER_FAILURE);
     379                }
     380
     381                werror = dns_tsig_compute_mac(mem_ctx, state, packet,
     382                                              tkey, current_time, &sig);
     383                if (!W_ERROR_IS_OK(werror)) {
     384                        return werror;
     385                }
     386        }
     387
     388        tsig->name = talloc_strdup(tsig, state->key_name);
    321389        if (tsig->name == NULL) {
    322390                return WERR_NOMEM;
    323391        }
    324         tsig->rr_class = check_rec->rr_class;
     392        tsig->rr_class = DNS_QCLASS_ANY;
    325393        tsig->rr_type = DNS_QTYPE_TSIG;
    326394        tsig->ttl = 0;
    327395        tsig->length = UINT16_MAX;
    328         tsig->rdata.tsig_record.algorithm_name = talloc_strdup(tsig,
    329                         check_rec->algorithm_name);
    330         tsig->rdata.tsig_record.time_prefix = check_rec->time_prefix;
    331         tsig->rdata.tsig_record.time = check_rec->time;
    332         tsig->rdata.tsig_record.fudge = check_rec->fudge;
     396        tsig->rdata.tsig_record.algorithm_name = talloc_strdup(tsig, "gss-tsig");
     397        tsig->rdata.tsig_record.time_prefix = 0;
     398        tsig->rdata.tsig_record.time = current_time;
     399        tsig->rdata.tsig_record.fudge = 300;
    333400        tsig->rdata.tsig_record.error = state->tsig_error;
    334401        tsig->rdata.tsig_record.original_id = packet->id;
    335402        tsig->rdata.tsig_record.other_size = 0;
    336403        tsig->rdata.tsig_record.other_data = NULL;
    337         tsig->rdata.tsig_record.mac_size = sig.length;
    338         tsig->rdata.tsig_record.mac = talloc_memdup(tsig, sig.data, sig.length);
    339 
     404        if (sig.length > 0) {
     405                tsig->rdata.tsig_record.mac_size = sig.length;
     406                tsig->rdata.tsig_record.mac = talloc_memdup(tsig, sig.data, sig.length);
     407        }
    340408
    341409        if (packet->arcount == 0) {
  • vendor/current/source4/dns_server/dns_server.c

    r988 r989  
    153153        }
    154154
    155         ret = dns_verify_tsig(dns, state, &state->state, &state->in_packet, in);
    156         if (!W_ERROR_IS_OK(ret)) {
    157                 DEBUG(1, ("Failed to verify TSIG!\n"));
    158                 state->dns_err = werr_to_dns_err(ret);
    159                 tevent_req_done(req);
    160                 return tevent_req_post(req, ev);
    161         }
    162 
    163155        if (state->in_packet.operation & DNS_FLAG_REPLY) {
    164156                DEBUG(1, ("Won't reply to replies.\n"));
     
    176168
    177169        state->out_packet = state->in_packet;
     170
     171        ret = dns_verify_tsig(dns, state, &state->state, &state->out_packet, in);
     172        if (!W_ERROR_IS_OK(ret)) {
     173                state->dns_err = werr_to_dns_err(ret);
     174                tevent_req_done(req);
     175                return tevent_req_post(req, ev);
     176        }
    178177
    179178        switch (state->in_packet.operation & DNS_OPCODE) {
     
    237236        }
    238237        if ((state->dns_err != DNS_RCODE_OK) &&
    239             (state->dns_err != DNS_RCODE_NXDOMAIN)) {
     238            (state->dns_err != DNS_RCODE_NXDOMAIN) &&
     239            (state->dns_err != DNS_RCODE_NOTAUTH))
     240        {
    240241                goto drop;
    241242        }
  • vendor/current/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c

    r988 r989  
    420420        }
    421421
     422        /*
     423         * We skip this check under dbcheck to allow fixing of other
     424         * attributes even if an attribute is missing.  This matters
     425         * for CN=RID Set as the required attribute rIDNextRid is not
     426         * replicated.
     427         */
    422428        if (found_must_contain[0] != NULL &&
    423             ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") == 0) {
     429            ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") == 0 &&
     430            ldb_request_get_control(ac->req, DSDB_CONTROL_DBCHECK) == NULL) {
    424431                ldb_asprintf_errstring(ldb, "objectclass_attrs: at least one mandatory attribute ('%s') on entry '%s' wasn't specified!",
    425432                                       found_must_contain[0],
  • vendor/current/source4/dsdb/samdb/ldb_modules/ranged_results.c

    r988 r989  
    202202        for (i = 0; req->op.search.attrs && req->op.search.attrs[i]; i++) {
    203203                char *p;
     204                size_t range_len = strlen(";range=");
     205
    204206                new_attrs = talloc_realloc(req, new_attrs, const char *, i+2);
    205207                new_attrs[i] = req->op.search.attrs[i];
     
    209211                        continue;
    210212                }
    211                 if (strncasecmp(p, ";range=", strlen(";range=")) != 0) {
     213                if (strncasecmp(p, ";range=", range_len) != 0) {
    212214                        continue;
    213215                }
    214216                end = (unsigned int)-1;
    215                 if (sscanf(p, ";range=%u-*", &start) != 1) {
    216                         if (sscanf(p, ";range=%u-%u", &start, &end) != 2) {
     217                if (sscanf(p + range_len, "%u-*", &start) != 1) {
     218                        if (sscanf(p + range_len, "%u-%u", &start, &end) != 2) {
    217219                                ldb_asprintf_errstring(ldb,
    218220                                        "range request error: "
  • vendor/current/source4/heimdal/kdc/misc.c

    r988 r989  
    4141              krb5_const_principal principal,
    4242              unsigned flags,
    43               krb5uint32 *kvno_ptr,
     43              krb5int32 *kvno_ptr,
    4444              HDB **db,
    4545              hdb_entry_ex **h)
  • vendor/current/source4/heimdal/lib/asn1/krb5.asn1

    r988 r989  
    361361EncryptedData ::= SEQUENCE {
    362362        etype[0]                ENCTYPE, -- EncryptionType
    363         kvno[1]                 krb5uint32 OPTIONAL,
     363        kvno[1]                 krb5int32 OPTIONAL,
    364364        cipher[2]               OCTET STRING -- ciphertext
    365365}
  • vendor/current/source4/heimdal/lib/krb5/mcache.c

    r988 r989  
    156156}
    157157
     158static void KRB5_CALLCONV
     159mcc_destroy_internal(krb5_context context,
     160                     krb5_mcache *m)
     161{
     162    struct link *l;
     163
     164    if (m->primary_principal != NULL) {
     165        krb5_free_principal (context, m->primary_principal);
     166        m->primary_principal = NULL;
     167    }
     168    m->dead = 1;
     169
     170    l = m->creds;
     171    while (l != NULL) {
     172        struct link *old;
     173
     174        krb5_free_cred_contents (context, &l->cred);
     175        old = l;
     176        l = l->next;
     177        free (old);
     178    }
     179
     180    m->creds = NULL;
     181    return;
     182}
     183
    158184static krb5_error_code KRB5_CALLCONV
    159185mcc_initialize(krb5_context context,
     
    162188{
    163189    krb5_mcache *m = MCACHE(id);
     190    /*
     191     * It's important to destroy any existing
     192     * creds here, that matches the baheviour
     193     * of all other backends and also the
     194     * MEMORY: backend in MIT.
     195     */
     196    mcc_destroy_internal(context, m);
    164197    m->dead = 0;
     198    m->kdc_offset = 0;
    165199    m->mtime = time(NULL);
    166200    return krb5_copy_principal (context,
     
    196230{
    197231    krb5_mcache **n, *m = MCACHE(id);
    198     struct link *l;
    199232
    200233    if (m->refcnt == 0)
     
    212245        }
    213246        HEIMDAL_MUTEX_unlock(&mcc_mutex);
    214         if (m->primary_principal != NULL) {
    215             krb5_free_principal (context, m->primary_principal);
    216             m->primary_principal = NULL;
    217         }
    218         m->dead = 1;
    219 
    220         l = m->creds;
    221         while (l != NULL) {
    222             struct link *old;
    223 
    224             krb5_free_cred_contents (context, &l->cred);
    225             old = l;
    226             l = l->next;
    227             free (old);
    228         }
    229         m->creds = NULL;
     247        mcc_destroy_internal(context, m);
    230248    }
    231249    return 0;
  • vendor/current/source4/lib/wmi/wmi_wrap.c

    r988 r989  
    4040/* attribute recognised by some compilers to avoid 'unused' warnings */
    4141#ifndef SWIGUNUSED
    42 # if defined(__GNUC__)
    43 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
    44 #     define SWIGUNUSED __attribute__ ((__unused__))
    45 #   else
    46 #     define SWIGUNUSED
    47 #   endif
    48 # elif defined(__ICC)
     42# ifdef HAVE___ATTRIBUTE__
    4943#   define SWIGUNUSED __attribute__ ((__unused__))
    5044# else
  • vendor/current/source4/librpc/rpc/dcerpc.c

    r988 r989  
    156156        c->srv_max_xmit_frag = 5840;
    157157        c->srv_max_recv_frag = 5840;
     158        c->max_total_response_size = DCERPC_NCACN_RESPONSE_DEFAULT_MAX_SIZE;
    158159        c->pending = NULL;
    159160
     
    14151416        /* the bind_ack might contain a reply set of credentials */
    14161417        if (pkt->auth_length != 0 && sec->tmp_auth_info.in != NULL) {
    1417                 uint32_t auth_length;
    1418 
    14191418                status = dcerpc_pull_auth_trailer(pkt, sec->tmp_auth_info.mem,
    14201419                                                  &pkt->u.bind_ack.auth_info,
    14211420                                                  sec->tmp_auth_info.in,
    1422                                                   &auth_length, true);
     1421                                                  NULL, true);
    14231422                if (tevent_req_nterror(req, status)) {
    14241423                        return;
     
    15781577        length = pkt->u.response.stub_and_verifier.length;
    15791578
    1580         if (req->payload.length + length > DCERPC_NCACN_PAYLOAD_MAX_SIZE) {
     1579        if (req->payload.length + length > c->max_total_response_size) {
    15811580                DEBUG(2,("Unexpected total payload 0x%X > 0x%X dcerpc response\n",
    15821581                         (unsigned)req->payload.length + length,
    1583                          DCERPC_NCACN_PAYLOAD_MAX_SIZE));
     1582                         (unsigned)c->max_total_response_size));
    15841583                dcerpc_connection_dead(c, NT_STATUS_RPC_PROTOCOL_ERROR);
    15851584                return;
     
    24352434        /* the alter_resp might contain a reply set of credentials */
    24362435        if (pkt->auth_length != 0 && sec->tmp_auth_info.in != NULL) {
    2437                 uint32_t auth_length;
    2438 
    24392436                status = dcerpc_pull_auth_trailer(pkt, sec->tmp_auth_info.mem,
    24402437                                                  &pkt->u.alter_resp.auth_info,
    24412438                                                  sec->tmp_auth_info.in,
    2442                                                   &auth_length, true);
     2439                                                  NULL, true);
    24432440                if (tevent_req_nterror(req, status)) {
    24442441                        return;
  • vendor/current/source4/librpc/rpc/dcerpc.h

    r988 r989  
    108108        /* the next context_id to be assigned */
    109109        uint32_t next_context_id;
     110
     111        /* The maximum total payload of reassembled response pdus */
     112        size_t max_total_response_size;
    110113};
    111114
  • vendor/current/source4/ntvfs/posix/posix_eadb.c

    r988 r989  
    2222#include "includes.h"
    2323#include "lib/tdb_wrap/tdb_wrap.h"
     24#ifdef WITH_NTVFS_FILESERVER
    2425#include "vfs_posix.h"
     26#endif
    2527#include "posix_eadb.h"
    2628
     
    144146}
    145147
    146 NTSTATUS pull_xattr_blob_tdb(struct pvfs_state *pvfs_state,
    147                              TALLOC_CTX *mem_ctx,
    148                              const char *attr_name,
    149                              const char *fname,
    150                              int fd,
    151                              size_t estimated_size,
    152                              DATA_BLOB *blob)
    153 {
    154         return pull_xattr_blob_tdb_raw(pvfs_state->ea_db,mem_ctx,attr_name,fname,fd,estimated_size,blob);
    155 }
    156 
    157148/*
    158149  push a xattr as a blob, using ea_tdb
     
    200191        return status;
    201192}
    202 NTSTATUS push_xattr_blob_tdb(struct pvfs_state *pvfs_state,
    203                              const char *attr_name,
    204                              const char *fname,
    205                              int fd,
    206                              const DATA_BLOB *blob)
    207 {
    208         return push_xattr_blob_tdb_raw(pvfs_state->ea_db, attr_name, fname, fd, blob);
    209 }
    210193
    211194
     
    235218
    236219/*
    237   delete a xattr
    238 */
    239 NTSTATUS delete_posix_eadb(struct pvfs_state *pvfs_state, const char *attr_name,
    240                           const char *fname, int fd)
    241 {
    242         return delete_posix_eadb_raw(pvfs_state->ea_db,
    243                                     attr_name, fname, fd);
    244 }
    245 
    246 
    247 /*
    248220  delete all xattrs for a file
    249221*/
     
    272244
    273245/*
    274   delete all xattrs for a file
    275 */
    276 NTSTATUS unlink_posix_eadb(struct pvfs_state *pvfs_state, const char *fname)
    277 {
    278         return unlink_posix_eadb_raw(pvfs_state->ea_db, fname, -1);
    279 }
    280 
    281 /*
    282246  list all xattrs for a file
    283247*/
     
    289253                                     fname, fd, 100, list);
    290254}
     255
     256#ifdef WITH_NTVFS_FILESERVER
     257NTSTATUS pull_xattr_blob_tdb(struct pvfs_state *pvfs_state,
     258                             TALLOC_CTX *mem_ctx,
     259                             const char *attr_name,
     260                             const char *fname,
     261                             int fd,
     262                             size_t estimated_size,
     263                             DATA_BLOB *blob)
     264{
     265        return pull_xattr_blob_tdb_raw(pvfs_state->ea_db,mem_ctx,attr_name,fname,fd,estimated_size,blob);
     266}
     267
     268NTSTATUS push_xattr_blob_tdb(struct pvfs_state *pvfs_state,
     269                             const char *attr_name,
     270                             const char *fname,
     271                             int fd,
     272                             const DATA_BLOB *blob)
     273{
     274        return push_xattr_blob_tdb_raw(pvfs_state->ea_db, attr_name, fname, fd, blob);
     275}
     276
     277/*
     278  delete a xattr
     279*/
     280NTSTATUS delete_posix_eadb(struct pvfs_state *pvfs_state, const char *attr_name,
     281                          const char *fname, int fd)
     282{
     283        return delete_posix_eadb_raw(pvfs_state->ea_db,
     284                                    attr_name, fname, fd);
     285}
     286
     287/*
     288  delete all xattrs for a file
     289*/
     290NTSTATUS unlink_posix_eadb(struct pvfs_state *pvfs_state, const char *fname)
     291{
     292        return unlink_posix_eadb_raw(pvfs_state->ea_db, fname, -1);
     293}
     294
     295#endif
  • vendor/current/source4/ntvfs/posix/wscript_build

    r988 r989  
    11#!/usr/bin/env python
    22
    3 bld.SAMBA_SUBSYSTEM('pvfs_acl',
    4         source='pvfs_acl.c',
    5         autoproto='vfs_acl_proto.h',
    6         deps='events samba-modules',
    7         )
     3if bld.CONFIG_SET('WITH_NTVFS_FILESERVER'):
     4    bld.SAMBA_SUBSYSTEM('pvfs_acl',
     5                        source='pvfs_acl.c',
     6                        autoproto='vfs_acl_proto.h',
     7                        deps='events samba-modules',
     8    )
    89
    910
    10 bld.SAMBA_MODULE('pvfs_acl_xattr',
    11         source='pvfs_acl_xattr.c',
    12         subsystem='pvfs_acl',
    13         init_function='pvfs_acl_xattr_init',
    14         deps='NDR_XATTR events'
    15         )
     11    bld.SAMBA_MODULE('pvfs_acl_xattr',
     12                     source='pvfs_acl_xattr.c',
     13                     subsystem='pvfs_acl',
     14                     init_function='pvfs_acl_xattr_init',
     15                    deps='NDR_XATTR events'
     16    )
    1617
    1718
    18 bld.SAMBA_MODULE('pvfs_acl_nfs4',
    19         source='pvfs_acl_nfs4.c',
    20         subsystem='pvfs_acl',
    21         init_function='pvfs_acl_nfs4_init',
    22         deps='NDR_NFS4ACL samdb events'
    23         )
     19    bld.SAMBA_MODULE('pvfs_acl_nfs4',
     20                     source='pvfs_acl_nfs4.c',
     21                     subsystem='pvfs_acl',
     22                     init_function='pvfs_acl_nfs4_init',
     23                    deps='NDR_NFS4ACL samdb events'
     24    )
    2425
    2526
    26 bld.SAMBA_SUBSYSTEM('pvfs_aio',
    27         source='pvfs_aio.c',
    28         deps='tevent',
    29         enabled=False
    30         )
     27    bld.SAMBA_SUBSYSTEM('pvfs_aio',
     28                        source='pvfs_aio.c',
     29                        deps='tevent',
     30                    enabled=False
     31    )
    3132
    3233
    33 bld.SAMBA_MODULE('ntvfs_posix',
    34         source='vfs_posix.c pvfs_util.c pvfs_search.c pvfs_dirlist.c pvfs_fileinfo.c pvfs_unlink.c pvfs_mkdir.c pvfs_open.c pvfs_read.c pvfs_flush.c pvfs_write.c pvfs_fsinfo.c pvfs_qfileinfo.c pvfs_setfileinfo.c pvfs_rename.c pvfs_resolve.c pvfs_shortname.c pvfs_lock.c pvfs_oplock.c pvfs_wait.c pvfs_seek.c pvfs_ioctl.c pvfs_xattr.c pvfs_streams.c pvfs_notify.c pvfs_sys.c xattr_system.c',
    35         autoproto='vfs_posix_proto.h',
    36         subsystem='ntvfs',
    37         init_function='ntvfs_posix_init',
    38         deps='NDR_XATTR attr ntvfs_common MESSAGING LIBWBCLIENT_OLD pvfs_acl pvfs_aio posix_eadb',
    39         internal_module=True
    40         )
     34    bld.SAMBA_MODULE('ntvfs_posix',
     35                     source='vfs_posix.c pvfs_util.c pvfs_search.c pvfs_dirlist.c pvfs_fileinfo.c pvfs_unlink.c pvfs_mkdir.c pvfs_open.c pvfs_read.c pvfs_flush.c pvfs_write.c pvfs_fsinfo.c pvfs_qfileinfo.c pvfs_setfileinfo.c pvfs_rename.c pvfs_resolve.c pvfs_shortname.c pvfs_lock.c pvfs_oplock.c pvfs_wait.c pvfs_seek.c pvfs_ioctl.c pvfs_xattr.c pvfs_streams.c pvfs_notify.c pvfs_sys.c xattr_system.c',
     36                     autoproto='vfs_posix_proto.h',
     37                     subsystem='ntvfs',
     38                    init_function='ntvfs_posix_init',
     39                     deps='NDR_XATTR attr ntvfs_common MESSAGING LIBWBCLIENT_OLD pvfs_acl pvfs_aio posix_eadb',
     40                     internal_module=True
     41    )
    4142
    4243
  • vendor/current/source4/ntvfs/wscript_build

    r988 r989  
    66                  deps='tevent samba-modules',
    77                  private_library=True,
    8                   enabled=bld.AD_DC_BUILD_IS_ENABLED()
     8                  enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER')
    99                  )
    1010
    11 if bld.AD_DC_BUILD_IS_ENABLED():
    12     bld.RECURSE('posix')
     11bld.RECURSE('posix')
     12if bld.CONFIG_SET('WITH_NTVFS_FILESERVER'):
    1313    bld.RECURSE('common')
    1414    bld.RECURSE('unixuid')
    1515    bld.RECURSE('sysdep')
    1616
    17 bld.SAMBA_MODULE('ntvfs_cifs',
    18         source='cifs/vfs_cifs.c',
    19         subsystem='ntvfs',
    20         init_function='ntvfs_cifs_init',
    21         deps='LIBCLI_SMB smbclient-raw param_options'
    22         )
     17    bld.SAMBA_MODULE('ntvfs_cifs',
     18                     source='cifs/vfs_cifs.c',
     19                     subsystem='ntvfs',
     20                     init_function='ntvfs_cifs_init',
     21                     deps='LIBCLI_SMB smbclient-raw param_options'
     22    )
    2323
    2424
    25 bld.SAMBA_MODULE('ntvfs_smb2',
    26         source='smb2/vfs_smb2.c',
    27         subsystem='ntvfs',
    28         init_function='ntvfs_smb2_init',
    29         deps='LIBCLI_SMB smbclient-raw param_options'
    30         )
     25    bld.SAMBA_MODULE('ntvfs_smb2',
     26                     source='smb2/vfs_smb2.c',
     27                     subsystem='ntvfs',
     28                     init_function='ntvfs_smb2_init',
     29                     deps='LIBCLI_SMB smbclient-raw param_options'
     30    )
    3131
    3232
    33 bld.SAMBA_MODULE('ntvfs_simple',
    34         source='simple/vfs_simple.c simple/svfs_util.c',
    35         autoproto='simple/proto.h',
    36         subsystem='ntvfs',
    37         init_function='ntvfs_simple_init',
    38         deps='talloc'
    39         )
     33    bld.SAMBA_MODULE('ntvfs_simple',
     34                     source='simple/vfs_simple.c simple/svfs_util.c',
     35                     autoproto='simple/proto.h',
     36                     subsystem='ntvfs',
     37                     init_function='ntvfs_simple_init',
     38                     deps='talloc'
     39    )
    4040
    4141
    42 bld.SAMBA_MODULE('ntvfs_cifsposix',
    43         source='cifs_posix_cli/vfs_cifs_posix.c cifs_posix_cli/svfs_util.c',
    44         autoproto='cifs_posix_cli/proto.h',
    45         subsystem='ntvfs',
    46         init_function='ntvfs_cifs_posix_init',
    47         deps='talloc'
    48         )
     42    bld.SAMBA_MODULE('ntvfs_cifsposix',
     43                     source='cifs_posix_cli/vfs_cifs_posix.c cifs_posix_cli/svfs_util.c',
     44                     autoproto='cifs_posix_cli/proto.h',
     45                     subsystem='ntvfs',
     46                     init_function='ntvfs_cifs_posix_init',
     47                    deps='talloc'
     48    )
    4949
    5050
    51 bld.SAMBA_MODULE('ntvfs_print',
    52         source='print/vfs_print.c',
    53         subsystem='ntvfs',
    54         init_function='ntvfs_print_init',
    55         deps='talloc'
    56         )
     51    bld.SAMBA_MODULE('ntvfs_print',
     52                     source='print/vfs_print.c',
     53                    subsystem='ntvfs',
     54                     init_function='ntvfs_print_init',
     55                     deps='talloc'
     56    )
    5757
    5858
    59 bld.SAMBA_MODULE('ntvfs_ipc',
    60         source='ipc/vfs_ipc.c ipc/ipc_rap.c ipc/rap_server.c',
    61         autoproto='ipc/proto.h',
    62         subsystem='ntvfs',
    63         init_function='ntvfs_ipc_init',
    64         deps='NDR_NAMED_PIPE_AUTH npa_tstream gssapi samba-credentials DCERPC_SHARE'
    65         )
     59    bld.SAMBA_MODULE('ntvfs_ipc',
     60                     source='ipc/vfs_ipc.c ipc/ipc_rap.c ipc/rap_server.c',
     61                     autoproto='ipc/proto.h',
     62                    subsystem='ntvfs',
     63                     init_function='ntvfs_ipc_init',
     64                     deps='NDR_NAMED_PIPE_AUTH npa_tstream gssapi samba-credentials DCERPC_SHARE'
     65    )
    6666
    6767
    68 bld.SAMBA_MODULE('ntvfs_nbench',
    69         source='nbench/vfs_nbench.c',
    70         subsystem='ntvfs',
    71         init_function='ntvfs_nbench_init',
    72         deps='talloc'
    73         )
     68    bld.SAMBA_MODULE('ntvfs_nbench',
     69                     source='nbench/vfs_nbench.c',
     70                     subsystem='ntvfs',
     71                     init_function='ntvfs_nbench_init',
     72                     deps='talloc'
     73    )
    7474
    7575
  • vendor/current/source4/param/pyparam.c

    r988 r989  
    322322
    323323}
     324
     325static PyObject *py_lp_log_level(PyObject *self, PyObject *unused)
     326{
     327        int ret = DEBUGLEVEL_CLASS[DBGC_CLASS];
     328        return PyInt_FromLong(ret);
     329}
     330
    324331
    325332static PyObject *py_samdb_url(PyObject *self, PyObject *unused)
     
    358365        { "dump", py_lp_dump, METH_VARARGS,
    359366                "S.dump(stream, show_defaults=False)" },
     367        { "log_level", py_lp_log_level, METH_NOARGS,
     368                "S.log_level() -> int\n Get the active log level" },
    360369        { "dump_a_parameter", py_lp_dump_a_parameter, METH_VARARGS,
    361370                "S.dump_a_parameter(stream, name, service_name)" },
  • vendor/current/source4/rpc_server/common/server_info.c

    r988 r989  
    2727#include "param/param.h"
    2828#include "rpc_server/common/common.h"
    29 #include "rpc_server/common/share.h"
    3029#include "libds/common/roles.h"
    3130
  • vendor/current/source4/rpc_server/dcerpc_server.c

    r988 r989  
    409409        p->max_recv_frag = 5840;
    410410        p->max_xmit_frag = 5840;
     411        p->max_total_request_size = DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE;
    411412
    412413        *_p = p;
     
    804805                TALLOC_FREE(call->context);
    805806
     807                if (call->fault_code == DCERPC_NCA_S_PROTO_ERROR) {
     808                        return dcesrv_bind_nak(call,
     809                        DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED);
     810                }
     811
    806812                if (auth->auth_level != DCERPC_AUTH_LEVEL_NONE) {
    807813                        /*
     
    936942        if (!dcesrv_auth_auth3(call)) {
    937943                call->conn->auth_state.auth_invalid = true;
     944                if (call->fault_code != 0) {
     945                        return dcesrv_fault_disconnect(call, call->fault_code);
     946                }
    938947        }
    939948
     
    11051114        auth_ok = dcesrv_auth_alter(call);
    11061115        if (!auth_ok) {
    1107                 if (call->in_auth_info.auth_type == DCERPC_AUTH_TYPE_NONE) {
    1108                         return dcesrv_fault_disconnect(call,
    1109                                         DCERPC_FAULT_ACCESS_DENIED);
     1116                if (call->fault_code != 0) {
     1117                        return dcesrv_fault_disconnect(call, call->fault_code);
    11101118                }
    11111119        }
     
    15331541                 * Up to 4 MByte are allowed by all fragments
    15341542                 */
    1535                 available = DCERPC_NCACN_PAYLOAD_MAX_SIZE;
     1543                available = dce_conn->max_total_request_size;
    15361544                if (er->stub_and_verifier.length > available) {
    15371545                        dcesrv_call_disconnect_after(existing,
     
    15861594                 * Up to 4 MByte are allowed by all fragments
    15871595                 */
    1588                 if (call->pkt.u.request.alloc_hint > DCERPC_NCACN_PAYLOAD_MAX_SIZE) {
     1596                if (call->pkt.u.request.alloc_hint > dce_conn->max_total_request_size) {
    15891597                        dcesrv_call_disconnect_after(call,
    15901598                                "dcesrv_auth_request - initial alloc hint too large");
  • vendor/current/source4/rpc_server/dcerpc_server.h

    r988 r989  
    274274        /* the association group the connection belongs to */
    275275        struct dcesrv_assoc_group *assoc_group;
     276
     277        /* The maximum total payload of reassembled request pdus */
     278        size_t max_total_request_size;
    276279};
    277280
  • vendor/current/source4/rpc_server/dcesrv_auth.c

    r988 r989  
    4545        struct dcesrv_auth *auth = &dce_conn->auth_state;
    4646        NTSTATUS status;
    47         uint32_t auth_length;
    4847
    4948        if (pkt->auth_length == 0) {
     
    5655        status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.bind.auth_info,
    5756                                          &call->in_auth_info,
    58                                           &auth_length, false);
    59         if (!NT_STATUS_IS_OK(status)) {
     57                                          NULL, true);
     58        if (!NT_STATUS_IS_OK(status)) {
     59                /*
     60                 * This will cause a
     61                 * DCERPC_BIND_NAK_REASON_PROTOCOL_VERSION_NOT_SUPPORTED
     62                 * in the caller
     63                 */
     64                call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
    6065                return false;
    6166        }
     
    242247        struct dcesrv_connection *dce_conn = call->conn;
    243248        NTSTATUS status;
    244         uint32_t auth_length;
    245249
    246250        if (pkt->auth_length == 0) {
     
    258262
    259263        status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.auth3.auth_info,
    260                                           &call->in_auth_info, &auth_length, true);
    261         if (!NT_STATUS_IS_OK(status)) {
     264                                          &call->in_auth_info, NULL, true);
     265        if (!NT_STATUS_IS_OK(status)) {
     266                /*
     267                 * Windows returns DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY
     268                 * instead of DCERPC_NCA_S_PROTO_ERROR.
     269                 */
     270                call->fault_code = DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY;
    262271                return false;
    263272        }
     
    325334        struct dcesrv_connection *dce_conn = call->conn;
    326335        NTSTATUS status;
    327         uint32_t auth_length;
    328336
    329337        /* on a pure interface change there is no auth blob */
     
    336344
    337345        if (dce_conn->auth_state.auth_finished) {
     346                call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
    338347                return false;
    339348        }
     
    345354
    346355        status = dcerpc_pull_auth_trailer(pkt, call, &pkt->u.alter.auth_info,
    347                                           &call->in_auth_info, &auth_length, true);
    348         if (!NT_STATUS_IS_OK(status)) {
     356                                          &call->in_auth_info, NULL, true);
     357        if (!NT_STATUS_IS_OK(status)) {
     358                call->fault_code = DCERPC_NCA_S_PROTO_ERROR;
     359                return false;
     360        }
     361
     362        if (call->in_auth_info.auth_type == DCERPC_AUTH_TYPE_NONE) {
     363                call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
    349364                return false;
    350365        }
  • vendor/current/source4/rpc_server/wkssvc/dcesrv_wkssvc.c

    r988 r989  
    2525#include "librpc/gen_ndr/ndr_srvsvc.h"
    2626#include "rpc_server/common/common.h"
    27 #include "rpc_server/common/share.h"
    2827#include "param/param.h"
    2928
  • vendor/current/source4/rpc_server/wscript_build

    r988 r989  
    22
    33bld.SAMBA_SUBSYSTEM('DCERPC_SHARE',
    4         source='common/server_info.c common/share_info.c',
     4        source='common/share_info.c',
    55        autoproto='common/share.h',
    66        deps='ldb',
    7         enabled=bld.AD_DC_BUILD_IS_ENABLED()
     7        enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER'),
    88        )
    99
    1010bld.SAMBA_SUBSYSTEM('DCERPC_COMMON',
    11         source='common/forward.c common/reply.c dcesrv_auth.c common/loadparm.c',
     11        source='common/server_info.c common/forward.c common/reply.c dcesrv_auth.c common/loadparm.c',
    1212        autoproto='common/proto.h',
    1313        deps='ldb DCERPC_SHARE samba_server_gensec',
     
    5555        subsystem='dcerpc_server',
    5656        init_function='dcerpc_server_srvsvc_init',
    57         deps='DCERPC_COMMON NDR_SRVSVC share ntvfs'
     57        deps='DCERPC_COMMON NDR_SRVSVC share ntvfs',
     58        enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER')
    5859        )
    5960
     
    8990        init_function='dcerpc_server_winreg_init',
    9091        deps='registry ndr-standard',
    91         internal_module=True
     92        internal_module=True,
     93        enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER')
    9294        )
    9395
     
    133135        init_function='dcerpc_server_spoolss_init',
    134136        deps='DCERPC_COMMON NDR_SPOOLSS ntptr RPC_NDR_SPOOLSS',
    135         internal_module=True
     137        internal_module=True,
     138        enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER')
    136139        )
    137140
  • vendor/current/source4/scripting/bin/samba_spnupdate

    r988 r989  
    220220    try:
    221221        binding_options = "seal"
    222         if int(lp.get("log level")) >= 5:
     222        if lp.log_level() >= 5:
    223223            binding_options += ",print"
    224224        drs = drsuapi.drsuapi('ncacn_ip_tcp:%s[%s]' % (server, binding_options), lp, creds)
  • vendor/current/source4/selftest/tests.py

    r988 r989  
    301301ntvfsargs = ["--option=torture:sharedelay=100000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=500000"]
    302302
    303 # smb2.change_notify_disabled must only run against env fileserver-notify-disabled
    304 smb2 = filter(lambda x: "smb2.change_notify_disabled" not in x, smbtorture4_testsuites("smb2."))
     303# Filter smb2 tests that should not run against ad_dc_ntvfs
     304smb2_s3only = ["smb2.change_notify_disabled", "smb2.dosmode"]
     305smb2 = [x for x in smbtorture4_testsuites("smb2.") if x not in smb2_s3only]
    305306
    306307#The QFILEINFO-IPC test needs to be on ipc$
     
    358359# DNS tests
    359360plantestsuite_loadlist("samba.tests.dns", "fl2003dc:local", [python, os.path.join(srcdir(), "python/samba/tests/dns.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
     361
     362plantestsuite_loadlist("samba.tests.dns_tkey", "fl2008r2dc", [python, os.path.join(srcdir(), "python/samba/tests/dns_tkey.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
    360363
    361364for t in smbtorture4_testsuites("dns_internal."):
     
    508511    plantestsuite("samba.ntlm_auth.(%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_s3.sh"), valgrindify(python), samba3srcdir, ntlm_auth3,  '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', configuration])
    509512
     513for env in ["s4member_dflt_domain", "s4member"]:
     514    for cmd in ["id", "getent"]:
     515        users = ["$DC_USERNAME", "$DC_USERNAME@$REALM"]
     516        if env == "s4member":
     517            users = ["$DOMAIN/$DC_USERNAME", "$DC_USERNAME@$REALM"]
     518        for usr in users:
     519            plantestsuite("samba4.winbind.dom_name_parse.cmd", env, "%s/dom_parse.sh %s %s" % (bbdir,cmd,usr))
    510520
    511521nsstest4 = binpath("nsstest")
     
    537547planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.srvsvc")
    538548planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.timecmd")
     549
     550# test fsmo show
     551for env in ["ad_dc_ntvfs", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
     552    planpythontestsuite(env + ":local", "samba.tests.samba_tool.fsmo")
    539553
    540554# We run this test against both AD DC implemetnations because it is
  • vendor/current/source4/smb_server/service_smb.c

    r988 r989  
    3535#include "param/param.h"
    3636#include "file_server/file_server.h"
    37 
     37#include "ntvfs/ntvfs.h"
     38#include "lib/cmdline/popt_common.h"
    3839/*
    3940  open the smb server sockets
     
    8788NTSTATUS server_service_smb_init(void)
    8889{
     90        ntvfs_init(cmdline_lp_ctx);
    8991        share_init();
    9092        return register_server_service("smb", smbsrv_task_init);
  • vendor/current/source4/smb_server/wscript_build

    r988 r989  
    66        subsystem='service',
    77        init_function='server_service_smb_init',
    8         deps='SMB_SERVER netif shares samba-hostconfig',
     8        deps='SMB_SERVER netif shares samba-hostconfig POPT_SAMBA',
    99        internal_module=False,
    1010        enabled=bld.CONFIG_SET('WITH_NTVFS_FILESERVER')
  • vendor/current/source4/smbd/server.c

    r988 r989  
    2929#include "system/dir.h"
    3030#include "system/filesys.h"
    31 #include "ntvfs/ntvfs.h"
    3231#include "ntptr/ntptr.h"
    3332#include "auth/gensec/gensec.h"
     
    410409                                                of the spoolss RPC server instead? */
    411410
    412         ntvfs_init(cmdline_lp_ctx);     /* FIXME: maybe run this in the initialization functions
    413                                                 of the SMB[,2] server instead? */
    414 
    415411        process_model_init(cmdline_lp_ctx);
    416412
  • vendor/current/source4/torture/raw/read.c

    r988 r989  
    2020#include "includes.h"
    2121#include "libcli/raw/libcliraw.h"
     22#include "libcli/raw/raw_proto.h"
    2223#include "system/time.h"
    2324#include "system/filesys.h"
     
    374375        const char *test_data = "TEST DATA";
    375376        unsigned int seed = time(NULL);
     377        struct smbcli_request *smbreq = NULL;
     378        unsigned int i;
    376379
    377380        buf = talloc_zero_array(tctx, uint8_t, maxsize);
     
    422425
    423426        smbcli_write(cli->tree, fnum, 0, test_data, 0, strlen(test_data));
     427
     428        printf("Checking reserved fields are [0]\n");
     429        io.readx.in.file.fnum = fnum;
     430        io.readx.in.offset = 0;
     431        io.readx.in.remaining = 0;
     432        io.readx.in.read_for_execute = false;
     433        io.readx.in.mincnt = strlen(test_data);
     434        io.readx.in.maxcnt = strlen(test_data);
     435        smbreq = smb_raw_read_send(cli->tree, &io);
     436        if (smbreq == NULL) {
     437                ret = false;
     438                torture_fail_goto(tctx, done, "smb_raw_read_send failed\n");
     439        }
     440        if (!smbcli_request_receive(smbreq) ||
     441             smbcli_request_is_error(smbreq)) {
     442                status = smbcli_request_destroy(smbreq);
     443                torture_fail_goto(tctx, done, "receive failed\n");
     444        }
     445
     446        if (smbreq->in.wct != 12) {
     447                ret = false;
     448                printf("Incorrect wct %u (should be 12)\n",
     449                        (unsigned int)smbreq->in.wct);
     450                status = smbcli_request_destroy(smbreq);
     451                torture_fail_goto(tctx, done, "bad wct\n");
     452        }
     453
     454        /* Ensure VWV8 - WVW11 are zero. */
     455        for (i = 8; i < 12; i++) {
     456                uint16_t br = SVAL(smbreq->in.vwv, VWV(i));
     457                if (br != 0) {
     458                        status = smbcli_request_destroy(smbreq);
     459                        ret = false;
     460                        printf("reserved field %u is %u not zero\n",
     461                                i,
     462                                (unsigned int)br);
     463                        torture_fail_goto(tctx, done, "bad reserved field\n");
     464                }
     465        }
     466
     467        smbcli_request_destroy(smbreq);
    424468
    425469        printf("Trying small read\n");
  • vendor/current/source4/torture/rpc/lsa.c

    r988 r989  
    31843184        int kvno = cli_credentials_get_kvno(credentials);
    31853185        int expected_kvno = 0;
    3186         krb5uint32 t_kvno = 0;
     3186        krb5int32 t_kvno = 0;
    31873187        const char *host = torture_setting_string(tctx, "host", NULL);
    31883188        krb5_error_code k5ret;
  • vendor/current/source4/torture/smb2/getinfo.c

    r988 r989  
    127127}
    128128
     129/*
     130  test granted access when desired access includes
     131  FILE_EXECUTE and does not include FILE_READ_DATA
     132*/
     133static bool torture_smb2_fileinfo_grant_read(struct torture_context *tctx)
     134{
     135        struct smb2_tree *tree;
     136        bool ret;
     137        struct smb2_handle hfile, hdir;
     138        NTSTATUS status;
     139        uint32_t file_granted_access, dir_granted_access;
     140
     141        ret = torture_smb2_connection(tctx, &tree);
     142        torture_assert(tctx, ret, "connection failed");
     143
     144        status = torture_smb2_testfile_access(
     145            tree, FNAME, &hfile, SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE);
     146        torture_assert_ntstatus_ok(tctx, status,
     147                                   "Unable to create test file " FNAME "\n");
     148        status =
     149            torture_smb2_get_allinfo_access(tree, hfile, &file_granted_access);
     150        torture_assert_ntstatus_ok(tctx, status,
     151                                   "Unable to query test file access ");
     152        torture_assert_int_equal(tctx, file_granted_access,
     153                                 SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     154                                 "granted file access ");
     155        smb2_util_close(tree, hfile);
     156
     157        status = torture_smb2_testdir_access(
     158            tree, DNAME, &hdir, SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE);
     159        torture_assert_ntstatus_ok(tctx, status,
     160                                   "Unable to create test dir " DNAME "\n");
     161        status =
     162            torture_smb2_get_allinfo_access(tree, hdir, &dir_granted_access);
     163        torture_assert_ntstatus_ok(tctx, status,
     164                                   "Unable to query test dir access ");
     165        torture_assert_int_equal(tctx, dir_granted_access,
     166                                 SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     167                                 "granted dir access ");
     168        smb2_util_close(tree, hdir);
     169
     170        return true;
     171}
    129172
    130173/*
     
    445488        torture_suite_add_simple_test(suite, "qsec_buffercheck",
    446489                                      torture_smb2_qsec_buffercheck);
     490        torture_suite_add_simple_test(suite, "granted",
     491                                      torture_smb2_fileinfo_grant_read);
    447492        return suite;
    448493}
  • vendor/current/source4/torture/smb2/ioctl.c

    r988 r989  
    274274{
    275275        bool ok;
     276        uint32_t initial_access = desired_access;
     277
     278        if (size > 0) {
     279                initial_access |= SEC_FILE_APPEND_DATA;
     280        }
    276281
    277282        smb2_util_unlink(tree, fname);
     
    280285                             fname,
    281286                             fh,
    282                              desired_access,
     287                             initial_access,
    283288                             file_attributes);
    284         torture_assert(torture, ok, "file open");
     289        torture_assert(torture, ok, "file create");
    285290
    286291        if (size > 0) {
     
    288293                torture_assert(torture, ok, "write pattern");
    289294        }
     295
     296        if (initial_access != desired_access) {
     297                smb2_util_close(tree, *fh);
     298                ok = test_setup_open(torture, tree, mem_ctx,
     299                                     fname,
     300                                     fh,
     301                                     desired_access,
     302                                     file_attributes);
     303                torture_assert(torture, ok, "file open");
     304        }
     305
    290306        return true;
    291307}
     
    12401256        enum ndr_err_code ndr_ret;
    12411257        bool ok;
    1242 
    1243         /* no read permission on src */
    1244         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1245                                    1, /* 1 chunk */
     1258        /* read permission on src */
     1259        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
    12461260                                   &src_h, 4096, /* fill 4096 byte src file */
    1247                                    SEC_RIGHTS_FILE_WRITE,
    1248                                    &dest_h, 0,  /* 0 byte dest file */
    1249                                    SEC_RIGHTS_FILE_ALL,
    1250                                    &cc_copy,
    1251                                    &ioctl);
     1261                                   SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
     1262                                   &dest_h, 0, /* 0 byte dest file */
     1263                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
     1264        if (!ok) {
     1265                torture_fail(torture, "setup copy chunk error");
     1266        }
     1267
     1268        cc_copy.chunks[0].source_off = 0;
     1269        cc_copy.chunks[0].target_off = 0;
     1270        cc_copy.chunks[0].length = 4096;
     1271
     1272        ndr_ret = ndr_push_struct_blob(
     1273            &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
     1274            (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
     1275        torture_assert_ndr_success(torture, ndr_ret,
     1276                                   "ndr_push_srv_copychunk_copy");
     1277
     1278        status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
     1279        torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
     1280                                      "FSCTL_SRV_COPYCHUNK");
     1281
     1282        smb2_util_close(tree, src_h);
     1283        smb2_util_close(tree, dest_h);
     1284
     1285        /* execute permission on src */
     1286        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
     1287                                   &src_h, 4096, /* fill 4096 byte src file */
     1288                                   SEC_FILE_EXECUTE | SEC_FILE_READ_ATTRIBUTE,
     1289                                   &dest_h, 0, /* 0 byte dest file */
     1290                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
     1291        if (!ok) {
     1292                torture_fail(torture, "setup copy chunk error");
     1293        }
     1294
     1295        cc_copy.chunks[0].source_off = 0;
     1296        cc_copy.chunks[0].target_off = 0;
     1297        cc_copy.chunks[0].length = 4096;
     1298
     1299        ndr_ret = ndr_push_struct_blob(
     1300            &ioctl.smb2.in.out, tmp_ctx, &cc_copy,
     1301            (ndr_push_flags_fn_t)ndr_push_srv_copychunk_copy);
     1302        torture_assert_ndr_success(torture, ndr_ret,
     1303                                   "ndr_push_srv_copychunk_copy");
     1304
     1305        status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
     1306        torture_assert_ntstatus_equal(torture, status, NT_STATUS_OK,
     1307                                      "FSCTL_SRV_COPYCHUNK");
     1308
     1309        smb2_util_close(tree, src_h);
     1310        smb2_util_close(tree, dest_h);
     1311
     1312        /* neither read nor execute permission on src */
     1313        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
     1314                                   &src_h, 4096, /* fill 4096 byte src file */
     1315                                   SEC_FILE_READ_ATTRIBUTE, &dest_h,
     1316                                   0, /* 0 byte dest file */
     1317                                   SEC_RIGHTS_FILE_ALL, &cc_copy, &ioctl);
    12521318        if (!ok) {
    12531319                torture_fail(torture, "setup copy chunk error");
     
    12731339
    12741340        /* no write permission on dest */
    1275         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1276                                    1, /* 1 chunk */
    1277                                    &src_h, 4096, /* fill 4096 byte src file */
    1278                                    SEC_RIGHTS_FILE_ALL,
    1279                                    &dest_h, 0,  /* 0 byte dest file */
    1280                                    (SEC_RIGHTS_FILE_READ
    1281                                     | SEC_RIGHTS_FILE_EXECUTE),
    1282                                    &cc_copy,
    1283                                    &ioctl);
     1341        ok = test_setup_copy_chunk(
     1342            torture, tree, tmp_ctx, 1, /* 1 chunk */
     1343            &src_h, 4096,             /* fill 4096 byte src file */
     1344            SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE, &dest_h,
     1345            0, /* 0 byte dest file */
     1346            (SEC_RIGHTS_FILE_ALL &
     1347             ~(SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA)),
     1348            &cc_copy, &ioctl);
    12841349        if (!ok) {
    12851350                torture_fail(torture, "setup copy chunk error");
     
    13051370
    13061371        /* no read permission on dest */
    1307         ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
    1308                                    1, /* 1 chunk */
     1372        ok = test_setup_copy_chunk(torture, tree, tmp_ctx, 1, /* 1 chunk */
    13091373                                   &src_h, 4096, /* fill 4096 byte src file */
    1310                                    SEC_RIGHTS_FILE_ALL,
    1311                                    &dest_h, 0,  /* 0 byte dest file */
    1312                                    (SEC_RIGHTS_FILE_WRITE
    1313                                     | SEC_RIGHTS_FILE_EXECUTE),
    1314                                    &cc_copy,
    1315                                    &ioctl);
     1374                                   SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE,
     1375                                   &dest_h, 0, /* 0 byte dest file */
     1376                                   (SEC_RIGHTS_FILE_ALL & ~SEC_FILE_READ_DATA),
     1377                                   &cc_copy, &ioctl);
    13161378        if (!ok) {
    13171379                torture_fail(torture, "setup copy chunk error");
     
    24782540        smb2_util_close(tree, fh);
    24792541
     2542        talloc_free(tmp_ctx);
     2543        return true;
     2544}
     2545
     2546static bool test_ioctl_compress_notsup_get(struct torture_context *torture,
     2547                                           struct smb2_tree *tree)
     2548{
     2549        struct smb2_handle fh;
     2550        NTSTATUS status;
     2551        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     2552        bool ok;
     2553        uint16_t compression_fmt;
     2554
     2555        ok = test_setup_create_fill(torture, tree, tmp_ctx,
     2556                                    FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
     2557                                    FILE_ATTRIBUTE_NORMAL);
     2558        torture_assert(torture, ok, "setup compression file");
     2559
     2560        /* skip if the server DOES support compression */
     2561        status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
     2562                                                  &ok);
     2563        torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
     2564        if (ok) {
     2565                smb2_util_close(tree, fh);
     2566                torture_skip(torture, "FS compression supported\n");
     2567        }
     2568
     2569        /*
     2570         * Despite not supporting compression, we should get a successful
     2571         * response indicating that the file is uncompressed - like WS2016.
     2572         */
     2573        status = test_ioctl_compress_get(torture, tmp_ctx, tree, fh,
     2574                                         &compression_fmt);
     2575        torture_assert_ntstatus_ok(torture, status, "FSCTL_GET_COMPRESSION");
     2576
     2577        torture_assert(torture, (compression_fmt == COMPRESSION_FORMAT_NONE),
     2578                       "initial compression state not NONE");
     2579
     2580        smb2_util_close(tree, fh);
     2581        talloc_free(tmp_ctx);
     2582        return true;
     2583}
     2584
     2585static bool test_ioctl_compress_notsup_set(struct torture_context *torture,
     2586                                           struct smb2_tree *tree)
     2587{
     2588        struct smb2_handle fh;
     2589        NTSTATUS status;
     2590        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     2591        bool ok;
     2592
     2593        ok = test_setup_create_fill(torture, tree, tmp_ctx,
     2594                                    FNAME, &fh, 0, SEC_RIGHTS_FILE_ALL,
     2595                                    FILE_ATTRIBUTE_NORMAL);
     2596        torture_assert(torture, ok, "setup compression file");
     2597
     2598        /* skip if the server DOES support compression */
     2599        status = test_ioctl_compress_fs_supported(torture, tree, tmp_ctx, &fh,
     2600                                                  &ok);
     2601        torture_assert_ntstatus_ok(torture, status, "SMB2_GETINFO_FS");
     2602        if (ok) {
     2603                smb2_util_close(tree, fh);
     2604                torture_skip(torture, "FS compression supported\n");
     2605        }
     2606
     2607        status = test_ioctl_compress_set(torture, tmp_ctx, tree, fh,
     2608                                         COMPRESSION_FORMAT_DEFAULT);
     2609        torture_assert_ntstatus_equal(torture, status,
     2610                                      NT_STATUS_NOT_SUPPORTED,
     2611                                      "FSCTL_GET_COMPRESSION");
     2612
     2613        smb2_util_close(tree, fh);
    24802614        talloc_free(tmp_ctx);
    24812615        return true;
     
    48504984        torture_suite_add_1smb2_test(suite, "compress_perms",
    48514985                                     test_ioctl_compress_perms);
     4986        torture_suite_add_1smb2_test(suite, "compress_notsup_get",
     4987                                     test_ioctl_compress_notsup_get);
     4988        torture_suite_add_1smb2_test(suite, "compress_notsup_set",
     4989                                     test_ioctl_compress_notsup_set);
    48524990        torture_suite_add_1smb2_test(suite, "network_interface_info",
    48534991                                     test_ioctl_network_interface_info);
  • vendor/current/source4/torture/smb2/lock.c

    r988 r989  
    30303030done:
    30313031        smb2_util_close(tree, h);
     3032        smb2_deltree(tree, BASEDIR);
     3033        return ret;
     3034}
     3035
     3036/**
     3037 * Test lock interaction between smbd and ctdb with tombstone records.
     3038 *
     3039 * Re-locking an unlocked record could lead to a deadlock between
     3040 * smbd and ctdb. Make sure we don't regress.
     3041 *
     3042 * https://bugzilla.samba.org/show_bug.cgi?id=12005
     3043 * https://bugzilla.samba.org/show_bug.cgi?id=10008
     3044 */
     3045static bool test_deadlock(struct torture_context *torture,
     3046                          struct smb2_tree *tree)
     3047{
     3048        NTSTATUS status;
     3049        bool ret = true;
     3050        struct smb2_handle _h;
     3051        struct smb2_handle *h = NULL;
     3052        uint8_t buf[200];
     3053        const char *fname = BASEDIR "\\deadlock.txt";
     3054
     3055        if (!lpcfg_clustering(torture->lp_ctx)) {
     3056                torture_skip(torture, "Test must be run on a ctdb cluster\n");
     3057                return true;
     3058        }
     3059
     3060        status = torture_smb2_testdir(tree, BASEDIR, &_h);
     3061        torture_assert_ntstatus_ok(torture, status,
     3062                                   "torture_smb2_testdir failed");
     3063        smb2_util_close(tree, _h);
     3064
     3065        status = torture_smb2_testfile(tree, fname, &_h);
     3066        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3067                                        "torture_smb2_testfile failed");
     3068        h = &_h;
     3069
     3070        ZERO_STRUCT(buf);
     3071        status = smb2_util_write(tree, *h, buf, 0, ARRAY_SIZE(buf));
     3072        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3073                                        "smb2_util_write failed");
     3074
     3075        status = test_smb2_lock(tree, *h, 0, 1, true);
     3076        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3077                                        "test_smb2_lock failed");
     3078
     3079        status = test_smb2_unlock(tree, *h, 0, 1);
     3080        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3081                                        "test_smb2_unlock failed");
     3082
     3083        status = test_smb2_lock(tree, *h, 0, 1, true);
     3084        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3085                                        "test_smb2_lock failed");
     3086
     3087        status = test_smb2_unlock(tree, *h, 0, 1);
     3088        torture_assert_ntstatus_ok_goto(torture, status, ret, done,
     3089                                        "test_smb2_unlock failed");
     3090
     3091done:
     3092        if (h != NULL) {
     3093                smb2_util_close(tree, *h);
     3094        }
    30323095        smb2_deltree(tree, BASEDIR);
    30333096        return ret;
     
    30693132        torture_suite_add_1smb2_test(suite, "truncate", test_truncate);
    30703133        torture_suite_add_1smb2_test(suite, "replay", test_replay);
     3134        torture_suite_add_1smb2_test(suite, "ctdb-delrec-deadlock", test_deadlock);
    30713135
    30723136        suite->description = talloc_strdup(suite, "SMB2-LOCK tests");
  • vendor/current/source4/torture/smb2/read.c

    r988 r989  
    2828
    2929
    30 #define CHECK_STATUS(status, correct) do { \
    31         if (!NT_STATUS_EQUAL(status, correct)) { \
    32                 printf("(%s) Incorrect status %s - should be %s\n", \
    33                        __location__, nt_errstr(status), nt_errstr(correct)); \
    34                 ret = false; \
    35                 goto done; \
    36         }} while (0)
    37 
    38 #define CHECK_VALUE(v, correct) do { \
    39         if ((v) != (correct)) { \
    40                 printf("(%s) Incorrect value %s=%u - should be %u\n", \
    41                        __location__, #v, (unsigned)v, (unsigned)correct); \
    42                 ret = false; \
    43                 goto done; \
    44         }} while (0)
     30#define CHECK_STATUS(_status, _expected) \
     31        torture_assert_ntstatus_equal_goto(torture, _status, _expected, \
     32                 ret, done, "Incorrect status")
     33
     34#define CHECK_VALUE(v, correct) \
     35        torture_assert_int_equal_goto(torture, v, correct, \
     36                 ret, done, "Incorrect value")
    4537
    4638#define FNAME "smb2_readtest.dat"
     
    235227}
    236228
     229static bool test_read_access(struct torture_context *torture,
     230                             struct smb2_tree *tree)
     231{
     232        bool ret = true;
     233        NTSTATUS status;
     234        struct smb2_handle h;
     235        uint8_t buf[64 * 1024];
     236        struct smb2_read rd;
     237        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     238
     239        ZERO_STRUCT(buf);
     240
     241        /* create a file */
     242        smb2_util_unlink(tree, FNAME);
     243
     244        status = torture_smb2_testfile(tree, FNAME, &h);
     245        CHECK_STATUS(status, NT_STATUS_OK);
     246
     247        status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
     248        CHECK_STATUS(status, NT_STATUS_OK);
     249
     250        status = smb2_util_close(tree, h);
     251        CHECK_STATUS(status, NT_STATUS_OK);
     252
     253        /* open w/ READ access - success */
     254        status = torture_smb2_testfile_access(
     255            tree, FNAME, &h, SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_DATA);
     256        CHECK_STATUS(status, NT_STATUS_OK);
     257
     258        ZERO_STRUCT(rd);
     259        rd.in.file.handle = h;
     260        rd.in.length = 5;
     261        rd.in.offset = 0;
     262        status = smb2_read(tree, tree, &rd);
     263        CHECK_STATUS(status, NT_STATUS_OK);
     264
     265        status = smb2_util_close(tree, h);
     266        CHECK_STATUS(status, NT_STATUS_OK);
     267
     268        /* open w/ EXECUTE access - success */
     269        status = torture_smb2_testfile_access(
     270            tree, FNAME, &h, SEC_FILE_READ_ATTRIBUTE | SEC_FILE_EXECUTE);
     271        CHECK_STATUS(status, NT_STATUS_OK);
     272
     273        ZERO_STRUCT(rd);
     274        rd.in.file.handle = h;
     275        rd.in.length = 5;
     276        rd.in.offset = 0;
     277        status = smb2_read(tree, tree, &rd);
     278        CHECK_STATUS(status, NT_STATUS_OK);
     279
     280        status = smb2_util_close(tree, h);
     281        CHECK_STATUS(status, NT_STATUS_OK);
     282
     283        /* open without READ or EXECUTE access - access denied */
     284        status = torture_smb2_testfile_access(tree, FNAME, &h,
     285                                              SEC_FILE_READ_ATTRIBUTE);
     286        CHECK_STATUS(status, NT_STATUS_OK);
     287
     288        ZERO_STRUCT(rd);
     289        rd.in.file.handle = h;
     290        rd.in.length = 5;
     291        rd.in.offset = 0;
     292        status = smb2_read(tree, tree, &rd);
     293        CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
     294
     295        status = smb2_util_close(tree, h);
     296        CHECK_STATUS(status, NT_STATUS_OK);
     297
     298done:
     299        talloc_free(tmp_ctx);
     300        return ret;
     301}
    237302
    238303/*
     
    246311        torture_suite_add_1smb2_test(suite, "position", test_read_position);
    247312        torture_suite_add_1smb2_test(suite, "dir", test_read_dir);
     313        torture_suite_add_1smb2_test(suite, "access", test_read_access);
    248314
    249315        suite->description = talloc_strdup(suite, "SMB2-READ tests");
  • vendor/current/source4/torture/smb2/replay.c

    r988 r989  
    9595#define BASEDIR "replaytestdir"
    9696
    97 static struct {
     97struct break_info {
    9898        struct torture_context *tctx;
    9999        struct smb2_handle handle;
     
    103103        int failures;
    104104        NTSTATUS failure_status;
    105 } break_info;
     105};
     106
     107static struct break_info break_info;
     108
     109static void torture_reset_break_info(struct torture_context *tctx,
     110                                     struct break_info *r)
     111{
     112        ZERO_STRUCTP(r);
     113        r->tctx = tctx;
     114}
    106115
    107116static void torture_oplock_ack_callback(struct smb2_request *req)
     
    161170        req->async.private_data = NULL;
    162171        return true;
     172}
     173
     174/**
     175 * Timer handler function notifies the registering function that time is up
     176 */
     177static void timeout_cb(struct tevent_context *ev,
     178                       struct tevent_timer *te,
     179                       struct timeval current_time,
     180                       void *private_data)
     181{
     182        bool *timesup = (bool *)private_data;
     183        *timesup = true;
     184        return;
     185}
     186
     187/**
     188 *  Wait a short period of time to receive a single oplock break request
     189 */
     190static void torture_wait_for_oplock_break(struct torture_context *tctx)
     191{
     192        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
     193        struct tevent_timer *te = NULL;
     194        struct timeval ne;
     195        bool timesup = false;
     196        int old_count = break_info.count;
     197
     198        /* Wait .1 seconds for an oplock break */
     199        ne = tevent_timeval_current_ofs(0, 100000);
     200
     201        te = tevent_add_timer(tctx->ev, tmp_ctx, ne, timeout_cb, &timesup);
     202        if (te == NULL) {
     203                torture_comment(tctx, "Failed to wait for an oplock break. "
     204                                      "test results may not be accurate.");
     205                goto done;
     206        }
     207
     208        while (!timesup && break_info.count < old_count + 1) {
     209                if (tevent_loop_once(tctx->ev) != 0) {
     210                        torture_comment(tctx, "Failed to wait for an oplock "
     211                                              "break. test results may not be "
     212                                              "accurate.");
     213                        goto done;
     214                }
     215        }
     216
     217done:
     218        /*
     219         * We don't know if the timed event fired and was freed, we received
     220         * our oplock break, or some other event triggered the loop.  Thus,
     221         * we create a tmp_ctx to be able to safely free/remove the timed
     222         * event in all 3 cases.
     223         */
     224        talloc_free(tmp_ctx);
     225
     226        return;
    163227}
    164228
     
    14291493}
    14301494
     1495static bool test_channel_sequence_table(struct torture_context *tctx,
     1496                                        struct smb2_tree *tree,
     1497                                        bool do_replay,
     1498                                        uint16_t opcode)
     1499{
     1500        NTSTATUS status;
     1501        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     1502        struct smb2_handle handle;
     1503        struct smb2_handle *phandle = NULL;
     1504        struct smb2_create io;
     1505        struct GUID create_guid = GUID_random();
     1506        bool ret = true;
     1507        const char *fname = BASEDIR "\\channel_sequence.dat";
     1508        uint16_t csn = 0;
     1509        uint16_t limit = UINT16_MAX - 0x7fff;
     1510        int i;
     1511        struct {
     1512                uint16_t csn;
     1513                bool csn_rand_low;
     1514                bool csn_rand_high;
     1515                NTSTATUS expected_status;
     1516        } tests[] = {
     1517                {
     1518                        .csn                    = 0,
     1519                        .expected_status        = NT_STATUS_OK,
     1520                },{
     1521                        .csn                    = 0x7fff + 1,
     1522                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1523                },{
     1524                        .csn                    = 0x7fff + 2,
     1525                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1526                },{
     1527                        .csn                    = -1,
     1528                        .csn_rand_high          = true,
     1529                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1530                },{
     1531                        .csn                    = 0xffff,
     1532                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1533                },{
     1534                        .csn                    = 0x7fff,
     1535                        .expected_status        = NT_STATUS_OK,
     1536                },{
     1537                        .csn                    = 0x7ffe,
     1538                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1539                },{
     1540                        .csn                    = 0,
     1541                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1542                },{
     1543                        .csn                    = -1,
     1544                        .csn_rand_low           = true,
     1545                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1546                },{
     1547                        .csn                    = 0x7fff + 1,
     1548                        .expected_status        = NT_STATUS_OK,
     1549                },{
     1550                        .csn                    = 0xffff,
     1551                        .expected_status        = NT_STATUS_OK,
     1552                },{
     1553                        .csn                    = 0,
     1554                        .expected_status        = NT_STATUS_OK,
     1555                },{
     1556                        .csn                    = 1,
     1557                        .expected_status        = NT_STATUS_OK,
     1558                },{
     1559                        .csn                    = 0,
     1560                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1561                },{
     1562                        .csn                    = 1,
     1563                        .expected_status        = NT_STATUS_OK,
     1564                },{
     1565                        .csn                    = 0xffff,
     1566                        .expected_status        = NT_STATUS_FILE_NOT_AVAILABLE,
     1567                }
     1568        };
     1569
     1570        smb2cli_session_reset_channel_sequence(tree->session->smbXcli, 0);
     1571
     1572        csn = smb2cli_session_current_channel_sequence(tree->session->smbXcli);
     1573        torture_comment(tctx, "Testing create with channel sequence number: 0x%04x\n", csn);
     1574
     1575        smb2_oplock_create_share(&io, fname,
     1576                        smb2_util_share_access("RWD"),
     1577                        smb2_util_oplock_level("b"));
     1578        io.in.durable_open = false;
     1579        io.in.durable_open_v2 = true;
     1580        io.in.create_guid = create_guid;
     1581        io.in.timeout = UINT32_MAX;
     1582
     1583        torture_assert_ntstatus_ok_goto(tctx,
     1584                smb2_create(tree, mem_ctx, &io),
     1585                ret, done, "failed to call smb2_create");
     1586
     1587        handle = io.out.file.handle;
     1588        phandle = &handle;
     1589
     1590        for (i=0; i <ARRAY_SIZE(tests); i++) {
     1591
     1592                const char *opstr = "";
     1593                union smb_fileinfo qfinfo;
     1594
     1595                csn = tests[i].csn;
     1596
     1597                if (tests[i].csn_rand_low) {
     1598                        csn = rand() % limit;
     1599                } else if (tests[i].csn_rand_high) {
     1600                        csn = rand() % limit + 0x7fff;
     1601                }
     1602
     1603                switch (opcode) {
     1604                case SMB2_OP_WRITE:
     1605                        opstr = "write";
     1606                        break;
     1607                case SMB2_OP_IOCTL:
     1608                        opstr = "ioctl";
     1609                        break;
     1610                case SMB2_OP_SETINFO:
     1611                        opstr = "setinfo";
     1612                        break;
     1613                default:
     1614                        break;
     1615                }
     1616
     1617                smb2cli_session_reset_channel_sequence(tree->session->smbXcli, csn);
     1618                csn = smb2cli_session_current_channel_sequence(tree->session->smbXcli);
     1619
     1620                torture_comment(tctx, "Testing %s (replay: %s) with CSN 0x%04x, expecting: %s\n",
     1621                        opstr, do_replay ? "true" : "false", csn,
     1622                        nt_errstr(tests[i].expected_status));
     1623
     1624                if (do_replay) {
     1625                        smb2cli_session_start_replay(tree->session->smbXcli);
     1626                }
     1627
     1628                switch (opcode) {
     1629                case SMB2_OP_WRITE: {
     1630                        DATA_BLOB blob = data_blob_talloc(tctx, NULL, 255);
     1631
     1632                        generate_random_buffer(blob.data, blob.length);
     1633
     1634                        status = smb2_util_write(tree, handle, blob.data, 0, blob.length);
     1635                        if (NT_STATUS_IS_OK(status)) {
     1636                                struct smb2_read rd;
     1637
     1638                                rd = (struct smb2_read) {
     1639                                        .in.file.handle = handle,
     1640                                        .in.length = blob.length,
     1641                                        .in.offset = 0
     1642                                };
     1643
     1644                                torture_assert_ntstatus_ok_goto(tctx,
     1645                                        smb2_read(tree, tree, &rd),
     1646                                        ret, done, "failed to read after write");
     1647
     1648                                torture_assert_data_blob_equal(tctx,
     1649                                        rd.out.data, blob,
     1650                                        "read/write mismatch");
     1651                        }
     1652                        break;
     1653                }
     1654                case SMB2_OP_IOCTL: {
     1655                        union smb_ioctl ioctl;
     1656                        ioctl = (union smb_ioctl) {
     1657                                .smb2.level = RAW_IOCTL_SMB2,
     1658                                .smb2.in.file.handle = handle,
     1659                                .smb2.in.function = FSCTL_CREATE_OR_GET_OBJECT_ID,
     1660                                .smb2.in.max_response_size = 64,
     1661                                .smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL
     1662                        };
     1663                        status = smb2_ioctl(tree, mem_ctx, &ioctl.smb2);
     1664                        break;
     1665                }
     1666                case SMB2_OP_SETINFO: {
     1667                        union smb_setfileinfo sfinfo;
     1668                        ZERO_STRUCT(sfinfo);
     1669                        sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
     1670                        sfinfo.generic.in.file.handle = handle;
     1671                        sfinfo.position_information.in.position = 0x1000;
     1672                        status = smb2_setinfo_file(tree, &sfinfo);
     1673                        break;
     1674                }
     1675                default:
     1676                        break;
     1677                }
     1678
     1679                qfinfo = (union smb_fileinfo) {
     1680                        .generic.level = RAW_SFILEINFO_POSITION_INFORMATION,
     1681                        .generic.in.file.handle = handle
     1682                };
     1683
     1684                torture_assert_ntstatus_ok_goto(tctx,
     1685                        smb2_getinfo_file(tree, mem_ctx, &qfinfo),
     1686                        ret, done, "failed to read after write");
     1687
     1688                if (do_replay) {
     1689                        smb2cli_session_stop_replay(tree->session->smbXcli);
     1690                }
     1691
     1692                torture_assert_ntstatus_equal_goto(tctx,
     1693                        status, tests[i].expected_status,
     1694                        ret, done, "got unexpected failure code");
     1695
     1696        }
     1697done:
     1698        if (phandle != NULL) {
     1699                smb2_util_close(tree, *phandle);
     1700        }
     1701
     1702        smb2_util_unlink(tree, fname);
     1703
     1704        return ret;
     1705}
     1706
     1707static bool test_channel_sequence(struct torture_context *tctx,
     1708                                  struct smb2_tree *tree)
     1709{
     1710        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     1711        bool ret = true;
     1712        const char *fname = BASEDIR "\\channel_sequence.dat";
     1713        struct smb2_transport *transport1 = tree->session->transport;
     1714        struct smb2_handle handle;
     1715        uint32_t server_capabilities;
     1716        uint16_t opcodes[] = { SMB2_OP_WRITE, SMB2_OP_IOCTL, SMB2_OP_SETINFO };
     1717        int i;
     1718
     1719        if (smbXcli_conn_protocol(transport1->conn) < PROTOCOL_SMB3_00) {
     1720                torture_skip(tctx, "SMB 3.X Dialect family required for "
     1721                                   "Replay tests\n");
     1722        }
     1723
     1724        server_capabilities = smb2cli_conn_server_capabilities(
     1725                                        tree->session->transport->conn);
     1726        if (!(server_capabilities & SMB2_CAP_MULTI_CHANNEL)) {
     1727                torture_skip(tctx,
     1728                             "Server does not support multi-channel.");
     1729        }
     1730
     1731        torture_comment(tctx, "Testing channel sequence numbers\n");
     1732
     1733        torture_assert_ntstatus_ok_goto(tctx,
     1734                torture_smb2_testdir(tree, BASEDIR, &handle),
     1735                ret, done, "failed to setup test directory");
     1736
     1737        smb2_util_close(tree, handle);
     1738        smb2_util_unlink(tree, fname);
     1739
     1740        for (i=0; i <ARRAY_SIZE(opcodes); i++) {
     1741                torture_assert(tctx,
     1742                        test_channel_sequence_table(tctx, tree, false, opcodes[i]),
     1743                        "failed to test CSN without replay flag");
     1744                torture_assert(tctx,
     1745                        test_channel_sequence_table(tctx, tree, true, opcodes[i]),
     1746                        "failed to test CSN with replay flag");
     1747        }
     1748
     1749done:
     1750
     1751        smb2_util_unlink(tree, fname);
     1752        smb2_deltree(tree, BASEDIR);
     1753
     1754        talloc_free(tree);
     1755        talloc_free(mem_ctx);
     1756
     1757        return ret;
     1758}
     1759
    14311760/**
    14321761 * Test Durablity V2 Create Replay Detection on Multi Channel
     
    19572286}
    19582287
     2288
     2289/**
     2290 * Test Error Codes when a DurableHandleReqV2 with matching CreateGuid is
     2291 * re-sent with or without SMB2_FLAGS_REPLAY_OPERATION
     2292 */
     2293static bool test_replay6(struct torture_context *tctx, struct smb2_tree *tree)
     2294{
     2295        NTSTATUS status;
     2296        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     2297        struct smb2_handle _h;
     2298        struct smb2_handle *h = NULL;
     2299        struct smb2_create io, ref1;
     2300        union smb_fileinfo qfinfo;
     2301        struct GUID create_guid = GUID_random();
     2302        bool ret = true;
     2303        const char *fname = BASEDIR "\\replay6.dat";
     2304        struct smb2_transport *transport = tree->session->transport;
     2305
     2306        if (smbXcli_conn_protocol(transport->conn) < PROTOCOL_SMB3_00) {
     2307                torture_skip(tctx, "SMB 3.X Dialect family required for "
     2308                                   "replay tests\n");
     2309        }
     2310
     2311        torture_reset_break_info(tctx, &break_info);
     2312        tree->session->transport->oplock.handler = torture_oplock_ack_handler;
     2313        tree->session->transport->oplock.private_data = tree;
     2314
     2315        torture_comment(tctx, "Error Codes for DurableHandleReqV2 Replay\n");
     2316        smb2_util_unlink(tree, fname);
     2317        status = torture_smb2_testdir(tree, BASEDIR, &_h);
     2318        CHECK_STATUS(status, NT_STATUS_OK);
     2319        smb2_util_close(tree, _h);
     2320        torture_wait_for_oplock_break(tctx);
     2321        CHECK_VAL(break_info.count, 0);
     2322        torture_reset_break_info(tctx, &break_info);
     2323
     2324        smb2_oplock_create_share(&io, fname,
     2325                        smb2_util_share_access("RWD"),
     2326                        smb2_util_oplock_level("b"));
     2327        io.in.durable_open = false;
     2328        io.in.durable_open_v2 = true;
     2329        io.in.persistent_open = false;
     2330        io.in.create_guid = create_guid;
     2331        io.in.timeout = UINT32_MAX;
     2332
     2333        status = smb2_create(tree, mem_ctx, &io);
     2334        CHECK_STATUS(status, NT_STATUS_OK);
     2335        ref1 = io;
     2336        _h = io.out.file.handle;
     2337        h = &_h;
     2338        CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE);
     2339        CHECK_VAL(io.out.oplock_level, smb2_util_oplock_level("b"));
     2340        CHECK_VAL(io.out.durable_open, false);
     2341        CHECK_VAL(io.out.durable_open_v2, true);
     2342
     2343        io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
     2344        io.in.create_disposition = NTCREATEX_DISP_OPEN;
     2345        smb2cli_session_start_replay(tree->session->smbXcli);
     2346        status = smb2_create(tree, mem_ctx, &io);
     2347        smb2cli_session_stop_replay(tree->session->smbXcli);
     2348        CHECK_STATUS(status, NT_STATUS_OK);
     2349        CHECK_CREATE_OUT(&io, &ref1);
     2350        torture_wait_for_oplock_break(tctx);
     2351        CHECK_VAL(break_info.count, 0);
     2352        torture_reset_break_info(tctx, &break_info);
     2353
     2354        qfinfo = (union smb_fileinfo) {
     2355                .generic.level = RAW_SFILEINFO_POSITION_INFORMATION,
     2356                .generic.in.file.handle = *h
     2357        };
     2358        torture_comment(tctx, "Trying getinfo\n");
     2359        status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
     2360        CHECK_STATUS(status, NT_STATUS_OK);
     2361        CHECK_VAL(qfinfo.position_information.out.position, 0);
     2362
     2363        smb2cli_session_start_replay(tree->session->smbXcli);
     2364        status = smb2_create(tree, mem_ctx, &io);
     2365        smb2cli_session_stop_replay(tree->session->smbXcli);
     2366        CHECK_STATUS(status, NT_STATUS_OK);
     2367        torture_assert_u64_not_equal_goto(tctx,
     2368                io.out.file.handle.data[0],
     2369                ref1.out.file.handle.data[0],
     2370                ret, done, "data 0");
     2371        torture_assert_u64_not_equal_goto(tctx,
     2372                io.out.file.handle.data[1],
     2373                ref1.out.file.handle.data[1],
     2374                ret, done, "data 1");
     2375        torture_wait_for_oplock_break(tctx);
     2376        CHECK_VAL(break_info.count, 1);
     2377        CHECK_VAL(break_info.level, smb2_util_oplock_level("s"));
     2378        torture_reset_break_info(tctx, &break_info);
     2379
     2380        /*
     2381         * Resend the matching Durable V2 Create without
     2382         * SMB2_FLAGS_REPLAY_OPERATION. This triggers an oplock break and still
     2383         * gets NT_STATUS_DUPLICATE_OBJECTID
     2384         */
     2385        status = smb2_create(tree, mem_ctx, &io);
     2386        CHECK_STATUS(status, NT_STATUS_DUPLICATE_OBJECTID);
     2387        torture_wait_for_oplock_break(tctx);
     2388        CHECK_VAL(break_info.count, 0);
     2389        torture_reset_break_info(tctx, &break_info);
     2390
     2391        /*
     2392         * According to MS-SMB2 3.3.5.9.10 if Durable V2 Create is replayed and
     2393         * FileAttributes or CreateDisposition do not match the earlier Create
     2394         * request the Server fails request with
     2395         * NT_STATUS_INVALID_PARAMETER. But through this test we see that server
     2396         * does not really care about changed FileAttributes or
     2397         * CreateDisposition.
     2398         */
     2399        io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
     2400        io.in.create_disposition = NTCREATEX_DISP_OPEN;
     2401        smb2cli_session_start_replay(tree->session->smbXcli);
     2402        status = smb2_create(tree, mem_ctx, &io);
     2403        smb2cli_session_stop_replay(tree->session->smbXcli);
     2404        CHECK_STATUS(status, NT_STATUS_OK);
     2405        torture_assert_u64_not_equal_goto(tctx,
     2406                io.out.file.handle.data[0],
     2407                ref1.out.file.handle.data[0],
     2408                ret, done, "data 0");
     2409        torture_assert_u64_not_equal_goto(tctx,
     2410                io.out.file.handle.data[1],
     2411                ref1.out.file.handle.data[1],
     2412                ret, done, "data 1");
     2413        torture_wait_for_oplock_break(tctx);
     2414        CHECK_VAL(break_info.count, 0);
     2415
     2416done:
     2417        if (h != NULL) {
     2418                smb2_util_close(tree, *h);
     2419        }
     2420
     2421        smb2_util_unlink(tree, fname);
     2422        smb2_deltree(tree, BASEDIR);
     2423
     2424        talloc_free(tree);
     2425        talloc_free(mem_ctx);
     2426
     2427        return ret;
     2428}
     2429
    19592430struct torture_suite *torture_smb2_replay_init(void)
    19602431{
     
    19722443        torture_suite_add_1smb2_test(suite, "replay-dhv2-lease3",  test_replay_dhv2_lease3);
    19732444        torture_suite_add_1smb2_test(suite, "replay-dhv2-lease-oplock",  test_replay_dhv2_lease_oplock);
     2445        torture_suite_add_1smb2_test(suite, "channel-sequence", test_channel_sequence);
    19742446        torture_suite_add_1smb2_test(suite, "replay3", test_replay3);
    19752447        torture_suite_add_1smb2_test(suite, "replay4", test_replay4);
    19762448        torture_suite_add_1smb2_test(suite, "replay5", test_replay5);
     2449        torture_suite_add_1smb2_test(suite, "replay6", test_replay6);
    19772450
    19782451        suite->description = talloc_strdup(suite, "SMB2 REPLAY tests");
  • vendor/current/source4/torture/smb2/smb2.c

    r988 r989  
    171171        torture_suite_add_suite(suite, torture_smb2_session_init());
    172172        torture_suite_add_suite(suite, torture_smb2_replay_init());
     173        torture_suite_add_simple_test(suite, "dosmode", torture_smb2_dosmode);
    173174
    174175        torture_suite_add_suite(suite, torture_smb2_doc_init());
  • vendor/current/source4/torture/smb2/util.c

    r988 r989  
    262262}
    263263
     264/*
     265  get granted access of a file handle
     266*/
     267NTSTATUS torture_smb2_get_allinfo_access(struct smb2_tree *tree,
     268                                         struct smb2_handle handle,
     269                                         uint32_t *granted_access)
     270{
     271        NTSTATUS status;
     272        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     273        union smb_fileinfo io;
     274
     275        io.generic.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
     276        io.generic.in.file.handle = handle;
     277
     278        status = smb2_getinfo_file(tree, tmp_ctx, &io);
     279        if (!NT_STATUS_IS_OK(status)) {
     280                DEBUG(0, ("getinfo failed - %s\n", nt_errstr(status)));
     281                goto out;
     282        }
     283
     284        *granted_access = io.all_info2.out.access_mask;
     285
     286out:
     287        talloc_free(tmp_ctx);
     288        return status;
     289}
     290
    264291/**
    265292 * open a smb2 tree connect
     
    429456}
    430457
    431 
    432458/*
    433459  create and return a handle to a test file
    434 */
    435 NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
    436                                struct smb2_handle *handle)
     460  with a specific access mask
     461*/
     462NTSTATUS torture_smb2_testfile_access(struct smb2_tree *tree, const char *fname,
     463                                      struct smb2_handle *handle,
     464                                      uint32_t desired_access)
    437465{
    438466        struct smb2_create io;
     
    441469        ZERO_STRUCT(io);
    442470        io.in.oplock_level = 0;
    443         io.in.desired_access = SEC_RIGHTS_FILE_ALL;
     471        io.in.desired_access = desired_access;
    444472        io.in.file_attributes   = FILE_ATTRIBUTE_NORMAL;
    445473        io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
     
    460488
    461489/*
     490  create and return a handle to a test file
     491*/
     492NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
     493                               struct smb2_handle *handle)
     494{
     495        return torture_smb2_testfile_access(tree, fname, handle,
     496                                            SEC_RIGHTS_FILE_ALL);
     497}
     498
     499/*
    462500  create and return a handle to a test directory
    463 */
    464 NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
    465                               struct smb2_handle *handle)
     501  with specific desired access
     502*/
     503NTSTATUS torture_smb2_testdir_access(struct smb2_tree *tree, const char *fname,
     504                                     struct smb2_handle *handle,
     505                                     uint32_t desired_access)
    466506{
    467507        struct smb2_create io;
     
    470510        ZERO_STRUCT(io);
    471511        io.in.oplock_level = 0;
    472         io.in.desired_access = SEC_RIGHTS_DIR_ALL;
     512        io.in.desired_access = desired_access;
    473513        io.in.file_attributes   = FILE_ATTRIBUTE_DIRECTORY;
    474514        io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
     
    485525}
    486526
     527/*
     528  create and return a handle to a test directory
     529*/
     530NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
     531                              struct smb2_handle *handle)
     532{
     533        return torture_smb2_testdir_access(tree, fname, handle,
     534                                           SEC_RIGHTS_DIR_ALL);
     535}
    487536
    488537/*
  • vendor/current/source4/torture/smb2/wscript_build

    r988 r989  
    55        smb2.c durable_open.c durable_v2_open.c oplock.c dir.c lease.c create.c
    66        acls.c read.c compound.c streams.c ioctl.c rename.c
    7         session.c delete-on-close.c replay.c notify_disabled.c''',
     7        session.c delete-on-close.c replay.c notify_disabled.c dosmode.c''',
    88        subsystem='smbtorture',
    99        deps='LIBCLI_SMB2 POPT_CREDENTIALS torture NDR_IOCTL',
  • vendor/current/source4/torture/vfs/vfs.c

    r988 r989  
    108108
    109109        torture_suite_add_suite(suite, torture_vfs_fruit());
     110        torture_suite_add_suite(suite, torture_acl_xattr());
    110111
    111112        torture_register_suite(suite);
  • vendor/current/source4/torture/wscript_build

    r988 r989  
    270270
    271271bld.SAMBA_MODULE('TORTURE_VFS',
    272         source='vfs/vfs.c vfs/fruit.c',
     272        source='vfs/vfs.c vfs/fruit.c vfs/acl_xattr.c',
    273273        subsystem='smbtorture',
    274274        deps='LIBCLI_SMB POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW',
Note: See TracChangeset for help on using the changeset viewer.