Logo Search packages:      
Sourcecode: ldb version File versions  Download package

int ldb_valid_attr_name ( const char *  s  ) 

Check the attribute name is valid according to rfc2251

Parameters:
s tthe string to check
Returns:
1 if the name is ok

Definition at line 86 of file ldb_utf8.c.

{
      int i;

      if (!s || !s[0])
            return 0;

      /* handle special ldb_tdb wildcard */
      if (strcmp(s, "*") == 0) return 1;

      for (i = 0; s[i]; i++) {
            if (! isascii(s[i])) {
                  return 0;
            }
            if (i == 0) { /* first char must be an alpha (or our special '@' identifier) */
                  if (! (isalpha(s[i]) || (s[i] == '@'))) {
                        return 0;
                  }
            } else {
                  if (! (isalnum(s[i]) || (s[i] == '-'))) {
                        return 0;
                  }
            }
      }
      return 1;
}


Generated by  Doxygen 1.6.0   Back to index