![如何解决将 schac 架构添加到 openldap 时出现“意外令牌”错误](https://linux22.com/image/770324/%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%E5%B0%86%20schac%20%E6%9E%B6%E6%9E%84%E6%B7%BB%E5%8A%A0%E5%88%B0%20openldap%20%E6%97%B6%E5%87%BA%E7%8E%B0%E2%80%9C%E6%84%8F%E5%A4%96%E4%BB%A4%E7%89%8C%E2%80%9D%E9%94%99%E8%AF%AF.png)
我正在尝试使用提供的 LDIF 文件将 schac 模式添加到我的 OpenLDAP 安装中,但此操作失败并出现“意外令牌”错误:
root [2533] /etc/ldap/schema# ldapadd -Y EXTERNAL -H ldapi:/// -f schac-schema-1.5.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
adding new entry "cn=schac,cn=schema,cn=config"
ldap_add: Other (e.g., implementation specific) error (80)
additional info: olcAttributeTypes: Unexpected token before DESC 'RFC 3066 code for prefered language of communication'EQUALITY caseExactMatchSINGLE-VALUESYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
这是 LDIF 文件的顶部;错误发生在第一个 olcAttributeTypes 声明上。
dn: cn=schac,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schac
olcObjectIdentifier: TERENA 1.3.6.1.4.1.25178
olcObjectIdentifier: schac TERENA:1
olcObjectIdentifier: schacExperimental schac:0
olcObjectIdentifier: schacObjectClass schac:1
olcObjectIdentifier: schacAttributeType schac:2
olcObjectIdentifier: schacExpObjClass schacExperimental:1
olcObjectIdentifier: schacExpAttr schacExperimental:2
olcAttributeTypes: ( schacAttributeType:1
NAME 'schacMotherTongue'
DESC 'RFC 3066 code for prefered language of communication'
EQUALITY caseExactMatch
SINGLE-VALUE
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( schacAttributeType:2
NAME 'schacGender'
DESC 'Representation of human sex (see ISO 5218)'
EQUALITY integerMatch
SINGLE-VALUE
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
.... etc...
由于此模式拥有庞大的用户群,我很惊讶它格式不正确,所以我猜测 schac 模式和其他一些预先要求的模式之间可能存在某种依赖关系,但这只是一个猜测。
我在 Debian buster 上的 OpenLDAP 2.4.47 安装中已经有 7 个其他模式。
欢迎任何帮助。