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
c838ce51
Commit
c838ce51
authored
18 years ago
by
Pierangelo Masarati
Browse files
Options
Downloads
Patches
Plain Diff
initialize random seed; use high-order bits for better randomness
parent
ca262ee8
No related branches found
Branches containing commit
No related tags found
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
+9
-6
9 additions, 6 deletions
tests/progs/slapd-bind.c
tests/progs/slapd-read.c
+8
-1
8 additions, 1 deletion
tests/progs/slapd-read.c
tests/progs/slapd-search.c
+7
-1
7 additions, 1 deletion
tests/progs/slapd-search.c
with
24 additions
and
8 deletions
tests/progs/slapd-bind.c
+
9
−
6
View file @
c838ce51
...
...
@@ -288,7 +288,7 @@ do_base( char *uri, char *dn, struct berval *pass, char *base, char *filter, cha
int
version
=
LDAP_VERSION3
;
char
*
nullstr
=
""
;
srand
(
pid
);
srand
(
pid
);
ldap_initialize
(
&
ld
,
uri
);
if
(
ld
==
NULL
)
{
...
...
@@ -397,16 +397,19 @@ novals:;
/* Ok, got list of DNs, now start binding to each */
for
(
i
=
0
;
i
<
maxloop
;
i
++
)
{
int
j
,
k
;
struct
berval
cred
=
{
0
,
NULL
};
int
j
;
struct
berval
cred
=
{
0
,
NULL
};
for
(
j
=
0
,
k
=
0
;
k
<
ndns
;
k
++
)
{
j
=
rand
()
%
ndns
;
}
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
j = rand() % ndns;
#endif
j
=
((
double
)
ndns
)
*
rand
()
/
(
RAND_MAX
+
1
.
0
);
if
(
creds
&&
!
BER_BVISEMPTY
(
&
creds
[
j
]
)
)
{
cred
=
creds
[
j
];
}
if
(
do_bind
(
uri
,
dns
[
j
],
&
cred
,
1
,
force
,
chaserefs
,
noinit
,
&
ld
)
&&
!
force
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/progs/slapd-read.c
+
8
−
1
View file @
c838ce51
...
...
@@ -215,6 +215,8 @@ do_random( char *uri, char *manager, struct berval *passwd,
char
**
values
=
NULL
;
LDAPMessage
*
res
=
NULL
,
*
e
=
NULL
;
srand
(
pid
);
attrs
[
0
]
=
LDAP_NO_ATTRS
;
attrs
[
1
]
=
NULL
;
...
...
@@ -275,7 +277,12 @@ do_random( char *uri, char *manager, struct berval *passwd,
}
for
(
i
=
0
;
i
<
innerloop
;
i
++
)
{
do_read
(
uri
,
manager
,
passwd
,
values
[
rand
()
%
nvalues
],
&
ld
,
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
int r = rand() % nvalues;
#endif
int
r
=
((
double
)
nvalues
)
*
rand
()
/
(
RAND_MAX
+
1
.
0
);
do_read
(
uri
,
manager
,
passwd
,
values
[
r
],
&
ld
,
noattrs
,
1
,
maxretries
,
delay
,
force
,
chaserefs
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/progs/slapd-search.c
+
7
−
1
View file @
c838ce51
...
...
@@ -223,6 +223,8 @@ do_random( char *uri, char *manager, struct berval *passwd,
char
**
values
=
NULL
;
LDAPMessage
*
res
=
NULL
,
*
e
=
NULL
;
srand
(
pid
);
attrs
[
0
]
=
attr
;
attrs
[
1
]
=
NULL
;
...
...
@@ -294,8 +296,12 @@ do_random( char *uri, char *manager, struct berval *passwd,
for
(
i
=
0
;
i
<
innerloop
;
i
++
)
{
char
buf
[
BUFSIZ
];
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
int r = rand() % nvalues;
#endif
int
r
=
((
double
)
nvalues
)
*
rand
()
/
(
RAND_MAX
+
1
.
0
);
snprintf
(
buf
,
sizeof
(
buf
),
"(%s=%s)"
,
attr
,
values
[
r
and
()
%
nvalues
]
);
snprintf
(
buf
,
sizeof
(
buf
),
"(%s=%s)"
,
attr
,
values
[
r
]
);
do_search
(
uri
,
manager
,
passwd
,
sbase
,
buf
,
&
ld
,
noattrs
,
1
,
maxretries
,
delay
,
force
,
chaserefs
);
...
...
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