Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
a9c7c243
Commit
a9c7c243
authored
18 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
need to be bound to lookup userPassword; cleanup
parent
5dcb4828
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/progs/slapd-bind.c
+16
-23
16 additions, 23 deletions
tests/progs/slapd-bind.c
tests/progs/slapd-read.c
+7
-3
7 additions, 3 deletions
tests/progs/slapd-read.c
tests/progs/slapd-tester.c
+14
-9
14 additions, 9 deletions
tests/progs/slapd-tester.c
with
37 additions
and
35 deletions
tests/progs/slapd-bind.c
+
16
−
23
View file @
a9c7c243
...
...
@@ -45,7 +45,7 @@ do_bind( char *uri, char *dn, struct berval *pass, int maxloop,
int
force
,
int
chaserefs
,
int
noinit
,
LDAP
**
ldp
);
static
int
do_base
(
char
*
uri
,
struct
berval
*
b
as
e
,
struct
berval
*
pass
,
char
*
pwattr
,
do_base
(
char
*
uri
,
char
*
dn
,
struct
berval
*
p
as
s
,
char
*
base
,
char
*
filter
,
char
*
pwattr
,
int
maxloop
,
int
force
,
int
chaserefs
,
int
noinit
,
int
delay
);
/* This program can be invoked two ways: if -D is used to specify a Bind DN,
...
...
@@ -73,8 +73,6 @@ usage( char *name )
exit
(
EXIT_FAILURE
);
}
static
char
*
filter
=
"(objectClass=person)"
;
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -82,7 +80,8 @@ main( int argc, char **argv )
char
*
uri
=
NULL
;
char
*
host
=
"localhost"
;
char
*
dn
=
NULL
;
struct
berval
base
=
{
0
,
NULL
};
char
*
base
=
NULL
;
char
*
filter
=
"(objectClass=person)"
;
struct
berval
pass
=
{
0
,
NULL
};
char
*
pwattr
=
NULL
;
int
port
=
-
1
;
...
...
@@ -105,7 +104,7 @@ main( int argc, char **argv )
break
;
case
'b'
:
/* base DN of a tree of user DNs */
b
er_str2bv
(
optarg
,
0
,
0
,
&
base
)
;
b
ase
=
optarg
;
break
;
case
'C'
:
...
...
@@ -183,8 +182,8 @@ main( int argc, char **argv )
uri
=
tester_uri
(
uri
,
host
,
port
);
for
(
i
=
0
;
i
<
outerloops
;
i
++
)
{
if
(
base
.
bv_val
!=
NULL
)
{
do_base
(
uri
,
&
base
,
&
pass
,
pwattr
,
loops
,
if
(
base
!=
NULL
)
{
do_base
(
uri
,
dn
,
&
pass
,
base
,
filter
,
pwattr
,
loops
,
force
,
chaserefs
,
noinit
,
delay
);
}
else
{
do_bind
(
uri
,
dn
,
&
pass
,
loops
,
...
...
@@ -267,7 +266,7 @@ do_bind( char *uri, char *dn, struct berval *pass, int maxloop,
static
int
do_base
(
char
*
uri
,
struct
berval
*
b
as
e
,
struct
berval
*
pass
,
char
*
pwattr
,
do_base
(
char
*
uri
,
char
*
dn
,
struct
berval
*
p
as
s
,
char
*
base
,
char
*
filter
,
char
*
pwattr
,
int
maxloop
,
int
force
,
int
chaserefs
,
int
noinit
,
int
delay
)
{
LDAP
*
ld
=
NULL
;
...
...
@@ -286,7 +285,6 @@ do_base( char *uri, struct berval *base, struct berval *pass, char *pwattr,
struct
timeval
beg
,
end
;
#endif
int
version
=
LDAP_VERSION3
;
struct
berval
pw
=
{
0
,
NULL
};
char
*
nullstr
=
""
;
srand
(
pid
);
...
...
@@ -301,19 +299,19 @@ do_base( char *uri, struct berval *base, struct berval *pass, char *pwattr,
(
void
)
ldap_set_option
(
ld
,
LDAP_OPT_REFERRALS
,
chaserefs
?
LDAP_OPT_ON
:
LDAP_OPT_OFF
);
rc
=
ldap_sasl_bind_s
(
ld
,
NULL
,
LDAP_SASL_SIMPLE
,
&
pw
,
NULL
,
NULL
,
NULL
);
rc
=
ldap_sasl_bind_s
(
ld
,
dn
,
LDAP_SASL_SIMPLE
,
pass
,
NULL
,
NULL
,
NULL
);
if
(
rc
!=
LDAP_SUCCESS
)
{
tester_ldap_error
(
ld
,
"ldap_sasl_bind_s"
,
NULL
);
exit
(
EXIT_FAILURE
);
}
fprintf
(
stderr
,
"PID=%ld - Bind(%d): base=
\"
%s
\"
, filter=
\"
%s
\"
attr=
\"
%s
\"
.
\n
"
,
(
long
)
pid
,
maxloop
,
base
->
bv_val
,
filter
,
pwattr
);
(
long
)
pid
,
maxloop
,
base
,
filter
,
pwattr
);
if
(
pwattr
!=
NULL
)
{
attrs
[
0
]
=
pwattr
;
}
rc
=
ldap_search_ext
(
ld
,
base
->
bv_val
,
LDAP_SCOPE_SUBTREE
,
rc
=
ldap_search_ext
(
ld
,
base
,
LDAP_SCOPE_SUBTREE
,
filter
,
attrs
,
0
,
NULL
,
NULL
,
0
,
0
,
&
msgid
);
if
(
rc
!=
LDAP_SUCCESS
)
{
tester_ldap_error
(
ld
,
"ldap_search_ext"
,
NULL
);
...
...
@@ -340,13 +338,8 @@ do_base( char *uri, struct berval *base, struct berval *pass, char *pwattr,
creds
=
realloc
(
creds
,
(
ndns
+
1
)
*
sizeof
(
struct
berval
)
);
if
(
values
==
NULL
)
{
novals:
;
if
(
pass
!=
NULL
)
{
ber_dupbv
(
&
creds
[
ndns
],
pass
);
}
else
{
creds
[
ndns
].
bv_len
=
0
;
creds
[
ndns
].
bv_val
=
nullstr
;
}
creds
[
ndns
].
bv_len
=
0
;
creds
[
ndns
].
bv_val
=
nullstr
;
}
else
{
static
struct
berval
cleartext
=
BER_BVC
(
"{CLEARTEXT} "
);
...
...
@@ -399,21 +392,21 @@ novals:;
}
fprintf
(
stderr
,
" PID=%ld - Bind base=
\"
%s
\"
filter=
\"
%s
\"
got %d values.
\n
"
,
(
long
)
pid
,
base
->
bv_val
,
filter
,
ndns
);
(
long
)
pid
,
base
,
filter
,
ndns
);
/* Ok, got list of DNs, now start binding to each */
for
(
i
=
0
;
i
<
maxloop
;
i
++
)
{
int
j
,
k
;
struct
berval
*
cred
=
pass
;
struct
berval
cred
=
{
0
,
NULL
}
;
for
(
j
=
0
,
k
=
0
;
k
<
ndns
;
k
++
)
{
j
=
rand
()
%
ndns
;
}
if
(
creds
&&
!
BER_BVISEMPTY
(
&
creds
[
j
]
)
)
{
cred
=
&
creds
[
j
];
cred
=
creds
[
j
];
}
if
(
do_bind
(
uri
,
dns
[
j
],
cred
,
1
,
force
,
chaserefs
,
noinit
,
&
ld
)
if
(
do_bind
(
uri
,
dns
[
j
],
&
cred
,
1
,
force
,
chaserefs
,
noinit
,
&
ld
)
&&
!
force
)
{
break
;
...
...
This diff is collapsed.
Click to expand it.
tests/progs/slapd-read.c
+
7
−
3
View file @
a9c7c243
...
...
@@ -354,18 +354,22 @@ retry:;
}
if
(
rc
)
{
unsigned
first
=
tester_ignore_err
(
rc
);
unsigned
first
=
tester_ignore_err
(
rc
);
char
buf
[
BUFSIZ
];
snprintf
(
buf
,
sizeof
(
buf
),
"ldap_search_ext_s(%s)"
,
entry
);
/* if ignore.. */
if
(
first
)
{
/* only log if first occurrence */
if
(
force
<
2
||
first
==
1
)
{
tester_ldap_error
(
ld
,
"ldap_search_ext_s"
,
NULL
);
tester_ldap_error
(
ld
,
buf
,
NULL
);
}
continue
;
}
/* busy needs special handling */
tester_ldap_error
(
ld
,
"ldap_search_ext_s"
,
NULL
);
tester_ldap_error
(
ld
,
buf
,
NULL
);
if
(
rc
==
LDAP_BUSY
&&
do_retry
>
0
)
{
ldap_unbind_ext
(
ld
,
NULL
,
NULL
);
ld
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
tests/progs/slapd-tester.c
+
14
−
9
View file @
a9c7c243
...
...
@@ -671,19 +671,24 @@ main( int argc, char **argv )
if
(
DOREQ
(
bnum
,
j
)
)
{
int
jj
=
j
%
bnum
;
bargs
[
banum
-
4
]
=
breqs
[
jj
];
bargs
[
banum
-
2
]
=
bcreds
[
jj
];
bargs
[
banum
-
1
]
=
NULL
;
if
(
battrs
[
jj
]
!=
NULL
)
{
bargs
[
banum
-
5
]
=
"-b"
;
bargs
[
banum
-
3
]
=
"-f"
;
bargs
[
banum
-
1
]
=
"-a"
;
bargs
[
banum
]
=
battrs
[
jj
];
bargs
[
banum
-
4
]
=
manager
?
manager
:
""
;
bargs
[
banum
-
2
]
=
passwd
?
passwd
:
""
;
bargs
[
banum
-
1
]
=
"-b"
;
bargs
[
banum
]
=
breqs
[
jj
];
bargs
[
banum
+
1
]
=
"-f"
;
bargs
[
banum
+
2
]
=
bcreds
[
jj
];
bargs
[
banum
+
3
]
=
"-a"
;
bargs
[
banum
+
4
]
=
battrs
[
jj
];
}
else
{
bargs
[
banum
-
4
]
=
breqs
[
jj
];
bargs
[
banum
-
2
]
=
bcreds
[
jj
];
bargs
[
banum
-
1
]
=
NULL
;
}
fork_child
(
bcmd
,
bargs
);
bargs
[
banum
-
5
]
=
"-D"
;
bargs
[
banum
-
3
]
=
"-w"
;
bargs
[
banum
-
1
]
=
NULL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment