~ubuntu-branches/ubuntu/utopic/samba/utopic

« back to all changes in this revision

Viewing changes to source3/smbd/smb2_server.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-21 09:06:34 UTC
  • mfrom: (0.39.23 sid)
  • Revision ID: package-import@ubuntu.com-20120221090634-svd7q7m33pfz0847
Tags: 2:3.6.3-1ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module.
* Dropped:
  - debian/patches/fix-samba-printer-browsing.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        req->mem_pool   = mem_pool;
207
207
        req->parent     = parent;
208
208
 
 
209
        req->last_session_id = UINT64_MAX;
 
210
        req->last_tid = UINT32_MAX;
 
211
 
209
212
        talloc_set_destructor(parent, smbd_smb2_request_parent_destructor);
210
213
        talloc_set_destructor(req, smbd_smb2_request_destructor);
211
214
 
511
514
                                struct smbd_smb2_request *outreq)
512
515
{
513
516
        int count, idx;
 
517
        uint16_t total_credits = 0;
514
518
 
515
519
        count = outreq->out.vector_count;
516
520
 
517
521
        for (idx=1; idx < count; idx += 3) {
 
522
                uint8_t *outhdr = (uint8_t *)outreq->out.vector[idx].iov_base;
518
523
                smb2_set_operation_credit(outreq->sconn,
519
524
                        &inreq->in.vector[idx],
520
525
                        &outreq->out.vector[idx]);
 
526
                /* To match Windows, count up what we
 
527
                   just granted. */
 
528
                total_credits += SVAL(outhdr, SMB2_HDR_CREDIT);
 
529
                /* Set to zero in all but the last reply. */
 
530
                if (idx + 3 < count) {
 
531
                        SSVAL(outhdr, SMB2_HDR_CREDIT, 0);
 
532
                } else {
 
533
                        SSVAL(outhdr, SMB2_HDR_CREDIT, total_credits);
 
534
                }
521
535
        }
522
536
}
523
537
 
574
588
                /* setup the SMB2 header */
575
589
                SIVAL(outhdr, SMB2_HDR_PROTOCOL_ID,     SMB2_MAGIC);
576
590
                SSVAL(outhdr, SMB2_HDR_LENGTH,          SMB2_HDR_BODY);
577
 
                SSVAL(outhdr, SMB2_HDR_EPOCH,           0);
 
591
                SSVAL(outhdr, SMB2_HDR_CREDIT_CHARGE,
 
592
                      SVAL(inhdr, SMB2_HDR_CREDIT_CHARGE));
578
593
                SIVAL(outhdr, SMB2_HDR_STATUS,
579
594
                      NT_STATUS_V(NT_STATUS_INTERNAL_ERROR));
580
595
                SSVAL(outhdr, SMB2_HDR_OPCODE,
590
605
                      IVAL(inhdr, SMB2_HDR_TID));
591
606
                SBVAL(outhdr, SMB2_HDR_SESSION_ID,
592
607
                      BVAL(inhdr, SMB2_HDR_SESSION_ID));
593
 
                memset(outhdr + SMB2_HDR_SIGNATURE, 0, 16);
 
608
                memcpy(outhdr + SMB2_HDR_SIGNATURE,
 
609
                       inhdr + SMB2_HDR_SIGNATURE, 16);
594
610
 
595
611
                /* setup error body header */
596
612
                SSVAL(outbody, 0x00, 0x08 + 1);
947
963
        SIVAL(hdr, SMB2_HDR_STATUS, NT_STATUS_V(STATUS_PENDING));
948
964
        SSVAL(hdr, SMB2_HDR_OPCODE, SVAL(reqhdr, SMB2_HDR_OPCODE));
949
965
 
950
 
        SIVAL(hdr, SMB2_HDR_FLAGS, flags | SMB2_HDR_FLAG_ASYNC);
 
966
        SIVAL(hdr, SMB2_HDR_FLAGS, flags);
951
967
        SIVAL(hdr, SMB2_HDR_NEXT_COMMAND, 0);
952
968
        SBVAL(hdr, SMB2_HDR_MESSAGE_ID, message_id);
953
969
        SBVAL(hdr, SMB2_HDR_PID, async_id);
970
986
                        &req->in.vector[i],
971
987
                        &state->vector[1]);
972
988
 
 
989
        SIVAL(hdr, SMB2_HDR_FLAGS, flags | SMB2_HDR_FLAG_ASYNC);
 
990
 
973
991
        if (req->do_signing) {
974
992
                status = smb2_signing_sign_pdu(req->session->session_key,
975
993
                                        &state->vector[1], 2);
1732
1750
 
1733
1751
        smb2_setup_nbt_length(req->out.vector, req->out.vector_count);
1734
1752
 
1735
 
        /* Set credit for this operation (zero credits if this
 
1753
        /* Set credit for these operations (zero credits if this
1736
1754
           is a final reply for an async operation). */
1737
 
        smb2_set_operation_credit(req->sconn,
1738
 
                        &req->in.vector[i],
1739
 
                        &req->out.vector[i]);
 
1755
        smb2_calculate_credits(req, req);
1740
1756
 
1741
1757
        if (req->do_signing) {
1742
1758
                NTSTATUS status;