Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Dragoș Haiduc
OpenLDAP
Compare revisions
master to 93ba7a8e2e6e71562c3b43b63592e392c8135700
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
dragos_h/openldap
Select target project
No results found
93ba7a8e2e6e71562c3b43b63592e392c8135700
Select Git revision
Swap
Target
openldap/openldap
Select target project
openldap/openldap
hyc/openldap
ryan/openldap
iboukris/openldap
ondra/openldap
sshanks-kx/openldap
blaggacao/openldap
pbrezina/openldap
quanah/openldap
dragos_h/openldap
lorenz/openldap
tsaarni/openldap
fei.ding/openldap
orent/openldap
arrowplum/openldap
barchiesi/openldap
jotik/openldap
hamano/openldap
ingovoss/openldap
henson/openldap
jlrine2/openldap
howeverAT/openldap
nivanova/openldap
orbea/openldap
rdubner/openldap
smckinney/openldap
jklowden/openldap
dpa-openldap/openldap
rouzier/openldap
orgads/openldap
ffontaine/openldap
jiaqingz/openldap
dcoutadeur/openldap
begeragus/openldap
pubellit/openldap
glandium/openldap
facboy/openldap
thesamesam/openldap
Johan/openldap
fkooman/openldap
gburd/openldap
h-homma/openldap
sgallagher/openldap
ahmed_zaki/openldap
gnoe/openldap
mid/openldap
clan/openldap
47 results
master
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/progs/slapd-auth.c
+0
-335
0 additions, 335 deletions
tests/progs/slapd-auth.c
tests/scripts/test050-syncrepl-multimaster
+12
-12
12 additions, 12 deletions
tests/scripts/test050-syncrepl-multimaster
with
12 additions
and
347 deletions
tests/progs/slapd-auth.c
deleted
100644 → 0
View file @
deab2937
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2006-2008 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Howard Chu for inclusion
* in OpenLDAP Software.
*/
#include
"portable.h"
#include
<stdio.h>
#include
<ac/stdlib.h>
#include
<ac/ctype.h>
#include
<ac/param.h>
#include
<ac/socket.h>
#include
<ac/string.h>
#include
<ac/unistd.h>
#include
<ac/wait.h>
#include
<ac/time.h>
#include
<ac/signal.h>
#include
<ldap.h>
#include
<ldap_pvt_thread.h>
#include
<lutil.h>
static
int
do_time
(
);
/* This program is a simplified version of SLAMD's WeightedAuthRate jobclass.
* It doesn't offer as much configurability, but it's a good starting point.
* When run without the -R option it will behave as a Standard AuthRate job.
* Eventually this will grow into a set of C-based load generators for the SLAMD
* framework. This code is anywhere from 2 to 10 times more efficient than the
* original Java code, allowing servers to be fully loaded without requiring
* anywhere near as much load-generation hardware.
*/
static
void
usage
(
char
*
name
)
{
fprintf
(
stderr
,
"usage: %s -H <uri> -b <baseDN> -w <passwd> -t <seconds> -r lo:hi
\n\t
"
"[-R %:lo:hi] [-f <filter-template>] [-n <threads>] [-D <bindDN>] [-i <seconds>]
\n
"
,
name
);
exit
(
EXIT_FAILURE
);
}
static
char
*
filter
=
"(uid=user.%d)"
;
static
char
hname
[
1024
];
static
char
*
uri
=
"ldap:///"
;
static
char
*
base
;
static
char
*
pass
;
static
char
*
binder
;
static
int
tdur
,
r1per
,
r1lo
,
r1hi
,
r2per
,
r2lo
,
r2hi
;
static
int
threads
=
1
;
static
int
interval
=
30
;
static
volatile
int
*
r1binds
,
*
r2binds
;
static
int
*
r1old
,
*
r2old
;
static
volatile
int
finish
;
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
while
(
(
i
=
getopt
(
argc
,
argv
,
"b:D:H:w:f:n:i:t:r:R:"
))
!=
EOF
)
{
switch
(
i
)
{
case
'b'
:
/* base DN of a tree of user DNs */
base
=
strdup
(
optarg
);
break
;
case
'D'
:
binder
=
strdup
(
optarg
);
break
;
case
'H'
:
/* the server uri */
uri
=
strdup
(
optarg
);
break
;
case
'w'
:
pass
=
strdup
(
optarg
);
break
;
case
't'
:
/* the duration to run */
if
(
lutil_atoi
(
&
tdur
,
optarg
)
!=
0
)
{
usage
(
argv
[
0
]
);
}
break
;
case
'i'
:
/* the time interval */
if
(
lutil_atoi
(
&
interval
,
optarg
)
!=
0
)
{
usage
(
argv
[
0
]
);
}
break
;
case
'r'
:
/* the uid range */
if
(
sscanf
(
optarg
,
"%d:%d"
,
&
r1lo
,
&
r1hi
)
!=
2
)
{
usage
(
argv
[
0
]
);
}
break
;
case
'R'
:
/* percentage:2nd uid range */
if
(
sscanf
(
optarg
,
"%d:%d:%d"
,
&
r2per
,
&
r2lo
,
&
r2hi
)
!=
3
)
{
usage
(
argv
[
0
]
);
}
break
;
case
'f'
:
filter
=
optarg
;
break
;
case
'n'
:
if
(
lutil_atoi
(
&
threads
,
optarg
)
!=
0
||
threads
<
1
)
{
usage
(
argv
[
0
]
);
}
break
;
default:
usage
(
argv
[
0
]
);
break
;
}
}
if
(
tdur
==
0
||
r1hi
<=
r1lo
)
usage
(
argv
[
0
]
);
r1per
=
100
-
r2per
;
if
(
r1per
<
1
)
usage
(
argv
[
0
]
);
r1binds
=
calloc
(
threads
*
4
,
sizeof
(
int
));
r2binds
=
r1binds
+
threads
;
r1old
=
(
int
*
)
r2binds
+
threads
;
r2old
=
r1old
+
threads
;
do_time
(
);
exit
(
EXIT_SUCCESS
);
}
static
void
*
my_task
(
void
*
my_num
)
{
LDAP
*
ld
=
NULL
,
*
sld
=
NULL
;
ber_int_t
msgid
;
LDAPMessage
*
res
,
*
msg
;
char
*
attrs
[]
=
{
"1.1"
,
NULL
};
int
rc
=
LDAP_SUCCESS
;
int
tid
=
*
(
int
*
)
my_num
;
ldap_initialize
(
&
ld
,
uri
);
if
(
ld
==
NULL
)
{
perror
(
"ldap_initialize"
);
return
NULL
;
}
{
int
version
=
LDAP_VERSION3
;
(
void
)
ldap_set_option
(
ld
,
LDAP_OPT_PROTOCOL_VERSION
,
&
version
);
}
(
void
)
ldap_set_option
(
ld
,
LDAP_OPT_REFERRALS
,
LDAP_OPT_OFF
);
ldap_initialize
(
&
sld
,
uri
);
if
(
sld
==
NULL
)
{
perror
(
"ldap_initialize"
);
return
NULL
;
}
{
int
version
=
LDAP_VERSION3
;
(
void
)
ldap_set_option
(
sld
,
LDAP_OPT_PROTOCOL_VERSION
,
&
version
);
}
(
void
)
ldap_set_option
(
sld
,
LDAP_OPT_REFERRALS
,
LDAP_OPT_OFF
);
if
(
binder
)
{
rc
=
ldap_bind_s
(
sld
,
binder
,
pass
,
LDAP_AUTH_SIMPLE
);
if
(
rc
!=
LDAP_SUCCESS
)
{
ldap_perror
(
sld
,
"ldap_bind"
);
}
}
r1binds
[
tid
]
=
0
;
for
(;;)
{
char
dn
[
BUFSIZ
],
*
ptr
,
fstr
[
256
];
int
j
,
isr1
;
if
(
finish
)
break
;
j
=
rand
()
%
100
;
if
(
j
<
r1per
)
{
j
=
rand
()
%
r1hi
;
isr1
=
1
;
}
else
{
j
=
rand
()
%
(
r2hi
-
r2lo
+
1
);
j
+=
r2lo
;
isr1
=
0
;
}
sprintf
(
fstr
,
filter
,
j
);
rc
=
ldap_search_ext
(
sld
,
base
,
LDAP_SCOPE_SUB
,
fstr
,
attrs
,
0
,
NULL
,
NULL
,
0
,
0
,
&
msgid
);
if
(
rc
!=
LDAP_SUCCESS
)
{
ldap_perror
(
sld
,
"ldap_search_ex"
);
return
NULL
;
}
while
((
rc
=
ldap_result
(
sld
,
LDAP_RES_ANY
,
LDAP_MSG_ONE
,
NULL
,
&
res
))
>
0
){
BerElement
*
ber
;
struct
berval
bv
;
char
*
ptr
;
int
done
=
0
;
for
(
msg
=
ldap_first_message
(
sld
,
res
);
msg
;
msg
=
ldap_next_message
(
sld
,
msg
))
{
switch
(
ldap_msgtype
(
msg
))
{
case
LDAP_RES_SEARCH_ENTRY
:
rc
=
ldap_get_dn_ber
(
sld
,
msg
,
&
ber
,
&
bv
);
strcpy
(
dn
,
bv
.
bv_val
);
ber_free
(
ber
,
0
);
break
;
case
LDAP_RES_SEARCH_RESULT
:
done
=
1
;
break
;
}
if
(
done
)
break
;
}
ldap_msgfree
(
res
);
if
(
done
)
break
;
}
rc
=
ldap_bind_s
(
ld
,
dn
,
pass
,
LDAP_AUTH_SIMPLE
);
if
(
rc
!=
LDAP_SUCCESS
)
{
ldap_perror
(
ld
,
"ldap_bind"
);
}
if
(
isr1
)
r1binds
[
tid
]
++
;
else
r2binds
[
tid
]
++
;
}
ldap_unbind
(
sld
);
ldap_unbind
(
ld
);
return
NULL
;
}
static
int
do_time
(
)
{
struct
timeval
tv
;
time_t
now
,
prevt
,
start
;
int
r1new
,
r2new
;
int
dt
,
dr1
,
dr2
,
rr1
,
rr2
;
int
dr10
,
dr20
;
int
i
;
gethostname
(
hname
,
sizeof
(
hname
));
printf
(
"%s(tid)
\t
deltaT
\t
auth1
\t
auth2
\t
rate1
\t
rate2
\t
Rate1+2
\n
"
,
hname
);
srand
(
getpid
());
prevt
=
start
=
time
(
0L
);
for
(
i
=
0
;
i
<
threads
;
i
++
)
{
ldap_pvt_thread_t
thr
;
r1binds
[
i
]
=
i
;
ldap_pvt_thread_create
(
&
thr
,
1
,
my_task
,
(
void
*
)
&
r1binds
[
i
]
);
}
for
(;;)
{
tv
.
tv_sec
=
interval
;
tv
.
tv_usec
=
0
;
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv
);
now
=
time
(
0L
);
dt
=
now
-
prevt
;
prevt
=
now
;
dr10
=
0
;
dr20
=
0
;
for
(
i
=
0
;
i
<
threads
;
i
++
)
{
r1new
=
r1binds
[
i
];
r2new
=
r2binds
[
i
];
dr1
=
r1new
-
r1old
[
i
];
dr2
=
r2new
-
r2old
[
i
];
rr1
=
dr1
/
dt
;
rr2
=
dr2
/
dt
;
printf
(
"%s(%d)
\t
%d
\t
%d
\t
%d
\t
%d
\t
%d
\t
%d
\n
"
,
hname
,
i
,
dt
,
dr1
,
dr2
,
rr1
,
rr2
,
rr1
+
rr2
);
dr10
+=
dr1
;
dr20
+=
dr2
;
r1old
[
i
]
=
r1new
;
r2old
[
i
]
=
r2new
;
}
if
(
i
>
1
)
{
rr1
=
dr10
/
dt
;
rr2
=
dr20
/
dt
;
printf
(
"%s(sum)
\t
%d
\t
%d
\t
%d
\t
%d
\t
%d
\t
%d
\n
"
,
hname
,
0
,
dr10
,
dr20
,
rr1
,
rr2
,
rr1
+
rr2
);
}
if
(
now
-
start
>=
tdur
)
{
finish
=
1
;
break
;
}
}
return
0
;
}
This diff is collapsed.
Click to expand it.
tests/scripts/test050-syncrepl-multimaster
View file @
93ba7a8e
...
...
@@ -157,13 +157,13 @@ changetype: modify
add: olcSyncRepl
olcSyncRepl: rid=001 provider=
$URI1
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=002 provider=
$URI2
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=003 provider=
$URI3
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
-
add: olcMirrorMode
olcMirrorMode: TRUE
...
...
@@ -213,13 +213,13 @@ changetype: modify
add: olcSyncRepl
olcSyncRepl: rid=001 provider=
$URI1
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=002 provider=
$URI2
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=003 provider=
$URI3
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
-
add: olcMirrorMode
olcMirrorMode: TRUE
...
...
@@ -263,13 +263,13 @@ changetype: modify
add: olcSyncRepl
olcSyncRepl: rid=001 provider=
$URI1
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=002 provider=
$URI2
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=003 provider=
$URI3
binddn="cn=config" bindmethod=simple
credentials=
$CONFIGPW
searchbase="cn=config" type=refreshAndPersist
retry="5 5 300 5" timeout=
1
retry="5 5 300 5" timeout=
3
-
add: olcMirrorMode
olcMirrorMode: TRUE
...
...
@@ -321,13 +321,13 @@ olcRootDN: $MANAGERDN
olcRootPW:
$PASSWD
olcSyncRepl: rid=004 provider=
$URI1
binddn="
$MANAGERDN
" bindmethod=simple
credentials=
$PASSWD
searchbase="
$BASEDN
" type=refreshOnly
interval=00:00:00:10 retry="5 5 300 5" timeout=
1
interval=00:00:00:10 retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=005 provider=
$URI2
binddn="
$MANAGERDN
" bindmethod=simple
credentials=
$PASSWD
searchbase="
$BASEDN
" type=refreshOnly
interval=00:00:00:10 retry="5 5 300 5" timeout=
1
interval=00:00:00:10 retry="5 5 300 5" timeout=
3
olcSyncRepl: rid=006 provider=
$URI3
binddn="
$MANAGERDN
" bindmethod=simple
credentials=
$PASSWD
searchbase="
$BASEDN
" type=refreshOnly
interval=00:00:00:10 retry="5 5 300 5" timeout=
1
interval=00:00:00:10 retry="5 5 300 5" timeout=
3
olcMirrorMode: TRUE
dn: olcOverlay=syncprov,olcDatabase={1}
${
BACKEND
}
,cn=config
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
Next