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; < }
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; >< } > > >
moved from Incoming to Development
changed notes changed state Open to Closed
"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
implemented