/* check to see if there's an id included */
next = s;
- if ( isdigit( *s ) ) {
+ if ( isdigit( (unsigned char) *s ) ) {
id = atoi( s );
if ( (s = ldif_getline( &next )) == NULL ) {
Debug( LDAP_DEBUG_TRACE,
if ( strcasecmp( type, "dn" ) == 0 ) {
if ( e->e_dn != NULL ) {
Debug( LDAP_DEBUG_ANY,
- "str2entry: entry %lu has multiple dns \"%s\" and \"%s\" (second ignored)\n",
+ "str2entry: entry %ld has multiple dns \"%s\" and \"%s\" (second ignored)\n",
e->e_id, e->e_dn, value );
continue;
}
if ( e->e_ndn != NULL ) {
Debug( LDAP_DEBUG_ANY,
- "str2entry: entry %lu already has a normalized dn \"%s\" for \"%s\" (first ignored)\n",
+ "str2entry: entry %ld already has a normalized dn \"%s\" for \"%s\" (first ignored)\n",
e->e_id, e->e_ndn, value );
free( e->e_ndn );
}
- e->e_ndn = dn_normalize_case( ch_strdup( value ) );
+ e->e_ndn = ch_strdup( value );
+ (void) dn_normalize_case( e->e_ndn );
continue;
}
/* check to make sure there was a dn: line */
if ( e->e_dn == NULL ) {
- Debug( LDAP_DEBUG_ANY, "str2entry: entry %lu has no dn\n",
+ Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has no dn\n",
e->e_id, 0, 0 );
entry_free( e );
return( NULL );
if ( e->e_ndn == NULL ) {
Debug( LDAP_DEBUG_ANY,
- "str2entry: entry %lu (\"%s\") has no normalized dn\n",
+ "str2entry: entry %ld (\"%s\") has no normalized dn\n",
e->e_id, e->e_dn, 0 );
entry_free( e );
return( NULL );
}
- Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %lu (0x%lx)\n",
+ Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %ld (0x%lx)\n",
e->e_dn, e->e_id, (unsigned long)e );
return( e );
void
entry_free( Entry *e )
{
- int i;
Attribute *a, *next;
if ( e->e_dn != NULL ) {
free( e );
}
+/*
+ * These routines are used only by Backend.
+ *
+ * the Entry has three entry points (ways to find things):
+ *
+ * by entry e.g., if you already have an entry from the cache
+ * and want to delete it. (really by entry ptr)
+ * by dn e.g., when looking for the base object of a search
+ * by id e.g., for search candidates
+ *
+ * these correspond to three different avl trees that are maintained.
+ */
+
+int
+entry_cmp( Entry *e1, Entry *e2 )
+{
+ return( e1 < e2 ? -1 : (e1 > e2 ? 1 : 0) );
+}
+
+int
+entry_dn_cmp( Entry *e1, Entry *e2 )
+{
+ /* compare their normalized UPPERCASED dn's */
+ return( strcmp( e1->e_ndn, e2->e_ndn ) );
+}
+
+int
+entry_id_cmp( Entry *e1, Entry *e2 )
+{
+ return( e1->e_id < e2->e_id ? -1 : (e1->e_id > e2->e_id ? 1 : 0) );
+}
+