/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
static LDAP_STAILQ_HEAD(OidMacroList, slap_oid_macro) om_list
= LDAP_STAILQ_HEAD_INITIALIZER(om_list);
+OidMacro *om_sys_tail;
+
/* Replace an OID Macro invocation with its full numeric OID.
* If the macro is used with "macroname:suffix" append ".suffix"
* to the expansion.
OidMacro **rom)
{
char *oid;
- OidMacro *om = NULL;
+ OidMacro *om = NULL, *prev = NULL;
struct berval bv;
oid = oidm_find( c->argv[1] );
}
om->som_oid.bv_len = strlen( om->som_oid.bv_val );
- if ( !user )
+ if ( !user ) {
om->som_flags |= SLAP_OM_HARDCODE;
+ prev = om_sys_tail;
+ om_sys_tail = om;
+ }
- LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next );
+ if ( prev ) {
+ LDAP_STAILQ_INSERT_AFTER( &om_list, prev, om, som_next );
+ } else {
+ LDAP_STAILQ_INSERT_TAIL( &om_list, om, som_next );
+ }
if ( rom ) *rom = om;
return 0;
}
/* count the result size */
i = 0;
for ( om=start; om; om=LDAP_STAILQ_NEXT(om, som_next)) {
- if ( sys && !(om->som_flags & SLAP_OM_HARDCODE)) continue;
+ if ( sys && !(om->som_flags & SLAP_OM_HARDCODE)) break;
for ( j=0; !BER_BVISNULL(&om->som_names[j]); j++ );
i += j;
if ( om == end ) break;
ibuf[0] = '\0';
}
for ( i=0,om=start; om; om=LDAP_STAILQ_NEXT(om, som_next)) {
- if ( sys && !(om->som_flags & SLAP_OM_HARDCODE)) continue;
+ if ( sys && !(om->som_flags & SLAP_OM_HARDCODE)) break;
for ( j=0; !BER_BVISNULL(&om->som_names[j]); i++,j++ ) {
if ( !sys ) {
idx.bv_len = sprintf(idx.bv_val, "{%d}", i );