[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-2212-ga5003de
Andrew Tridgell
tridge at samba.org
Wed Jun 10 01:46:37 GMT 2009
The branch, master has been updated
via a5003de56beefa800858b60bb62545c1ad324922 (commit)
via d42019644bdad2b0810d054e72378026a02dc295 (commit)
from 9e7501b2cbc52db8f63f75876a966110e35fba9f (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a5003de56beefa800858b60bb62545c1ad324922
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Jun 10 11:45:13 2009 +1000
fixed the encoding/decoding of the reverse attribute for server side sort
commit d42019644bdad2b0810d054e72378026a02dc295
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Jun 10 11:44:47 2009 +1000
added asn1 functions for handling booleans in a simple context
-----------------------------------------------------------------------
Summary of changes:
lib/util/asn1.c | 23 +++++++++++++++++++++++
lib/util/asn1.h | 2 ++
source4/libcli/ldap/ldap_controls.c | 13 ++++++++++---
3 files changed, 35 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/asn1.c b/lib/util/asn1.c
index c687f8d..aadaf86 100644
--- a/lib/util/asn1.c
+++ b/lib/util/asn1.c
@@ -332,6 +332,29 @@ bool asn1_read_BOOLEAN(struct asn1_data *data, bool *v)
return !data->has_error;
}
+/* write a BOOLEAN in a simple context */
+bool asn1_write_BOOLEAN_context(struct asn1_data *data, bool v, int context)
+{
+ asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(context));
+ asn1_write_uint8(data, v ? 0xFF : 0);
+ asn1_pop_tag(data);
+ return !data->has_error;
+}
+
+bool asn1_read_BOOLEAN_context(struct asn1_data *data, bool *v, int context)
+{
+ uint8_t tmp = 0;
+ asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(context));
+ asn1_read_uint8(data, &tmp);
+ if (tmp == 0xFF) {
+ *v = true;
+ } else {
+ *v = false;
+ }
+ asn1_end_tag(data);
+ return !data->has_error;
+}
+
/* check a BOOLEAN */
bool asn1_check_BOOLEAN(struct asn1_data *data, bool v)
{
diff --git a/lib/util/asn1.h b/lib/util/asn1.h
index 8ecb85c..0f41ae3 100644
--- a/lib/util/asn1.h
+++ b/lib/util/asn1.h
@@ -70,6 +70,8 @@ bool asn1_write_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *bl
bool asn1_write_BOOLEAN(struct asn1_data *data, bool v);
bool asn1_read_BOOLEAN(struct asn1_data *data, bool *v);
bool asn1_check_BOOLEAN(struct asn1_data *data, bool v);
+bool asn1_write_BOOLEAN_context(struct asn1_data *data, bool v, int context);
+bool asn1_read_BOOLEAN_context(struct asn1_data *data, bool *v, int context);
bool asn1_load(struct asn1_data *data, DATA_BLOB blob);
bool asn1_peek(struct asn1_data *data, void *p, int len);
bool asn1_read(struct asn1_data *data, void *p, int len);
diff --git a/source4/libcli/ldap/ldap_controls.c b/source4/libcli/ldap/ldap_controls.c
index 7949758..48ac542 100644
--- a/source4/libcli/ldap/ldap_controls.c
+++ b/source4/libcli/ldap/ldap_controls.c
@@ -126,9 +126,9 @@ static bool decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void *_out)
}
}
- if (asn1_peek_tag(data, ASN1_BOOLEAN)) {
+ if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) {
bool reverse;
- if (!asn1_read_BOOLEAN(data, &reverse)) {
+ if (!asn1_read_BOOLEAN_context(data, &reverse, 1)) {
return false;
}
lssc[num]->reverse = reverse;
@@ -688,6 +688,13 @@ static bool encode_server_sort_request(void *mem_ctx, void *in, DATA_BLOB *out)
return false;
}
+ /*
+ RFC2891 section 1.1:
+ SortKeyList ::= SEQUENCE OF SEQUENCE {
+ attributeType AttributeDescription,
+ orderingRule [0] MatchingRuleId OPTIONAL,
+ reverseOrder [1] BOOLEAN DEFAULT FALSE }
+ */
for (num = 0; lssc[num]; num++) {
if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
return false;
@@ -704,7 +711,7 @@ static bool encode_server_sort_request(void *mem_ctx, void *in, DATA_BLOB *out)
}
if (lssc[num]->reverse) {
- if (!asn1_write_BOOLEAN(data, lssc[num]->reverse)) {
+ if (!asn1_write_BOOLEAN_context(data, lssc[num]->reverse, 1)) {
return false;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list