Issue 612 - Boolean Syntax not implemented
Summary: Boolean Syntax not implemented
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-06-29 13:44 UTC by stephan.siano@suse.de
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description stephan.siano@suse.de 2000-06-29 13:44:37 UTC
Full_Name: Stephan Siano
Version: 2.0-devel
OS: Linux 2.2.14
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (195.243.113.230)


The boolean Syntax was not implemented. The patch below for schema_init
implements
the booleanValidate function (the content must be TRUE or FALSE) and maps the
booleanNormalize to numericStringNormalize (which ist essentially the normalize
Functions for Strings that do not contain whitespace characters in the middle
of
the string.


/* $OpenLDAP: pkg/ldap/servers/slapd/schema_init.c,v 1.57 2000/06/28 03:29:09
mrv Exp $ */

24a25
> #define booleanValidate                                       NULL
31,32c32
< #define booleanNormalize                               
numericStringNormalize
 
<
---
>
34a35
> #define booleanNormalize                              NULL
301,323d301
< }
<
< static int
< booleanValidate(
<       Syntax *syntax,
<       struct berval *in )
< {
<       char *p;
<
<         if( (!in->bv_len) || (!in->bv_val) ) return LDAP_INVALID_SYNTAX;
<         p = in->bv_val;
<
<         /* Ignore initial whitespace */
<         while ( ASCII_SPACE( *p ) ) {
<                 p++;
<         }
<
<       /* the value must be TRUE or FALSE */
<       if( !strncmp(p,"TRUE",5) || !strncmp(p,"FALSE",6) ) {
<               return LDAP_SUCCESS;
<       } else {
<               return LDAP_INVALID_SYNTAX;
<       } 
Comment 1 Kurt Zeilenga 2000-06-29 22:45:55 UTC
I added an experiemental (ie: untested) booleanValidate and
booleanMatch routines without use of a normalizer...

A better approach would be to define booleanValidate as
numericStringValidate, add a normalizer which accepted
varients of true/false and normalized them to "TRUE"
and "FALSE", and add a prettier that stored the vaue
in normalized form.

At 01:44 PM 6/29/00 GMT, stephan.siano@suse.de wrote:
>Full_Name: Stephan Siano
>Version: 2.0-devel
>OS: Linux 2.2.14
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (195.243.113.230)
>
>
>The boolean Syntax was not implemented. The patch below for schema_init
>implements
>the booleanValidate function (the content must be TRUE or FALSE) and maps the
>booleanNormalize to numericStringNormalize (which ist essentially the normalize
>Functions for Strings that do not contain whitespace characters in the middle
>of
>the string.
>
>
>/* $OpenLDAP: pkg/ldap/servers/slapd/schema_init.c,v 1.57 2000/06/28 03:29:09
>mrv Exp $ */
>
>24a25
>> #define booleanValidate                                       NULL
>31,32c32
>< #define booleanNormalize                               
>numericStringNormalize
> 
><
>---
>>
>34a35
>> #define booleanNormalize                              NULL
>301,323d301
>< }
><
>< static int
>< booleanValidate(
><       Syntax *syntax,
><       struct berval *in )
>< {
><       char *p;
><
><         if( (!in->bv_len) || (!in->bv_val) ) return LDAP_INVALID_SYNTAX;
><         p = in->bv_val;
><
><         /* Ignore initial whitespace */
><         while ( ASCII_SPACE( *p ) ) {
><                 p++;
><         }
><
><       /* the value must be TRUE or FALSE */
><       if( !strncmp(p,"TRUE",5) || !strncmp(p,"FALSE",6) ) {
><               return LDAP_SUCCESS;
><       } else {
><               return LDAP_INVALID_SYNTAX;
><       } 
>
>
>
Comment 2 Kurt Zeilenga 2000-06-30 10:09:30 UTC
moved from Incoming to Development
Comment 3 Kurt Zeilenga 2000-06-30 10:13:23 UTC
changed notes
changed state Open to Closed
Comment 4 stephan.siano@suse.de 2000-06-30 10:36:08 UTC
"Kurt D. Zeilenga" wrote:
> 
> I added an experiemental (ie: untested) booleanValidate and
> booleanMatch routines without use of a normalizer...

ok. the stuff seems to work (I tested adding an object with a boolean
attribute. That will succeed if the value is TRUE or FALSE and will fail
otherwise).

> A better approach would be to define booleanValidate as
> numericStringValidate, add a normalizer which accepted
> varients of true/false and normalized them to "TRUE"
> and "FALSE", and add a prettier that stored the vaue
> in normalized form.
Hmm, I'm not sure whether I catch you right. 

You say booleanValidate should be numericStringValidate (which is in
fact IA5StringValidate). The inserted value should be converted to
"TRUE" of "FALSE" by the normalizer and the prettier should user the
normalizer to convert. If I try to store a boolean attribute to the
database, the validator will let it pass (whatever I enter there). The
prettier is applied to the value before writing the database and
converts the data to TRUE or FALSE. So if a do a ldap_add or ldap_modify
with "myBooleanAttribute:hugo" TRUE (or FALSE?) will be written to
the database.

Is this correct?

Is this the desired behaviour? 

Yours,
Stephan Siano
-- 
Stephan Siano                           Mail:  Stephan.Siano@suse.de
SuSE Linux Solutions AG                 Phone: 06196 50951 31
Mergenthalerallee 45-47			Fax:   06196 409607
D-65760 Eschborn
Comment 5 OpenLDAP project 2014-08-01 21:05:27 UTC
implemented