The branch, master has been updated
       via  7434723 tldap: Parse a search entry only if it is one
       via  f09cebd4 tldap: Make tldap_search use tldap_search_all
       via  0d1165a tldap: Add tldap_pending_reqs()
       via  d29c45c tldap: Add tldap_search_all
       via  b6244ae tldap: Avoid a "ret == false"
       via  372bf52 asn1: Fix whitespace
       via  ceb75ad spnego: Some simplifications
       via  e46e030 asn1: Simplify _ber_read_OID_String_impl
       via  7d8006f ldap: Correctly check asn1_tag_remaining retval
       via  024c619 spnego: Correctly check asn1_tag_remaining retval
       via  f3dbaac libads: Factor out ldap_schema_oids.h
       via  d56e42d ldb: Avoid a "talloc_steal"
       via  11c5513 ldb: Fix some whitespace
       via  465c646 smbtorture3: Convert the tldap caller to TLDAPRC
       via  2c3cf3c lib: Introduce TLDAPRC
       via  2bd88bf tldap: Parse the sasl output blob Reviewed-by: Guenther 
Deschner <[email protected]>
       via  3673752 tldap: Slightly simplify tldap_search_cb
       via  22f06c2 tldap: Mark server down if read failed
       via  59c1b10 tldap: Add some required includes
      from  2d80498 smbd: Fix CID 1351215 Improper use of negative value

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


- Log -----------------------------------------------------------------
commit 7434723ecda802e0fcefa075e583983b7671d927
Author: Volker Lendecke <[email protected]>
Date:   Tue Feb 2 12:15:49 2016 +0100

    tldap: Parse a search entry only if it is one
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>
    
    Autobuild-User(master): Günther Deschner <[email protected]>
    Autobuild-Date(master): Wed Feb  3 18:12:44 CET 2016 on sn-devel-144

commit f09cebd4fcae562e110a5356d6144ce9d2e220a5
Author: Volker Lendecke <[email protected]>
Date:   Sun Jan 31 15:29:29 2016 +0100

    tldap: Make tldap_search use tldap_search_all
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 0d1165a4241c67f88d5f0f1b718e29597698d515
Author: Volker Lendecke <[email protected]>
Date:   Sun Jan 31 15:15:46 2016 +0100

    tldap: Add tldap_pending_reqs()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit d29c45ce41c3360726b67e4683703b9eb433e29d
Author: Volker Lendecke <[email protected]>
Date:   Tue Dec 22 13:32:01 2015 +0100

    tldap: Add tldap_search_all
    
    Signed-off-by: Volker Lendecke <[email protected]>
    
    TLDAPRC
    Reviewed-by: Guenther Deschner <[email protected]>

commit b6244ae2573ce6a9fef4a17172d58afa097fc200
Author: Volker Lendecke <[email protected]>
Date:   Sun Jan 31 12:25:32 2016 +0100

    tldap: Avoid a "ret == false"
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 372bf525bf7dab6fe12dfd6509dc428732d2130a
Author: Volker Lendecke <[email protected]>
Date:   Sun Jan 31 11:12:23 2016 +0100

    asn1: Fix whitespace
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit ceb75ad09e99c46e6593575867a03759b6ff58bd
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 11 21:58:25 2016 +0100

    spnego: Some simplifications
    
    asn1_tag_remaining already checks for has_error and only
    returns positive if there is error-free space left
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit e46e030ee2af8d89f055ce07ec5b19f657629c38
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 11 22:05:43 2016 +0100

    asn1: Simplify _ber_read_OID_String_impl
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 7d8006f3b4e4bd435db7177002198f205ca3781a
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 11 21:49:21 2016 +0100

    ldap: Correctly check asn1_tag_remaining retval
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 024c619fa82960ae4f8af029b6872102202ffd07
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 11 21:49:21 2016 +0100

    spnego: Correctly check asn1_tag_remaining retval
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit f3dbaaca4121a5c9cd4d989c36b6b50fed32faf9
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 25 16:29:01 2016 +0100

    libads: Factor out ldap_schema_oids.h
    
    Make the oids accessible without having to include ADS_STRUCT&friends
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit d56e42de64af84ad839749beaa22450f71bec58a
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 25 12:40:53 2016 +0100

    ldb: Avoid a "talloc_steal"
    
    There's only one caller of "next_chunk" that does a talloc_steal right
    after the call. Pass in a talloc context.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 11c5513bb121fd43f566eacfe7b2af64f3cb3a83
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 25 12:38:36 2016 +0100

    ldb: Fix some whitespace
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 465c64676b09e46f7ee991a7ee5437c337ed0b50
Author: Volker Lendecke <[email protected]>
Date:   Mon Jan 25 09:26:06 2016 +0100

    smbtorture3: Convert the tldap caller to TLDAPRC
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 2c3cf3ce608bd4fb2a87a9eac7ed8f8ddd9c9937
Author: Volker Lendecke <[email protected]>
Date:   Sun Jan 24 11:53:48 2016 +0100

    lib: Introduce TLDAPRC
    
    Make ldap return codes type safe
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 2bd88bff0475cb2dbeb344b04e0d7c4ae3d8b7ea
Author: Volker Lendecke <[email protected]>
Date:   Sat Dec 26 22:40:36 2015 +0100

    tldap: Parse the sasl output blob
    Reviewed-by: Guenther Deschner <[email protected]>

commit 3673752f682dea1eda6581c8ec15b510b4d3b0f8
Author: Volker Lendecke <[email protected]>
Date:   Mon Dec 21 21:28:35 2015 +0100

    tldap: Slightly simplify tldap_search_cb
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 22f06c2e6f8659f13d9497d7480c988c62bf15b7
Author: Volker Lendecke <[email protected]>
Date:   Fri Dec 18 16:31:46 2015 +0100

    tldap: Mark server down if read failed
    
    This matches tldap_msg_sent
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

commit 59c1b1048f973197970d1ba6c915229038a30cd0
Author: Volker Lendecke <[email protected]>
Date:   Fri Dec 18 17:23:19 2015 +0100

    tldap: Add some required includes
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Guenther Deschner <[email protected]>

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

Summary of changes:
 lib/ldb/common/ldb_ldif.c                          |  63 +-
 lib/util/asn1.c                                    |  29 +-
 lib/util/asn1.h                                    |  10 +-
 libcli/auth/spnego_parse.c                         |   7 +-
 libcli/ldap/ldap_message.c                         |   2 +-
 source3/include/tldap.h                            | 218 +++---
 source3/include/tldap_util.h                       |  24 +-
 source3/lib/tldap.c                                | 852 +++++++++++----------
 source3/lib/tldap_util.c                           | 102 ++-
 source3/libads/ldap_schema.c                       |   1 +
 source3/libads/ldap_schema.h                       |  25 -
 .../libads/{ldap_schema.h => ldap_schema_oids.h}   |  39 +-
 source3/libsmb/clispnego.c                         |   8 +-
 source3/torture/torture.c                          |  15 +-
 14 files changed, 691 insertions(+), 704 deletions(-)
 copy source3/libads/{ldap_schema.h => ldap_schema_oids.h} (66%)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c
index f9743dc..07de517 100644
--- a/lib/ldb/common/ldb_ldif.c
+++ b/lib/ldb/common/ldb_ldif.c
@@ -1,4 +1,4 @@
-/* 
+/*
    ldb database library
 
    Copyright (C) Andrew Tridgell  2004
@@ -6,7 +6,7 @@
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
      ** under the LGPL
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -39,7 +39,7 @@
 #include "system/locale.h"
 
 /*
-  
+
 */
 static int ldb_read_data_file(TALLOC_CTX *mem_ctx, struct ldb_val *value)
 {
@@ -236,7 +236,7 @@ static int fold_string(int (*fprintf_fn)(void *, const char 
*, ...), void *priva
   encode as base64 to a file
 */
 static int base64_encode_f(struct ldb_context *ldb,
-                          int (*fprintf_fn)(void *, const char *, ...), 
+                          int (*fprintf_fn)(void *, const char *, ...),
                           void *private_data,
                           const char *buf, int len, int start_pos)
 {
@@ -273,9 +273,9 @@ static const struct {
   write to ldif, using a caller supplied write method, and only printing 
secrets if we are not in a trace
 */
 static int ldb_ldif_write_trace(struct ldb_context *ldb,
-                               int (*fprintf_fn)(void *, const char *, ...), 
+                               int (*fprintf_fn)(void *, const char *, ...),
                                void *private_data,
-                               const struct ldb_ldif *ldif, 
+                               const struct ldb_ldif *ldif,
                                bool in_trace)
 {
        TALLOC_CTX *mem_ctx;
@@ -324,20 +324,20 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
                if (ldif->changetype == LDB_CHANGETYPE_MODIFY) {
                        switch (msg->elements[i].flags & LDB_FLAG_MOD_MASK) {
                        case LDB_FLAG_MOD_ADD:
-                               fprintf_fn(private_data, "add: %s\n", 
+                               fprintf_fn(private_data, "add: %s\n",
                                           msg->elements[i].name);
                                break;
                        case LDB_FLAG_MOD_DELETE:
-                               fprintf_fn(private_data, "delete: %s\n", 
+                               fprintf_fn(private_data, "delete: %s\n",
                                           msg->elements[i].name);
                                break;
                        case LDB_FLAG_MOD_REPLACE:
-                               fprintf_fn(private_data, "replace: %s\n", 
+                               fprintf_fn(private_data, "replace: %s\n",
                                           msg->elements[i].name);
                                break;
                        }
                }
-               
+
                if (in_trace && secret_attributes && 
ldb_attr_in_list(secret_attributes, msg->elements[i].name)) {
                        /* Deliberatly skip printing this password */
                        ret = fprintf_fn(private_data, "# %s::: REDACTED SECRET 
ATTRIBUTE\n",
@@ -356,10 +356,10 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
                        use_b64_encode = !(ldb->flags & LDB_FLG_SHOW_BINARY)
                                        && ldb_should_b64_encode(ldb, &v);
                        if (ret != LDB_SUCCESS || use_b64_encode) {
-                               ret = fprintf_fn(private_data, "%s:: ", 
+                               ret = fprintf_fn(private_data, "%s:: ",
                                                 msg->elements[i].name);
                                CHECK_RET;
-                               ret = base64_encode_f(ldb, fprintf_fn, 
private_data, 
+                               ret = base64_encode_f(ldb, fprintf_fn, 
private_data,
                                                      (char *)v.data, v.length,
                                                      
strlen(msg->elements[i].name)+3);
                                CHECK_RET;
@@ -369,7 +369,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
                                ret = fprintf_fn(private_data, "%s: ", 
msg->elements[i].name);
                                CHECK_RET;
                                if (ldb->flags & LDB_FLG_SHOW_BINARY) {
-                                       ret = fprintf_fn(private_data, "%*.*s", 
+                                       ret = fprintf_fn(private_data, "%*.*s",
                                                         v.length, v.length, 
(char *)v.data);
                                } else {
                                        ret = fold_string(fprintf_fn, 
private_data,
@@ -403,7 +403,7 @@ static int ldb_ldif_write_trace(struct ldb_context *ldb,
   write to ldif, using a caller supplied write method
 */
 int ldb_ldif_write(struct ldb_context *ldb,
-                  int (*fprintf_fn)(void *, const char *, ...), 
+                  int (*fprintf_fn)(void *, const char *, ...),
                   void *private_data,
                   const struct ldb_ldif *ldif)
 {
@@ -417,7 +417,7 @@ int ldb_ldif_write(struct ldb_context *ldb,
 
   caller frees
 */
-static char *next_chunk(struct ldb_context *ldb, 
+static char *next_chunk(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
                        int (*fgetc_fn)(void *), void *private_data)
 {
        size_t alloc_size=0, chunk_size = 0;
@@ -429,7 +429,7 @@ static char *next_chunk(struct ldb_context *ldb,
                if (chunk_size+1 >= alloc_size) {
                        char *c2;
                        alloc_size += 1024;
-                       c2 = talloc_realloc(ldb, chunk, char, alloc_size);
+                       c2 = talloc_realloc(mem_ctx, chunk, char, alloc_size);
                        if (!c2) {
                                talloc_free(chunk);
                                errno = ENOMEM;
@@ -442,15 +442,15 @@ static char *next_chunk(struct ldb_context *ldb,
                        if (c == '\n') {
                                in_comment = 0;
                        }
-                       continue;                       
+                       continue;
                }
-               
+
                /* handle continuation lines - see RFC2849 */
                if (c == ' ' && chunk_size > 1 && chunk[chunk_size-1] == '\n') {
                        chunk_size--;
                        continue;
                }
-               
+
                /* chunks are terminated by a double line-feed */
                if (c == '\n' && chunk_size > 0 && chunk[chunk_size-1] == '\n') 
{
                        chunk[chunk_size-1] = 0;
@@ -774,18 +774,17 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
        msg->elements = NULL;
        msg->num_elements = 0;
 
-       chunk = next_chunk(ldb, fgetc_fn, private_data);
+       chunk = next_chunk(ldb, ldif, fgetc_fn, private_data);
        if (!chunk) {
                goto failed;
        }
-       talloc_steal(ldif, chunk);
 
        s = chunk;
 
        if (next_attr(ldif, &s, &attr, &value) != 0) {
                goto failed;
        }
-       
+
        /* first line must be a dn */
        if (ldb_attr_cmp(attr, "dn") != 0) {
                ldb_debug(ldb, LDB_DEBUG_ERROR, "Error: First line of ldif must 
be a dn not '%s'",
@@ -845,7 +844,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
                        }
                        continue;
                }
-               
+
                el = &msg->elements[msg->num_elements-1];
 
                a = ldb_schema_attribute_by_name(ldb, attr);
@@ -853,8 +852,8 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
                if (msg->num_elements > 0 && ldb_attr_cmp(attr, el->name) == 0 
&&
                    flags == el->flags) {
                        /* its a continuation */
-                       el->values = 
-                               talloc_realloc(msg->elements, el->values, 
+                       el->values =
+                               talloc_realloc(msg->elements, el->values,
                                                 struct ldb_val, 
el->num_values+1);
                        if (!el->values) {
                                goto failed;
@@ -874,8 +873,8 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
                        el->num_values++;
                } else {
                        /* its a new attribute */
-                       msg->elements = talloc_realloc(msg, msg->elements, 
-                                                        struct 
ldb_message_element, 
+                       msg->elements = talloc_realloc(msg, msg->elements,
+                                                        struct 
ldb_message_element,
                                                         msg->num_elements+1);
                        if (!msg->elements) {
                                goto failed;
@@ -934,7 +933,7 @@ static int fgetc_file(void *private_data)
        return c;
 }
 
-struct ldb_ldif *ldb_ldif_read_file_state(struct ldb_context *ldb, 
+struct ldb_ldif *ldb_ldif_read_file_state(struct ldb_context *ldb,
                                          struct ldif_read_file_state *state)
 {
        return ldb_ldif_read(ldb, fgetc_file, state);
@@ -1020,7 +1019,7 @@ static int ldif_printf_string(void *private_data, const 
char *fmt, ...)
        va_list ap;
        size_t oldlen = talloc_get_size(state->string);
        va_start(ap, fmt);
-       
+
        state->string = talloc_vasprintf_append(state->string, fmt, ap);
        va_end(ap);
        if (!state->string) {
@@ -1030,7 +1029,7 @@ static int ldif_printf_string(void *private_data, const 
char *fmt, ...)
        return talloc_get_size(state->string) - oldlen;
 }
 
-char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX 
*mem_ctx, 
+char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX 
*mem_ctx,
                                           const struct ldb_ldif *ldif)
 {
        struct ldif_write_string_state state;
@@ -1044,7 +1043,7 @@ char *ldb_ldif_write_redacted_trace_string(struct 
ldb_context *ldb, TALLOC_CTX *
        return state.string;
 }
 
-char *ldb_ldif_write_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, 
+char *ldb_ldif_write_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
                            const struct ldb_ldif *ldif)
 {
        struct ldif_write_string_state state;
@@ -1062,7 +1061,7 @@ char *ldb_ldif_write_string(struct ldb_context *ldb, 
TALLOC_CTX *mem_ctx,
   convenient function to turn a ldb_message into a string. Useful for
   debugging
  */
-char *ldb_ldif_message_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, 
+char *ldb_ldif_message_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
                              enum ldb_changetype changetype,
                              const struct ldb_message *msg)
 {
diff --git a/lib/util/asn1.c b/lib/util/asn1.c
index 8f2c516..9aa9772 100644
--- a/lib/util/asn1.c
+++ b/lib/util/asn1.c
@@ -1,18 +1,18 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    simple ASN1 routines
    Copyright (C) Andrew Tridgell 2001
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -143,7 +143,7 @@ bool asn1_pop_tag(struct asn1_data *data)
        }
        len = data->ofs - (nesting->start+1);
        /* yes, this is ugly. We don't know in advance how many bytes the length
-          of a tag will take, so we assumed 1 byte. If we were wrong then we 
+          of a tag will take, so we assumed 1 byte. If we were wrong then we
           need to correct our mistake */
        if (len > 0xFFFFFF) {
                data->data[nesting->start] = 0x84;
@@ -617,7 +617,7 @@ bool asn1_start_tag(struct asn1_data *data, uint8_t tag)
 {
        uint8_t b;
        struct nesting *nesting;
-       
+
        if (!asn1_read_uint8(data, &b))
                return false;
 
@@ -641,7 +641,7 @@ bool asn1_start_tag(struct asn1_data *data, uint8_t tag)
                        return false;
                nesting->taglen = b;
                while (n > 1) {
-                       if (!asn1_read_uint8(data, &b)) 
+                       if (!asn1_read_uint8(data, &b))
                                return false;
                        nesting->taglen = (nesting->taglen << 8) | b;
                        n--;
@@ -718,9 +718,7 @@ static bool _ber_read_OID_String_impl(TALLOC_CTX *mem_ctx, 
DATA_BLOB blob,
 
        b = blob.data;
 
-       tmp_oid = talloc_asprintf(mem_ctx, "%u",  b[0]/40);
-       if (!tmp_oid) goto nomem;
-       tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u",  b[0]%40);
+       tmp_oid = talloc_asprintf(mem_ctx, "%u.%u", b[0]/40, b[0]%40);
        if (!tmp_oid) goto nomem;
 
        if (bytes_eaten != NULL) {
@@ -940,8 +938,7 @@ bool asn1_read_implicit_Integer(struct asn1_data *data, int 
*i)
                }
                *i = (*i << 8) + b;
        }
-       return !data->has_error;        
-       
+       return !data->has_error;
 }
 
 /* read an integer */
@@ -951,7 +948,7 @@ bool asn1_read_Integer(struct asn1_data *data, int *i)
 
        if (!asn1_start_tag(data, ASN1_INTEGER)) return false;
        if (!asn1_read_implicit_Integer(data, i)) return false;
-       return asn1_end_tag(data);      
+       return asn1_end_tag(data);
 }
 
 /* read a BIT STRING */
@@ -991,7 +988,7 @@ bool asn1_read_BitString(struct asn1_data *data, TALLOC_CTX 
*mem_ctx, DATA_BLOB
 bool asn1_read_enumerated(struct asn1_data *data, int *v)
 {
        *v = 0;
-       
+
        if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false;
        while (!data->has_error && asn1_tag_remaining(data)>0) {
                uint8_t b;
@@ -1000,7 +997,7 @@ bool asn1_read_enumerated(struct asn1_data *data, int *v)
                }
                *v = (*v << 8) + b;
        }
-       return asn1_end_tag(data);      
+       return asn1_end_tag(data);
 }
 
 /* check a enumerated value is correct */
@@ -1089,7 +1086,7 @@ int asn1_peek_full_tag(DATA_BLOB blob, uint8_t tag, 
size_t *packet_size)
        if (size > blob.length) {
                *packet_size = size;
                return EAGAIN;
-       }               
+       }
 
        *packet_size = size;
        return 0;
diff --git a/lib/util/asn1.h b/lib/util/asn1.h
index 9ebf453..95e7dbf 100644
--- a/lib/util/asn1.h
+++ b/lib/util/asn1.h
@@ -1,18 +1,18 @@
-/* 
-   Unix SMB/CIFS implementation.   
+/*
+   Unix SMB/CIFS implementation.
    simple ASN1 code
    Copyright (C) Andrew Tridgell 2001
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
diff --git a/libcli/auth/spnego_parse.c b/libcli/auth/spnego_parse.c
index 1b294df..a608dce 100644
--- a/libcli/auth/spnego_parse.c
+++ b/libcli/auth/spnego_parse.c
@@ -32,7 +32,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, 
TALLOC_CTX *mem_ctx,
        if (!asn1_start_tag(asn1, ASN1_CONTEXT(0))) return false;
        if (!asn1_start_tag(asn1, ASN1_SEQUENCE(0))) return false;
 
-       while (!asn1_has_error(asn1) && 0 < asn1_tag_remaining(asn1)) {
+       while (asn1_tag_remaining(asn1) > 0) {
                int i;
                uint8_t context;
 
@@ -54,8 +54,7 @@ static bool read_negTokenInit(struct asn1_data *asn1, 
TALLOC_CTX *mem_ctx,
                                asn1_set_error(asn1);
                                return false;
                        }
-                       for (i = 0; !asn1_has_error(asn1) &&
-                                    0 < asn1_tag_remaining(asn1); i++) {
+                       for (i = 0; asn1_tag_remaining(asn1) > 0; i++) {
                                char *oid;
                                const char **p;
                                p = talloc_realloc(mem_ctx,
@@ -201,7 +200,7 @@ static bool read_negTokenTarg(struct asn1_data *asn1, 
TALLOC_CTX *mem_ctx,
        if (!asn1_start_tag(asn1, ASN1_CONTEXT(1))) return false;
        if (!asn1_start_tag(asn1, ASN1_SEQUENCE(0))) return false;
 
-       while (!asn1_has_error(asn1) && 0 < asn1_tag_remaining(asn1)) {
+       while (asn1_tag_remaining(asn1) > 0) {
                uint8_t context;
                char *oid;
                if (!asn1_peek_uint8(asn1, &context)) {
diff --git a/libcli/ldap/ldap_message.c b/libcli/ldap/ldap_message.c
index 76d2ee9..c89705b 100644
--- a/libcli/ldap/ldap_message.c
+++ b/libcli/ldap/ldap_message.c
@@ -886,7 +886,7 @@ static struct ldb_parse_tree 
*ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
                        goto failed;
                }
 
-               while (asn1_tag_remaining(data)) {
+               while (asn1_tag_remaining(data) > 0) {
                        if (!asn1_peek_uint8(data, &subs_tag)) goto failed;
                        subs_tag &= 0x1f;       /* strip off the asn1 stuff */
                        if (subs_tag > 2) goto failed;
diff --git a/source3/include/tldap.h b/source3/include/tldap.h
index 1c704b4..0d7e55d 100644
--- a/source3/include/tldap.h
+++ b/source3/include/tldap.h
@@ -20,6 +20,7 @@
 #ifndef __TLDAP_H__
 #define __TLDAP_H__
 
+#include "replace.h"
 #include <talloc.h>
 #include <tevent.h>
 #include "lib/util/data_blob.h"
@@ -46,7 +47,74 @@ struct tldap_mod {
        DATA_BLOB *values;
 };
 
-bool tevent_req_is_ldap_error(struct tevent_req *req, int *perr);
+typedef struct { uint8_t rc; } TLDAPRC;
+#define TLDAP_RC(x) ((TLDAPRC){.rc = x})
+#define TLDAP_RC_V(x) ((x).rc)
+
+#define TLDAP_RC_EQUAL(x,y) (TLDAP_RC_V(x)==TLDAP_RC_V(y))
+#define TLDAP_RC_IS_SUCCESS(x) TLDAP_RC_EQUAL(x,TLDAP_SUCCESS)
+
+#define TLDAP_SUCCESS TLDAP_RC(0x00)
+#define TLDAP_OPERATIONS_ERROR TLDAP_RC(0x01)
+#define TLDAP_PROTOCOL_ERROR TLDAP_RC(0x02)
+#define TLDAP_TIMELIMIT_EXCEEDED TLDAP_RC(0x03)
+#define TLDAP_SIZELIMIT_EXCEEDED TLDAP_RC(0x04)
+#define TLDAP_COMPARE_FALSE TLDAP_RC(0x05)
+#define TLDAP_COMPARE_TRUE TLDAP_RC(0x06)
+#define TLDAP_STRONG_AUTH_NOT_SUPPORTED TLDAP_RC(0x07)
+#define TLDAP_STRONG_AUTH_REQUIRED TLDAP_RC(0x08)
+#define TLDAP_REFERRAL TLDAP_RC(0x0a)
+#define TLDAP_ADMINLIMIT_EXCEEDED TLDAP_RC(0x0b)
+#define TLDAP_UNAVAILABLE_CRITICAL_EXTENSION TLDAP_RC(0x0c)
+#define TLDAP_CONFIDENTIALITY_REQUIRED TLDAP_RC(0x0d)
+#define TLDAP_SASL_BIND_IN_PROGRESS TLDAP_RC(0x0e)
+#define TLDAP_NO_SUCH_ATTRIBUTE TLDAP_RC(0x10)
+#define TLDAP_UNDEFINED_TYPE TLDAP_RC(0x11)
+#define TLDAP_INAPPROPRIATE_MATCHING TLDAP_RC(0x12)
+#define TLDAP_CONSTRAINT_VIOLATION TLDAP_RC(0x13)
+#define TLDAP_TYPE_OR_VALUE_EXISTS TLDAP_RC(0x14)
+#define TLDAP_INVALID_SYNTAX TLDAP_RC(0x15)
+#define TLDAP_NO_SUCH_OBJECT TLDAP_RC(0x20)
+#define TLDAP_ALIAS_PROBLEM TLDAP_RC(0x21)
+#define TLDAP_INVALID_DN_SYNTAX TLDAP_RC(0x22)
+#define TLDAP_IS_LEAF TLDAP_RC(0x23)
+#define TLDAP_ALIAS_DEREF_PROBLEM TLDAP_RC(0x24)
+#define TLDAP_INAPPROPRIATE_AUTH TLDAP_RC(0x30)
+#define TLDAP_INVALID_CREDENTIALS TLDAP_RC(0x31)
+#define TLDAP_INSUFFICIENT_ACCESS TLDAP_RC(0x32)
+#define TLDAP_BUSY TLDAP_RC(0x33)
+#define TLDAP_UNAVAILABLE TLDAP_RC(0x34)
+#define TLDAP_UNWILLING_TO_PERFORM TLDAP_RC(0x35)
+#define TLDAP_LOOP_DETECT TLDAP_RC(0x36)
+#define TLDAP_NAMING_VIOLATION TLDAP_RC(0x40)
+#define TLDAP_OBJECT_CLASS_VIOLATION TLDAP_RC(0x41)
+#define TLDAP_NOT_ALLOWED_ON_NONLEAF TLDAP_RC(0x42)
+#define TLDAP_NOT_ALLOWED_ON_RDN TLDAP_RC(0x43)
+#define TLDAP_ALREADY_EXISTS TLDAP_RC(0x44)
+#define TLDAP_NO_OBJECT_CLASS_MODS TLDAP_RC(0x45)
+#define TLDAP_RESULTS_TOO_LARGE TLDAP_RC(0x46)
+#define TLDAP_AFFECTS_MULTIPLE_DSAS TLDAP_RC(0x47)
+#define TLDAP_OTHER TLDAP_RC(0x50)
+#define TLDAP_SERVER_DOWN TLDAP_RC(0x51)
+#define TLDAP_LOCAL_ERROR TLDAP_RC(0x52)
+#define TLDAP_ENCODING_ERROR TLDAP_RC(0x53)
+#define TLDAP_DECODING_ERROR TLDAP_RC(0x54)
+#define TLDAP_TIMEOUT TLDAP_RC(0x55)
+#define TLDAP_AUTH_UNKNOWN TLDAP_RC(0x56)
+#define TLDAP_FILTER_ERROR TLDAP_RC(0x57)
+#define TLDAP_USER_CANCELLED TLDAP_RC(0x58)
+#define TLDAP_PARAM_ERROR TLDAP_RC(0x59)
+#define TLDAP_NO_MEMORY TLDAP_RC(0x5a)
+#define TLDAP_CONNECT_ERROR TLDAP_RC(0x5b)
+#define TLDAP_NOT_SUPPORTED TLDAP_RC(0x5c)


-- 
Samba Shared Repository

Reply via email to