The branch, master has been updated
       via  60df3c0 s3: Make "net sam list [users|workstations]" list only the 
right things
       via  26051b8 s3: Use tlap_simple_recv in tldap_sasl_bind_recv
       via  f6df16d s3: Add error checking to asn1_read_OctetString_talloc
       via  f49ad6d s3: Remove an unneeded proto
       via  80accd3 Fix typos
       via  9331bc3 s3: Fix some nonempty blank lines
       via  fe551d6 s3: Convert tldap_entry_values args to "array, count"
       via  84abb42 s3: Add an explicit counter to tldap_add_mod_[blobs|str]
       via  158c1e3 s3: Convert tldap_make_mod_fmt args to "array, count"
       via  6375e69 s3: Convert tldap_make_mod_blob args to "array, count"
       via  67e6874 s3: Convert tldap_make_mod_blob_int args to "array, count"
       via  3363bab s3: Convert tldap_add_blob_vals args to "array, count"
       via  6b492a1 s3: Convert tldap_add_mod_blobs args to "array, count"
       via  7852527 Fix some nonempty blank lines
       via  30e72e0 s3: Align the args of pdb_ads_update_sam_account to 
tldap_modify
      from  a730155 pyldb: fix a bug in the unit test which prevented 
ldb.python to run all the tests in the testsuite

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


- Log -----------------------------------------------------------------
commit 60df3c06790d2b4f6e3006123bd883fd842dfb41
Author: Volker Lendecke <[email protected]>
Date:   Sun Feb 13 11:26:49 2011 +0100

    s3: Make "net sam list [users|workstations]" list only the right things
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Sun Feb 13 12:59:14 CET 2011 on sn-devel-104

commit 26051b8aaaf1fd359997dbc71f617ea3e7b71d8a
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 23:49:26 2011 +0100

    s3: Use tlap_simple_recv in tldap_sasl_bind_recv

commit f6df16d9d2913db5a0b20ac83cc512c336572877
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 23:41:48 2011 +0100

    s3: Add error checking to asn1_read_OctetString_talloc

commit f49ad6d0738c34636f39df7ad0a62b9dc5b8cd4d
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 20:00:42 2011 +0100

    s3: Remove an unneeded proto

commit 80accd3946f64108b23f39398f1f92a77e4c7335
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 19:54:26 2011 +0100

    Fix typos

commit 9331bc378d609941a1bdbe793e1cf3f12e1a61da
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 19:52:05 2011 +0100

    s3: Fix some nonempty blank lines

commit fe551d681586adde38d4a01230f494ce0dd87b2c
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 17:00:30 2011 +0100

    s3: Convert tldap_entry_values args to "array, count"

commit 84abb428f640e4c48a7231ed78383b197ed715a9
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:58:10 2011 +0100

    s3: Add an explicit counter to tldap_add_mod_[blobs|str]

commit 158c1e315b2b680dad56d1b14ccfd4679c04c8bc
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:51:08 2011 +0100

    s3: Convert tldap_make_mod_fmt args to "array, count"

commit 6375e6993e38483fe2dfb3ce5d039b20b950b438
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:46:59 2011 +0100

    s3: Convert tldap_make_mod_blob args to "array, count"

commit 67e6874651e1cf0d0015079309c15a68f4048913
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:42:37 2011 +0100

    s3: Convert tldap_make_mod_blob_int args to "array, count"

commit 3363bab8754563f39c87de5bb91f77fcad3090f9
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:37:02 2011 +0100

    s3: Convert tldap_add_blob_vals args to "array, count"

commit 6b492a1741b8bdcfc61e5fded36e818fa7795b76
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 16:33:26 2011 +0100

    s3: Convert tldap_add_mod_blobs args to "array, count"

commit 78525270733a79a6e2def662d7340382cb648414
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 12:18:16 2011 +0100

    Fix some nonempty blank lines

commit 30e72e0d0ad95f8b2dd138525670ca687900f4b8
Author: Volker Lendecke <[email protected]>
Date:   Sat Feb 12 11:39:16 2011 +0100

    s3: Align the args of pdb_ads_update_sam_account to tldap_modify

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

Summary of changes:
 lib/socket_wrapper/socket_wrapper.c            |   36 +++++-----
 source3/include/tldap_util.h                   |   14 ++--
 source3/lib/tldap.c                            |   28 +++++---
 source3/lib/tldap_util.c                       |   49 ++++++++------
 source3/passdb/pdb_ads.c                       |   84 ++++++++++++++---------
 source3/passdb/pdb_compat.c                    |   12 ++--
 source3/winbindd/idmap_passdb.c                |    8 +-
 source4/dsdb/samdb/ldb_modules/password_hash.c |    2 +-
 8 files changed, 134 insertions(+), 99 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/socket_wrapper/socket_wrapper.c 
b/lib/socket_wrapper/socket_wrapper.c
index 594b807..563c3a8 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -297,7 +297,7 @@ static int convert_un_in(const struct sockaddr_un *un, 
struct sockaddr *in, sock
        case SOCKET_TYPE_CHAR_TCP:
        case SOCKET_TYPE_CHAR_UDP: {
                struct sockaddr_in *in2 = (struct sockaddr_in *)in;
-               
+
                if ((*len) < sizeof(*in2)) {
                    errno = EINVAL;
                    return -1;
@@ -315,7 +315,7 @@ static int convert_un_in(const struct sockaddr_un *un, 
struct sockaddr *in, sock
        case SOCKET_TYPE_CHAR_TCP_V6:
        case SOCKET_TYPE_CHAR_UDP_V6: {
                struct sockaddr_in6 *in2 = (struct sockaddr_in6 *)in;
-               
+
                if ((*len) < sizeof(*in2)) {
                        errno = EINVAL;
                        return -1;
@@ -614,7 +614,7 @@ static int sockaddr_convert_to_un(struct socket_info *si, 
const struct sockaddr
        default:
                break;
        }
-       
+
        errno = EAFNOSUPPORT;
        return -1;
 }
@@ -1669,7 +1669,7 @@ static int swrap_auto_bind(struct socket_info *si, int 
family)
                         "%s/"SOCKET_FORMAT, socket_wrapper_dir(),
                         type, socket_wrapper_default_iface(), port);
                if (stat(un_addr.sun_path, &st) == 0) continue;
-               
+
                ret = real_bind(si->fd, (struct sockaddr *)&un_addr, 
sizeof(un_addr));
                if (ret == -1) return ret;
 
@@ -1928,7 +1928,7 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, 
size_t len, int flags, con
                 * which makes it easier to format PCAP capture files
                 * (as the caller will simply continue from here) */
                len = MIN(len, 1500);
-       
+
                ret = real_send(s, buf, len, flags);
                break;
        case SOCK_DGRAM:
@@ -1936,29 +1936,29 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, 
size_t len, int flags, con
                        ret = swrap_auto_bind(si, si->family);
                        if (ret == -1) return -1;
                }
-               
+
                ret = sockaddr_convert_to_un(si, to, tolen, &un_addr, 0, 
&bcast);
                if (ret == -1) return -1;
-               
+
                if (bcast) {
                        struct stat st;
                        unsigned int iface;
                        unsigned int prt = ntohs(((const struct sockaddr_in 
*)to)->sin_port);
                        char type;
-                       
+
                        type = SOCKET_TYPE_CHAR_UDP;
-                       
+
                        for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
                                snprintf(un_addr.sun_path, 
sizeof(un_addr.sun_path), "%s/"SOCKET_FORMAT, 
                                         socket_wrapper_dir(), type, iface, 
prt);
                                if (stat(un_addr.sun_path, &st) != 0) continue;
-                               
+
                                /* ignore the any errors in broadcast sends */
                                real_sendto(s, buf, len, flags, (struct 
sockaddr *)&un_addr, sizeof(un_addr));
                        }
-                       
+
                        swrap_dump_packet(si, to, SWRAP_SENDTO, buf, len);
-                       
+
                        return len;
                }
 
@@ -1994,7 +1994,7 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, 
size_t len, int flags, con
                errno = EHOSTUNREACH;
                break;
        }
-               
+
        /* to give better errors */
        if (ret == -1 && errno == ENOENT) {
                errno = EHOSTUNREACH;
@@ -2155,7 +2155,7 @@ _PUBLIC_ ssize_t swrap_sendmsg(int s, const struct msghdr 
*msg, int flags)
        off_t ofs = 0;
        size_t i;
        size_t remain;
-       
+
        struct socket_info *si = find_socket_info(s);
 
        if (!si) {
@@ -2191,7 +2191,7 @@ _PUBLIC_ ssize_t swrap_sendmsg(int s, const struct msghdr 
*msg, int flags)
 
        ret = real_sendmsg(s, msg, flags);
        remain = ret;
-               
+
        /* we capture it as one single packet */
        buf = (uint8_t *)malloc(ret);
        if (!buf) {
@@ -2199,7 +2199,7 @@ _PUBLIC_ ssize_t swrap_sendmsg(int s, const struct msghdr 
*msg, int flags)
                errno = 0;
                return ret;
        }
-       
+
        for (i=0; i < msg->msg_iovlen; i++) {
                size_t this_time = MIN(remain, msg->msg_iov[i].iov_len);
                memcpy(buf + ofs,
@@ -2208,7 +2208,7 @@ _PUBLIC_ ssize_t swrap_sendmsg(int s, const struct msghdr 
*msg, int flags)
                ofs += this_time;
                remain -= this_time;
        }
-       
+
        swrap_dump_packet(si, NULL, SWRAP_SEND, buf, ret);
        free(buf);
        if (ret == -1) {
@@ -2233,7 +2233,7 @@ int swrap_readv(int s, const struct iovec *vector, size_t 
count)
                 * which makes it easier to format PCAP capture files
                 * (as the caller will simply continue from here) */
                size_t i, len = 0;
-               
+
                for (i=0; i < count; i++) {
                        size_t nlen;
                        nlen = len + vector[i].iov_len;
diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h
index 2e0da85..53b0c7b 100644
--- a/source3/include/tldap_util.h
+++ b/source3/include/tldap_util.h
@@ -23,7 +23,7 @@
 #include "includes.h"
 
 bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
-                       int *num_values, DATA_BLOB **values);
+                       DATA_BLOB **values, int *num_values);
 bool tldap_get_single_valueblob(struct tldap_message *msg,
                                const char *attribute, DATA_BLOB *blob);
 char *tldap_talloc_single_attribute(struct tldap_message *msg,
@@ -33,16 +33,18 @@ bool tldap_pull_binsid(struct tldap_message *msg, const 
char *attribute,
                       struct dom_sid *sid);
 bool tldap_pull_guid(struct tldap_message *msg, const char *attribute,
                     struct GUID *guid);
-bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx,
+                        struct tldap_mod **pmods, int *pnum_mods,
                         int mod_op, const char *attrib,
-                        int num_values, DATA_BLOB *values);
-bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+                        DATA_BLOB *newvals, int num_newvals);
+bool tldap_add_mod_str(TALLOC_CTX *mem_ctx,
+                      struct tldap_mod **pmods, int *pnum_mods,
                       int mod_op, const char *attrib, const char *str);
 bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
-                        int *pnum_mods, struct tldap_mod **pmods,
+                        struct tldap_mod **pmods, int *pnum_mods,
                         const char *attrib, DATA_BLOB newval);
 bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
-                       int *pnum_mods, struct tldap_mod **pmods,
+                       struct tldap_mod **pmods, int *pnum_mods,
                        const char *attrib, const char *fmt, ...);
 
 const char *tldap_errstr(TALLOC_CTX *mem_ctx, struct tldap_context *ld,
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 775d9ad..1dd380f 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -20,6 +20,8 @@
 #include "includes.h"
 #include "tldap.h"
 
+static int tldap_simple_recv(struct tevent_req *req);
+
 bool tevent_req_is_ldap_error(struct tevent_req *req, int *perr)
 {
        enum tevent_req_state state;
@@ -506,7 +508,7 @@ static bool tldap_msg_set_pending(struct tevent_req *req)
        }
 
        /*
-        * We're the first ones, add the read_ldap request that waits for the
+        * We're the first one, add the read_ldap request that waits for the
         * answer from the server
         */
        subreq = read_ldap_send(ld->pending, state->ev, ld->conn);
@@ -734,6 +736,11 @@ static void tldap_save_msg(struct tldap_context *ld, 
struct tevent_req *req)
 static char *blob2string_talloc(TALLOC_CTX *mem_ctx, DATA_BLOB blob)
 {
        char *result = talloc_array(mem_ctx, char, blob.length+1);
+
+       if (result == NULL) {
+               return NULL;
+       }
+
        memcpy(result, blob.data, blob.length);
        result[blob.length] = '\0';
        return result;
@@ -741,13 +748,21 @@ static char *blob2string_talloc(TALLOC_CTX *mem_ctx, 
DATA_BLOB blob)
 
 static bool asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx,
                                         struct asn1_data *data,
-                                        char **result)
+                                        char **presult)
 {
        DATA_BLOB string;
+       char *result;
        if (!asn1_read_OctetString(data, mem_ctx, &string))
                return false;
-       *result = blob2string_talloc(mem_ctx, string);
+
+       result = blob2string_talloc(mem_ctx, string);
+
        data_blob_free(&string);
+
+       if (result == NULL) {
+               return false;
+       }
+       *presult = result;
        return true;
 }
 
@@ -869,12 +884,7 @@ static void tldap_sasl_bind_done(struct tevent_req *subreq)
 
 int tldap_sasl_bind_recv(struct tevent_req *req)
 {
-       int err;
-
-       if (tevent_req_is_ldap_error(req, &err)) {
-               return err;
-       }
-       return TLDAP_SUCCESS;
+       return tldap_simple_recv(req);
 }
 
 int tldap_sasl_bind(struct tldap_context *ld,
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 7f1e916..b83a1b7 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -23,7 +23,7 @@
 #include "../libcli/security/security.h"
 
 bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
-                       int *num_values, DATA_BLOB **values)
+                       DATA_BLOB **values, int *num_values)
 {
        struct tldap_attribute *attributes;
        int i, num_attributes;
@@ -54,7 +54,7 @@ bool tldap_get_single_valueblob(struct tldap_message *msg,
        if (attribute == NULL) {
                return NULL;
        }
-       if (!tldap_entry_values(msg, attribute, &num_values, &values)) {
+       if (!tldap_entry_values(msg, attribute, &values, &num_values)) {
                return NULL;
        }
        if (num_values != 1) {
@@ -106,7 +106,7 @@ bool tldap_pull_guid(struct tldap_message *msg, const char 
*attribute,
 }
 
 static bool tldap_add_blob_vals(TALLOC_CTX *mem_ctx, struct tldap_mod *mod,
-                               int num_newvals, DATA_BLOB *newvals)
+                               DATA_BLOB *newvals, int num_newvals)
 {
        int num_values = talloc_array_length(mod->values);
        int i;
@@ -131,9 +131,10 @@ static bool tldap_add_blob_vals(TALLOC_CTX *mem_ctx, 
struct tldap_mod *mod,
        return true;
 }
 
-bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx,
+                        struct tldap_mod **pmods, int *pnum_mods,
                         int mod_op, const char *attrib,
-                        int num_newvals, DATA_BLOB *newvals)
+                        DATA_BLOB *newvals, int num_newvals)
 {
        struct tldap_mod new_mod;
        struct tldap_mod *mods = *pmods;
@@ -147,7 +148,7 @@ bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct 
tldap_mod **pmods,
                return false;
        }
 
-       num_mods = talloc_array_length(mods);
+       num_mods = *pnum_mods;
 
        for (i=0; i<num_mods; i++) {
                if ((mods[i].mod_op == mod_op)
@@ -169,11 +170,11 @@ bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct 
tldap_mod **pmods,
        }
 
        if ((num_newvals != 0)
-           && !tldap_add_blob_vals(mods, mod, num_newvals, newvals)) {
+           && !tldap_add_blob_vals(mods, mod, newvals, num_newvals)) {
                return false;
        }
 
-       if (i == num_mods) {
+       if ((i == num_mods) && (talloc_array_length(mods) < num_mods + 1)) {
                mods = talloc_realloc(talloc_tos(), mods, struct tldap_mod,
                                      num_mods+1);
                if (mods == NULL) {
@@ -183,10 +184,12 @@ bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct 
tldap_mod **pmods,
        }
 
        *pmods = mods;
+       *pnum_mods += 1;
        return true;
 }
 
-bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
+bool tldap_add_mod_str(TALLOC_CTX *mem_ctx,
+                      struct tldap_mod **pmods, int *pnum_mods,
                       int mod_op, const char *attrib, const char *str)
 {
        DATA_BLOB utf8;
@@ -198,14 +201,15 @@ bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct 
tldap_mod **pmods,
                return false;
        }
 
-       ret = tldap_add_mod_blobs(mem_ctx, pmods, mod_op, attrib, 1, &utf8);
+       ret = tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods, mod_op, attrib,
+                                 &utf8, 1);
        TALLOC_FREE(utf8.data);
        return ret;
 }
 
 static bool tldap_make_mod_blob_int(struct tldap_message *existing,
                                    TALLOC_CTX *mem_ctx,
-                                   int *pnum_mods, struct tldap_mod **pmods,
+                                   struct tldap_mod **pmods, int *pnum_mods,
                                    const char *attrib, DATA_BLOB newval,
                                    int (*comparison)(const DATA_BLOB *d1,
                                                      const DATA_BLOB *d2))
@@ -215,7 +219,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message 
*existing,
        DATA_BLOB oldval = data_blob_null;
 
        if ((existing != NULL)
-           && tldap_entry_values(existing, attrib, &num_values, &values)) {
+           && tldap_entry_values(existing, attrib, &values, &num_values)) {
 
                if (num_values > 1) {
                        /* can't change multivalue attributes atm */
@@ -247,8 +251,9 @@ static bool tldap_make_mod_blob_int(struct tldap_message 
*existing,
 
                DEBUG(10, ("smbldap_make_mod_blob: deleting attribute |%s|\n",
                           attrib));
-               if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_DELETE,
-                                        attrib, 1, &oldval)) {
+               if (!tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods,
+                                        TLDAP_MOD_DELETE,
+                                        attrib, &oldval, 1)) {
                        return false;
                }
        }
@@ -260,20 +265,20 @@ static bool tldap_make_mod_blob_int(struct tldap_message 
*existing,
        if (newval.data != NULL) {
                DEBUG(10, ("smbldap_make_mod: adding attribute |%s| value len "
                           "%d\n", attrib, (int)newval.length));
-               if (!tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_ADD,
-                                        attrib, 1, &newval)) {
+               if (!tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods,
+                                        TLDAP_MOD_ADD,
+                                        attrib, &newval, 1)) {
                        return false;
                }
        }
-       *pnum_mods = talloc_array_length(*pmods);
        return true;
 }
 
 bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
-                        int *pnum_mods, struct tldap_mod **pmods,
+                        struct tldap_mod **pmods, int *pnum_mods,
                         const char *attrib, DATA_BLOB newval)
 {
-       return tldap_make_mod_blob_int(existing, mem_ctx, pnum_mods, pmods,
+       return tldap_make_mod_blob_int(existing, mem_ctx, pmods, pnum_mods,
                                       attrib, newval, data_blob_cmp);
 }
 
@@ -301,7 +306,7 @@ static int compare_utf8_blobs(const DATA_BLOB *d1, const 
DATA_BLOB *d2)
 }
 
 bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
-                       int *pnum_mods, struct tldap_mod **pmods,
+                       struct tldap_mod **pmods, int *pnum_mods,
                        const char *attrib, const char *fmt, ...)
 {
        va_list ap;
@@ -321,7 +326,7 @@ bool tldap_make_mod_fmt(struct tldap_message *existing, 
TALLOC_CTX *mem_ctx,
        if (blob.length != 0) {
                blob.data = CONST_DISCARD(uint8_t *, newval);
        }
-       ret = tldap_make_mod_blob_int(existing, mem_ctx, pnum_mods, pmods,
+       ret = tldap_make_mod_blob_int(existing, mem_ctx, pmods, pnum_mods,
                                      attrib, blob, compare_utf8_blobs);
        TALLOC_FREE(newval);
        return ret;
@@ -542,7 +547,7 @@ bool tldap_entry_has_attrvalue(struct tldap_message *msg,
        int i, num_values;
        DATA_BLOB *values;
 
-       if (!tldap_entry_values(msg, attribute, &num_values, &values)) {
+       if (!tldap_entry_values(msg, attribute, &values, &num_values)) {
                return false;
        }
        for (i=0; i<num_values; i++) {
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index 565b469..b60615f 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -41,9 +41,6 @@ struct pdb_ads_samu_private {
        struct tldap_message *ldapmsg;
 };
 
-static NTSTATUS pdb_ads_getsampwsid(struct pdb_methods *m,
-                                   struct samu *sam_acct,
-                                   const struct dom_sid *sid);
 static bool pdb_ads_gid_to_sid(struct pdb_methods *m, gid_t gid,
                               struct dom_sid *sid);
 static bool pdb_ads_dnblob2sid(struct pdb_ads_state *state, DATA_BLOB *dnblob,
@@ -291,7 +288,7 @@ fail:
 static bool pdb_ads_init_ads_from_sam(struct pdb_ads_state *state,
                                      struct tldap_message *existing,
                                      TALLOC_CTX *mem_ctx,
-                                     int *pnum_mods, struct tldap_mod **pmods,
+                                     struct tldap_mod **pmods, int *pnum_mods,
                                      struct samu *sam)
 {
        bool ret = true;
@@ -301,7 +298,7 @@ static bool pdb_ads_init_ads_from_sam(struct pdb_ads_state 
*state,
        /* TODO: All fields :-) */
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "displayName",
+               existing, mem_ctx, pmods, pnum_mods, "displayName",
                "%s", pdb_get_fullname(sam));
 
        pw = pdb_get_plaintext_passwd(sam);
@@ -330,33 +327,31 @@ static bool pdb_ads_init_ads_from_sam(struct 
pdb_ads_state *state,
                }
                blob = data_blob_const(pw_utf16, pw_utf16_len);
 
-               ret &= tldap_add_mod_blobs(mem_ctx, pmods, TLDAP_MOD_REPLACE,
-                                          "unicodePwd", 1, &blob);
-               if (ret) {
-                       *pnum_mods = talloc_array_length(*pmods);
-               }
+               ret &= tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods,
+                                          TLDAP_MOD_REPLACE,
+                                          "unicodePwd", &blob, 1);
                TALLOC_FREE(pw_utf16);
                TALLOC_FREE(pw_quote);
        }
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "userAccountControl",
+               existing, mem_ctx, pmods, pnum_mods, "userAccountControl",
                "%d", ds_acb2uf(pdb_get_acct_ctrl(sam)));
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "homeDirectory",
+               existing, mem_ctx, pmods, pnum_mods, "homeDirectory",
                "%s", pdb_get_homedir(sam));
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "homeDrive",
+               existing, mem_ctx, pmods, pnum_mods, "homeDrive",
                "%s", pdb_get_dir_drive(sam));
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "scriptPath",
+               existing, mem_ctx, pmods, pnum_mods, "scriptPath",
                "%s", pdb_get_logon_script(sam));
 
        ret &= tldap_make_mod_fmt(
-               existing, mem_ctx, pnum_mods, pmods, "profilePath",
+               existing, mem_ctx, pmods, pnum_mods, "profilePath",
                "%s", pdb_get_profile_path(sam));
 
 fail:
@@ -507,9 +502,9 @@ static NTSTATUS pdb_ads_create_user(struct pdb_methods *m,
 
        ok = true;
        ok &= tldap_make_mod_fmt(


-- 
Samba Shared Repository

Reply via email to