[Date Prev][Date Next] [Chronological] [Thread] [Top]

Invalid syntax: booleanMatch



Hi,

I have a problem with ldap_add_s() when trying to add an entry with a
boolean or integer attribute. I get the error "Invalid syntax",
additional info:"value #0 contains invalid data":
>From the code part below you can see that I pass values TRUE and FALSE
as strings to mod_vals.modv_strvals. Other values like true/false or 1/0
give the same result.

Do I need to add something to the attributetypes in my schema or is it
simply not possible to pass a boolean/integer via mod_vals with
ldap_add_s() ?

The entries in my schema look like this:

attributetype ( 1.1.2.1.1.5 NAME 'ApplicationServerTrigger'
     EQUALITY booleanMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
     SINGLE-VALUE )

attributetype ( 1.1.2.1.1.7 NAME 'AuthenticationType'
     EQUALITY integerMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
     SINGLE-VALUE )

Both are MUST attributes in my objectclass im-user.

In my code I have:
 ...
  mods[5] = (LDAPMod *)ber_alloc();
  mods[5]->mod_op = 0;
  mods[5]->mod_type = new char[80];
  strcpy(mods[5]->mod_type, attribApplServerTrigger.c_str());
  if (applServerTrigger == 0)
  {
    helpStr = "FALSE";
    mods[5]->mod_values = &helpStr;
    mods[5]->mod_values[1] = NULL;
  }
  else
  {
    helpStr = "TRUE";
    mods[5]->mod_values = &helpStr;
    mods[5]->mod_values[1] = NULL;
  }
 ...
  mods[7] = (LDAPMod *)ber_alloc();
  mods[7]->mod_op = 0;
  mods[7]->mod_type = new char[80];
  strcpy(mods[7]->mod_type, attribAuthenticationType.c_str());
  switch(authenticationType){
    case authType_none :
      helpStr = "0";
      break;
    case authType_Logintool :
      helpStr = "1";
      break;
    case authType_CHAP :
      helpStr = "2";
      break;
    default:
      cout << "ERROR: Unknown authentication type" << endl;
      helpStr = "E";
      break;
  }
  mods[7]->mod_values = &helpStr;
  mods[7]->mod_values[1] = NULL;

  int rc = ldap_add_s(ldapConnection, (char *)dn.c_str(), mods);

Thanks,
Frank Joris
begin:vcard 
n:Joris;Frank
x-mozilla-html:FALSE
org:Alcatel Telecom Antwerp;VE13 - NGN Multimedia
adr:;;;;;;
version:2.1
email;internet:jorisf@se.bel.alcatel.be
title:Switching Engineer
note:Tel: +32-3-240 4666
x-mozilla-cpt:;-31744
fn:Frank Joris
end:vcard