Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Robert Dubner
OpenLDAP
Commits
17a7a9df
Commit
17a7a9df
authored
Jan 14, 1999
by
Kurt Zeilenga
Browse files
Import normalized dn in Entry change from devel.
parent
30e6b973
Changes
6
Hide whitespace changes
Inline
Side-by-side
servers/slapd/add.c
View file @
17a7a9df
...
...
@@ -58,8 +58,10 @@ do_add( Connection *conn, Operation *op )
entry_rdwr_init
(
e
);
e
->
e_dn
=
dn
;
dn
=
dn_normalize
(
ch_strdup
(
dn
)
);
Debug
(
LDAP_DEBUG_ARGS
,
" do_add: dn (%s)
\n
"
,
dn
,
0
,
0
);
e
->
e_ndn
=
dn_normalize
(
ch_strdup
(
dn
)
);
dn
=
NULL
;
Debug
(
LDAP_DEBUG_ARGS
,
" do_add: ndn (%s)
\n
"
,
e
->
e_ndn
,
0
,
0
);
/* get the attrs */
e
->
e_attrs
=
NULL
;
...
...
@@ -71,7 +73,6 @@ do_add( Connection *conn, Operation *op )
if
(
ber_scanf
(
ber
,
"{a{V}}"
,
&
type
,
&
vals
)
==
LBER_ERROR
)
{
send_ldap_result
(
conn
,
op
,
LDAP_PROTOCOL_ERROR
,
NULL
,
"decoding error"
);
free
(
dn
);
entry_free
(
e
);
return
;
}
...
...
@@ -82,7 +83,6 @@ do_add( Connection *conn, Operation *op )
send_ldap_result
(
conn
,
op
,
LDAP_PROTOCOL_ERROR
,
NULL
,
NULL
);
free
(
type
);
free
(
dn
);
entry_free
(
e
);
return
;
}
...
...
@@ -94,15 +94,14 @@ do_add( Connection *conn, Operation *op )
}
Statslog
(
LDAP_DEBUG_STATS
,
"conn=%d op=%d ADD dn=
\"
%s
\"\n
"
,
conn
->
c_connid
,
op
->
o_opid
,
dn
,
0
,
0
);
conn
->
c_connid
,
op
->
o_opid
,
e
->
e_n
dn
,
0
,
0
);
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
be
=
select_backend
(
dn
);
free
(
dn
);
be
=
select_backend
(
e
->
e_ndn
);
if
(
be
==
NULL
)
{
entry_free
(
e
);
send_ldap_result
(
conn
,
op
,
LDAP_PARTIAL_RESULTS
,
NULL
,
...
...
servers/slapd/back-ldbm/cache.c
View file @
17a7a9df
...
...
@@ -35,7 +35,8 @@ cache_entry_cmp( Entry *e1, Entry *e2 )
static
int
cache_entrydn_cmp
(
Entry
*
e1
,
Entry
*
e2
)
{
return
(
strcasecmp
(
e1
->
e_dn
,
e2
->
e_dn
)
);
/* compare their normalized dn's */
return
(
strcasecmp
(
e1
->
e_ndn
,
e2
->
e_ndn
)
);
}
static
int
...
...
@@ -234,10 +235,13 @@ cache_find_entry_dn2id(
pthread_mutex_lock
(
&
cache
->
c_mutex
);
e
.
e_dn
=
dn
;
e
.
e_ndn
=
dn_normalize
(
ch_strdup
(
dn
)
);
if
(
(
ep
=
(
Entry
*
)
avl_find
(
cache
->
c_dntree
,
(
caddr_t
)
&
e
,
cache_entrydn_cmp
))
!=
NULL
)
{
free
(
e
.
e_ndn
);
Debug
(
LDAP_DEBUG_TRACE
,
"====> cache_find_entry_dn2id: found dn: %s
\n
"
,
dn
,
0
,
0
);
...
...
@@ -291,6 +295,8 @@ cache_find_entry_dn2id(
return
(
id
);
}
free
(
e
.
e_ndn
);
/* free cache mutex */
pthread_mutex_unlock
(
&
cache
->
c_mutex
);
...
...
servers/slapd/back-passwd/search.c
View file @
17a7a9df
...
...
@@ -136,6 +136,7 @@ pw2entry( Backend *be, struct passwd *pw )
sprintf
(
buf
,
"%s@%s"
,
pw
->
pw_name
,
be
->
be_suffix
[
0
]
);
e
->
e_dn
=
ch_strdup
(
buf
);
e
->
e_ndn
=
ch_strdup
(
buf
);
val
.
bv_val
=
pw
->
pw_name
;
val
.
bv_len
=
strlen
(
pw
->
pw_name
);
...
...
servers/slapd/entry.c
View file @
17a7a9df
...
...
@@ -17,7 +17,7 @@ static int emaxsize;/* max size of ebuf */
Entry
*
str2entry
(
char
*
s
)
{
int
i
;
int
id
=
0
;
Entry
*
e
;
Attribute
**
a
;
char
*
type
;
...
...
@@ -46,22 +46,29 @@ str2entry( char *s )
Debug
(
LDAP_DEBUG_TRACE
,
"=> str2entry
\n
"
,
s
?
s
:
"NULL"
,
0
,
0
);
e
=
(
Entry
*
)
ch_calloc
(
1
,
sizeof
(
Entry
)
);
/* check to see if there's an id included */
next
=
s
;
if
(
isdigit
(
*
s
)
)
{
e
->
e_
id
=
atoi
(
s
);
id
=
atoi
(
s
);
if
(
(
s
=
str_getline
(
&
next
))
==
NULL
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"<= str2entry NULL (missing newline after id)
\n
"
,
0
,
0
,
0
);
free
(
e
);
return
(
NULL
);
}
}
/* initialize reader/writer lock */
e
=
(
Entry
*
)
ch_calloc
(
1
,
sizeof
(
Entry
)
);
if
(
e
==
NULL
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"<= str2entry NULL (entry allocation failed)
\n
"
,
0
,
0
,
0
);
return
(
NULL
);
}
e
->
e_id
=
id
;
entry_rdwr_init
(
e
);
/* dn + attributes */
...
...
@@ -86,6 +93,7 @@ str2entry( char *s )
maxvals
=
0
;
a
=
NULL
;
}
if
(
strcasecmp
(
type
,
"dn"
)
==
0
)
{
if
(
e
->
e_dn
!=
NULL
)
{
Debug
(
LDAP_DEBUG_ANY
,
...
...
@@ -94,6 +102,14 @@ str2entry( char *s )
continue
;
}
e
->
e_dn
=
ch_strdup
(
value
);
if
(
e
->
e_ndn
!=
NULL
)
{
Debug
(
LDAP_DEBUG_ANY
,
"str2entry: entry %lu 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
(
ch_strdup
(
value
)
);
continue
;
}
...
...
@@ -117,6 +133,14 @@ str2entry( char *s )
return
(
NULL
);
}
if
(
e
->
e_ndn
==
NULL
)
{
Debug
(
LDAP_DEBUG_ANY
,
"str2entry: entry %lu (
\"
%s
\"
) has no normalized dn
\n
"
,
e
->
e_id
,
e
->
e_dn
,
0
);
entry_free
(
e
);
return
(
NULL
);
}
Debug
(
LDAP_DEBUG_TRACE
,
"<= str2entry 0x%lx
\n
"
,
(
unsigned
long
)
e
,
0
,
0
);
return
(
e
);
...
...
@@ -203,6 +227,9 @@ entry_free( Entry *e )
if
(
e
->
e_dn
!=
NULL
)
{
free
(
e
->
e_dn
);
}
if
(
e
->
e_ndn
!=
NULL
)
{
free
(
e
->
e_ndn
);
}
for
(
a
=
e
->
e_attrs
;
a
!=
NULL
;
a
=
next
)
{
next
=
a
->
a_next
;
attr_free
(
a
);
...
...
servers/slapd/monitor.c
View file @
17a7a9df
...
...
@@ -49,6 +49,7 @@ monitor_info( Connection *conn, Operation *op )
entry_rdwr_init
(
e
);
e
->
e_attrs
=
NULL
;
e
->
e_dn
=
ch_strdup
(
SLAPD_MONITOR_DN
);
e
->
e_ndn
=
NULL
;
val
.
bv_val
=
Versionstr
;
if
((
p
=
strchr
(
Versionstr
,
'\n'
))
==
NULL
)
{
...
...
servers/slapd/slap.h
View file @
17a7a9df
...
...
@@ -120,6 +120,7 @@ typedef unsigned long ID;
*/
typedef
struct
entry
{
char
*
e_dn
;
/* DN of this entry */
char
*
e_ndn
;
/* normalized DN of this entry */
Attribute
*
e_attrs
;
/* list of attributes + values */
ID
e_id
;
/* id of this entry - this should */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment