- if ( at->at_oid ) {
- if ( !OID_LEADCHAR( at->at_oid[0] )) {
- /* Expand OID macros */
- oid = find_oidm( at->at_oid );
- if ( !oid ) {
- fprintf(stderr,
- "%s: line %d: OID %s not recognized\n",
- fname, lineno, at->at_oid);
- exit( EXIT_FAILURE );
- }
- if ( oid != at->at_oid ) {
- ldap_memfree( at->at_oid );
- at->at_oid = oid;
- }
- }
+
+ if ( at->at_oid == NULL ) {
+ snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s: OID is missing",
+ c->argv[0] );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s %s\n", c->log, c->cr_msg, 0 );
+ at_usage();
+ code = 1;
+ goto done;
+ }
+
+ /* operational attributes should be defined internally */
+ if ( at->at_usage ) {
+ snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s: \"%s\" is operational",
+ c->argv[0], at->at_oid );
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s %s\n", c->log, c->cr_msg, 0 );
+ code = 1;
+ goto done;
+ }
+
+ code = at_add( at, 1, sat, prev, &err);
+ if ( code ) {
+ snprintf( c->cr_msg, sizeof( c->cr_msg ), "%s: %s: \"%s\"",
+ c->argv[0], scherr2str(code), err);
+ Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_NONE,
+ "%s %s\n", c->log, c->cr_msg, 0 );
+ code = 1;
+ goto done;
+ }
+
+done:;
+ if ( code ) {
+ ldap_attributetype_free( at );
+
+ } else {
+ ldap_memfree( at );