The branch, master has been updated
       via  3ede4ff Fix bug #8561 - Password change settings not fully observed.
       via  65566df Ensure we correctly calculate reply credits over all 
returned SMB2 replies, and do as Windows does and return the total in the last 
SMB2 reply. Fixes an issue found by Christian M Ambach 
<christian.amb...@de.ibm.com> (and thanks to Christian for the initial patch 
this was based on).
       via  c476338 Remove unneeded NULL check.
      from  ec38098 s4:partition LDB module - fix handling regarding special 
DNs on searches

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3ede4ffe969f806ba2363b62c09673c32a4ec296
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 15 13:27:14 2011 -0800

    Fix bug #8561 - Password change settings not fully observed.
    
    Autobuild-User: Jeremy Allison <j...@samba.org>
    Autobuild-Date: Wed Nov 16 00:22:41 CET 2011 on sn-devel-104

commit 65566dfa8629136eaf0dc1491502dc651d1a4858
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 15 11:27:56 2011 -0800

    Ensure we correctly calculate reply credits over all returned
    SMB2 replies, and do as Windows does and return the total in the
    last SMB2 reply. Fixes an issue found by Christian M Ambach 
<christian.amb...@de.ibm.com>
    (and thanks to Christian for the initial patch this was based on).

commit c4763385a883dcdec7f2101ae65c5a45642c247c
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 15 11:27:42 2011 -0800

    Remove unneeded NULL check.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/passdb.h              |    1 +
 source3/passdb/pdb_get_set.c          |   38 +++++++++++++++++++++++++++++---
 source3/rpc_server/samr/srv_samr_nt.c |    2 +-
 source3/smbd/aio.c                    |    4 ---
 source3/smbd/smb2_server.c            |   17 +++++++++++---
 5 files changed, 49 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 37d35cf..5980364 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -708,6 +708,7 @@ bool pdb_set_group_sid_from_rid (struct samu *sampass, 
uint32_t grid, enum pdb_v
 
 /* The following definitions come from passdb/pdb_get_set.c  */
 
+bool pdb_is_password_change_time_max(time_t test_time);
 uint32_t pdb_get_acct_ctrl(const struct samu *sampass);
 time_t pdb_get_logon_time(const struct samu *sampass);
 time_t pdb_get_logoff_time(const struct samu *sampass);
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index cf79a7f..540435f 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -40,6 +40,36 @@
 #define PDB_NOT_QUITE_NULL ""
 
 /*********************************************************************
+ Test if a change time is a max value. Copes with old and new values
+ of max.
+ ********************************************************************/
+
+bool pdb_is_password_change_time_max(time_t test_time)
+{
+       if (test_time == get_time_t_max()) {
+               return true;
+       }
+#if (defined(SIZEOF_TIME_T) && (SIZEOF_TIME_T == 8))
+       if (test_time == 0x7FFFFFFFFFFFFFFFLL) {
+               return true;
+       }
+#endif
+       if (test_time == 0x7FFFFFFF) {
+               return true;
+       }
+       return false;
+}
+
+/*********************************************************************
+ Return an unchanging version of max password change time - 0x7FFFFFFF.
+ ********************************************************************/
+
+time_t pdb_password_change_time_max(void)
+{
+       return 0x7FFFFFFF;
+}
+
+/*********************************************************************
  Collection of get...() functions for struct samu.
  ********************************************************************/
 
@@ -87,7 +117,7 @@ time_t pdb_get_pass_can_change_time(const struct samu 
*sampass)
           we're trying to update this real value from the sampass
           to indicate that the user cannot change their password.  jmcd
        */
-       if (sampass->pass_can_change_time == get_time_t_max() &&
+       if (pdb_is_password_change_time_max(sampass->pass_can_change_time) &&
            IS_SAM_CHANGED(sampass, PDB_CANCHANGETIME))
                return sampass->pass_can_change_time;
 
@@ -113,7 +143,7 @@ time_t pdb_get_pass_must_change_time(const struct samu 
*sampass)
                return (time_t) 0;
 
        if (sampass->acct_ctrl & ACB_PWNOEXP)
-               return get_time_t_max();
+               return pdb_password_change_time_max();
 
        if (!pdb_get_account_policy(PDB_POLICY_MAX_PASSWORD_AGE, &expire)
            || expire == (uint32_t)-1 || expire == 0)
@@ -124,7 +154,7 @@ time_t pdb_get_pass_must_change_time(const struct samu 
*sampass)
 
 bool pdb_get_pass_can_change(const struct samu *sampass)
 {
-       if (sampass->pass_can_change_time == get_time_t_max())
+       if (pdb_is_password_change_time_max(sampass->pass_can_change_time))
                return False;
        return True;
 }
@@ -959,7 +989,7 @@ bool pdb_set_backend_private_data(struct samu *sampass, 
void *private_data,
 bool pdb_set_pass_can_change(struct samu *sampass, bool canchange)
 {
        return pdb_set_pass_can_change_time(sampass, 
-                                    canchange ? 0 : get_time_t_max(),
+                                    canchange ? 0 : 
pdb_password_change_time_max(),
                                     PDB_CHANGED);
 }
 
diff --git a/source3/rpc_server/samr/srv_samr_nt.c 
b/source3/rpc_server/samr/srv_samr_nt.c
index 58892b7..ebe6e45 100644
--- a/source3/rpc_server/samr/srv_samr_nt.c
+++ b/source3/rpc_server/samr/srv_samr_nt.c
@@ -2855,7 +2855,7 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
        unix_to_nt_time(&r->allow_password_change, 
pdb_get_pass_can_change_time(pw));
 
        must_change_time = pdb_get_pass_must_change_time(pw);
-       if (must_change_time == get_time_t_max()) {
+       if (pdb_is_password_change_time_max(must_change_time)) {
                unix_to_nt_time_abs(&force_password_change, must_change_time);
        } else {
                unix_to_nt_time(&force_password_change, must_change_time);
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index d367826..07b8388 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -387,10 +387,6 @@ bool cancel_smb2_aio(struct smb_request *smbreq)
        struct aio_extra *aio_ex = NULL;
        int ret;
 
-       if (smbreq) {
-               smb2req = smbreq->smb2req;
-       }
-
        if (smb2req) {
                aio_ex = talloc_get_type(smbreq->async_priv,
                                         struct aio_extra);
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index dbb0089..851e2fd 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -517,13 +517,24 @@ static void smb2_calculate_credits(const struct 
smbd_smb2_request *inreq,
                                struct smbd_smb2_request *outreq)
 {
        int count, idx;
+       uint16_t total_credits = 0;
 
        count = outreq->out.vector_count;
 
        for (idx=1; idx < count; idx += 3) {
+               uint8_t *outhdr = (uint8_t *)outreq->out.vector[idx].iov_base;
                smb2_set_operation_credit(outreq->sconn,
                        &inreq->in.vector[idx],
                        &outreq->out.vector[idx]);
+               /* To match Windows, count up what we
+                  just granted. */
+               total_credits += SVAL(outhdr, SMB2_HDR_CREDIT);
+               /* Set to zero in all but the last reply. */
+               if (idx + 3 < count) {
+                       SSVAL(outhdr, SMB2_HDR_CREDIT, 0);
+               } else {
+                       SSVAL(outhdr, SMB2_HDR_CREDIT, total_credits);
+               }
        }
 }
 
@@ -1851,11 +1862,9 @@ static NTSTATUS smbd_smb2_request_reply(struct 
smbd_smb2_request *req)
 
        smb2_setup_nbt_length(req->out.vector, req->out.vector_count);
 
-       /* Set credit for this operation (zero credits if this
+       /* Set credit for these operations (zero credits if this
           is a final reply for an async operation). */
-       smb2_set_operation_credit(req->sconn,
-                       &req->in.vector[i],
-                       &req->out.vector[i]);
+       smb2_calculate_credits(req, req);
 
        if (req->do_signing) {
                NTSTATUS status;


-- 
Samba Shared Repository

Reply via email to