The branch, v3-2-test has been updated
       via  9c24713b402978e74dc8691be5cab71d8666eb41 (commit)
       via  7590b12a994cc3c5f299ce7f3299c76adad1c599 (commit)
      from  5c7f7629a97ef0929e00e52f1fae4386c984000b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 9c24713b402978e74dc8691be5cab71d8666eb41
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Wed Dec 12 13:50:48 2007 +0100

    Fix logic and prevent segfaults in secrets trustdom tdb pack code.
    
    New size calculation logic in tdb_trusted_dom_pass_pack()
    and tdb_sid_pack() used accumulated sizes as successive offsets
    to buffer pointer.
    
    Michael

commit 7590b12a994cc3c5f299ce7f3299c76adad1c599
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Wed Dec 12 13:37:46 2007 +0100

    Fix secrets_store_trusted_domain_password() after pstring removal.
    
    Jeremy, this small "&" sign has given me a headache... :-)
    
    Michael

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

Summary of changes:
 source/passdb/secrets.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/passdb/secrets.c b/source/passdb/secrets.c
index eee8aae..a4cb766 100644
--- a/source/passdb/secrets.c
+++ b/source/passdb/secrets.c
@@ -360,16 +360,16 @@ static size_t tdb_sid_pack(uint8 *pack_buf, int bufsize, 
DOM_SID* sid)
        len += tdb_pack(p, remaining_space, "bb", sid->sid_rev_num,
                        sid->num_auths);
        if (pack_buf) {
-               p += len;
-               remaining_space -= len;
+               p = pack_buf + len;
+               remaining_space = bufsize - len;
        }
 
        for (idx = 0; idx < 6; idx++) {
                len += tdb_pack(p, remaining_space, "b",
                                sid->id_auth[idx]);
                if (pack_buf) {
-                       p += len;
-                       remaining_space -= len;
+                       p = pack_buf + len;
+                       remaining_space = bufsize - len;
                }
        }
 
@@ -377,8 +377,8 @@ static size_t tdb_sid_pack(uint8 *pack_buf, int bufsize, 
DOM_SID* sid)
                len += tdb_pack(p, remaining_space, "d",
                                sid->sub_auths[idx]);
                if (pack_buf) {
-                       p += len;
-                       remaining_space -= len;
+                       p = pack_buf + len;
+                       remaining_space = bufsize - len;
                }
        }
 
@@ -440,31 +440,31 @@ static size_t tdb_trusted_dom_pass_pack(uint8 *pack_buf, 
int bufsize,
        len += tdb_pack(p, remaining_space, "d",
                        pass->uni_name_len);
        if (pack_buf) {
-               p += len;
-               remaining_space -= len;
+               p = pack_buf + len;
+               remaining_space = bufsize - len;
        }
 
        for (idx = 0; idx < 32; idx++) {
                len += tdb_pack(p, remaining_space, "w",
                                 pass->uni_name[idx]);
                if (pack_buf) {
-                       p += len;
-                       remaining_space -= len;
+                       p = pack_buf + len;
+                       remaining_space = bufsize - len;
                }
        }
 
        len += tdb_pack(p, remaining_space, "dPd", pass->pass_len,
                             pass->pass, pass->mod_time);
        if (pack_buf) {
-               p += len;
-               remaining_space -= len;
+               p = pack_buf + len;
+               remaining_space = bufsize - len;
        }
 
        /* packing SID structure */
        len += tdb_sid_pack(p, remaining_space, &pass->domain_sid);
        if (pack_buf) {
-               p += len;
-               remaining_space -= len;
+               p = pack_buf + len;
+               remaining_space = bufsize - len;
        }
 
        return len;
@@ -622,7 +622,7 @@ bool secrets_store_trusted_domain_password(const char* 
domain, const char* pwd,
                return false;
        }
        pass_len = tdb_trusted_dom_pass_pack(pass_buf, pass_len, &pass);
-       ret = secrets_store(trustdom_keystr(domain), (void *)&pass_buf,
+       ret = secrets_store(trustdom_keystr(domain), (void *)pass_buf,
                        pass_len);
        SAFE_FREE(pass_buf);
        return ret;


-- 
Samba Shared Repository

Reply via email to