From 2e0c16b56b65defece5cdcbab137206c33a0078b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julio=20S=C3=A1nchez=20Fern=C3=A1ndez?= Date: Wed, 24 May 2000 15:54:21 +0000 Subject: [PATCH] Get a couple of extensions into fields easy to use at runtime. --- servers/slapd/at.c | 19 +++++++++++++++++++ servers/slapd/slap.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 14c20bd19f..40964b217b 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -402,6 +402,7 @@ at_add( Syntax *syn; int code; char *cname; + LDAP_SCHEMA_EXTENSION_ITEM **ext; if ( at->at_names && at->at_names[0] ) { cname = at->at_names[0]; @@ -447,6 +448,8 @@ at_add( sat->sat_equality = sat->sat_sup->sat_equality; sat->sat_ordering = sat->sat_sup->sat_ordering; sat->sat_substr = sat->sat_sup->sat_substr; + sat->sat_binary = sat->sat_sup->sat_binary; + sat->sat_not_h_r = sat->sat_sup->sat_not_h_r; } if ( at->at_syntax_oid ) { @@ -522,6 +525,22 @@ at_add( } } + if ( sat->sat_extensions ) { + for ( ext = sat->sat_extensions; *ext; ext++ ) { + if ( strcmp((*ext)->lsei_name, "X-BINARY-TRANSFER-REQUIRED") == 0 && + (*ext)->lsei_values && + (*ext)->lsei_values[0] && + strcasecmp((*ext)->lsei_values[0], "true") == 0 ) { + sat->sat_binary = 1; + } else if ( strcmp((*ext)->lsei_name, "X-NOT-HUMAN-READABLE") == 0 && + (*ext)->lsei_values && + (*ext)->lsei_values[0] && + strcasecmp((*ext)->lsei_values[0], "true") == 0 ) { + sat->sat_not_h_r = 1; + } + } + } + code = at_insert(sat,err); return code; } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index b300852ba2..92978f9861 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -260,6 +260,8 @@ typedef struct slap_attribute_type { MatchingRule *sat_ordering; MatchingRule *sat_substr; Syntax *sat_syntax; + int sat_binary; + int sat_not_h_r; #ifndef SLAPD_SCHEMA_NOT_COMPAT /* The next one is created to help in the transition */ int sat_syntax_compat; @@ -285,6 +287,8 @@ typedef struct slap_attribute_type { #define is_at_single_value(at) ((at)->sat_single_value) #define is_at_collective(at) ((at)->sat_collective) #define is_at_no_user_mod(at) ((at)->sat_no_user_mod) +#define is_at_binary(at) ((at)->sat_binary) +#define is_at_h_r(at) ((at)->sat_not_h_r == 0) typedef struct slap_object_class { LDAP_OBJECT_CLASS soc_oclass; -- 2.39.5