commit_id
string | repo
string | commit_message
string | diff
string | label
int64 |
---|---|---|---|---|
974c802fceb429315bf799805917a208b44c4917
|
389ds/389-ds-base
|
Ticket 50363 - ds-replcheck incorrectly reports error out of order multi-valued attributes
Bug Description: If for some reason an entry's multi-valued attribute
values are in different orders on different replicas
the tool reports this as an inconsistency when it is
not.
Fix Description: For both offline & online processing sort each entry's
multi-valued attribute values.
https://pagure.io/389-ds-base/issue/50363
Reviewed by: firstyear & mhonek (Thanks!!)
|
commit 974c802fceb429315bf799805917a208b44c4917
Author: Mark Reynolds <[email protected]>
Date: Fri May 10 16:57:42 2019 -0400
Ticket 50363 - ds-replcheck incorrectly reports error out of order multi-valued attributes
Bug Description: If for some reason an entry's multi-valued attribute
values are in different orders on different replicas
the tool reports this as an inconsistency when it is
not.
Fix Description: For both offline & online processing sort each entry's
multi-valued attribute values.
https://pagure.io/389-ds-base/issue/50363
Reviewed by: firstyear & mhonek (Thanks!!)
diff --git a/dirsrvtests/tests/suites/ds_tools/replcheck_test.py b/dirsrvtests/tests/suites/ds_tools/replcheck_test.py
index 63c80a015..a6add891f 100644
--- a/dirsrvtests/tests/suites/ds_tools/replcheck_test.py
+++ b/dirsrvtests/tests/suites/ds_tools/replcheck_test.py
@@ -343,6 +343,8 @@ def test_inconsistencies(topo_tls_ldapi):
m2 = topo_tls_ldapi.ms["master2"]
attr_m1 = "m1_inconsistency"
attr_m2 = "m2_inconsistency"
+ attr_first = "first ordered valued"
+ attr_second = "second ordered valued"
attr_m1_only = "123123123"
try:
@@ -355,6 +357,9 @@ def test_inconsistencies(topo_tls_ldapi):
user_m1.set("description", attr_m1)
user_m2.set("description", attr_m2)
user_m1.set("telephonenumber", attr_m1_only)
+ # Add the same multi-valued attrs, but out of order
+ user_m1.set("cn", [attr_first, attr_second])
+ user_m2.set("cn", [attr_second, attr_first])
time.sleep(2)
for tool_cmd in replcheck_cmd_list(topo_tls_ldapi):
@@ -362,12 +367,16 @@ def test_inconsistencies(topo_tls_ldapi):
assert attr_m1 in result
assert attr_m2 in result
assert attr_m1_only in result
+ assert attr_first not in result
+ assert attr_second not in result
# Ignore some attributes and check the output
tool_cmd.extend(['-i', '{},{}'.format('description', 'telephonenumber')])
result = subprocess.check_output(tool_cmd, encoding='utf-8').lower()
assert attr_m1 not in result
assert attr_m2 not in result
assert attr_m1_only not in result
+ assert attr_first not in result
+ assert attr_second not in result
finally:
topo_tls_ldapi.resume_all_replicas()
diff --git a/ldap/admin/src/scripts/ds-replcheck b/ldap/admin/src/scripts/ds-replcheck
index 72527aaa6..5d7295e50 100755
--- a/ldap/admin/src/scripts/ds-replcheck
+++ b/ldap/admin/src/scripts/ds-replcheck
@@ -125,7 +125,7 @@ def convert_entries(entries):
for entry in entries:
new_entry = Entry(entry)
- new_entry.data = {k.lower(): v for k, v in list(new_entry.data.items())}
+ new_entry.data = {k.lower(): sorted(v) for k, v in list(new_entry.data.items())}
# Decode nscpentrywsi bytes values for future use
nscpentrywsi_list = []
@@ -448,6 +448,11 @@ def ldif_search(LDIF, dn):
# Keep track of entry index - we use this later when searching the LDIF again
result['idx'] = count
+ # Sort all the multi-valued attributes
+ for k, v in data.items():
+ v.sort()
+ data[k] = v
+
result['glue'] = None
if found_conflict and found_subentry and found_tombstone is False:
result['entry'] = None
| 0 |
1c573d976f3a4990130630a7ec728038e3e8fed6
|
389ds/389-ds-base
|
Issue 5864 - Server fails to start after reboot because it's unable to access nsslapd-rundir
Bug Description:
Sometimes after reboot dirsrv service fails to start:
EMERG - main - Unable to access nsslapd-rundir: No such file or directory
EMERG - main - Ensure that user "dirsrv" has read and write permissions on /run/dirsrv
EMERG - main - Shutting down.
We rely on systemd-tmpfiles for /run/dirsrv creation. But dirsrv service
doesn't explicitly wait for systemd-tmpfiles-setup.service to start.
This creates a race condition.
Fix Description:
dirsrv service should start only after systemd-tmpfiles-setup.service is finished,
add it as a dependency via `After=` and `Wants=`.
Fixes: https://github.com/389ds/389-ds-base/issues/5864
Reviwed-by: @Firstyear (Thanks!)
|
commit 1c573d976f3a4990130630a7ec728038e3e8fed6
Author: Viktor Ashirov <[email protected]>
Date: Wed Jul 26 16:44:51 2023 +0200
Issue 5864 - Server fails to start after reboot because it's unable to access nsslapd-rundir
Bug Description:
Sometimes after reboot dirsrv service fails to start:
EMERG - main - Unable to access nsslapd-rundir: No such file or directory
EMERG - main - Ensure that user "dirsrv" has read and write permissions on /run/dirsrv
EMERG - main - Shutting down.
We rely on systemd-tmpfiles for /run/dirsrv creation. But dirsrv service
doesn't explicitly wait for systemd-tmpfiles-setup.service to start.
This creates a race condition.
Fix Description:
dirsrv service should start only after systemd-tmpfiles-setup.service is finished,
add it as a dependency via `After=` and `Wants=`.
Fixes: https://github.com/389ds/389-ds-base/issues/5864
Reviwed-by: @Firstyear (Thanks!)
diff --git a/wrappers/systemd.template.service.in b/wrappers/systemd.template.service.in
index 725f2fee2..b7bd2e5f6 100644
--- a/wrappers/systemd.template.service.in
+++ b/wrappers/systemd.template.service.in
@@ -4,8 +4,9 @@
[Unit]
Description=@capbrand@ Directory Server %i.
PartOf=@systemdgroupname@
-After=chronyd.service ntpd.service network-online.target
+After=chronyd.service ntpd.service network-online.target systemd-tmpfiles-setup.service
Before=radiusd.service
+Wants=systemd-tmpfiles-setup.service
[Service]
Type=notify
| 0 |
950712cfcc382fd5966a466d9d312942240aa4f7
|
389ds/389-ds-base
|
Bug 750625 - Fix Coverity (11091) Unchecked return value
https://bugzilla.redhat.com/show_bug.cgi?id=750625
slapd/back-ldbm/import-threads.c (index_producer)
Bug Description: No check of the return value of "db_create".
Fix Description: Adding a checking code for the return value
from db_create.
|
commit 950712cfcc382fd5966a466d9d312942240aa4f7
Author: Noriko Hosoi <[email protected]>
Date: Wed Nov 2 09:48:01 2011 -0700
Bug 750625 - Fix Coverity (11091) Unchecked return value
https://bugzilla.redhat.com/show_bug.cgi?id=750625
slapd/back-ldbm/import-threads.c (index_producer)
Bug Description: No check of the return value of "db_create".
Fix Description: Adding a checking code for the return value
from db_create.
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index e95d32f49..eb2cc8285 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -1148,9 +1148,8 @@ index_producer(void *param)
tmp_db->close(tmp_db, 0);
rc = db_create(&db, env, 0);
if (rc) {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "Creating db handle to rename %s to %s failed.\n",
- tmpid2entry, id2entry);
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,
+ "Creating db handle to remove %s failed.\n", id2entry);
goto bail;
}
rc = db->remove(db, id2entry, NULL, 0);
@@ -1158,7 +1157,13 @@ index_producer(void *param)
LDAPDebug1Arg(LDAP_DEBUG_ANY, "Removing %s failed.\n", id2entry);
goto bail;
}
- db_create(&db, env, 0);
+ rc = db_create(&db, env, 0);
+ if (rc) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "Creating db handle to rename %s to %s failed.\n",
+ tmpid2entry, id2entry);
+ goto bail;
+ }
rc = db->rename(db, tmpid2entry, NULL, id2entry, 0);
if (rc) {
LDAPDebug2Args(LDAP_DEBUG_ANY, "Renaming %s to %s failed.\n",
| 0 |
ee20c8fbf0b36bd42b0b601aa7effec402da5113
|
389ds/389-ds-base
|
Ticket #612 - improve dbgen rdn generation, output
https://fedorahosted.org/389/ticket/612
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
added ability to create rdn values as sequential numbers - output to stdout
added the -b flag which not only specifies the beginning number but makes
the RDN values increasing numbers with optional 0 padding (as used by ldclt)
using -o - will output to stdout
if not using verbose, will only print out ldif
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: Yes
|
commit ee20c8fbf0b36bd42b0b601aa7effec402da5113
Author: Rich Megginson <[email protected]>
Date: Fri Jan 11 17:33:07 2013 -0700
Ticket #612 - improve dbgen rdn generation, output
https://fedorahosted.org/389/ticket/612
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
added ability to create rdn values as sequential numbers - output to stdout
added the -b flag which not only specifies the beginning number but makes
the RDN values increasing numbers with optional 0 padding (as used by ldclt)
using -o - will output to stdout
if not using verbose, will only print out ldif
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: Yes
diff --git a/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in b/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in
index e500abece..ce18f7c61 100755
--- a/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in
+++ b/ldap/servers/slapd/tools/rsearch/scripts/dbgen.pl.in
@@ -60,8 +60,14 @@ sub PrintUsage {
print STDERR
"Usage: $0 [options] -o output_file -n number\n",
"\t Where options are:\n",
+ "\t -o filename output file\n",
"\t -s suffix, default is 'dc=example,dc=com'\n",
"\t -c for CN naming style RDN's : default is UID\n",
+ "\t -z extra objectclasses to add to base used in -O - should be AUXILIARY or SUB\n",
+ "\t -j 0 pad numbers used in RDN to this many digits e.g. with 4 1 becomes 0001\n",
+ "\t -m naming attribute for RDN\n",
+ "\t -n number of entries to generate\n",
+ "\t -b beginning number for RDN (default 1 - ending number is -n value)\n",
"\t -O for organizationalPersons, default is inetOrgPerson\n",
"\t -p for piranha style aci's, default is barracuda\n",
"\t -r seed---seed number for random number generator\n",
@@ -529,7 +535,7 @@ my $mycert =
require "flush.pl";
require "getopts.pl";
-&Getopts('n:o:s:r:cOvpqgxyl:');
+&Getopts('n:o:s:r:cOvpqgxyl:z:m:b:j:');
$Number_To_Generate = $opt_n;
$Verbose = $opt_v;
@@ -541,9 +547,16 @@ $debug = $opt_d;
$Suffix = $opt_s || 'dc=example,dc=com';
$NamingType = "cn" if ($opt_c);
$NamingType = "uid" if (!$opt_c);
+$NamingType = $opt_m if ($opt_m);
$inetOrgPerson = "objectClass: inetOrgPerson\n" if (!$opt_O);
$PrintOrgChartDat = $opt_g;
$DataDir = $opt_l || "@templatedir@";
+$ExtraObjClasses = "";
+if ($opt_z) {
+ $ExtraObjClasses = join "\n", map { "objectClass: $_" } split(/ /, $opt_z);
+ $ExtraObjClasses .= "\n";
+}
+$BeginNum = $opt_b || 0;
$printpreamble = 1;
if ("" != $opt_x)
{
@@ -554,6 +567,7 @@ if ("" != $opt_y)
{
$printorgunit = 0;
}
+$ZeroPad = $opt_j;
if ($Suffix =~ /o=/) {
($Organization) = $Suffix =~ /o=([^,]+)/;
@@ -580,6 +594,13 @@ if ( (!$Number_To_Generate) || (!$Output_File_Name)) {
&PrintUsage;
}
+if ($Output_File_Name eq '-') {
+ *OUTPUT_FILE = *STDOUT;
+} else {
+ open (OUTPUT_FILE, ">>$Output_File_Name") ||
+ die "Error---Can't open output file $Output_File_Name\n";
+}
+
srand($Random_Seed);
print "Loading Name Data...\n" if $Verbose;
@@ -604,9 +625,6 @@ if ($printpreamble)
}
}
-open (OUTPUT_FILE, ">>$Output_File_Name") ||
- die "Error---Can't open output file $Output_File_Name\n";
-
if ($printorgunit)
{
&PrintOrganizationalUnits;
@@ -655,9 +673,9 @@ if ($PrintOrgChartDat)
}
}
-print "Generating $Number_To_Generate entries, please wait\n";
+print "Generating $Number_To_Generate entries, please wait\n" if $Verbose;
-print "Progress: ";
+print "Progress: " if $Verbose;
# We don't want people with duplicate names, so for each name generated,
# add it to "TheMap", which is an associative array with the
# name as the key. If there's a duplicate, throw the name out and
@@ -670,7 +688,7 @@ $dups = 0;
# CHANGED: updated to allow for uid naming style or cn style. Check the RDN for uniqueness
-for ($x= 0; $x < $Number_To_Generate; $x++) {
+for ($x= $BeginNum; $x < ($Number_To_Generate+$BeginNum); $x++) {
($givenName, $sn, $cn, $uid, $rdn,) = &MakeRandomName;
if (&AddAndCheck($rdn)) {
@@ -729,10 +747,10 @@ for ($x= 0; $x < $Number_To_Generate; $x++) {
$userPassword = "$uid\n";
}
- if ($PrintOrgChartDat) {
- $dnstr = "dn: $NamingType=$rdn, ou=People, $Suffix\n",
+ if ($PrintOrgChartDat or !$printorgunit) {
+ $dnstr = "dn: $NamingType=$rdn,ou=People,$Suffix\n",
} else {
- $dnstr = "dn: $NamingType=$rdn, ou=$OrgUnit, $Suffix\n";
+ $dnstr = "dn: $NamingType=$rdn,ou=$OrgUnit,$Suffix\n";
}
print OUTPUT_FILE
@@ -740,7 +758,7 @@ for ($x= 0; $x < $Number_To_Generate; $x++) {
"objectClass: top\n",
"objectClass: person\n",
"objectClass: organizationalPerson\n",
- $inetOrgPerson,
+ $inetOrgPerson, $ExtraObjClasses,
"cn: $cn\n",
"sn: $sn\n",
"uid: $uid\n",
@@ -769,15 +787,15 @@ for ($x= 0; $x < $Number_To_Generate; $x++) {
if (!$Quiet) {
if ($x % 1000 == 0) {
- print ".";
+ print "." if $Verbose;
&flush(STDOUT);
}
}
}
-print "\n";
-print "Generated $x entries\n";
+print "\n" if $Verbose;
+print "Generated $x entries\n" if $Verbose;
if ($Verbose) {
print "$dups duplicates skipped\n";
@@ -825,7 +843,6 @@ sub ReadFamilyNames {
sub PrintPreAmblePiranha {
local($output_file) = @_;
- open (OUTPUT_FILE, ">$output_file") || die "Can't open $output_file for writing $!\n";
print OUTPUT_FILE<<End_Of_File
dn: $Suffix
objectClass: top
@@ -836,17 +853,12 @@ subtreeaci: +(privilege=compare)
subtreeaci: +(|(privilege=search)(privilege=read))
End_Of_File
- ;
-
- close (OUTPUT_FILE);
-
+ ;
}
sub PrintPreAmbleBarracuda {
local($output_file) = @_;
- open (OUTPUT_FILE, ">$output_file") || die "Can't open $output_file for writing $!\n";
-
print OUTPUT_FILE<<End_Of_File
dn: $Suffix
objectClass: top
@@ -858,14 +870,11 @@ aci: (target=ldap:///$Suffix)(targetattr=*)(version 3.0; acl "acl3"; allow(read,
End_Of_File
;
- close (OUTPUT_FILE);
}
sub PrintPreAmbleNoACI {
local($output_file) = @_;
- open (OUTPUT_FILE, ">$output_file") || die "Can't open $output_file for writing $!\n";
-
print OUTPUT_FILE<<End_Of_File
dn: $Suffix
objectClass: top
@@ -874,8 +883,6 @@ o: $Organization
End_Of_File
;
- close (OUTPUT_FILE);
-
}
@@ -883,14 +890,14 @@ End_Of_File
sub PrintOrganizationalUnits {
foreach $ou (@OrganizationalUnits) {
print OUTPUT_FILE
- "dn: ou=$ou, $Suffix\n",
+ "dn: ou=$ou,$Suffix\n",
"objectClass: top\n",
"objectClass: organizationalUnit\n",
"ou: $ou\n\n";
}
if ($PrintOrgChartDat) {
print OUTPUT_FILE
- "dn: ou=People, $Suffix\n",
+ "dn: ou=People,$Suffix\n",
"objectClass: top\n",
"objectClass: organizationalUnit\n",
"ou: People\n\n";
@@ -938,7 +945,7 @@ sub PrintManagers {
$userPassword = "$uid\n";
}
- $dnstr = "dn: $NamingType=$rdn, ou=People, $Suffix\n";
+ $dnstr = "dn: $NamingType=$rdn,ou=People,$Suffix\n";
if ("" ne $orgUnit) {
$oustr = "ou: $orgUnit\n";
}
@@ -997,22 +1004,22 @@ sub MakeRandomName {
$Given_Name = $given_names[rand @given_names];
$Surname = $family_names[rand @family_names];
$Full_Name = "$Given_Name $Surname";
+ $first = substr($Given_Name, 0,1);
+ $last = substr($Surname, 0,8);
+ $UID = $first . $last . "$uniq";
# Create the uid based on the DN naming type defined
- if ($NamingType eq "uid") {
- $first = substr($Given_Name, 0,1);
- $last = substr($Surname, 0,8);
- $UID = $first . $last . "$uniq";
+ if ($opt_b) { # use a uniquenumber for the RDN value
+ if ($ZeroPad) {
+ $RDN = sprintf "%0.${ZeroPad}d", $x;
+ } else {
+ $RDN = $x;
+ }
+ } elsif ($NamingType eq "uid") {
$RDN = $UID;
+ } else {
+ $RDN = $Full_Name;
}
- else
- {
- $first = substr($Given_Name, 0,1);
- $last = substr($Surname, 0,8);
- $UID = $first . $last . "$uniq";
- $RDN = $Full_Name;
- }
-
return ($Given_Name, $Surname, $Full_Name, $UID, $RDN);
}
@@ -1098,6 +1105,3 @@ sub MakeInitials {
($last) = $sn =~ /^(\w).*/;
return "$first" . ". " . "$last" . ".";
}
-
-
-
| 0 |
0e92a50f3061313820e456dc783cfddfd458f15b
|
389ds/389-ds-base
|
update internal builds to use latest components
|
commit 0e92a50f3061313820e456dc783cfddfd458f15b
Author: Rich Megginson <[email protected]>
Date: Sat Oct 7 03:20:36 2006 +0000
update internal builds to use latest components
diff --git a/component_versions.mk b/component_versions.mk
index 124cf2e54..81e969e06 100644
--- a/component_versions.mk
+++ b/component_versions.mk
@@ -57,7 +57,7 @@ endif
# SECURITY (NSS) LIBRARY
ifndef SECURITY_RELDATE
- SECURITY_RELDATE = NSS_3_11_1_RTM
+ SECURITY_RELDATE = NSS_3_11_3_RTM
endif
# LIBDB
@@ -76,7 +76,7 @@ endif
# LDAP SDK
ifndef LDAP_RELDATE
- LDAP_RELDATE = v5.17-sun-merge
+ LDAP_RELDATE = v6.0.0
endif
ifndef LDAPCOMP_DIR
LDAPCOMP_DIR=ldapcsdk
@@ -166,7 +166,7 @@ ifndef LDAPCONSOLE_RELDATE
endif
ifndef PERLDAP_VERSION
- PERLDAP_VERSION=1.5/20060915
+ PERLDAP_VERSION=1.5/20061006
endif
ifndef JSS_COMP
diff --git a/nsdefs.mk b/nsdefs.mk
index eb75e659b..35b6d4acc 100644
--- a/nsdefs.mk
+++ b/nsdefs.mk
@@ -120,7 +120,7 @@ endif # SOLARIS
endif # !BUILD_JAVA_CODE
NSPR_SUF=20
-LDAP_SUF=50
+LDAP_SUF=60
IS_DIR_LITE=false
| 0 |
22fd3c28ca62d080b42f25f4d7c0fb711c1a011c
|
389ds/389-ds-base
|
Ticket #47725 - compiler error on daemon.c
Description: This syntax is invalid for Solaris Studio Compiler:
while((0 = getmntent(fp, &mnt))){
Applied the patch provided by cgrzemba (Thanks!!)
https://fedorahosted.org/389/ticket/47725
Reviewed by [email protected].
|
commit 22fd3c28ca62d080b42f25f4d7c0fb711c1a011c
Author: Noriko Hosoi <[email protected]>
Date: Mon Mar 3 16:07:21 2014 -0800
Ticket #47725 - compiler error on daemon.c
Description: This syntax is invalid for Solaris Studio Compiler:
while((0 = getmntent(fp, &mnt))){
Applied the patch provided by cgrzemba (Thanks!!)
https://fedorahosted.org/389/ticket/47725
Reviewed by [email protected].
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 7594d534a..b0cdcc152 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -498,7 +498,7 @@ disk_mon_get_mount_point(char *dir)
dev_id = s.st_dev;
- while((0 = getmntent(fp, &mnt))){
+ while((0 == getmntent(fp, &mnt))){
if (stat(mnt.mnt_mountp, &s) != 0) {
continue;
}
| 0 |
baea677acb49c94b6204b26e7d7aeb20a9474f53
|
389ds/389-ds-base
|
616608 - SIGBUS in RDN index reads on platforms with strict alignments
https://bugzilla.redhat.com/show_bug.cgi?id=616608
Fix description:
Use the marshall/unmarshall technique for the entryrdn index data.
Introduced sizeushort_internal_to_stored/sizeushort_stored_to_internal
for the size data to store in 2 bytes.
Entryrdn related functions in the dbscan utility are also modified
to support marshalled data.
Reviewed by [email protected] and fixed bugs found by him.
|
commit baea677acb49c94b6204b26e7d7aeb20a9474f53
Author: Noriko Hosoi <[email protected]>
Date: Tue Jul 27 15:35:39 2010 -0700
616608 - SIGBUS in RDN index reads on platforms with strict alignments
https://bugzilla.redhat.com/show_bug.cgi?id=616608
Fix description:
Use the marshall/unmarshall technique for the entryrdn index data.
Introduced sizeushort_internal_to_stored/sizeushort_stored_to_internal
for the size data to store in 2 bytes.
Entryrdn related functions in the dbscan utility are also modified
to support marshalled data.
Reviewed by [email protected] and fixed bugs found by him.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index dc00d33a9..8b0a00568 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -73,13 +73,15 @@ static int entryrdn_noancestorid = 0;
#define RDN_STRINGID_LEN 64
typedef struct _rdn_elem {
- PRUint32 rdn_elem_id;
- PRUint16 rdn_elem_nrdn_len; /* including '\0' */
- PRUint16 rdn_elem_rdn_len; /* including '\0' */
- char rdn_elem_nrdn_rdn[1]; /* "normalized rdn" '\0' "rdn" '\0' */
+ char rdn_elem_id[sizeof(ID)];
+ char rdn_elem_nrdn_len[2]; /* ushort; length including '\0' */
+ char rdn_elem_rdn_len[2]; /* ushort; length including '\0' */
+ char rdn_elem_nrdn_rdn[1]; /* "normalized rdn" '\0' "rdn" '\0' */
} rdn_elem;
-#define RDN_ADDR(elem) ((elem)->rdn_elem_nrdn_rdn + (elem)->rdn_elem_nrdn_len)
+#define RDN_ADDR(elem) \
+ ((elem)->rdn_elem_nrdn_rdn + \
+ sizeushort_stored_to_internal((elem)->rdn_elem_nrdn_len))
/* helper functions */
static rdn_elem *_entryrdn_new_rdn_elem(backend *be, ID id, Slapi_RDN *srdn, size_t *length);
@@ -356,7 +358,7 @@ entryrdn_index_read(backend *be,
if (rc) {
goto bail;
}
- *id = elem->rdn_elem_id;
+ *id = id_stored_to_internal(elem->rdn_elem_id);
bail:
/* Close the cursor */
@@ -423,6 +425,7 @@ entryrdn_rename_subtree(backend *be,
size_t oldsupelemlen = 0;
const Slapi_DN *mynewsupsdn = NULL;
Slapi_RDN *mynewsrdn = NULL;
+ ID targetid = 0;
slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"--> entryrdn_rename_subtree\n");
@@ -568,6 +571,7 @@ entryrdn_rename_subtree(backend *be,
slapi_sdn_get_dn(oldsdn), rc);
goto bail;
}
+ targetid = id_stored_to_internal(targetelem->rdn_elem_id);
targetelemlen = _entryrdn_rdn_elem_size(targetelem);
if (oldsupelem) {
oldsupelemlen = _entryrdn_rdn_elem_size(oldsupelem);
@@ -577,8 +581,8 @@ entryrdn_rename_subtree(backend *be,
/* 2) update targetelem's child link, if renaming the target */
if (mynewsrdn) {
/* remove the old elem; (1) rename targetelem */
- keybuf = slapi_ch_smprintf("%d:%s",
- targetelem->rdn_elem_id, targetelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%u:%s",
+ targetid, targetelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -593,8 +597,8 @@ entryrdn_rename_subtree(backend *be,
}
if (childelems) {
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD,
- targetelem->rdn_elem_id, targetelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD,
+ targetid, targetelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -614,8 +618,7 @@ entryrdn_rename_subtree(backend *be,
/* add the new elem */
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%d:%s",
- newelem->rdn_elem_id, newelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%u:%s", id, newelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -633,8 +636,8 @@ entryrdn_rename_subtree(backend *be,
}
if (childelems) {
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD,
- newelem->rdn_elem_id, newelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, id,
+ newelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -656,9 +659,8 @@ entryrdn_rename_subtree(backend *be,
/* 3) update targetelem's parent link, if any */
if (oldsupelem) {
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT,
- targetelem->rdn_elem_id,
- targetelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT,
+ targetid, targetelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -676,9 +678,8 @@ entryrdn_rename_subtree(backend *be,
if (mynewsrdn) {
slapi_ch_free_string(&keybuf);
key.flags = DB_DBT_USERMEM;
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT,
- newelem->rdn_elem_id,
- newelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT,
+ id, newelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
@@ -716,8 +717,9 @@ entryrdn_rename_subtree(backend *be,
for (cep = childelems; cep && *cep; cep++) {
/* remove the old elem */
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT,
- (*cep)->rdn_elem_id, (*cep)->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT,
+ id_stored_to_internal((*cep)->rdn_elem_id),
+ (*cep)->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -750,9 +752,9 @@ entryrdn_rename_subtree(backend *be,
if (oldsupelem) {
/* remove the old elem */
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD,
- oldsupelem->rdn_elem_id,
- oldsupelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD,
+ id_stored_to_internal(oldsupelem->rdn_elem_id),
+ oldsupelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -769,9 +771,9 @@ entryrdn_rename_subtree(backend *be,
/* add the new elem */
if (mynewsupsdn) {
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD,
- newsupelem->rdn_elem_id,
- newsupelem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD,
+ id_stored_to_internal(newsupelem->rdn_elem_id),
+ newsupelem->rdn_elem_nrdn_rdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -924,24 +926,24 @@ entryrdn_get_subordinates(backend *be,
NULL, &childelems, db_txn);
for (cep = childelems; cep && *cep; cep++) {
+ ID childid = id_stored_to_internal((*cep)->rdn_elem_id);
/* set direct children to the idlist */
- rc = idl_append_extend(subordinates, (*cep)->rdn_elem_id);
+ rc = idl_append_extend(subordinates, childid);
if (rc) {
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG,
"entryrdn_get_subordinates: Appending %d to idl "
- "for direct children failed (%d)\n",
- (*cep)->rdn_elem_id, rc);
+ "for direct children failed (%d)\n", childid, rc);
goto bail;
}
/* set indirect subordinates to the idlist */
rc = _entryrdn_append_childidl(cursor, (*cep)->rdn_elem_nrdn_rdn,
- (*cep)->rdn_elem_id, subordinates);
+ childid, subordinates);
if (rc) {
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG,
"entryrdn_get_subordinates: Appending %d to idl "
"for indirect children failed (%d)\n",
- (*cep)->rdn_elem_id, rc);
+ childid, rc);
goto bail;
}
}
@@ -1062,7 +1064,7 @@ entryrdn_lookup_dn(backend *be,
do {
/* Setting up a key for the node to get its parent */
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT, workid, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT, workid, nrdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -1118,7 +1120,7 @@ retry_get1:
#endif
slapi_ch_free_string(&nrdn);
nrdn = slapi_ch_strdup(elem->rdn_elem_nrdn_rdn);
- workid = elem->rdn_elem_id;
+ workid = id_stored_to_internal(elem->rdn_elem_id);
/* 1 is byref, and the dup'ed rdn is freed with srdn */
slapi_rdn_add_rdn_to_all_rdns(srdn, slapi_ch_strdup(RDN_ADDR(elem)), 1);
} while (workid);
@@ -1228,7 +1230,7 @@ entryrdn_get_parent(backend *be,
/* Setting up a key for the node to get its parent */
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT, id, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT, id, nrdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -1269,7 +1271,7 @@ retry_get1:
#ifdef LDAP_DEBUG_ENTRYRDN
_entryrdn_dump_rdn_elem(elem);
#endif
- *pid = elem->rdn_elem_id;
+ *pid = id_stored_to_internal(elem->rdn_elem_id);
*prdn = slapi_ch_strdup(RDN_ADDR(elem));
bail:
slapi_ch_free_string(&nrdn);
@@ -1339,11 +1341,11 @@ _entryrdn_new_rdn_elem(backend *be,
nrdn_len = strlen(nrdn) + 1;
*length = sizeof(rdn_elem) + rdn_len + nrdn_len;
re = (rdn_elem *)slapi_ch_malloc(*length);
- re->rdn_elem_id = id;
- re->rdn_elem_nrdn_len = nrdn_len;
- re->rdn_elem_rdn_len = rdn_len;
- PR_snprintf(re->rdn_elem_nrdn_rdn, re->rdn_elem_nrdn_len, nrdn);
- PR_snprintf(RDN_ADDR(re), re->rdn_elem_rdn_len, rdn);
+ id_internal_to_stored(id, re->rdn_elem_id);
+ sizeushort_internal_to_stored(nrdn_len, re->rdn_elem_nrdn_len);
+ sizeushort_internal_to_stored(rdn_len, re->rdn_elem_rdn_len);
+ PR_snprintf(re->rdn_elem_nrdn_rdn, nrdn_len, nrdn);
+ PR_snprintf(RDN_ADDR(re), rdn_len, rdn);
slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"<-- _entryrdn_new_rdn_elem\n");
@@ -1363,7 +1365,8 @@ static size_t
_entryrdn_rdn_elem_size(rdn_elem *elem)
{
size_t len = sizeof(rdn_elem);
- len += elem->rdn_elem_rdn_len + elem->rdn_elem_nrdn_len;
+ len += sizeushort_stored_to_internal(elem->rdn_elem_rdn_len) +
+ sizeushort_stored_to_internal(elem->rdn_elem_nrdn_len);
return len;
}
@@ -1376,16 +1379,16 @@ _entryrdn_dump_rdn_elem(rdn_elem *elem)
return;
}
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, "RDN ELEMENT:\n");
- slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " ID: %d\n",
- elem->rdn_elem_id);
+ slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " ID: %u\n",
+ id_stored_to_internal(elem->rdn_elem_id));
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " RDN: \"%s\"\n",
- RDN_ADDR(elem));
+ RDN_ADDR(elem));
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " RDN length: %u\n",
- elem->rdn_elem_rdn_len);
+ sizeushort_stored_to_internal(elem->rdn_elem_rdn_len));
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " Normalized RDN: \"%s\"\n",
- elem->rdn_elem_nrdn_rdn);
+ elem->rdn_elem_nrdn_rdn);
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG, " Normalized RDN length: %u\n",
- elem->rdn_elem_nrdn_len);
+ sizeushort_stored_to_internal(elem->rdn_elem_nrdn_len));
return;
}
#endif
@@ -1674,6 +1677,7 @@ _entryrdn_insert_key_elems(backend *be,
char *keybuf = NULL;
size_t len = 0;
int rc = 0;
+ ID myid = 0;
slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"--> _entryrdn_insert_key_elems\n");
@@ -1702,11 +1706,13 @@ _entryrdn_insert_key_elems(backend *be,
goto bail;
}
+ myid = id_stored_to_internal(elem->rdn_elem_id);
+
/* adding RDN to the self key */
slapi_ch_free_string(&keybuf);
/* Generate a key for self rdn */
/* E.g., 222:uid=tuser0 */
- keybuf = slapi_ch_smprintf("%d:%s", elem->rdn_elem_id, elem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%u:%s", myid, elem->rdn_elem_nrdn_rdn);
key->data = keybuf;
key->size = key->ulen = strlen(keybuf) + 1;
key->flags = DB_DBT_USERMEM;
@@ -1720,7 +1726,8 @@ _entryrdn_insert_key_elems(backend *be,
slapi_ch_free_string(&keybuf);
/* Generate a key for parent rdn */
/* E.g., P222:uid=tuser0 */
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_PARENT, elem->rdn_elem_id, elem->rdn_elem_nrdn_rdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_PARENT,
+ myid, elem->rdn_elem_nrdn_rdn);
key->data = keybuf;
key->size = key->ulen = strlen(keybuf) + 1;
key->flags = DB_DBT_USERMEM;
@@ -1857,7 +1864,7 @@ _entryrdn_insert_key(backend *be,
goto bail;
}
/* workid: ID of suffix */
- workid = elem->rdn_elem_id;
+ workid = id_stored_to_internal(elem->rdn_elem_id);
parentelem = elem;
elem = NULL;
@@ -1869,7 +1876,7 @@ _entryrdn_insert_key(backend *be,
&childnrdn, FLAG_ALL_NRDNS);
/* Generate a key for child tree */
/* E.g., C1:dc=example,dc=com */
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD, workid, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, workid, nrdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -1913,7 +1920,7 @@ _entryrdn_insert_key(backend *be,
/* keybuf (C#:<parent_rdn>) is consumed in
_entryrdn_insert_key_elems */
/* set id to the elem to be added */
- elem->rdn_elem_id = id;
+ id_internal_to_stored(id, elem->rdn_elem_id);
rc = _entryrdn_insert_key_elems(be, cursor, srdn, &key,
parentelem, elem, len, db_txn);
keybuf = NULL;
@@ -1937,17 +1944,18 @@ _entryrdn_insert_key(backend *be,
slapi_ch_free((void **)&tmpelem);
goto bail;
} else { /* rc == 0; succeeded to get an element */
+ ID currid = 0;
slapi_ch_free((void **)&elem);
elem = tmpelem;
+ currid = id_stored_to_internal(elem->rdn_elem_id);
if (0 == rdnidx) { /* Child is a Leaf RDN to be added */
- if (elem->rdn_elem_id == id) {
+ if (currid == id) {
/* already in the file */
/* do nothing and return. */
rc = 0;
slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
- "_entryrdn_insert_key: ID %d is "
- "already in the index. NOOP.\n",
- elem->rdn_elem_id);
+ "_entryrdn_insert_key: ID %d is already "
+ "in the index. NOOP.\n", currid);
} else { /* different id, error return */
char *dn = NULL;
int tmprc = slapi_rdn_get_dn(srdn, &dn);
@@ -1957,7 +1965,7 @@ _entryrdn_insert_key(backend *be,
"is already in the %s file with different ID "
"%d. Expected ID is %d.\n",
tmprc?"rdn":"dn", tmprc?childnrdn:dn,
- LDBM_ENTRYRDN_STR, elem->rdn_elem_id, id);
+ LDBM_ENTRYRDN_STR, currid, id);
slapi_ch_free_string(&dn);
/* returning special error code for the upgrade */
rc = LDBM_ERROR_FOUND_DUPDN;
@@ -1965,7 +1973,7 @@ _entryrdn_insert_key(backend *be,
goto bail;
} else { /* if (0 != rdnidx) */
nrdn = childnrdn;
- workid = elem->rdn_elem_id;
+ workid = currid;
slapi_ch_free((void **)&parentelem);
parentelem = elem;
elem = NULL;
@@ -2046,7 +2054,7 @@ _entryrdn_delete_key(backend *be,
}
/* check if the target element has a child or not */
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD, id, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, id, nrdn);
key.data = (void *)keybuf;
key.size = key.ulen = strlen(nrdn) + 1;
key.flags = DB_DBT_USERMEM;
@@ -2082,7 +2090,7 @@ retry_get0:
if (NULL == parentnrdn && NULL == selfnrdn) {
/* First, deleting parent link */
/* E.g., P10:uid=tuser0 */
- keybuf = slapi_ch_smprintf("%c%d:%s",
+ keybuf = slapi_ch_smprintf("%c%u:%s",
RDN_INDEX_PARENT, workid, nrdn);
rc = slapi_rdn_partial_dup(srdn, &tmpsrdn, 1);
if (rc) {
@@ -2106,7 +2114,7 @@ retry_get0:
}
} else if (parentnrdn) {
/* Then, the child link from the parent */
- keybuf = slapi_ch_smprintf("%c%d:%s",
+ keybuf = slapi_ch_smprintf("%c%u:%s",
RDN_INDEX_CHILD, workid, parentnrdn);
elem = _entryrdn_new_rdn_elem(be, id, srdn, &len);
if (NULL == elem) {
@@ -2123,7 +2131,7 @@ retry_get0:
if (issuffix) {
keybuf = slapi_ch_smprintf("%s", selfnrdn);
} else {
- keybuf = slapi_ch_smprintf("%d:%s", workid, selfnrdn);
+ keybuf = slapi_ch_smprintf("%u:%s", workid, selfnrdn);
}
elem = _entryrdn_new_rdn_elem(be, id, srdn, &len);
if (NULL == elem) {
@@ -2170,7 +2178,7 @@ retry_get0:
_entryrdn_dump_rdn_elem(elem);
#endif
parentnrdn = slapi_ch_strdup(elem->rdn_elem_nrdn_rdn);
- workid = elem->rdn_elem_id;
+ workid = id_stored_to_internal(elem->rdn_elem_id);
/* deleteing the parent link */
/* the cursor is set at the parent link by _entryrdn_get_elem */
@@ -2318,7 +2326,7 @@ _entryrdn_index_read(backend *be,
goto bail;
}
/* workid: ID of suffix */
- id = (*elem)->rdn_elem_id;
+ id = id_stored_to_internal((*elem)->rdn_elem_id);
do {
slapi_ch_free_string(&keybuf);
@@ -2374,7 +2382,7 @@ _entryrdn_index_read(backend *be,
/* Generate a key for child tree */
/* E.g., C1:dc=example,dc=com */
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD, id, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, id, nrdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -2410,7 +2418,7 @@ _entryrdn_index_read(backend *be,
"_entryrdn_index_read: %s matched normalized child "
"rdn %s\n", (*elem)->rdn_elem_nrdn_rdn, childnrdn);
#endif
- id = (*elem)->rdn_elem_id;
+ id = id_stored_to_internal((*elem)->rdn_elem_id);
nrdn = childnrdn;
if (0 == id) {
@@ -2426,7 +2434,7 @@ _entryrdn_index_read(backend *be,
static char buffer[RDN_BULK_FETCH_BUFFER_SIZE];
slapi_ch_free_string(&keybuf);
- keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD, id, nrdn);
+ keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, id, nrdn);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
key.flags = DB_DBT_USERMEM;
@@ -2510,7 +2518,7 @@ _entryrdn_append_childidl(DBC *cursor,
IDList **affectedidl)
{
/* E.g., C5:ou=accounting */
- char *keybuf = slapi_ch_smprintf("%c%d:%s", RDN_INDEX_CHILD, id, nrdn);
+ char *keybuf = slapi_ch_smprintf("%c%u:%s", RDN_INDEX_CHILD, id, nrdn);
DBT key, data;
static char buffer[RDN_BULK_FETCH_BUFFER_SIZE];
int rc = 0;
@@ -2549,6 +2557,7 @@ retry_get0:
void *ptr;
DB_MULTIPLE_INIT(ptr, &data);
do {
+ ID myid = 0;
myelem = NULL;
memset(&dataret, 0, sizeof(dataret));
DB_MULTIPLE_NEXT(ptr, &data, dataret.data, dataret.size);
@@ -2556,16 +2565,17 @@ retry_get0:
break;
}
myelem = (rdn_elem *)dataret.data;
- rc = idl_append_extend(affectedidl, myelem->rdn_elem_id);
+ myid = id_stored_to_internal(myelem->rdn_elem_id);
+ rc = idl_append_extend(affectedidl, myid);
if (rc) {
slapi_log_error(SLAPI_LOG_FATAL, ENTRYRDN_TAG,
"_entryrdn_append_childidl: Appending %d to "
- "affectedidl failed (%d)\n", myelem->rdn_elem_id, rc);
+ "affectedidl failed (%d)\n", myid, rc);
goto bail;
}
rc = _entryrdn_append_childidl(cursor,
(const char *)myelem->rdn_elem_nrdn_rdn,
- myelem->rdn_elem_id, affectedidl);
+ myid, affectedidl);
if (rc) {
goto bail;
}
diff --git a/ldap/servers/slapd/back-ldbm/nextid.c b/ldap/servers/slapd/back-ldbm/nextid.c
index 02d381b6c..bc9ec3eab 100644
--- a/ldap/servers/slapd/back-ldbm/nextid.c
+++ b/ldap/servers/slapd/back-ldbm/nextid.c
@@ -232,3 +232,18 @@ ID id_stored_to_internal(char* b)
i |= ((ID)b[0]) << 24;
return i;
}
+
+void sizeushort_internal_to_stored(size_t i,char *b)
+{
+ PRUint16 ui = (PRUint16)(i & 0xffff);
+ b[0] = (char)(ui >> 8);
+ b[1] = (char)ui;
+}
+
+size_t sizeushort_stored_to_internal(char* b)
+{
+ size_t i;
+ i = (PRUint16)b[1] & 0x000000ff;
+ i |= (((PRUint16)b[0]) << 8) & 0x0000ff00;
+ return i;
+}
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 5b7768471..90ac5700b 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -374,9 +374,8 @@ void next_id_return( backend *be, ID id );
ID next_id_get( backend *be );
void id_internal_to_stored(ID,char*);
ID id_stored_to_internal(char*);
-#if 0
-int write_dbversion( ldbm_instance *inst );
-#endif
+void sizeushort_internal_to_stored(size_t i,char *b);
+size_t sizeushort_stored_to_internal(char* b);
void get_ids_from_disk(backend *be);
void get_both_ids( struct ldbminfo *li, ID *nextid, ID *nextid2index );
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index 320f5eda8..69c693fc3 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -128,13 +128,16 @@ typedef struct {
#define RDN_BULK_FETCH_BUFFER_SIZE (8*1024)
typedef struct _rdn_elem {
- PRUint32 rdn_elem_id;
- PRUint16 rdn_elem_nrdn_len; /* including '\0' */
- PRUint16 rdn_elem_rdn_len; /* including '\0' */
- char rdn_elem_nrdn_rdn[1]; /* "normalized rdn" '\0' "rdn" '\0' */
+ char rdn_elem_id[sizeof(ID)];
+ char rdn_elem_nrdn_len[2]; /* ushort; length including '\0' */
+ char rdn_elem_rdn_len[2]; /* ushort; length including '\0' */
+ char rdn_elem_nrdn_rdn[1]; /* "normalized rdn" '\0' "rdn" '\0' */
} rdn_elem;
-#define RDN_ADDR(elem) ((elem)->rdn_elem_nrdn_rdn + (elem)->rdn_elem_nrdn_len)
+
+#define RDN_ADDR(elem) \
+ ((elem)->rdn_elem_nrdn_rdn + \
+ sizeushort_stored_to_internal((elem)->rdn_elem_nrdn_len))
static void display_entryrdn_parent(DB *db, ID id, const char *nrdn, int indent);
static void display_entryrdn_self(DB *db, ID id, const char *nrdn, int indent);
@@ -443,6 +446,14 @@ static void id_internal_to_stored(ID i,char *b)
b[3] = (char)i;
}
+static size_t sizeushort_stored_to_internal(char* b)
+{
+ size_t i;
+ i = (PRUint16)b[1] & 0x000000ff;
+ i |= (((PRUint16)b[0]) << 8) & 0x0000ff00;
+ return i;
+}
+
void _cl5ReadMod(char **buff)
{
char *pos = *buff;
@@ -745,7 +756,7 @@ static void display_item(DBC *cursor, DBT *key, DBT *data)
} else if (file_type & ENTRYTYPE) {
/* id2entry file */
ID entry_id = id_stored_to_internal(key->data);
- printf("id %d\n", entry_id);
+ printf("id %u\n", entry_id);
printf("\t%s\n", format_entry(data->data, data->size, buf, buflen));
} else {
/* user didn't tell us what kind of file, dump it raw */
@@ -765,8 +776,9 @@ _entryrdn_dump_rdn_elem(char *key, rdn_elem *elem, int indent)
for (p = indentp; p < endp; p++) *p = ' ';
*p = '\0';
printf("%s\n", key);
- printf("%sID: %d; RDN: \"%s\"; NRDN: \"%s\"\n",
- indentp, elem->rdn_elem_id, RDN_ADDR(elem), elem->rdn_elem_nrdn_rdn);
+ printf("%sID: %u; RDN: \"%s\"; NRDN: \"%s\"\n",
+ indentp, id_stored_to_internal(elem->rdn_elem_id),
+ RDN_ADDR(elem), elem->rdn_elem_nrdn_rdn);
free(indentp);
}
@@ -785,7 +797,7 @@ display_entryrdn_self(DB *db, ID id, const char *nrdn, int indent)
printf("Can't create db cursor: %s\n", db_strerror(rc));
exit(1);
}
- snprintf(buffer, sizeof(buffer), "%d:%s", id, nrdn);
+ snprintf(buffer, sizeof(buffer), "%u:%s", id, nrdn);
keybuf = strdup(buffer);
key.data = keybuf;
key.size = key.ulen = strlen(keybuf) + 1;
@@ -803,9 +815,9 @@ display_entryrdn_self(DB *db, ID id, const char *nrdn, int indent)
elem = (rdn_elem *)data.data;
_entryrdn_dump_rdn_elem(keybuf, elem, indent);
- display_entryrdn_parent(db, elem->rdn_elem_id,
+ display_entryrdn_parent(db, id_stored_to_internal(elem->rdn_elem_id),
elem->rdn_elem_nrdn_rdn, indent);
- display_entryrdn_children(db, elem->rdn_elem_id,
+ display_entryrdn_children(db, id_stored_to_internal(elem->rdn_elem_id),
elem->rdn_elem_nrdn_rdn, indent);
bail:
if (keybuf) {
@@ -903,7 +915,7 @@ display_entryrdn_children(DB *db, ID id, const char *nrdn, int indent)
for (;;) {
elem = (rdn_elem *)data.data;
_entryrdn_dump_rdn_elem(keybuf, elem, indent);
- display_entryrdn_self(db, elem->rdn_elem_id,
+ display_entryrdn_self(db, id_stored_to_internal(elem->rdn_elem_id),
elem->rdn_elem_nrdn_rdn, indent);
rc = cursor->c_get(cursor, &key, &data, DB_NEXT_DUP);
if (rc) {
@@ -950,9 +962,8 @@ display_entryrdn_item(DB *db, DBC *cursor, DBT *key)
elem = (rdn_elem *)data.data;
_entryrdn_dump_rdn_elem((char *)key->data, elem, indent);
- display_entryrdn_children(db, elem->rdn_elem_id,
- elem->rdn_elem_nrdn_rdn,
- indent);
+ display_entryrdn_children(db, id_stored_to_internal(elem->rdn_elem_id),
+ elem->rdn_elem_nrdn_rdn, indent);
} else { /* otherwise, display all from the HEAD to TAIL */
char buffer[RDN_BULK_FETCH_BUFFER_SIZE];
DBT dataret;
| 0 |
ad01ce06fd32da96a90b47659c09393e22d5def8
|
389ds/389-ds-base
|
166012 - Use of incorrect iterator in indexing code was causing illegal access of memory which sometimes resulted in crashing.
|
commit ad01ce06fd32da96a90b47659c09393e22d5def8
Author: Nathan Kinder <[email protected]>
Date: Mon Aug 15 20:59:27 2005 +0000
166012 - Use of incorrect iterator in indexing code was causing illegal access of memory which sometimes resulted in crashing.
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index b56370322..750c10416 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -639,8 +639,12 @@ index_add_mods(
* removed.
*/
slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr);
- if ( valuearray_find(curr_attr, evals, mods_valueArray[i]) == -1 ) {
- flags |= BE_INDEX_EQUALITY;
+ for (j = 0; mods_valueArray[j] != NULL; j++ ) {
+ if ( valuearray_find(curr_attr, evals, mods_valueArray[j]) == -1 ) {
+ if (!(flags & BE_INDEX_EQUALITY)) {
+ flags |= BE_INDEX_EQUALITY;
+ }
+ }
}
rc = index_addordel_values_sv( be, basetype,
| 0 |
a09c2cb8bf50719740d3c0bdaeed6bd813abfd50
|
389ds/389-ds-base
|
Resolves: bug 400421
Bug Description: unable to restart configDS via console
Reviewed by: nhosoi (Thanks!)
Fix Description: We were using the old format for the ldapStart directive, which assumed everything was under a serverroot, so it just stored the relative path. We need the absolute path. During regular setup, we can get this from the directory server instance. During migration, we need to update the ldapStart directive to use the absolute path, so we need to get that information from the directory server code.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
|
commit a09c2cb8bf50719740d3c0bdaeed6bd813abfd50
Author: Rich Megginson <[email protected]>
Date: Fri Dec 7 00:08:25 2007 +0000
Resolves: bug 400421
Bug Description: unable to restart configDS via console
Reviewed by: nhosoi (Thanks!)
Fix Description: We were using the old format for the ldapStart directive, which assumed everything was under a serverroot, so it just stored the relative path. We need the absolute path. During regular setup, we can get this from the directory server instance. During migration, we need to update the ldapStart directive to use the absolute path, so we need to get that information from the directory server code.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index e500bd26a..e5c76582b 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -895,6 +895,16 @@ sub migrateDS {
my $mig = shift;
my @errs;
+ # migration needs to know the instance directory for the directory
+ # servers - this assumes they are all in the same place
+ if (!$mig->{ServerRoot}) {
+ if ("@with_fhs_opt@") {
+ $mig->{ServerRoot} = "$inf->{General}->{prefix}/opt/@PACKAGE_NAME@";
+ } else {
+ $mig->{ServerRoot} = "$inf->{General}->{prefix}@serverdir@";
+ }
+ }
+
# for each instance
foreach my $inst (@{$mig->{instances}}) {
if (-f "$mig->{configdir}/$inst/dse.ldif") {
diff --git a/ldap/admin/src/scripts/Util.pm.in b/ldap/admin/src/scripts/Util.pm.in
index 7b2e1a5c1..9a2cfd235 100644
--- a/ldap/admin/src/scripts/Util.pm.in
+++ b/ldap/admin/src/scripts/Util.pm.in
@@ -829,8 +829,20 @@ sub createInfFromConfig {
last if ($ent->hasValue('cn', 'userRoot', 1));
$ent = $conn->nextEntry();
}
+
+ # we also need the instance dir
+ $ent = $conn->search("cn=config", "base", "(objectclass=*)");
+ if (!$ent) {
+ push @{$errs}, "error_opening_dseldif", $fname, $!;
+ close $outfh;
+ $conn->close();
+ return 0;
+ }
+ my $inst_dir = $ent->getValue('nsslapd-instancedir');
+
$conn->close();
+ print $outfh, "inst_dir = $inst_dir\n";
print $outfh "Suffix = $suffix\n";
close $outfh;
| 0 |
fc0036e2d35e189c2a34f4722fbebda548cf94b9
|
389ds/389-ds-base
|
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and opid are
used in the accesslog.
Also, NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
modified: acl_access_allowed & print_access_control_summary in acl.c
slapi-plugin.h
|
commit fc0036e2d35e189c2a34f4722fbebda548cf94b9
Author: Noriko Hosoi <[email protected]>
Date: Fri Feb 27 15:02:42 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13075 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for op. If NULL, default connid and opid are
used in the accesslog.
Also, NSPRIu64 and NSPRI64 is defined based upon the architecture and compiler.
modified: acl_access_allowed & print_access_control_summary in acl.c
slapi-plugin.h
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index f04e25816..cd307d9f9 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -257,12 +257,17 @@ acl_access_allowed(
Slapi_Operation *op = NULL;
aclResultReason_t decision_reason;
int loglevel;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
slapi_pblock_get(pb, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
- TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","",
- tnf_int,access,access);
+ TNF_PROBE_1_DEBUG(acl_access_allowed_start,"ACL","", tnf_int,access,access);
decision_reason.deciding_aci = NULL;
decision_reason.reason = ACL_REASON_NONE;
@@ -301,8 +306,8 @@ acl_access_allowed(
if ( !privateBackend && (be_readonly || slapi_config_get_readonly () )){
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Deny %s on entry(%s)"
- ": readonly backend\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": readonly backend\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return LDAP_UNWILLING_TO_PERFORM;
@@ -314,8 +319,8 @@ acl_access_allowed(
if ( acl_skip_access_check ( pb, e )) {
slapi_log_error (loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (main): Allow %s on entry(%s)"
- ": root user\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ ": root user\n",
+ o_connid, o_opid,
acl_access2str(access),
n_edn);
return(LDAP_SUCCESS);
@@ -466,7 +471,7 @@ acl_access_allowed(
slapi_log_error(loglevel, plugin_name,
"#### conn=%" NSPRIu64 " op=%d binddn=\"%s\"\n",
- (long long unsigned int)op->o_connid, op->o_opid, clientDn);
+ o_connid, o_opid, clientDn);
aclpb->aclpb_stat_total_entries++;
if (!(access & SLAPI_ACL_PROXY) &&
@@ -711,6 +716,8 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
Slapi_Operation *op = NULL;
int loglevel;
int i;
+ PRUint64 o_connid = 0xffffffffffffffff; /* no op */
+ int o_opid = -1; /* no op */
loglevel = slapi_is_loglevel_set(SLAPI_LOG_ACL) ? SLAPI_LOG_ACL : SLAPI_LOG_ACLSUMMARY;
@@ -724,6 +731,10 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
}
slapi_pblock_get(aclpb->aclpb_pblock, SLAPI_OPERATION, &op); /* for logging */
+ if (op) {
+ o_connid = op->o_connid;
+ o_opid = op->o_opid;
+ }
if (ret_val == LDAP_INSUFFICIENT_ACCESS) {
access_status = access_not_allowed_string;
@@ -789,7 +800,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -803,7 +814,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -818,7 +829,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -832,7 +843,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -847,7 +858,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
@@ -861,7 +872,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
slapi_log_error(loglevel, plugin_name,
"conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
": %s\n",
- (long long unsigned int)op->o_connid, op->o_opid,
+ o_connid, o_opid,
source,
access_status,
right,
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index bc68157c6..3a1203a50 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -89,8 +89,13 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
/* NSPR uses the print macros a bit differently than ANSI C. We
* need to use ll for a 64-bit integer, even when a long is 64-bit.
*/
+#if defined(HAVE_LONG_LONG) && PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
+#define NSPRIu64 "lu"
+#define NSPRI64 "l"
+#else /* just assume long long is used */
#define NSPRIu64 "llu"
#define NSPRI64 "ll"
+#endif
/* OpenLDAP uses unsigned long for ber_tag_t and ber_len_t but mozldap uses unsigned int */
/* use this macro for printf statements for ber_tag_t and ber_len_t */
| 0 |
636c89b575d290dd3d3d7ee9df20d2da204b2784
|
389ds/389-ds-base
|
Ticket 48846 - 32 bit systems set low vmsize
Bug Description: 32 bit systems set vmsize low, and it grows. We should use
*not* use this for page available checks as it causes some errors.
Fix Description: Only uses pages from meminfo on a 32bit platform rather than
vmsize.
https://fedorahosted.org/389/ticket/48846
Author: wibrown
Review by: nhosoi (Thanks!)
|
commit 636c89b575d290dd3d3d7ee9df20d2da204b2784
Author: William Brown <[email protected]>
Date: Sun May 22 14:19:03 2016 +1000
Ticket 48846 - 32 bit systems set low vmsize
Bug Description: 32 bit systems set vmsize low, and it grows. We should use
*not* use this for page available checks as it causes some errors.
Fix Description: Only uses pages from meminfo on a 32bit platform rather than
vmsize.
https://fedorahosted.org/389/ticket/48846
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 070a7dbfe..89c7579a8 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1650,12 +1650,20 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
*/
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, vmsize=%lu, \n",
(unsigned long) *pages, (unsigned long) vmsize,0);
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+ /* On 64bit platforms, vmsize is set high (VmSize), and doesn't change. IE 17tb */
if (vmsize < *pages) {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using vmsize for pages \n",0,0,0);
*pages = vmsize;
} else {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
}
+#else
+ /* On 32bit platforms, vmsize is set low (VmSize) and grows. */
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
+#endif
+#endif
/* Availpages is how much we *could* alloc. We should take the smallest:
* - pages
| 0 |
bc789a909c0022dd5228f0c3f15039b7274aa508
|
389ds/389-ds-base
|
Issue 51076 - prevent unnecessarily duplication of the target entry
Bug Description: For any update operation the MEP plugin was calling
slapi_search_internal_get_entry() which duplicates
the entry it returns. In this case the entry is just
read from and discarded, but this entry is already
in the pblock (the PRE OP ENTRY).
Fix Description: Just grab the PRE OP ENTRY from the pblock and use
that to read the attribute values from. This saves
two entry duplications for every update operation
from MEP.
fixes: https://pagure.io/389-ds-base/issue/51076
Reviewed by: tbordaz & firstyear(Thanks!!)
|
commit bc789a909c0022dd5228f0c3f15039b7274aa508
Author: Mark Reynolds <[email protected]>
Date: Fri May 8 10:52:43 2020 -0400
Issue 51076 - prevent unnecessarily duplication of the target entry
Bug Description: For any update operation the MEP plugin was calling
slapi_search_internal_get_entry() which duplicates
the entry it returns. In this case the entry is just
read from and discarded, but this entry is already
in the pblock (the PRE OP ENTRY).
Fix Description: Just grab the PRE OP ENTRY from the pblock and use
that to read the attribute values from. This saves
two entry duplications for every update operation
from MEP.
fixes: https://pagure.io/389-ds-base/issue/51076
Reviewed by: tbordaz & firstyear(Thanks!!)
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index ca9a64b3b..401d95e3a 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -2165,9 +2165,8 @@ mep_pre_op(Slapi_PBlock *pb, int modop)
if (e && free_entry) {
slapi_entry_free(e);
}
-
- slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id());
- free_entry = 1;
+ slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &e);
+ free_entry = 0;
}
if (e && mep_is_managed_entry(e)) {
| 0 |
0b932d4b926d46ac5060f02617330dc444e06da1
|
389ds/389-ds-base
|
Bug 1347760 - CVE-2016-4992 389-ds-base: Information disclosure via repeated use of LDAP ADD operation, etc.
Description: If a bind user has no rights, it should not disclose
any information including the existence of the entry.
Fix description:
1) ALREADY_EXISTS in add -- If to be added entry is found existing
in ldbm_back_add, it checks the ACI and if there is no rights,
it returns INSUFFICIENT_ACCESS instead of ALREADY_EXISTS.
2) NO_SUCH_OBJECT in other update operations -- If the target entry
is found not existing, it checks the ancestor entry's access
rights in find_entry. If it is not allowed to access the subtree,
it returns INSUFFICIENT_ACCESS instead of NO_SUC_OBJECT. Plus,
it supresses the "Matched" ancestor message.
3) NO_SUCH_OBJECT in search -- If a bind entry has no rights to read
a subtree, it returns no search results with SUCCESS. It should
be applied to the no existing subtree if the bind entry has no
rights to the super tree.
4) If bind fails because of the non-existence of the bind user or
the parent nodes, the bind returns LDAP_INVALID_CREDENTIALS to
the client with no other information.
The detailed cause is logged in the access log as follows:
RESULT err=49 .. etime=0 - No such suffix (<given suffix>)
RESULT err=49 .. etime=0 - Invalid credentials
RESULT err=49 .. etime=0 - No such entry
https://bugzilla.redhat.com/show_bug.cgi?id=1347760
Reviewed by [email protected], [email protected], and [email protected].
Thank you!!!
|
commit 0b932d4b926d46ac5060f02617330dc444e06da1
Author: Noriko Hosoi <[email protected]>
Date: Wed Jul 13 14:49:18 2016 -0700
Bug 1347760 - CVE-2016-4992 389-ds-base: Information disclosure via repeated use of LDAP ADD operation, etc.
Description: If a bind user has no rights, it should not disclose
any information including the existence of the entry.
Fix description:
1) ALREADY_EXISTS in add -- If to be added entry is found existing
in ldbm_back_add, it checks the ACI and if there is no rights,
it returns INSUFFICIENT_ACCESS instead of ALREADY_EXISTS.
2) NO_SUCH_OBJECT in other update operations -- If the target entry
is found not existing, it checks the ancestor entry's access
rights in find_entry. If it is not allowed to access the subtree,
it returns INSUFFICIENT_ACCESS instead of NO_SUC_OBJECT. Plus,
it supresses the "Matched" ancestor message.
3) NO_SUCH_OBJECT in search -- If a bind entry has no rights to read
a subtree, it returns no search results with SUCCESS. It should
be applied to the no existing subtree if the bind entry has no
rights to the super tree.
4) If bind fails because of the non-existence of the bind user or
the parent nodes, the bind returns LDAP_INVALID_CREDENTIALS to
the client with no other information.
The detailed cause is logged in the access log as follows:
RESULT err=49 .. etime=0 - No such suffix (<given suffix>)
RESULT err=49 .. etime=0 - Invalid credentials
RESULT err=49 .. etime=0 - No such entry
https://bugzilla.redhat.com/show_bug.cgi?id=1347760
Reviewed by [email protected], [email protected], and [email protected].
Thank you!!!
diff --git a/ldap/servers/slapd/back-ldbm/dn2entry.c b/ldap/servers/slapd/back-ldbm/dn2entry.c
index 6d1d92ff4..76566882e 100644
--- a/ldap/servers/slapd/back-ldbm/dn2entry.c
+++ b/ldap/servers/slapd/back-ldbm/dn2entry.c
@@ -151,14 +151,15 @@ struct backentry *
dn2ancestor(
Slapi_Backend *be,
const Slapi_DN *sdn,
- Slapi_DN *ancestordn,
+ Slapi_DN *ancestordn,
back_txn *txn,
- int *err
+ int *err,
+ int allow_suffix
)
{
- struct backentry *e = NULL;
+ struct backentry *e = NULL;
- LDAPDebug( LDAP_DEBUG_TRACE, "=> dn2ancestor \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
+ LDAPDebug( LDAP_DEBUG_TRACE, "=> dn2ancestor \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
/* first, check to see if the given sdn is empty or a root suffix of the
given backend - if so, it has no parent */
@@ -190,7 +191,13 @@ dn2ancestor(
*/
/* stop when we get to "", or a backend suffix point */
- while (!e && !slapi_sdn_isempty(&ancestorndn) && !slapi_be_issuffix( be, &ancestorndn )) {
+ while (!e && !slapi_sdn_isempty(&ancestorndn)) {
+ if (!allow_suffix) {
+ /* Original behavior. */
+ if (slapi_be_issuffix(be, &ancestorndn)) {
+ break;
+ }
+ }
/* find the entry - it uses the ndn, so no further conversion is necessary */
e= dn2entry(be,&ancestorndn,txn,err);
if (!e) {
diff --git a/ldap/servers/slapd/back-ldbm/findentry.c b/ldap/servers/slapd/back-ldbm/findentry.c
index 4a574bf89..8b842e3e3 100644
--- a/ldap/servers/slapd/back-ldbm/findentry.c
+++ b/ldap/servers/slapd/back-ldbm/findentry.c
@@ -16,8 +16,8 @@
#include "back-ldbm.h"
-static struct backentry *find_entry_internal_dn(Slapi_PBlock *pb, backend *be, const Slapi_DN *sdn, int lock, back_txn *txn, int flags);
-static struct backentry * find_entry_internal(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, int lock, back_txn *txn, int flags);
+static struct backentry *find_entry_internal_dn(Slapi_PBlock *pb, backend *be, const Slapi_DN *sdn, int lock, back_txn *txn, int flags, int *rc);
+static struct backentry * find_entry_internal(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, int lock, back_txn *txn, int flags, int *rc);
/* The flags take these values */
#define FE_TOMBSTONE_INCLUDED TOMBSTONE_INCLUDED /* :1 defined in back-ldbm.h */
#define FE_REALLY_INTERNAL 0x2
@@ -27,7 +27,7 @@ check_entry_for_referral(Slapi_PBlock *pb, Slapi_Entry *entry, char *matched, co
{
int rc=0, i=0, numValues=0;
Slapi_Attr *attr;
- Slapi_Value *val=NULL;
+ Slapi_Value *val=NULL;
struct berval **refscopy=NULL;
struct berval **url=NULL;
@@ -80,12 +80,13 @@ out:
static struct backentry *
find_entry_internal_dn(
- Slapi_PBlock *pb,
+ Slapi_PBlock *pb,
backend *be,
const Slapi_DN *sdn,
int lock,
- back_txn *txn,
- int flags
+ back_txn *txn,
+ int flags,
+ int *rc /* return code */
)
{
struct backentry *e;
@@ -93,9 +94,14 @@ find_entry_internal_dn(
int err;
ldbm_instance *inst = (ldbm_instance *) be->be_instance_info;
size_t tries = 0;
+ int isroot = 0;
+ int op_type;
+ char *errbuf = NULL;
/* get the managedsait ldap message control */
- slapi_pblock_get( pb, SLAPI_MANAGEDSAIT, &managedsait );
+ slapi_pblock_get(pb, SLAPI_MANAGEDSAIT, &managedsait);
+ slapi_pblock_get(pb, SLAPI_REQUESTOR_ISROOT, &isroot);
+ slapi_pblock_get(pb, SLAPI_OPERATION_TYPE, &op_type);
while ( (tries < LDBM_CACHE_RETRY_COUNT) &&
(e = dn2entry_ext( be, sdn, txn, flags & TOMBSTONE_INCLUDED, &err ))
@@ -113,6 +119,9 @@ find_entry_internal_dn(
if(check_entry_for_referral(pb, e->ep_entry, NULL, "find_entry_internal_dn"))
{
CACHE_RETURN( &inst->inst_cache, &e );
+ if (rc) { /* if check_entry_for_referral returns non-zero, result is sent. */
+ *rc = FE_RC_SENT_RESULT;
+ }
return( NULL );
}
}
@@ -151,27 +160,89 @@ find_entry_internal_dn(
struct backentry *me;
Slapi_DN ancestorsdn;
slapi_sdn_init(&ancestorsdn);
- me= dn2ancestor(pb->pb_backend,sdn,&ancestorsdn,txn,&err);
+ me = dn2ancestor(pb->pb_backend, sdn, &ancestorsdn, txn, &err, 1 /* allow_suffix */);
if ( !managedsait && me != NULL ) {
/* if the entry is a referral send the referral */
if(check_entry_for_referral(pb, me->ep_entry, (char*)slapi_sdn_get_dn(&ancestorsdn), "find_entry_internal_dn"))
{
CACHE_RETURN( &inst->inst_cache, &me );
slapi_sdn_done(&ancestorsdn);
+ if (rc) { /* if check_entry_for_referral returns non-zero, result is sent. */
+ *rc = FE_RC_SENT_RESULT;
+ }
return( NULL );
}
/* else fall through to no such object */
}
/* entry not found */
- slapi_send_ldap_result( pb, ( 0 == err || DB_NOTFOUND == err ) ?
- LDAP_NO_SUCH_OBJECT : ( LDAP_INVALID_DN_SYNTAX == err ) ?
- LDAP_INVALID_DN_SYNTAX : LDAP_OPERATIONS_ERROR,
- (char*)slapi_sdn_get_dn(&ancestorsdn), NULL, 0, NULL );
+ if ((0 == err) || (DB_NOTFOUND == err)) {
+ if (me && !isroot) {
+ /* If not root, you may not want to reveal it. */
+ int acl_type = -1;
+ int return_err = LDAP_NO_SUCH_OBJECT;
+ err = LDAP_SUCCESS;
+ switch (op_type) {
+ case SLAPI_OPERATION_ADD:
+ acl_type = SLAPI_ACL_ADD;
+ return_err = LDAP_INSUFFICIENT_ACCESS;
+ break;
+ case SLAPI_OPERATION_DELETE:
+ acl_type = SLAPI_ACL_DELETE;
+ return_err = LDAP_INSUFFICIENT_ACCESS;
+ break;
+ case SLAPI_OPERATION_MODDN:
+ acl_type = SLAPI_ACL_MODDN;
+ return_err = LDAP_INSUFFICIENT_ACCESS;
+ break;
+ case SLAPI_OPERATION_MODIFY:
+ acl_type = SLAPI_ACL_WRITE;
+ return_err = LDAP_INSUFFICIENT_ACCESS;
+ break;
+ case SLAPI_OPERATION_SEARCH:
+ case SLAPI_OPERATION_COMPARE:
+ return_err = LDAP_SUCCESS;
+ acl_type = SLAPI_ACL_READ;
+ break;
+ case SLAPI_OPERATION_BIND:
+ acl_type = -1; /* skip acl check. acl is not set up for bind. */
+ return_err = LDAP_INVALID_CREDENTIALS;
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "No such entry");
+ break;
+ }
+ if (acl_type > 0) {
+ err = plugin_call_acl_plugin(pb, me->ep_entry, NULL, NULL, acl_type,
+ ACLPLUGIN_ACCESS_DEFAULT, &errbuf);
+ }
+ if (((acl_type > 0) && err) || (op_type == SLAPI_OPERATION_BIND)) {
+ /*
+ * Operations to be checked && ACL returns disallow.
+ * Not to disclose the info about the entry's existence,
+ * do not return the "matched" DN.
+ * Plus, the bind case returns LDAP_INAPPROPRIATE_AUTH.
+ */
+ slapi_send_ldap_result(pb, return_err, NULL, NULL, 0, NULL);
+ } else {
+ slapi_send_ldap_result(pb, LDAP_NO_SUCH_OBJECT,
+ (char*)slapi_sdn_get_dn(&ancestorsdn), NULL, 0, NULL);
+ }
+ } else {
+ slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT,
+ (char*)slapi_sdn_get_dn(&ancestorsdn), NULL, 0, NULL);
+ }
+ } else {
+ slapi_send_ldap_result( pb, ( LDAP_INVALID_DN_SYNTAX == err ) ?
+ LDAP_INVALID_DN_SYNTAX : LDAP_OPERATIONS_ERROR,
+ (char*)slapi_sdn_get_dn(&ancestorsdn), NULL, 0, NULL );
+ }
+ if (rc) {
+ *rc = FE_RC_SENT_RESULT;
+ }
slapi_sdn_done(&ancestorsdn);
CACHE_RETURN( &inst->inst_cache, &me );
}
+ slapi_ch_free_string(&errbuf);
LDAPDebug( LDAP_DEBUG_TRACE, "<= find_entry_internal_dn not found (%s)\n",
slapi_sdn_get_dn(sdn), 0, 0 );
return( NULL );
@@ -183,11 +254,11 @@ find_entry_internal_dn(
*/
static struct backentry *
find_entry_internal_uniqueid(
- Slapi_PBlock *pb,
+ Slapi_PBlock *pb,
backend *be,
- const char *uniqueid,
+ const char *uniqueid,
int lock,
- back_txn *txn
+ back_txn *txn
)
{
ldbm_instance *inst = (ldbm_instance *) be->be_instance_info;
@@ -243,8 +314,9 @@ find_entry_internal(
Slapi_Backend *be,
const entry_address *addr,
int lock,
- back_txn *txn,
- int flags
+ back_txn *txn,
+ int flags,
+ int *rc
)
{
/* check if we should search based on uniqueid or dn */
@@ -261,11 +333,9 @@ find_entry_internal(
LDAPDebug( LDAP_DEBUG_TRACE, "=> find_entry_internal (dn=%s) lock %d\n",
slapi_sdn_get_dn(addr->sdn), lock, 0 );
if (addr->sdn) {
- entry = find_entry_internal_dn (pb, be, addr->sdn,
- lock, txn, flags);
+ entry = find_entry_internal_dn (pb, be, addr->sdn, lock, txn, flags, rc);
} else {
- LDAPDebug0Args( LDAP_DEBUG_ANY,
- "find_entry_internal: Null target dn\n" );
+ LDAPDebug0Args( LDAP_DEBUG_ANY, "find_entry_internal: Null target dn\n" );
}
LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= find_entry_internal\n" );
@@ -278,10 +348,11 @@ find_entry(
Slapi_PBlock *pb,
Slapi_Backend *be,
const entry_address *addr,
- back_txn *txn
+ back_txn *txn,
+ int *rc
)
{
- return( find_entry_internal( pb, be, addr, 0/*!lock*/, txn, 0/*flags*/ ) );
+ return(find_entry_internal(pb, be, addr, 0/*!lock*/, txn, 0/*flags*/, rc));
}
struct backentry *
@@ -289,10 +360,11 @@ find_entry2modify(
Slapi_PBlock *pb,
Slapi_Backend *be,
const entry_address *addr,
- back_txn *txn
+ back_txn *txn,
+ int *rc
)
{
- return( find_entry_internal( pb, be, addr, 1/*lock*/, txn, 0/*flags*/ ) );
+ return(find_entry_internal(pb, be, addr, 1/*lock*/, txn, 0/*flags*/, rc));
}
/* New routines which do not do any referral stuff.
@@ -304,10 +376,11 @@ find_entry_only(
Slapi_PBlock *pb,
Slapi_Backend *be,
const entry_address *addr,
- back_txn *txn
+ back_txn *txn,
+ int *rc
)
{
- return( find_entry_internal( pb, be, addr, 0/*!lock*/, txn, FE_REALLY_INTERNAL ) );
+ return(find_entry_internal(pb, be, addr, 0/*!lock*/, txn, FE_REALLY_INTERNAL, rc));
}
struct backentry *
@@ -315,10 +388,11 @@ find_entry2modify_only(
Slapi_PBlock *pb,
Slapi_Backend *be,
const entry_address *addr,
- back_txn *txn
+ back_txn *txn,
+ int *rc
)
{
- return( find_entry_internal( pb, be, addr, 1/*lock*/, txn, FE_REALLY_INTERNAL ) );
+ return(find_entry_internal(pb, be, addr, 1/*lock*/, txn, 0 /* to check aci, disable INTERNAL */, rc));
}
struct backentry *
@@ -327,10 +401,9 @@ find_entry2modify_only_ext(
Slapi_Backend *be,
const entry_address *addr,
int flags,
- back_txn *txn
-
+ back_txn *txn,
+ int *rc
)
{
- return( find_entry_internal( pb, be, addr, 1/*lock*/, txn,
- FE_REALLY_INTERNAL | flags ));
+ return(find_entry_internal(pb, be, addr, 1/*lock*/, txn, FE_REALLY_INTERNAL | flags, rc));
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index 7eb8fe96b..f462376df 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -93,6 +93,7 @@ ldbm_back_add( Slapi_PBlock *pb )
int myrc = 0;
PRUint64 conn_id;
int op_id;
+ int result_sent = 0;
if (slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id) < 0) {
conn_id = 0; /* connection is NULL */
}
@@ -379,7 +380,7 @@ ldbm_back_add( Slapi_PBlock *pb )
addr.sdn = &parentsdn;
addr.udn = NULL;
addr.uniqueid = operation->o_params.p.p_add.parentuniqueid;
- parententry = find_entry2modify_only(pb,be,&addr,&txn);
+ parententry = find_entry2modify_only(pb, be, &addr, &txn, &result_sent);
if (parententry && parententry->ep_entry) {
if (!operation->o_params.p.p_add.parentuniqueid){
/* Set the parentuniqueid now */
@@ -431,6 +432,14 @@ ldbm_back_add( Slapi_PBlock *pb )
/* The entry already exists */
ldap_result_code = LDAP_ALREADY_EXISTS;
}
+ if ((LDAP_ALREADY_EXISTS == ldap_result_code) && !isroot && !is_replicated_operation) {
+ myrc = plugin_call_acl_plugin(pb, e, NULL, NULL, SLAPI_ACL_ADD,
+ ACLPLUGIN_ACCESS_DEFAULT, &errbuf);
+ if (myrc) {
+ ldap_result_code = myrc;
+ ldap_result_message = errbuf;
+ }
+ }
goto error_return;
}
else
@@ -447,7 +456,7 @@ ldbm_back_add( Slapi_PBlock *pb )
Slapi_DN ancestorsdn;
struct backentry *ancestorentry;
slapi_sdn_init(&ancestorsdn);
- ancestorentry= dn2ancestor(pb->pb_backend,sdn,&ancestorsdn,&txn,&err);
+ ancestorentry = dn2ancestor(pb->pb_backend, sdn, &ancestorsdn, &txn, &err, 0);
slapi_sdn_done(&ancestorsdn);
if ( ancestorentry != NULL )
{
@@ -495,7 +504,7 @@ ldbm_back_add( Slapi_PBlock *pb )
addr.udn = NULL;
addr.sdn = NULL;
addr.uniqueid = (char *)slapi_entry_get_uniqueid(e); /* jcm - cast away const */
- tombstoneentry = find_entry2modify( pb, be, &addr, &txn );
+ tombstoneentry = find_entry2modify(pb, be, &addr, &txn, &result_sent);
if ( tombstoneentry==NULL )
{
ldap_result_code= -1;
@@ -712,7 +721,7 @@ ldbm_back_add( Slapi_PBlock *pb )
LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM, "ldbm_add: Parent \"%s\" does not exist. "
"It might be a conflict entry.\n", slapi_sdn_get_dn(&parentsdn));
slapi_sdn_init(&ancestorsdn);
- ancestorentry = dn2ancestor(be, &parentsdn, &ancestorsdn, &txn, &err );
+ ancestorentry = dn2ancestor(be, &parentsdn, &ancestorsdn, &txn, &err, 1);
CACHE_RETURN( &inst->inst_cache, &ancestorentry );
ldap_result_code= LDAP_NO_SUCH_OBJECT;
@@ -1349,7 +1358,9 @@ common_return:
* And we don't want the supplier to halt sending the updates. */
ldap_result_code = LDAP_SUCCESS;
}
- slapi_send_ldap_result( pb, ldap_result_code, ldap_result_matcheddn, ldap_result_message, 0, NULL );
+ if (!result_sent) {
+ slapi_send_ldap_result(pb, ldap_result_code, ldap_result_matcheddn, ldap_result_message, 0, NULL);
+ }
}
backentry_free(&originalentry);
backentry_free(&tmpentry);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_bind.c b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
index ea0df330d..99a081814 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_bind.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
@@ -29,6 +29,7 @@ ldbm_back_bind( Slapi_PBlock *pb )
entry_address *addr;
back_txn txn = {NULL};
int rc = SLAPI_BIND_SUCCESS;
+ int result_sent = 0;
/* get parameters */
slapi_pblock_get( pb, SLAPI_BACKEND, &be );
@@ -63,8 +64,12 @@ ldbm_back_bind( Slapi_PBlock *pb )
* find the target entry. find_entry() takes care of referrals
* and sending errors if the entry does not exist.
*/
- if (( e = find_entry( pb, be, addr, &txn )) == NULL ) {
+ if ((e = find_entry( pb, be, addr, &txn, &result_sent)) == NULL) {
rc = SLAPI_BIND_FAIL;
+ /* In the failure case, the result is supposed to be sent in the backend. */
+ if (!result_sent) {
+ slapi_send_ldap_result(pb, LDAP_INAPPROPRIATE_AUTH, NULL, NULL, 0, NULL);
+ }
goto bail;
}
@@ -82,8 +87,8 @@ ldbm_back_bind( Slapi_PBlock *pb )
bvals= attr_get_present_values(attr);
slapi_value_init_berval(&cv,cred);
if ( slapi_pw_find_sv( bvals, &cv ) != 0 ) {
- slapi_send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
- NULL, 0, NULL );
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "Invalid credentials");
+ slapi_send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL, NULL, 0, NULL );
CACHE_RETURN( &inst->inst_cache, &e );
value_done(&cv);
rc = SLAPI_BIND_FAIL;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_compare.c b/ldap/servers/slapd/back-ldbm/ldbm_compare.c
index e52cd6c86..e9973a9c4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_compare.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_compare.c
@@ -56,7 +56,7 @@ ldbm_back_compare( Slapi_PBlock *pb )
/* get the namespace dn */
namespace_dn = (Slapi_DN*)slapi_be_getsuffix(be, 0);
- if ( (e = find_entry( pb, be, addr, &txn )) == NULL ) {
+ if ((e = find_entry(pb, be, addr, &txn, NULL)) == NULL) {
ret = -1; /* error result sent by find_entry() */
goto bail;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 5b24af2af..f801e01ef 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -77,6 +77,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
int op_id;
ID ep_id = 0;
ID tomb_ep_id = 0;
+ int result_sent = 0;
if (slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id) < 0) {
conn_id = 0; /* connection is NULL */
@@ -266,7 +267,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
* deleted. That is, the entry 'e' found with "addr" is a tomb-
* stone. If it is the case, we need to back off.
*/
- if ( (e = find_entry2modify( pb, be, addr, &txn )) == NULL )
+ if ((e = find_entry2modify(pb, be, addr, &txn, &result_sent)) == NULL)
{
ldap_result_code= LDAP_NO_SUCH_OBJECT;
retval = -1;
@@ -507,7 +508,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
parent_addr.uniqueid = NULL;
}
parent_addr.sdn = &parentsdn;
- parent = find_entry2modify_only_ext(pb, be, &parent_addr, TOMBSTONE_INCLUDED, &txn);
+ parent = find_entry2modify_only_ext(pb, be, &parent_addr, TOMBSTONE_INCLUDED, &txn, &result_sent);
}
if (parent) {
int isglue;
@@ -1466,7 +1467,9 @@ diskfull_return:
* And we don't want the supplier to halt sending the updates. */
ldap_result_code = LDAP_SUCCESS;
}
- slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
+ if (!result_sent) {
+ slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
+ }
}
slapi_log_error(SLAPI_LOG_BACKLDBM, "ldbm_back_delete",
"conn=%lu op=%d modify_term: old_entry=0x%p, new_entry=0x%p, in_cache=%d\n",
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 9b3062c0c..34d9861dd 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -392,6 +392,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
int not_an_error = 0;
int fixup_tombstone = 0;
int ec_locked = 0;
+ int result_sent = 0;
slapi_pblock_get( pb, SLAPI_BACKEND, &be);
slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
@@ -466,12 +467,12 @@ ldbm_back_modify( Slapi_PBlock *pb )
if ( MANAGE_ENTRY_BEFORE_DBLOCK(li)) {
/* find and lock the entry we are about to modify */
if (fixup_tombstone) {
- e = find_entry2modify_only_ext( pb, be, addr, TOMBSTONE_INCLUDED, &txn );
+ e = find_entry2modify_only_ext( pb, be, addr, TOMBSTONE_INCLUDED, &txn, &result_sent );
} else {
- e = find_entry2modify( pb, be, addr, &txn );
+ e = find_entry2modify( pb, be, addr, &txn, &result_sent );
}
if (e == NULL) {
- ldap_result_code= -1;
+ ldap_result_code = -1;
goto error_return; /* error result sent by find_entry2modify() */
}
}
@@ -551,12 +552,12 @@ ldbm_back_modify( Slapi_PBlock *pb )
if ( !MANAGE_ENTRY_BEFORE_DBLOCK(li)) {
/* find and lock the entry we are about to modify */
if (fixup_tombstone) {
- e = find_entry2modify_only_ext( pb, be, addr, TOMBSTONE_INCLUDED, &txn );
+ e = find_entry2modify_only_ext( pb, be, addr, TOMBSTONE_INCLUDED, &txn, &result_sent );
} else {
- e = find_entry2modify( pb, be, addr, &txn );
+ e = find_entry2modify( pb, be, addr, &txn, &result_sent );
}
if (e == NULL) {
- ldap_result_code= -1;
+ ldap_result_code = -1;
goto error_return; /* error result sent by find_entry2modify() */
}
}
@@ -966,7 +967,10 @@ common_return:
* And we don't want the supplier to halt sending the updates. */
ldap_result_code = LDAP_SUCCESS;
}
- slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
+ if (!result_sent) {
+ /* result is already sent in find_entry. */
+ slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
+ }
}
/* free our backups */
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index c0cd2ab57..f9343052a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -95,6 +95,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
int myrc = 0;
PRUint64 conn_id;
int op_id;
+ int result_sent = 0;
if (slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id) < 0) {
conn_id = 0; /* connection is NULL */
}
@@ -474,7 +475,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
/* find and lock the entry we are about to modify */
/* JCMREPL - Argh, what happens about the stinking referrals? */
slapi_pblock_get (pb, SLAPI_TARGET_ADDRESS, &old_addr);
- e = find_entry2modify( pb, be, old_addr, &txn );
+ e = find_entry2modify(pb, be, old_addr, &txn, &result_sent);
if ( e == NULL )
{
ldap_result_code= -1;
@@ -510,7 +511,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
} else {
oldparent_addr.uniqueid = NULL;
}
- parententry = find_entry2modify_only( pb, be, &oldparent_addr, &txn );
+ parententry = find_entry2modify_only(pb, be, &oldparent_addr, &txn, &result_sent);
modify_init(&parent_modify_context,parententry);
/* Fetch and lock the new parent of the entry that is moving */
@@ -520,7 +521,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
if (is_resurect_operation) {
newsuperior_addr->uniqueid = slapi_entry_attr_get_charptr(e->ep_entry, SLAPI_ATTR_VALUE_PARENT_UNIQUEID);
}
- newparententry = find_entry2modify_only( pb, be, newsuperior_addr, &txn );
+ newparententry = find_entry2modify_only(pb, be, newsuperior_addr, &txn, &result_sent);
slapi_ch_free_string(&newsuperior_addr->uniqueid);
modify_init(&newparent_modify_context,newparententry);
}
@@ -581,7 +582,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
Slapi_DN ancestorsdn;
struct backentry *ancestorentry;
slapi_sdn_init(&ancestorsdn);
- ancestorentry= dn2ancestor(be,&dn_newdn,&ancestorsdn,&txn,&err);
+ ancestorentry = dn2ancestor(be, &dn_newdn, &ancestorsdn, &txn, &err, 0);
CACHE_RETURN( &inst->inst_cache, &ancestorentry );
ldap_result_matcheddn= slapi_ch_strdup((char *) slapi_sdn_get_dn(&ancestorsdn));
ldap_result_code= LDAP_NO_SUCH_OBJECT;
@@ -1486,8 +1487,10 @@ common_return:
* And we don't want the supplier to halt sending the updates. */
ldap_result_code = LDAP_SUCCESS;
}
- slapi_send_ldap_result( pb, ldap_result_code, ldap_result_matcheddn,
- ldap_result_message, 0,NULL );
+ if (!result_sent) {
+ slapi_send_ldap_result(pb, ldap_result_code, ldap_result_matcheddn,
+ ldap_result_message, 0, NULL);
+ }
}
slapi_mods_done(&smods_operation_wsi);
slapi_mods_done(&smods_generated);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 535529c4f..cda1714de 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -584,7 +584,7 @@ ldbm_back_search( Slapi_PBlock *pb )
}
else
{
- if ( ( e = find_entry( pb, be, addr, &txn )) == NULL )
+ if ((e = find_entry(pb, be, addr, &txn, NULL)) == NULL)
{
/* error or referral sent by find_entry */
return ldbm_back_search_cleanup(pb, li, sort_control,
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index 77c1e70fe..516b32d5f 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -412,7 +412,7 @@ ldbm_txn_ruv_modify_context( Slapi_PBlock *pb, modify_context *mc )
/* Note: if we find the bentry, it will stay locked until someone calls
* modify_term on the mc we'll be associating the bentry with */
- bentry = find_entry2modify_only( pb, be, &bentry_addr, &txn );
+ bentry = find_entry2modify_only(pb, be, &bentry_addr, &txn, NULL);
if (NULL == bentry) {
/* Uh oh, we couldn't find and lock the RUV entry! */
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 86e2237ff..8c813dd83 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -174,7 +174,7 @@ int ldbm_back_ctrl_info(Slapi_Backend *be, int cmd, void *info);
struct backentry *dn2entry(Slapi_Backend *be, const Slapi_DN *sdn, back_txn *txn, int *err);
struct backentry *dn2entry_ext(Slapi_Backend *be, const Slapi_DN *sdn, back_txn *txn, int flags, int *err);
struct backentry *dn2entry_or_ancestor(Slapi_Backend *be, const Slapi_DN *sdn, Slapi_DN *ancestor, back_txn *txn, int *err);
-struct backentry *dn2ancestor(Slapi_Backend *be,const Slapi_DN *sdn,Slapi_DN *ancestordn,back_txn *txn,int *err);
+struct backentry *dn2ancestor(Slapi_Backend *be,const Slapi_DN *sdn,Slapi_DN *ancestordn,back_txn *txn,int *err, int allow_suffix);
int get_copy_of_entry(Slapi_PBlock *pb, const entry_address *addr, back_txn *txn, int plock_parameter, int must_exist);
int get_copy_of_entry_ext(Slapi_PBlock *pb, ID id, const entry_address *addr, back_txn *txn, int plock_parameter, int must_exist);
void done_with_pblock_entry(Slapi_PBlock *pb, int plock_parameter);
@@ -194,11 +194,13 @@ IDList * filter_candidates_ext( Slapi_PBlock *pb, backend *be, const char *base,
/*
* findentry.c
*/
-struct backentry * find_entry2modify( Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn );
-struct backentry * find_entry( Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn );
-struct backentry * find_entry2modify_only( Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn);
-struct backentry * find_entry2modify_only_ext( Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, int flags, back_txn *txn);
-struct backentry * find_entry_only( Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn);
+/* Return code */
+#define FE_RC_SENT_RESULT 1
+struct backentry *find_entry2modify(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn, int *rc);
+struct backentry *find_entry(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn, int *rc);
+struct backentry *find_entry2modify_only(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn, int *rc);
+struct backentry *find_entry2modify_only_ext(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, int flags, back_txn *txn, int *rc);
+struct backentry *find_entry_only(Slapi_PBlock *pb, Slapi_Backend *be, const entry_address *addr, back_txn *txn, int *rc);
int check_entry_for_referral(Slapi_PBlock *pb, Slapi_Entry *entry, char *matched, const char *callingfn);
/*
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index fcd0c2d8a..df378211f 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -162,7 +162,7 @@ vlvSearch_init(struct vlvSearch* p, Slapi_PBlock *pb, const Slapi_Entry *e, ldbm
addr.sdn = p->vlv_base;
addr.uniqueid = NULL;
- e = find_entry( pb, inst->inst_be, &addr, &txn );
+ e = find_entry(pb, inst->inst_be, &addr, &txn, NULL);
/* Check to see if the entry is absent. If it is, mark this search
* as not initialized */
if (NULL == e) {
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 1ffec4e2b..b44161511 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -438,8 +438,8 @@ do_bind( Slapi_PBlock *pb )
* to an LDAP DN, fail and return an invalidCredentials error.
*/
if ( NULL == pb->pb_conn->c_external_dn ) {
- send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
- "client certificate mapping failed", 0, NULL );
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "Client certificate mapping failed");
+ send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL, "", 0, NULL);
/* call postop plugins */
plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
goto free_and_return;
@@ -556,33 +556,32 @@ do_bind( Slapi_PBlock *pb )
/* Check if simple binds are allowed over an insecure channel. We only check
* this for authenticated binds. */
} else if (config_get_require_secure_binds() == 1) {
- Connection *conn = NULL;
- int sasl_ssf = 0;
- int local_ssf = 0;
-
- /* Allow simple binds only for SSL/TLS established connections
- * or connections using SASL privacy layers */
- conn = pb->pb_conn;
- if ( slapi_pblock_get(pb, SLAPI_CONN_SASL_SSF, &sasl_ssf) != 0) {
- slapi_log_error( SLAPI_LOG_PLUGIN, "do_bind",
- "Could not get SASL SSF from connection\n" );
- sasl_ssf = 0;
- }
+ Connection *conn = NULL;
+ int sasl_ssf = 0;
+ int local_ssf = 0;
+
+ /* Allow simple binds only for SSL/TLS established connections
+ * or connections using SASL privacy layers */
+ conn = pb->pb_conn;
+ if ( slapi_pblock_get(pb, SLAPI_CONN_SASL_SSF, &sasl_ssf) != 0) {
+ slapi_log_error( SLAPI_LOG_PLUGIN, "do_bind",
+ "Could not get SASL SSF from connection\n" );
+ sasl_ssf = 0;
+ }
- if ( slapi_pblock_get(pb, SLAPI_CONN_LOCAL_SSF, &local_ssf) != 0) {
- slapi_log_error( SLAPI_LOG_PLUGIN, "do_bind",
- "Could not get local SSF from connection\n" );
- local_ssf = 0;
- }
+ if ( slapi_pblock_get(pb, SLAPI_CONN_LOCAL_SSF, &local_ssf) != 0) {
+ slapi_log_error( SLAPI_LOG_PLUGIN, "do_bind",
+ "Could not get local SSF from connection\n" );
+ local_ssf = 0;
+ }
- if (((conn->c_flags & CONN_FLAG_SSL) != CONN_FLAG_SSL) &&
- (sasl_ssf <= 1) && (local_ssf <= 1)) {
- send_ldap_result(pb, LDAP_CONFIDENTIALITY_REQUIRED, NULL,
- "Operation requires a secure connection",
- 0, NULL);
- slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
- goto free_and_return;
- }
+ if (((conn->c_flags & CONN_FLAG_SSL) != CONN_FLAG_SSL) &&
+ (sasl_ssf <= 1) && (local_ssf <= 1)) {
+ send_ldap_result(pb, LDAP_CONFIDENTIALITY_REQUIRED, NULL,
+ "Operation requires a secure connection", 0, NULL);
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
+ goto free_and_return;
+ }
}
break;
default:
@@ -627,6 +626,7 @@ do_bind( Slapi_PBlock *pb )
/*
* right dn, wrong passwd - reject with invalid credentials
*/
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "Invalid credentials");
send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL, NULL, 0, NULL );
/* increment BindSecurityErrorcount */
slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
@@ -686,7 +686,8 @@ do_bind( Slapi_PBlock *pb )
slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &pb_sdn);
if (!pb_sdn) {
slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set NULL dn\n");
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
goto free_and_return;
} else if ((pb_sdn != sdn) || (sdn_updated = slapi_sdn_compare(original_sdn, pb_sdn))) {
/*
@@ -696,8 +697,10 @@ do_bind( Slapi_PBlock *pb )
sdn = pb_sdn;
dn = slapi_sdn_get_dn(sdn);
if (!dn) {
- slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set corrupted dn\n");
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
+ char *udn = slapi_sdn_get_udn(sdn);
+ slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set corrupted dn %s\n", udn?udn:"");
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
goto free_and_return;
}
if (!sdn_updated) { /* pb_sdn != sdn; need to compare the dn's. */
@@ -711,7 +714,8 @@ do_bind( Slapi_PBlock *pb )
slapi_pblock_set( pb, SLAPI_BACKEND, be );
} else {
slapi_create_errormsg(errorbuf, sizeof(errorbuf), "No matching backend for %s\n", dn);
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
goto free_and_return;
}
}
@@ -790,7 +794,8 @@ do_bind( Slapi_PBlock *pb )
goto account_locked;
}
} else {
- send_ldap_result(pb, LDAP_NO_SUCH_OBJECT, NULL, "", 0, NULL);
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "No such entry");
+ send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL, "", 0, NULL);
goto free_and_return;
}
}
@@ -850,8 +855,7 @@ account_locked:
* the front end.
*/
if ( rc == SLAPI_BIND_SUCCESS || rc == SLAPI_BIND_ANONYMOUS) {
- send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL,
- 0, NULL );
+ send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
}
slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &rc );
@@ -876,8 +880,7 @@ free_and_return:;
slapi_sdn_free(&sdn);
slapi_ch_free_string( &saslmech );
slapi_ch_free( (void **)&cred.bv_val );
- if ( bind_target_entry != NULL )
- slapi_entry_free(bind_target_entry);
+ slapi_entry_free(bind_target_entry);
}
diff --git a/ldap/servers/slapd/defbackend.c b/ldap/servers/slapd/defbackend.c
index 7d73501ac..da4a7019a 100644
--- a/ldap/servers/slapd/defbackend.c
+++ b/ldap/servers/slapd/defbackend.c
@@ -171,6 +171,51 @@ defbackend_abandon( Slapi_PBlock *pb )
}
+#define DEFBE_NO_SUCH_SUFFIX "No such suffix"
+/*
+ * Generate a "No such suffix" return text
+ * Example:
+ * cn=X,dc=bogus,dc=com ==> "No such suffix (dc=bogus,dc=com)"
+ * if the last rdn starts with "dc=", print all last dc= rdn's.
+ * cn=X,cn=bogus ==> "No such suffix (cn=bogus)"
+ * otherwise, print the very last rdn.
+ * cn=X,z=bogus ==> "No such suffix (x=bogus)"
+ * it is true even if it is an invalid rdn.
+ * cn=X,bogus ==> "No such suffix (bogus)"
+ * another example of invalid rdn.
+ */
+static void
+_defbackend_gen_returntext(char *buffer, size_t buflen, char **dns)
+{
+ int dnidx;
+ int sidx;
+ struct suffix_repeat {
+ char *suffix;
+ int size;
+ } candidates[] = {
+ {"dc=", 3}, /* dc could be repeated. otherwise the last rdn is used. */
+ {NULL, 0}
+ };
+ PR_snprintf(buffer, buflen, "%s (", DEFBE_NO_SUCH_SUFFIX);
+ for (dnidx = 0; dns[dnidx]; dnidx++) ; /* finding the last */
+ dnidx--; /* last rdn */
+ for (sidx = 0; candidates[sidx].suffix; sidx++) {
+ if (!PL_strncasecmp(dns[dnidx], candidates[sidx].suffix, candidates[sidx].size)) {
+ while (!PL_strncasecmp(dns[--dnidx], candidates[sidx].suffix, candidates[sidx].size)) ;
+ PL_strcat(buffer, dns[++dnidx]); /* the first "dn=", e.g. */
+ for (++dnidx; dns[dnidx]; dnidx++) {
+ PL_strcat(buffer, ",");
+ PL_strcat(buffer, dns[dnidx]);
+ }
+ PL_strcat(buffer, ")");
+ return; /* finished the task */
+ }
+ }
+ PL_strcat(buffer, dns[dnidx]);
+ PL_strcat(buffer, ")");
+ return;
+}
+
static int
defbackend_bind( Slapi_PBlock *pb )
{
@@ -188,11 +233,40 @@ defbackend_bind( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_BIND_METHOD, &method );
slapi_pblock_get( pb, SLAPI_BIND_CREDENTIALS, &cred );
if ( method == LDAP_AUTH_SIMPLE && cred->bv_len == 0 ) {
- slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
- rc = SLAPI_BIND_ANONYMOUS;
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsAnonymousBinds);
+ rc = SLAPI_BIND_ANONYMOUS;
} else {
- send_nobackend_ldap_result( pb );
- rc = SLAPI_BIND_FAIL;
+ Slapi_DN *sdn = NULL;
+ char *suffix = NULL;
+ char **dns = NULL;
+
+ if (pb->pb_op) {
+ sdn = operation_get_target_spec(pb->pb_op);
+ if (sdn) {
+ dns = slapi_ldap_explode_dn(slapi_sdn_get_dn(sdn), 0);
+ if (dns) {
+ size_t dnlen = slapi_sdn_get_ndn_len(sdn);
+ size_t len = dnlen + sizeof(DEFBE_NO_SUCH_SUFFIX) + 4;
+ suffix = slapi_ch_malloc(len);
+ if (dnlen) {
+ _defbackend_gen_returntext(suffix, len, dns);
+ } else {
+ PR_snprintf(suffix, len, "%s", DEFBE_NO_SUCH_SUFFIX);
+ }
+ }
+ }
+ }
+ if (suffix) {
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, suffix);
+ } else {
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, DEFBE_NO_SUCH_SUFFIX);
+ }
+ send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL, "", 0, NULL);
+ if (dns) {
+ slapi_ldap_value_free(dns);
+ }
+ slapi_ch_free_string(&suffix);
+ rc = SLAPI_BIND_FAIL;
}
return( rc );
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 506da9203..c2a020601 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -2067,14 +2067,26 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
}
else if ( !internal_op )
{
+ char *pbtxt = NULL;
+ char *ext_str = NULL;
+ slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &pbtxt);
+ if (pbtxt) {
+ ext_str = slapi_ch_smprintf(" - %s", pbtxt);
+ } else {
+ ext_str = "";
+ }
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
- " tag=%" BERTAG_T " nentries=%d etime=%s%s%s\n",
+ " tag=%" BERTAG_T " nentries=%d etime=%s%s%s%s\n",
op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
- notes_str, csn_str );
+ notes_str, csn_str, ext_str);
+ if (pbtxt) {
+ /* if !pbtxt ==> ext_str == "". Don't free ext_str. */
+ slapi_ch_free_string(&ext_str);
+ }
}
else
{
| 0 |
55fc8e4dc7d4b1d90f45637f8679325ce198c278
|
389ds/389-ds-base
|
Resolves: 219586
Summary: Fixed leak of Slapi_Value in index code.
|
commit 55fc8e4dc7d4b1d90f45637f8679325ce198c278
Author: Nathan Kinder <[email protected]>
Date: Fri Sep 28 22:54:16 2007 +0000
Resolves: 219586
Summary: Fixed leak of Slapi_Value in index code.
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index ebd4d27d7..dab71e288 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -535,7 +535,8 @@ index_add_mods(
slapi_entry_attr_find( olde->ep_entry, mods[i]->mod_type, &curr_attr );
if ( mods_valueArray != NULL ) {
for ( j = 0; mods_valueArray[j] != NULL; j++ ) {
- valuearray_remove_value(curr_attr, evals, mods_valueArray[j]);
+ Slapi_Value *rval = valuearray_remove_value(curr_attr, evals, mods_valueArray[j]);
+ slapi_value_free( &rval );
}
}
@@ -549,7 +550,8 @@ index_add_mods(
}
} else {
/* Remove duplicate value from deleted value array */
- valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ Slapi_Value *rval = valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ slapi_value_free( &rval );
j--;
}
}
@@ -615,7 +617,8 @@ index_add_mods(
}
} else {
/* Remove duplicate value from the mod list */
- valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ Slapi_Value *rval = valuearray_remove_value(curr_attr, deleted_valueArray, deleted_valueArray[j]);
+ slapi_value_free( &rval );
j--;
}
}
| 0 |
fbf320f316c2742f4c60cdc9f3e27a38944468e2
|
389ds/389-ds-base
|
Issue 48978 - Fix the emergency logging functions severity levels
Description: We have duplicate CRITICAL messages, and we were not
properly setting the emergency log severity level.
https://pagure.io/389-ds-base/issue/48978
Reviewed by: nhosoi(Thanks!)
|
commit fbf320f316c2742f4c60cdc9f3e27a38944468e2
Author: Mark Reynolds <[email protected]>
Date: Thu Apr 20 16:01:50 2017 -0400
Issue 48978 - Fix the emergency logging functions severity levels
Description: We have duplicate CRITICAL messages, and we were not
properly setting the emergency log severity level.
https://pagure.io/389-ds-base/issue/48978
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/plugins/addn/addn.c b/ldap/servers/plugins/addn/addn.c
index 6ba783387..e4b6ed93e 100644
--- a/ldap/servers/plugins/addn/addn.c
+++ b/ldap/servers/plugins/addn/addn.c
@@ -96,7 +96,7 @@ addn_get_subconfig(Slapi_PBlock *pb, char *identifier)
search_pblock = slapi_pblock_new();
if (search_pblock == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: CRITICAL: Unable to allocate search_pblock!!!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: Unable to allocate search_pblock!!!\n");
goto out;
}
@@ -108,7 +108,7 @@ addn_get_subconfig(Slapi_PBlock *pb, char *identifier)
search_result = slapi_pblock_get(search_pblock, SLAPI_PLUGIN_INTOP_RESULT, &search_result);
if (search_result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: CRITICAL: Internal search pblock get failed!!!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: Internal search pblock get failed!!!\n");
goto out;
}
@@ -119,7 +119,7 @@ addn_get_subconfig(Slapi_PBlock *pb, char *identifier)
/* On all other errors, just fail out. */
if (search_result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_PLUGIN, plugin_name, "addn_get_subconfig: CRITICAL: Internal search error occured %d \n", search_result);
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: Internal search error occurred %d \n", search_result);
goto out;
}
@@ -127,7 +127,7 @@ addn_get_subconfig(Slapi_PBlock *pb, char *identifier)
search_result = slapi_pblock_get(search_pblock, SLAPI_NENTRIES, &entry_count);
if (search_result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: CRITICAL: Unable to retrieve number of entries from pblock!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: Unable to retrieve number of entries from pblock!\n");
goto out;
}
/* If there are multiple results, we should also fail as we cannot */
@@ -135,13 +135,13 @@ addn_get_subconfig(Slapi_PBlock *pb, char *identifier)
if (entry_count != 1) {
/* Is there a better log level for this? */
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: WARNING, multiple or no results returned. Failing to auth ...\n");
+ slapi_log_err(SLAPI_LOG_WARNING, plugin_name, "addn_get_subconfig: multiple or no results returned. Failing to auth ...\n");
goto out;
}
search_result = slapi_pblock_get(search_pblock, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
if (search_result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: CRITICAL: Unable to retrieve entries from pblock!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_get_subconfig: Unable to retrieve entries from pblock!\n");
goto out;
}
@@ -209,7 +209,7 @@ addn_prebind(Slapi_PBlock *pb)
result = slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &config);
if (result != LDAP_SUCCESS || config == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Unable to retrieve plugin configuration!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Unable to retrieve plugin configuration!\n");
result = ADDN_FAILURE;
goto out;
}
@@ -267,7 +267,7 @@ addn_prebind(Slapi_PBlock *pb)
/* Validate the filter_template only has one %s */
if (addn_filter_validate(config_filter) != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Failed to validate addn_filter %s for domain %s\n", config_filter, dn_domain_escaped);
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Failed to validate addn_filter %s for domain %s\n", config_filter, dn_domain_escaped);
result = ADDN_FAILURE;
goto out;
}
@@ -281,7 +281,7 @@ addn_prebind(Slapi_PBlock *pb)
search_pblock = slapi_pblock_new();
if (search_pblock == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Unable to allocate search_pblock!!!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Unable to allocate search_pblock!!!\n");
result = ADDN_FAILURE;
goto out;
}
@@ -294,7 +294,7 @@ addn_prebind(Slapi_PBlock *pb)
result = slapi_pblock_get(search_pblock, SLAPI_PLUGIN_INTOP_RESULT, &search_result);
if (result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Internal search pblock get failed!!!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Internal search pblock get failed!!!\n");
result = ADDN_FAILURE;
goto out;
}
@@ -314,7 +314,7 @@ addn_prebind(Slapi_PBlock *pb)
/* On all other errors, just fail out. */
if (search_result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_PLUGIN, plugin_name, "addn_prebind: CRITICAL: Internal search error occured %d \n", search_result);
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Internal search error occurred %d \n", search_result);
result = ADDN_FAILURE;
goto out;
}
@@ -323,7 +323,7 @@ addn_prebind(Slapi_PBlock *pb)
result = slapi_pblock_get(search_pblock, SLAPI_NENTRIES, &entry_count);
if (result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Unable to retrieve number of entries from pblock!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Unable to retrieve number of entries from pblock!\n");
result = ADDN_FAILURE;
goto out;
}
@@ -332,14 +332,14 @@ addn_prebind(Slapi_PBlock *pb)
if (entry_count > 1) {
/* Is there a better log level for this? */
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: WARNING, multiple results returned. Failing to auth ...\n");
+ slapi_log_err(SLAPI_LOG_WARNING, plugin_name, "addn_prebind: multiple results returned. Failing to auth ...\n");
result = ADDN_FAILURE;
goto out;
}
result = slapi_pblock_get(search_pblock, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
if (result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Unable to retrieve entries from pblock!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Unable to retrieve entries from pblock!\n");
result = ADDN_FAILURE;
goto out;
}
@@ -356,7 +356,7 @@ addn_prebind(Slapi_PBlock *pb)
/* Free the original SDN */
result = slapi_pblock_set(pb, SLAPI_TARGET_SDN, pb_sdn_mapped);
if (result != LDAP_SUCCESS) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: CRITICAL: Unable to set new mapped DN to pblock!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_prebind: Unable to set new mapped DN to pblock!\n");
/* We have to free the mapped SDN here */
slapi_sdn_free(&pb_sdn_mapped);
result = ADDN_FAILURE;
@@ -404,7 +404,7 @@ addn_start(Slapi_PBlock *pb)
/* It looks like we mis-use the SLAPI_ADD_ENTRY space in PB during plugin startup */
result = slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &plugin_entry);
if (result != LDAP_SUCCESS || plugin_entry == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_start: CRITICAL: Failed to retrieve config entry!\n");
+ slapi_log_err(SLAPI_LOG_ERR, plugin_name, "addn_start: Failed to retrieve config entry!\n");
return SLAPI_PLUGIN_FAILURE;
}
@@ -416,7 +416,7 @@ addn_start(Slapi_PBlock *pb)
if (domain == NULL) {
slapi_log_err(SLAPI_LOG_ERR, plugin_name,
- "addn_start: CRITICAL: No default domain in configuration, you must set addn_default_domain!\n");
+ "addn_start: No default domain in configuration, you must set addn_default_domain!\n");
slapi_ch_free((void**)&config);
return SLAPI_PLUGIN_FAILURE;
}
@@ -498,7 +498,7 @@ addn_init(Slapi_PBlock *pb)
out:
if (result == LDAP_SUCCESS) {
slapi_log_err(SLAPI_LOG_PLUGIN, plugin_name, "addn_init: Success: plugin loaded.\n");
- slapi_log_err(SLAPI_LOG_WARNING, plugin_name, "addn_init: WARNING: The use of this plugin violates the LDAPv3 specification RFC4511 section 4.2 BindDN specification. You have been warned ...\n");
+ slapi_log_err(SLAPI_LOG_WARNING, plugin_name, "addn_init: The use of this plugin violates the LDAPv3 specification RFC4511 section 4.2 BindDN specification. You have been warned ...\n");
} else {
slapi_log_err(SLAPI_LOG_PLUGIN, plugin_name, "addn_init: Error: %d. \n", result);
}
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 7a5d68825..199496ab4 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2255,11 +2255,11 @@ vslapd_log_emergency_error(LOGFD fp, const char *msg, int locked)
if (logging_hr_timestamps_enabled == 1) {
struct timespec tsnow;
if (clock_gettime(CLOCK_REALTIME, &tsnow) != 0) {
- syslog(LOG_CRIT, "CRITICAL: vslapd_log_emergency_error, Unable to determine system time for message :: %s", msg);
+ syslog(LOG_EMERG, "vslapd_log_emergency_error, Unable to determine system time for message :: %s", msg);
return;
}
if (format_localTime_hr_log(tsnow.tv_sec, tsnow.tv_nsec, sizeof(tbuf), tbuf, &size) != 0) {
- syslog(LOG_CRIT, "CRITICAL: vslapd_log_emergency_error, Unable to format system time for message :: %s", msg);
+ syslog(LOG_EMERG, "vslapd_log_emergency_error, Unable to format system time for message :: %s", msg);
return;
}
} else {
@@ -2267,14 +2267,14 @@ vslapd_log_emergency_error(LOGFD fp, const char *msg, int locked)
time_t tnl;
tnl = current_time();
if (format_localTime_log(tnl, sizeof(tbuf), tbuf, &size) != 0) {
- syslog(LOG_CRIT, "CRITICAL: vslapd_log_emergency_error, Unable to format system time for message :: %s", msg);
+ syslog(LOG_EMERG, "vslapd_log_emergency_error, Unable to format system time for message :: %s", msg);
return;
}
#ifdef HAVE_CLOCK_GETTIME
}
#endif
- PR_snprintf( buffer, sizeof(buffer), "%s - %s", tbuf, msg);
+ PR_snprintf( buffer, sizeof(buffer), "%s - EMERG - %s", tbuf, msg);
size = strlen(buffer);
if(!locked) {
@@ -2332,7 +2332,7 @@ vslapd_log_error(
int err = 0;
if (vasprintf(&vbuf, fmt, ap) == -1) {
- log__error_emergency("CRITICAL: vslapd_log_error, Unable to format message", 1 , locked);
+ log__error_emergency("vslapd_log_error, Unable to format message", 1 , locked);
return -1;
}
@@ -2340,13 +2340,13 @@ vslapd_log_error(
if (logging_hr_timestamps_enabled == 1) {
struct timespec tsnow;
if (clock_gettime(CLOCK_REALTIME, &tsnow) != 0) {
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_error, Unable to determine system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_error, Unable to determine system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,locked);
return -1;
}
if (format_localTime_hr_log(tsnow.tv_sec, tsnow.tv_nsec, sizeof(buffer), buffer, &blen) != 0) {
/* MSG may be truncated */
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_error, Unable to format system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_error, Unable to format system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,locked);
return -1;
}
@@ -2355,7 +2355,7 @@ vslapd_log_error(
time_t tnl;
tnl = current_time();
if (format_localTime_log(tnl, sizeof(buffer), buffer, &blen) != 0) {
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_error, Unable to format system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_error, Unable to format system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,locked);
return -1;
}
@@ -2521,7 +2521,7 @@ static int vslapd_log_access(char *fmt, va_list ap)
/* We do this sooner, because that we we can use the message in other calls */
if ((vlen = vsnprintf(vbuf, SLAPI_LOG_BUFSIZ, fmt, ap)) == -1){
- log__error_emergency("CRITICAL: vslapd_log_access, Unable to format message", 1 ,0);
+ log__error_emergency("vslapd_log_access, Unable to format message", 1 ,0);
return -1;
}
@@ -2530,14 +2530,14 @@ static int vslapd_log_access(char *fmt, va_list ap)
struct timespec tsnow;
if (clock_gettime(CLOCK_REALTIME, &tsnow) != 0) {
/* Make an error */
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_access, Unable to determine system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_access, Unable to determine system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,0);
return -1;
}
tnl = tsnow.tv_sec;
if (format_localTime_hr_log(tsnow.tv_sec, tsnow.tv_nsec, sizeof(buffer), buffer, &blen) != 0) {
/* MSG may be truncated */
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_access, Unable to format system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_access, Unable to format system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,0);
return -1;
}
@@ -2546,7 +2546,7 @@ static int vslapd_log_access(char *fmt, va_list ap)
tnl = current_time();
if (format_localTime_log(tnl, sizeof(buffer), buffer, &blen) != 0) {
/* MSG may be truncated */
- PR_snprintf(buffer, sizeof(buffer), "CRITICAL: vslapd_log_access, Unable to format system time for message :: %s", vbuf);
+ PR_snprintf(buffer, sizeof(buffer), "vslapd_log_access, Unable to format system time for message :: %s", vbuf);
log__error_emergency(buffer, 1 ,0);
return -1;
}
| 0 |
b5e840b6f9146de2087291167be57688057c27fb
|
389ds/389-ds-base
|
Ticket 49494 - python 2 bytes mode.
Bug Description: a piece of python 2 support was removed that
affected some tests.
Fix Description: Add back the suport for non-bytes mode.
https://pagure.io/389-ds-base/issue/49494
Author: wibrown
Review by: tbordaz (Thanks)
|
commit b5e840b6f9146de2087291167be57688057c27fb
Author: William Brown <[email protected]>
Date: Fri Dec 8 16:29:38 2017 +0100
Ticket 49494 - python 2 bytes mode.
Bug Description: a piece of python 2 support was removed that
affected some tests.
Fix Description: Add back the suport for non-bytes mode.
https://pagure.io/389-ds-base/issue/49494
Author: wibrown
Review by: tbordaz (Thanks)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index e23ae91e5..6961d1f2b 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -1095,7 +1095,10 @@ class DirSrv(SimpleLDAPObject, object):
if not uri:
uri = self.toLDAPURL()
self.log.debug('open(): Connecting to uri %s' % uri)
- super(DirSrv, self).__init__(uri, bytes_mode=False, trace_level=TRACE_LEVEL)
+ if hasattr(ldap, 'PYLDAP_VERSION') and MAJOR >= 3:
+ super(DirSrv, self).__init__(uri, bytes_mode=False, trace_level=TRACE_LEVEL)
+ else:
+ super(DirSrv, self).__init__(uri, trace_level=TRACE_LEVEL)
if certdir is None and self.isLocal:
certdir = self.get_cert_dir()
| 0 |
8ba2982457e7d2143ae0c2af212412122592c284
|
389ds/389-ds-base
|
Bug #361: Bad DNs in ACIs can segfault ns-slapd
A bad userdn will make the DN normalization fail. This sets dn to NULL,
and the server will attempt to access the NULL dn.
The fix is to just return with an error if the normalization fails since
the DN is invalid.
Reviewed by: rmeggins
|
commit 8ba2982457e7d2143ae0c2af212412122592c284
Author: Charles Lopes <[email protected]>
Date: Tue May 8 15:37:59 2012 +0000
Bug #361: Bad DNs in ACIs can segfault ns-slapd
A bad userdn will make the DN normalization fail. This sets dn to NULL,
and the server will attempt to access the NULL dn.
The fix is to just return with an error if the normalization fails since
the DN is invalid.
Reviewed by: rmeggins
diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c
index 15b373b14..39d9f6cf9 100644
--- a/ldap/servers/plugins/acl/aclparse.c
+++ b/ldap/servers/plugins/acl/aclparse.c
@@ -566,6 +566,11 @@ __aclp__copy_normalized_str (char *src, char *endsrc, char *start,
/* Normalize the value of userdn and append it to ret_str */
slapi_sdn_init_dn_byref(&sdn, p);
dn = slapi_sdn_get_dn(&sdn);
+ /* Normalization failed so return an error (-1) */
+ if (!dn) {
+ slapi_sdn_done(&sdn);
+ return -1;
+ }
/* append up to ldap(s):/// */
aclutil_str_append_ext(dest, destlen, start, p - start);
/* append the DN part */
| 0 |
5c5c9603946ecb89fb17df665a95aa3ce75e01de
|
389ds/389-ds-base
|
Ticket #47831 - server restart wipes out index config if there is a default index
https://fedorahosted.org/389/ticket/47831
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: In ldbm_instance_index_config_enable_index(), only call
the function ldbm_index_parse_entry() if the index does not exist. Instead,
get the name of the index from the "cn" attribute of the entry, and use
ainfo_get() to get the index. If this returns NULL, then call
ldbm_index_parse_entry() to create and parse the index.
Platforms tested: Fedora 20
Flag Day: no
Doc impact: no
|
commit 5c5c9603946ecb89fb17df665a95aa3ce75e01de
Author: Rich Megginson <[email protected]>
Date: Wed Jun 25 16:49:50 2014 -0600
Ticket #47831 - server restart wipes out index config if there is a default index
https://fedorahosted.org/389/ticket/47831
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: In ldbm_instance_index_config_enable_index(), only call
the function ldbm_index_parse_entry() if the index does not exist. Instead,
get the name of the index from the "cn" attribute of the entry, and use
ainfo_get() to get the index. If this returns NULL, then call
ldbm_index_parse_entry() to create and parse the index.
Platforms tested: Fedora 20
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index e2bec7910..51801f526 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -347,19 +347,26 @@ int ldbm_instance_config_add_index_entry(
int
ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e)
{
- char *index_name;
- int rc;
+ char *index_name = NULL;
+ int rc = LDAP_SUCCESS;
+ struct attrinfo *ai = NULL;
- rc=ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
+ index_name = slapi_entry_attr_get_charptr(e, "cn");
+ if (index_name) {
+ ainfo_get(inst->inst_be, index_name, &ai);
+ }
+ if (!ai) {
+ rc=ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
+ }
if (rc == LDAP_SUCCESS) {
/* Assume the caller knows if it is OK to go online immediately */
- struct attrinfo *ai = NULL;
-
- ainfo_get(inst->inst_be, index_name, &ai);
+ if (!ai) {
+ ainfo_get(inst->inst_be, index_name, &ai);
+ }
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
- slapi_ch_free((void **)&index_name);
- }
+ }
+ slapi_ch_free_string(&index_name);
return rc;
}
| 0 |
5d975ea1a14b9eaf31eea8032e911c68c047965b
|
389ds/389-ds-base
|
add testcase for ticket 48759
Fixes for ticket 47859 reviewed by Noriko, thanks
|
commit 5d975ea1a14b9eaf31eea8032e911c68c047965b
Author: Ludwig Krispenz <[email protected]>
Date: Tue Mar 15 12:18:22 2016 +0100
add testcase for ticket 48759
Fixes for ticket 47859 reviewed by Noriko, thanks
diff --git a/dirsrvtests/tests/tickets/ticket48759_test.py b/dirsrvtests/tests/tickets/ticket48759_test.py
new file mode 100644
index 000000000..93c322385
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket48759_test.py
@@ -0,0 +1,285 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+MEMBEROF_PLUGIN_DN = ('cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config')
+GROUP_DN = ("cn=group," + DEFAULT_SUFFIX)
+MEMBER_DN_COMP = "uid=member"
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ # Here we have standalone instance up and running
+ return TopologyStandalone(standalone)
+
+def _add_group_with_members(topology):
+ # Create group
+ try:
+ topology.standalone.add_s(Entry((GROUP_DN,
+ {'objectclass': 'top groupofnames'.split(),
+ 'cn': 'group'})))
+ except ldap.LDAPError as e:
+ log.fatal('Failed to add group: error ' + e.message['desc'])
+ assert False
+
+ # Add members to the group - set timeout
+ log.info('Adding members to the group...')
+ for idx in range(1, 5):
+ try:
+ MEMBER_VAL = ("uid=member%d,%s" % (idx, DEFAULT_SUFFIX))
+ topology.standalone.modify_s(GROUP_DN,
+ [(ldap.MOD_ADD,
+ 'member',
+ MEMBER_VAL)])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to update group: member (%s) - error: %s' %
+ (MEMBER_VAL, e.message['desc']))
+ assert False
+
+def _find_retrocl_changes(topology, user_dn=None):
+ ents = topology.standalone.search_s('cn=changelog', ldap.SCOPE_SUBTREE, '(targetDn=%s)' %user_dn)
+ return len(ents)
+
+def _find_memberof(topology, user_dn=None, group_dn=None, find_result=True):
+ ent = topology.standalone.getEntry(user_dn, ldap.SCOPE_BASE, "(objectclass=*)", ['memberof'])
+ found = False
+ if ent.hasAttr('memberof'):
+
+ for val in ent.getValues('memberof'):
+ topology.standalone.log.info("!!!!!!! %s: memberof->%s" % (user_dn, val))
+ if val == group_dn:
+ found = True
+ break
+
+ if find_result:
+ assert(found)
+ else:
+ assert(not found)
+
+def test_ticket48759(topology):
+ """
+ The fix for ticket 48759 has to prevent plugin calls for tombstone purging
+
+ The test uses the memberof and retrocl plugins to verify this.
+ In tombstone purging without the fix the mmeberof plugin is called,
+ if the tombstone entry is a group,
+ it modifies the user entries for the group
+ and if retrocl is enabled this mod is written to the retrocl
+
+ The test sequence is:
+ - enable replication
+ - enable memberof and retro cl plugin
+ - add user entries
+ - add a group and add the users as members
+ - verify memberof is set to users
+ - delete the group
+ - verify memberof is removed from users
+ - add group again
+ - verify memberof is set to users
+ - get number of changes in retro cl for one user
+ - configure tombstone purging
+ - wait for purge interval to pass
+ - add a dummy entry to increase maxcsn
+ - wait for purge interval to pass two times
+ - get number of changes in retro cl for user again
+ - assert there was no additional change
+ """
+
+ log.info('Testing Ticket 48759 - no plugin calls for tombstone purging')
+
+ #
+ # Setup Replication
+ #
+ log.info('Setting up replication...')
+ topology.standalone.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=REPLICAROLE_MASTER,
+ replicaId=REPLICAID_MASTER_1)
+
+ #
+ # enable dynamic plugins, memberof and retro cl plugin
+ #
+ log.info('Enable plugins...')
+ try:
+ topology.standalone.modify_s(DN_CONFIG,
+ [(ldap.MOD_REPLACE,
+ 'nsslapd-dynamic-plugins',
+ 'on')])
+ except ldap.LDAPError as e:
+ ldap.error('Failed to enable dynamic plugins! ' + e.message['desc'])
+ assert False
+
+ topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
+ # Configure memberOf group attribute
+ try:
+ topology.standalone.modify_s(MEMBEROF_PLUGIN_DN,
+ [(ldap.MOD_REPLACE,
+ 'memberofgroupattr',
+ 'member')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to configure memberOf plugin: error ' + e.message['desc'])
+ assert False
+
+
+ #
+ # create some users and a group
+ #
+ log.info('create users and group...')
+ for idx in range(1, 5):
+ try:
+ USER_DN = ("uid=member%d,%s" % (idx, DEFAULT_SUFFIX))
+ topology.standalone.add_s(Entry((USER_DN,
+ {'objectclass': 'top extensibleObject'.split(),
+ 'uid': 'member%d' % (idx)})))
+ except ldap.LDAPError as e:
+ log.fatal('Failed to add user (%s): error %s' % (USER_DN, e.message['desc']))
+ assert False
+
+ _add_group_with_members(topology)
+
+ MEMBER_VAL = ("uid=member2,%s" % DEFAULT_SUFFIX)
+ time.sleep(1)
+ _find_memberof(topology, MEMBER_VAL, GROUP_DN, True)
+
+ # delete group
+ log.info('delete group...')
+ try:
+ topology.standalone.delete_s(GROUP_DN)
+ except ldap.LDAPError as e:
+ log.error('Failed to delete entry: ' + e.message['desc'])
+ assert False
+
+ time.sleep(1)
+ _find_memberof(topology, MEMBER_VAL, GROUP_DN, False)
+
+ # add group again
+ log.info('add group again')
+ _add_group_with_members(topology)
+ time.sleep(1)
+ _find_memberof(topology, MEMBER_VAL, GROUP_DN, True)
+
+ #
+ # get number of changelog records for one user entry
+ log.info('get number of changes for %s before tombstone purging' % MEMBER_VAL)
+ changes_pre = _find_retrocl_changes(topology, MEMBER_VAL)
+
+ # configure tombstone purging
+ args = {REPLICA_PRECISE_PURGING: 'on',
+ REPLICA_PURGE_DELAY: '5',
+ REPLICA_PURGE_INTERVAL: '5'}
+ try:
+ topology.standalone.replica.setProperties(DEFAULT_SUFFIX, None, None, args)
+ except:
+ log.fatal('Failed to configure replica')
+ assert False
+
+ # Wait for the interval to pass
+ log.info('Wait for tombstone purge interval to pass ...')
+ time.sleep(6)
+
+ # Add an entry to trigger replication
+ log.info('add dummy entry')
+ try:
+ topology.standalone.add_s(Entry(('cn=test_entry,dc=example,dc=com', {
+ 'objectclass': 'top person'.split(),
+ 'sn': 'user',
+ 'cn': 'entry1'})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add entry: ' + e.message['desc'])
+ assert False
+
+ # check memberof is still correct
+ time.sleep(1)
+ _find_memberof(topology, MEMBER_VAL, GROUP_DN, True)
+
+ # Wait for the interval to pass again
+ log.info('Wait for tombstone purge interval to pass again...')
+ time.sleep(10)
+
+ #
+ # get number of changelog records for one user entry
+ log.info('get number of changes for %s before tombstone purging' % MEMBER_VAL)
+ changes_post = _find_retrocl_changes(topology, MEMBER_VAL)
+
+ assert (changes_pre == changes_post)
+
+
+def test_ticket48759_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket48759(topo)
+ test_ticket48759_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
| 0 |
efe42b474049e790401179a75e8574ec2029cc8f
|
389ds/389-ds-base
|
Ticket 48043 - use nunc-stans config initializer
Description: Use the nunc-stans thread pool config initializer before
creating a new thread pool.
https://fedorahosted.org/389/ticket/48043
Reviewed by: rmeggins(Thanks!)
|
commit efe42b474049e790401179a75e8574ec2029cc8f
Author: Mark Reynolds <[email protected]>
Date: Thu Feb 26 15:33:33 2015 -0500
Ticket 48043 - use nunc-stans config initializer
Description: Use the nunc-stans thread pool config initializer before
creating a new thread pool.
https://fedorahosted.org/389/ticket/48043
Reviewed by: rmeggins(Thanks!)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index dc69bc481..9ddd78034 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1498,6 +1498,8 @@ void slapd_daemon( daemon_ports_t *ports )
maxthreads = atoi(getenv("MAX_THREADS"));
}
/* Set the nunc-stans thread pool config */
+ ns_thrpool_config_init(&tp_config);
+
tp_config.initial_threads = maxthreads;
tp_config.max_threads = maxthreads;
tp_config.stacksize = 0;
| 0 |
52632d7cfbb74b98fc807a7c5b831f0f2f428c57
|
389ds/389-ds-base
|
Bug 643937 - Initialize replication version flags
The flags used to identity the replication protocol versions for
7.1 and 9.0 are not being initialized. This can cause the wrong
protocol to be used when replicating to another server. This
patch initializes the flags to 0 when the structures are created.
|
commit 52632d7cfbb74b98fc807a7c5b831f0f2f428c57
Author: Nathan Kinder <[email protected]>
Date: Mon Oct 18 09:33:11 2010 -0700
Bug 643937 - Initialize replication version flags
The flags used to identity the replication protocol versions for
7.1 and 9.0 are not being initialized. This can cause the wrong
protocol to be used when replicating to another server. This
patch initializes the flags to 0 when the structures are created.
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index dde91f19a..dac03ba30 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -2100,6 +2100,8 @@ Repl_5_Inc_Protocol_new(Repl_Protocol *rp)
prp->private = (void *)rip;
prp->replica_acquired = PR_FALSE;
prp->repl50consumer = 0;
+ prp->repl71consumer = 0;
+ prp->repl90consumer = 0;
return prp;
loser:
repl5_inc_delete(&prp);
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index d679ca294..f383f4c42 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -583,6 +583,8 @@ Repl_5_Tot_Protocol_new(Repl_Protocol *rp)
prp->private = (void *)rip;
prp->replica_acquired = PR_FALSE;
prp->repl50consumer = 0;
+ prp->repl71consumer = 0;
+ prp->repl90consumer = 0;
return prp;
loser:
repl5_tot_delete(&prp);
| 0 |
a64d6be1a11eea4129e0c02f07fa79aa9bfa0a38
|
389ds/389-ds-base
|
Issue 49256 - log warning when thread number is very different from autotuned value
Description: To help prevent customers from setting incorrect values for
the thread number it would be useful to warn them that the
configured value is either way too low or way too high.
relates: https://pagure.io/389-ds-base/issue/49256
Reviewed by: firstyear(Thanks!)
|
commit a64d6be1a11eea4129e0c02f07fa79aa9bfa0a38
Author: Mark Reynolds <[email protected]>
Date: Mon Jun 22 17:49:10 2020 -0400
Issue 49256 - log warning when thread number is very different from autotuned value
Description: To help prevent customers from setting incorrect values for
the thread number it would be useful to warn them that the
configured value is either way too low or way too high.
relates: https://pagure.io/389-ds-base/issue/49256
Reviewed by: firstyear(Thanks!)
diff --git a/dirsrvtests/tests/suites/config/autotuning_test.py b/dirsrvtests/tests/suites/config/autotuning_test.py
index d1c751444..540761250 100644
--- a/dirsrvtests/tests/suites/config/autotuning_test.py
+++ b/dirsrvtests/tests/suites/config/autotuning_test.py
@@ -43,6 +43,34 @@ def test_threads_basic(topo):
assert topo.standalone.config.get_attr_val_int("nsslapd-threadnumber") > 0
+def test_threads_warning(topo):
+ """Check that we log a warning if the thread number is too high or low
+
+ :id: db92412b-2812-49de-84b0-00f452cd254f
+ :setup: Standalone Instance
+ :steps:
+ 1. Get autotuned thread number
+ 2. Set threads way higher than hw threads, and find a warning in the log
+ 3. Set threads way lower than hw threads, and find a warning in the log
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ """
+ topo.standalone.config.set("nsslapd-threadnumber", "-1")
+ autotuned_value = topo.standalone.config.get_attr_val_utf8("nsslapd-threadnumber")
+
+ topo.standalone.config.set("nsslapd-threadnumber", str(int(autotuned_value) * 4))
+ time.sleep(.5)
+ assert topo.standalone.ds_error_log.match('.*higher.*hurt server performance.*')
+
+ if int(autotuned_value) > 1:
+ # If autotuned is 1, there isn't anything to test here
+ topo.standalone.config.set("nsslapd-threadnumber", "1")
+ time.sleep(.5)
+ assert topo.standalone.ds_error_log.match('.*lower.*hurt server performance.*')
+
+
@pytest.mark.parametrize("invalid_value", ('-2', '0', 'invalid'))
def test_threads_invalid_value(topo, invalid_value):
"""Check nsslapd-threadnumber for an invalid values
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index d540d84c9..97af7bb3c 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -4374,6 +4374,7 @@ config_set_threadnumber(const char *attrname, char *value, char *errorbuf, int a
{
int retVal = LDAP_SUCCESS;
int32_t threadnum = 0;
+ int32_t hw_threadnum = 0;
char *endp = NULL;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
@@ -4386,8 +4387,39 @@ config_set_threadnumber(const char *attrname, char *value, char *errorbuf, int a
threadnum = strtol(value, &endp, 10);
/* Means we want to re-run the hardware detection. */
+ hw_threadnum = util_get_hardware_threads();
if (threadnum == -1) {
- threadnum = util_get_hardware_threads();
+ threadnum = hw_threadnum;
+ } else {
+ /*
+ * Log a message if the user defined thread number is very different
+ * from the hardware threads as this is probably not the optimal
+ * value.
+ */
+ if (threadnum >= hw_threadnum) {
+ if (threadnum > MIN_THREADS && threadnum / hw_threadnum >= 4) {
+ /* We're over the default minimum and way higher than the hw
+ * threads. */
+ slapi_log_err(SLAPI_LOG_NOTICE, "config_set_threadnumber",
+ "The configured thread number (%d) is significantly "
+ "higher than the number of hardware threads (%d). "
+ "This can potentially hurt server performance. If "
+ "you are unsure how to tune \"nsslapd-threadnumber\" "
+ "then set it to \"-1\" and the server will tune it "
+ "according to the system hardware\n",
+ threadnum, hw_threadnum);
+ }
+ } else if (threadnum < MIN_THREADS) {
+ /* The thread number should never be less than the minimum and
+ * hardware threads. */
+ slapi_log_err(SLAPI_LOG_WARNING, "config_set_threadnumber",
+ "The configured thread number (%d) is lower than the number "
+ "of hardware threads (%d). This will hurt server performance. "
+ "If you are unsure how to tune \"nsslapd-threadnumber\" then "
+ "set it to \"-1\" and the server will tune it according to the "
+ "system hardware\n",
+ threadnum, hw_threadnum);
+ }
}
if (*endp != '\0' || errno == ERANGE || threadnum < 1 || threadnum > 65535) {
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index cef8c789c..7e0fa61c8 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -403,6 +403,9 @@ typedef void (*VFPV)(); /* takes undefined arguments */
#define SLAPD_DEFAULT_PW_MAX_CLASS_CHARS_ATTRIBUTE 0
#define SLAPD_DEFAULT_PW_MAX_CLASS_CHARS_ATTRIBUTE_STR "0"
+#define MIN_THREADS 16
+#define MAX_THREADS 512
+
/* Default password values. */
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index fda4fdfe6..7d0dc078a 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -41,9 +41,6 @@
#define FILTER_BUF 128 /* initial buffer size for attr value */
#define BUF_INCR 16 /* the amount to increase the FILTER_BUF once it fills up */
-#define MIN_THREADS 16
-#define MAX_THREADS 512
-
/* slapi-private contains the pal. */
#include <slapi-private.h>
| 0 |
37c531d17ce6dfe1ffd7b42adafc03960def3a40
|
389ds/389-ds-base
|
Ticket 568 - make usage of transaction batch flush durable
Bug Description: if a transaction batch value >1 is specified
in a txn commit the txn log is ionly flushed if the batch
limit is reached. This can increase performance, but since
the operation is acknowleded to the client, a crash before
flushing the log would violate the durability condition.
Fix Description: to allow txn log flushing in batches, if batch-limit > 0
the flushing is done in the logflush thread. In a txn commit
a worker thread adds its transaction to the list of txns to flush,
eventually notifies the logflush thread and waits until logflushthread
confirms that the txn was flushed. only then the worker thread
continues and acknowledges success to the client.
There needs to be care that the txn logs are flushed frequently by the
logflush thread, even if there are less than the batch limit of txns
are waiting to be flushed.
one condition is base on active txns vs waiting txns, if there are no more
outstanding txns do flush.
the other condition is tiome based on two configurable timers:
- the logflush thread sleeps on a condition variable until it gets notified
by a worker thread that the batch limit is exceeded or the interval has passed
- if it awakes it checks when the last flush was done and either if it is longer
than th esecond timeer or the batch limit is reached the txns are flushed
The fix provided here makes the use of batch vals safe, but to get a performance
benefit further changes are required. Right now the txn is started and committed
inside dblayer_lock|unlock_backend, so txns cannot accumulate to be flushed.
So the order of txn and backend locking needs to be reveresed, or eventually the
code in the worker thread handling the synchronization could be move close to
sending the result to the client. But this optimization question ahs been moved
to a seperate ticket: 47358
The fix includes a minor change for the trickle thread, it is only started if trickling
is required (trickle percentage > 0).
https://fedorahosted.org/389/ticket/568
Reviewed by: Noriko, Thanks
|
commit 37c531d17ce6dfe1ffd7b42adafc03960def3a40
Author: Ludwig Krispenz <[email protected]>
Date: Tue May 14 11:47:12 2013 +0200
Ticket 568 - make usage of transaction batch flush durable
Bug Description: if a transaction batch value >1 is specified
in a txn commit the txn log is ionly flushed if the batch
limit is reached. This can increase performance, but since
the operation is acknowleded to the client, a crash before
flushing the log would violate the durability condition.
Fix Description: to allow txn log flushing in batches, if batch-limit > 0
the flushing is done in the logflush thread. In a txn commit
a worker thread adds its transaction to the list of txns to flush,
eventually notifies the logflush thread and waits until logflushthread
confirms that the txn was flushed. only then the worker thread
continues and acknowledges success to the client.
There needs to be care that the txn logs are flushed frequently by the
logflush thread, even if there are less than the batch limit of txns
are waiting to be flushed.
one condition is base on active txns vs waiting txns, if there are no more
outstanding txns do flush.
the other condition is tiome based on two configurable timers:
- the logflush thread sleeps on a condition variable until it gets notified
by a worker thread that the batch limit is exceeded or the interval has passed
- if it awakes it checks when the last flush was done and either if it is longer
than th esecond timeer or the batch limit is reached the txns are flushed
The fix provided here makes the use of batch vals safe, but to get a performance
benefit further changes are required. Right now the txn is started and committed
inside dblayer_lock|unlock_backend, so txns cannot accumulate to be flushed.
So the order of txn and backend locking needs to be reveresed, or eventually the
code in the worker thread handling the synchronization could be move close to
sending the result to the client. But this optimization question ahs been moved
to a seperate ticket: 47358
The fix includes a minor change for the trickle thread, it is only started if trickling
is required (trickle percentage > 0).
https://fedorahosted.org/389/ticket/568
Reviewed by: Noriko, Thanks
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index e272cfaca..2d5f98ff7 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -219,9 +219,16 @@ static int dblayer_start_checkpoint_thread(struct ldbminfo *li);
static int dblayer_start_trickle_thread(struct ldbminfo *li);
static int dblayer_start_perf_thread(struct ldbminfo *li);
static int dblayer_start_txn_test_thread(struct ldbminfo *li);
-static int trans_batch_count=1;
+static int trans_batch_count=0;
static int trans_batch_limit=0;
+static int trans_batch_txn_min_sleep = 50; /* ms */
+static int trans_batch_txn_max_sleep = 50;
static PRBool log_flush_thread=PR_FALSE;
+static int txn_in_progress_count = 0;
+static int *txn_log_flush_pending = NULL;
+static PRLock *sync_txn_log_flush = NULL;
+static PRCondVar *sync_txn_log_flush_done = NULL;
+static PRCondVar *sync_txn_log_do_flush = NULL;
static int dblayer_db_remove_ex(dblayer_private_env *env, char const path[], char const dbName[], PRBool use_lock);
static void dblayer_init_pvt_txn();
static void dblayer_push_pvt_txn(back_txn *txn);
@@ -342,12 +349,59 @@ dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase
}
return retval;
}
+int
+dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phase, int apply) {
+ int val = (int)((uintptr_t)value);
+ int retval = LDAP_SUCCESS;
+
+ if (apply) {
+ if(phase == CONFIG_PHASE_STARTUP) {
+ trans_batch_txn_min_sleep=val;
+ } else if(trans_batch_txn_min_sleep != FLUSH_REMOTEOFF ) {
+ if((val == 0) && (log_flush_thread)) {
+ log_flush_thread=PR_FALSE;
+ trans_batch_txn_min_sleep = FLUSH_REMOTEOFF;
+ } else if(val > 0) {
+ trans_batch_txn_min_sleep=val;
+ }
+ }
+ }
+ return retval;
+}
+int
+dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phase, int apply) {
+ int val = (int)((uintptr_t)value);
+ int retval = LDAP_SUCCESS;
+
+ if (apply) {
+ if(phase == CONFIG_PHASE_STARTUP) {
+ trans_batch_txn_max_sleep=val;
+ } else if(trans_batch_txn_max_sleep != FLUSH_REMOTEOFF ) {
+ if((val == 0) && (log_flush_thread)) {
+ log_flush_thread=PR_FALSE;
+ trans_batch_txn_max_sleep = FLUSH_REMOTEOFF;
+ } else if(val > 0) {
+ trans_batch_txn_max_sleep=val;
+ }
+ }
+ }
+ return retval;
+}
void *
dblayer_get_batch_transactions(void *arg) {
return (void *)((uintptr_t)trans_batch_limit);
}
+void *
+dblayer_get_batch_txn_min_sleep(void *arg) {
+ return (void *)((uintptr_t)trans_batch_txn_min_sleep);
+}
+
+void *
+dblayer_get_batch_txn_max_sleep(void *arg) {
+ return (void *)((uintptr_t)trans_batch_txn_max_sleep);
+}
/*
Threading: dblayer isolates upper layers from threading considerations
@@ -3507,10 +3561,17 @@ dblayer_txn_begin_ext(struct ldbminfo *li, back_txnid parent_txn, back_txn *txn,
{
/* this txn is now our current transaction for current operations
and new parent for any nested transactions created */
- dblayer_push_pvt_txn(&new_txn);
- if (txn) {
- txn->back_txn_txn = new_txn.back_txn_txn;
- }
+ if (use_lock && log_flush_thread) {
+ int txn_id = new_txn.back_txn_txn->id(new_txn.back_txn_txn);
+ PR_Lock(sync_txn_log_flush);
+ txn_in_progress_count++;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_begin: batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ PR_Unlock(sync_txn_log_flush);
+ }
+ dblayer_push_pvt_txn(&new_txn);
+ if (txn) {
+ txn->back_txn_txn = new_txn.back_txn_txn;
+ }
}
} else
{
@@ -3554,6 +3615,8 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
dblayer_private *priv = NULL;
DB_TXN *db_txn = NULL;
back_txn *cur_txn = NULL;
+ int txn_id = 0;
+ int txn_batch_slot = 0;
PR_ASSERT(NULL != li);
@@ -3576,6 +3639,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
priv->dblayer_env &&
priv->dblayer_enable_transactions)
{
+ txn_id = db_txn->id(db_txn);
return_value = TXN_COMMIT(db_txn, 0);
/* if we were given a transaction, and it is the same as the
current transaction in progress, pop it off the stack
@@ -3590,17 +3654,33 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
}
if ((priv->dblayer_durable_transactions) && use_lock ) {
if(trans_batch_limit > 0) {
- if(trans_batch_count % trans_batch_limit) {
- trans_batch_count++;
- } else {
- LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- trans_batch_count=1;
- }
+ /* let log_flush thread do the flushing */
+ PR_Lock(sync_txn_log_flush);
+ txn_batch_slot = trans_batch_count++;
+ txn_log_flush_pending[txn_batch_slot] = txn_id;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (befor notify): batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ /* the log flush thread will periodically flush the txn log,
+ * but in two cases it should be notified to do it immediately:
+ * - the batch limit is passed
+ * - there is no other outstanding txn
+ */
+ if (trans_batch_count > trans_batch_limit ||
+ trans_batch_count == txn_in_progress_count)
+ PR_NotifyCondVar(sync_txn_log_do_flush);
+ /* we need to wait until the txn has been flushed before continuing
+ * and returning success to the client, nit to vialate durability
+ * PR_WaitCondvar releases and reaquires the lock
+ */
+ while (txn_log_flush_pending[txn_batch_slot] == txn_id)
+ PR_WaitCondVar(sync_txn_log_flush_done, PR_INTERVAL_NO_TIMEOUT);
+ txn_in_progress_count--;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (before unlock): batchcount: %d, txn_in_progress: %d, curr_txn %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ PR_Unlock(sync_txn_log_flush);
} else if(trans_batch_limit == FLUSH_REMOTEOFF) { /* user remotely turned batching off */
LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- }
- }
- if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
+ }
+ }
+ if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
} else
{
return_value = 0;
@@ -3663,6 +3743,13 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
priv->dblayer_env &&
priv->dblayer_enable_transactions)
{
+ int txn_id = db_txn->id(db_txn);
+ if (log_flush_thread) {
+ PR_Lock(sync_txn_log_flush);
+ txn_in_progress_count--;
+ PR_Unlock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_abort : batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ }
return_value = TXN_ABORT(db_txn);
/* if we were given a transaction, and it is the same as the
current transaction in progress, pop it off the stack
@@ -4336,10 +4423,17 @@ static int
dblayer_start_log_flush_thread(dblayer_private *priv)
{
int return_value = 0;
+ int max_threads = config_get_threadnumber();
if ((priv->dblayer_durable_transactions) &&
(priv->dblayer_enable_transactions) && (trans_batch_limit > 0)) {
log_flush_thread=PR_TRUE;
+ /* initialize the synchronization objects for the log_flush and worker threads */
+ sync_txn_log_flush = PR_NewLock();
+ sync_txn_log_flush_done = PR_NewCondVar (sync_txn_log_flush);
+ sync_txn_log_do_flush = PR_NewCondVar (sync_txn_log_flush);
+ txn_log_flush_pending = (int*)slapi_ch_malloc(max_threads*sizeof(int));
+
if (NULL == PR_CreateThread (PR_USER_THREAD,
(VFP) (void *) log_flush_threadmain, priv,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
@@ -4365,28 +4459,65 @@ dblayer_start_log_flush_thread(dblayer_private *priv)
static int log_flush_threadmain(void *param)
{
dblayer_private *priv = NULL;
- PRIntervalTime interval;
+ PRIntervalTime interval_wait, interval_flush, interval_def;
+ PRIntervalTime last_flush;
+ int i;
+ int do_flush = 0;
PR_ASSERT(NULL != param);
priv = (dblayer_private *) param;
INCR_THREAD_COUNT(priv);
- interval = PR_MillisecondsToInterval(300);
+ interval_flush = PR_MillisecondsToInterval(trans_batch_txn_min_sleep);
+ interval_wait = PR_MillisecondsToInterval(trans_batch_txn_max_sleep);
+ interval_def = PR_MillisecondsToInterval(300); /*used while no txn or txn batching */
+ /* LK this is only needed if online change of
+ * of txn config is supported ???
+ */
while ((!priv->dblayer_stop_threads) && (log_flush_thread))
{
if (priv->dblayer_enable_transactions)
- {
- DB_CHECKPOINT_LOCK(1, priv->dblayer_env->dblayer_env_lock);
- if(trans_batch_limit > 0) {
- if(trans_batch_count > 1) {
- LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- trans_batch_count=1;
- }
- }
- DB_CHECKPOINT_UNLOCK(1, priv->dblayer_env->dblayer_env_lock);
- }
- DS_Sleep(interval);
+ {
+ if (trans_batch_limit > 0) {
+ /* synchronize flushing thread with workers */
+ PR_Lock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (in loop): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ /* if here, do flush the txn logs if any of the following conditions are met
+ * - batch limit exceeded
+ * - no more active transaction, no need to wait
+ * - do_flush indicate that the max waiting interval is exceeded
+ */
+ if(trans_batch_count >= trans_batch_limit || trans_batch_count == txn_in_progress_count || do_flush) {
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (working): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
+ for (i=0;i<trans_batch_count;i++)
+ txn_log_flush_pending[i] = 0;
+ trans_batch_count = 0;
+ last_flush = PR_IntervalNow();
+ do_flush = 0;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (before notify): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ PR_NotifyAllCondVar(sync_txn_log_flush_done);
+ }
+ /* wait until flushing conditions are met */
+ while ( trans_batch_count == 0 ||
+ ( trans_batch_count < trans_batch_limit &&
+ trans_batch_count < txn_in_progress_count)) {
+ if (priv->dblayer_stop_threads) break;
+ if (PR_IntervalNow() - last_flush > interval_flush) {
+ do_flush = 1;
+ break;
+ }
+ PR_WaitCondVar(sync_txn_log_do_flush, interval_wait);
+ }
+ PR_Unlock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (wakeup): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ } else {
+ DS_Sleep(interval_def);
+ }
+ } else {
+ DS_Sleep(interval_def);
+ }
}
DECR_THREAD_COUNT(priv);
@@ -4580,6 +4711,11 @@ static int
dblayer_start_trickle_thread(struct ldbminfo *li)
{
int return_value = 0;
+ dblayer_private *priv = (dblayer_private*)li->li_dblayer_private;
+
+ if (priv->dblayer_trickle_percentage == 0)
+ return return_value;
+
if (NULL == PR_CreateThread (PR_USER_THREAD,
(VFP) (void *) trickle_threadmain, li,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 232af5417..b72984b38 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -1326,6 +1326,8 @@ static config_info ldbm_config[] = {
{CONFIG_DB_TRANSACTION_LOGGING, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_transaction_logging_get, &ldbm_config_db_transaction_logging_set, 0},
{CONFIG_DB_CHECKPOINT_INTERVAL, CONFIG_TYPE_INT, "60", &ldbm_config_db_checkpoint_interval_get, &ldbm_config_db_checkpoint_interval_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_TRANSACTION_BATCH, CONFIG_TYPE_INT, "0", &dblayer_get_batch_transactions, &dblayer_set_batch_transactions, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ {CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_min_sleep, &dblayer_set_batch_txn_min_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ {CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_max_sleep, &dblayer_set_batch_txn_max_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_LOGBUF_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_logbuf_size_get, &ldbm_config_db_logbuf_size_set, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_DB_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_page_size_get, &ldbm_config_db_page_size_set, 0},
{CONFIG_DB_INDEX_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_index_page_size_get, &ldbm_config_db_index_page_size_set, 0},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index a5830e344..204f64d8c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -111,6 +111,8 @@ struct config_info {
#define CONFIG_DB_TRANSACTION_LOGGING "nsslapd-db-transaction-logging"
#define CONFIG_DB_CHECKPOINT_INTERVAL "nsslapd-db-checkpoint-interval"
#define CONFIG_DB_TRANSACTION_BATCH "nsslapd-db-transaction-batch-val"
+#define CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP "nsslapd-db-transaction-batch-min-wait"
+#define CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP "nsslapd-db-transaction-batch-max-wait"
#define CONFIG_DB_LOGBUF_SIZE "nsslapd-db-logbuf-size"
#define CONFIG_DB_PAGE_SIZE "nsslapd-db-page-size"
#define CONFIG_DB_INDEX_PAGE_SIZE "nsslapd-db-index-page-size" /* With the new
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index e87c9007d..a3261852d 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -163,7 +163,11 @@ PRInt64 db_atol(char *str, int *err);
PRInt64 db_atoi(char *str, int *err);
unsigned long db_strtoul(const char *str, int *err);
int dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase, int apply);
+int dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phase, int apply);
+int dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phase, int apply);
void *dblayer_get_batch_transactions(void *arg);
+void *dblayer_get_batch_txn_min_sleep(void *arg);
+void *dblayer_get_batch_txn_max_sleep(void *arg);
int dblayer_in_import(ldbm_instance *inst);
int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext);
| 0 |
886581f3a50ccc1ffa67894cb2cc9010f07e31d6
|
389ds/389-ds-base
|
added .spec file for building RPM - package is svrcore-devel - a script svrcore-config for getting cflag and ldflag information, and a .pc file for pkg-config
|
commit 886581f3a50ccc1ffa67894cb2cc9010f07e31d6
Author: richm%stanfordalumni.org <richm%stanfordalumni.org>
Date: Fri Jan 6 18:02:35 2006 +0000
added .spec file for building RPM - package is svrcore-devel - a script svrcore-config for getting cflag and ldflag information, and a .pc file for pkg-config
diff --git a/Makefile b/Makefile
index 01a6df23d..e69de29bb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,100 +0,0 @@
-#! gmake
-#
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is the Netscape svrcore library.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1996, 1997
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY). #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL) #
-#######################################################################
-
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL). #
-#######################################################################
-
-# Build only static library
-IMPORT_LIBRARY=
-SHARED_LIBRARY=
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL) #
-#######################################################################
-
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL). #
-#######################################################################
-
-all release::
- @echo ---- Finished ----
-
-coreconf_hack:
- cd ../coreconf; $(MAKE) export
- $(MAKE) import
-
-RelEng_bld: coreconf_hack
- $(MAKE)
-
-ifeq ($(OS_ARCH), WINNT)
-libs install:: ntsvrcore.res
- $(NSINSTALL) -m 444 $< $(SOURCE_LIB_DIR)
-
-release_md::
- $(INSTALL) -m 444 ntsvrcore.res $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)
-endif
-
-ntsvrcore.res: ntgetpin.rc
- rc -fo $@ -i. $<
diff --git a/svrcore-config.in b/svrcore-config.in
new file mode 100644
index 000000000..e69de29bb
diff --git a/svrcore.pc.in b/svrcore.pc.in
new file mode 100644
index 000000000..df466d861
--- /dev/null
+++ b/svrcore.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: svrcore-devel
+Description: Svrcore - development files for secure PIN handling using NSS crypto
+Version: %SVRCORE_VERSION%
+Requires: nspr >= %NSPR_VERSION% , nss >= %NSS_VERSION%
+Libs: -lsvrcore
+Cflags: -I${includedir}
diff --git a/svrcore.spec b/svrcore.spec
new file mode 100644
index 000000000..907c2bd5f
--- /dev/null
+++ b/svrcore.spec
@@ -0,0 +1,139 @@
+%define nspr_version 4.6
+%define nss_version 3.11
+
+Summary: Svrcore - development files for secure PIN handling using NSS crypto
+Name: svrcore-devel
+Version: 4.0.1
+Release: 1
+License: MPL/GPL/LGPL
+URL: http://www.mozilla.org/projects/security/pki/
+Group: Development/Libraries
+Requires: nspr-devel >= %{nspr_version}, nss-devel >= %{nspr_version}
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: nspr-devel >= %{nspr_version}, nss-devel >= %{nss_version}
+BuildRequires: pkgconfig
+BuildRequires: gawk
+Provides: svrcore-devel
+
+Source0: %{name}-%{version}.tar.gz
+
+%description
+svrcore provides applications with several ways to handle secure PIN storage
+e.g. in an application that must be restarted, but needs the PIN to unlock
+the private key and other crypto material, without user intervention. svrcore
+uses the facilities provided by NSS.
+
+%prep
+%setup -q
+
+%build
+
+# Enable compiler optimizations and disable debugging code
+BUILD_OPT=1
+export BUILD_OPT
+
+# Generate symbolic info for debuggers
+XCFLAGS=$RPM_OPT_FLAGS
+export XCFLAGS
+
+#export NSPR_INCLUDE_DIR=`nspr-config --includedir`
+#export NSPR_LIB_DIR=`nspr-config --libdir`
+
+PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
+PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
+
+export PKG_CONFIG_ALLOW_SYSTEM_LIBS
+export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
+
+NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
+
+export NSPR_INCLUDE_DIR
+
+NSS_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nss | sed 's/-I//'`
+
+export NSS_INCLUDE_DIR
+
+%ifarch x86_64 ppc64 ia64 s390x
+USE_64=1
+export USE_64
+%endif
+
+cd mozilla/security/svrcore
+# This make assumes the build is still using the mozilla/security/coreconf stuff,
+# which does all kinds of crazy stuff with copying files around, looking for
+# dependencies, etc.
+make EXPORTS="" RELEASE="" REQUIRES="" MODULE="" IMPORTS="" OBJDIR=. INSTALL=true
+
+# Set up our package file
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
+%{__cat} svrcore.pc.in | sed -e "s,%%libdir%%,%{_libdir},g" \
+ -e "s,%%prefix%%,%{_prefix},g" \
+ -e "s,%%exec_prefix%%,%{_prefix},g" \
+ -e "s,%%includedir%%,%{_includedir}/nss3,g" \
+ -e "s,%%NSPR_VERSION%%,%{nspr_version},g" \
+ -e "s,%%NSS_VERSION%%,%{nss_version},g" \
+ -e "s,%%SVRCORE_VERSION%%,%{version},g" > \
+ $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/svrcore.pc
+
+VMAJOR=`echo %{version}|cut -f1 -d.`
+VMINOR=`echo %{version}|cut -f2 -d.`
+VPATCH=`echo %{version}|cut -f3 -d.`
+
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
+%{__cat} svrcore-config.in | sed -e "s,@libdir@,%{_libdir},g" \
+ -e "s,@prefix@,%{_prefix},g" \
+ -e "s,@exec_prefix@,%{_prefix},g" \
+ -e "s,@includedir@,%{_includedir},g" \
+ -e "s,@MOD_MAJOR_VERSION@,$VMAJOR,g" \
+ -e "s,@MOD_MINOR_VERSION@,$VMINOR,g" \
+ -e "s,@MOD_PATCH_VERSION@,$VPATCH,g" \
+ > $RPM_BUILD_ROOT/%{_bindir}/svrcore-config
+
+chmod 755 $RPM_BUILD_ROOT/%{_bindir}/svrcore-config
+
+
+%install
+
+# There is no make install target so we'll do it ourselves.
+
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_includedir}
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}
+%{__mkdir_p} $RPM_BUILD_ROOT/%{_bindir}
+
+cd mozilla/security/svrcore
+# Copy the binary libraries we want
+for file in libsvrcore.a
+do
+ %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_libdir}
+done
+
+# Copy the include files
+for file in svrcore.h
+do
+ %{__install} -m 644 $file $RPM_BUILD_ROOT/%{_includedir}
+done
+
+
+%clean
+%{__rm} -rf $RPM_BUILD_ROOT
+
+
+%post
+/sbin/ldconfig >/dev/null 2>/dev/null
+
+
+%postun
+/sbin/ldconfig >/dev/null 2>/dev/null
+
+
+%files
+%defattr(0644,root,root)
+%{_libdir}/pkgconfig/svrcore.pc
+%{_libdir}/libsvrcore.a
+%attr(0755,root,root) %{_bindir}/svrcore-config
+%{_includedir}/svrcore.h
+
+%changelog
+* Mon Dec 19 2005 Rich Megginson <[email protected]> - 4.01-1
+- Initial revision
+
| 0 |
92864e0b229a61ba65bd8e923e04f08bef48e2b2
|
389ds/389-ds-base
|
Ticket 48432 - Linux capabilities on ns-slapd
Bug Description: Support capabilities on ns-slapd allowing dirsrv
to start the Directory Server service directly.
Fix Description: Fix the rpm spec to set the capabilities. This
should allow us to run with systemd and docker without root
privs.
https://pagure.io/389-ds-base/issue/48432
Author: wibrown
Review by: mreynolds, lslebodn (Thanks!)
|
commit 92864e0b229a61ba65bd8e923e04f08bef48e2b2
Author: William Brown <[email protected]>
Date: Fri Mar 10 15:17:35 2017 +1000
Ticket 48432 - Linux capabilities on ns-slapd
Bug Description: Support capabilities on ns-slapd allowing dirsrv
to start the Directory Server service directly.
Fix Description: Fix the rpm spec to set the capabilities. This
should allow us to run with systemd and docker without root
privs.
https://pagure.io/389-ds-base/issue/48432
Author: wibrown
Review by: mreynolds, lslebodn (Thanks!)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index a76d00e87..83bc20406 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -489,7 +489,50 @@ fi
%{_datadir}/%{pkgname}
%{_unitdir}
%{_bindir}/*
-%{_sbindir}/*
+# We have to seperate this from being a glob to ensure the caps are applied.
+%caps(CAP_NET_BIND_SERVICE=pe) %{_sbindir}/ns-slapd
+%{_sbindir}/bak2db
+%{_sbindir}/bak2db.pl
+%{_sbindir}/cleanallruv.pl
+%{_sbindir}/db2bak
+%{_sbindir}/db2bak.pl
+%{_sbindir}/db2index
+%{_sbindir}/db2index.pl
+%{_sbindir}/db2ldif
+%{_sbindir}/db2ldif.pl
+%{_sbindir}/dbmon.sh
+%{_sbindir}/dbverify
+%{_sbindir}/dn2rdn
+%{_sbindir}/ds_selinux_enabled
+%{_sbindir}/ds_selinux_port_query
+%{_sbindir}/ds_systemd_ask_password_acl
+%{_sbindir}/fixup-linkedattrs.pl
+%{_sbindir}/fixup-memberof.pl
+%{_sbindir}/ldif2db
+%{_sbindir}/ldif2db.pl
+%{_sbindir}/ldif2ldap
+%{_sbindir}/migrate-ds.pl
+%{_sbindir}/monitor
+%{_sbindir}/ns-accountstatus.pl
+%{_sbindir}/ns-activate.pl
+%{_sbindir}/ns-inactivate.pl
+%{_sbindir}/ns-newpwpolicy.pl
+%{_sbindir}/remove-ds.pl
+%{_sbindir}/restart-dirsrv
+%{_sbindir}/restoreconfig
+%{_sbindir}/saveconfig
+%{_sbindir}/schema-reload.pl
+%{_sbindir}/setup-ds.pl
+%{_sbindir}/start-dirsrv
+%{_sbindir}/status-dirsrv
+%{_sbindir}/stop-dirsrv
+%{_sbindir}/suffix2instance
+%{_sbindir}/syntax-validate.pl
+%{_sbindir}/upgradedb
+%{_sbindir}/upgradednformat
+%{_sbindir}/usn-tombstone-cleanup.pl
+%{_sbindir}/verify-db.pl
+%{_sbindir}/vlvindex
%{_libdir}/%{pkgname}/perl
%{_libdir}/%{pkgname}/python
%dir %{_libdir}/%{pkgname}/plugins
| 0 |
7dc6aaa83b9f854c81a1284a380f13e1aaab37d0
|
389ds/389-ds-base
|
The correct naming convention for RHEL is
RHEL4_x86_64_gcc3_OPT.OBJ
The makefiles were assuming that if the string 86 was found in uname -m
it should use x86 for the arch. However, it should only do this if
uname -m is not x86_64. Also, for RHEL/Linux, we do not have to add the
NS64TAG just before the _OPT (or _DBG) since it's already in the arch.
Other platforms continue to use the other naming convention. The
default naming convention for the mozilla components is
Linux2.6_x86_64_glibc_PTH_64_OPT.OBJ. I considered using Wan-Teh's
instructions about source builds, but that would cause many changes to
be made to our makefiles, so I just changed the way we calculate the
mozilla OBJDIR name from the regular OBJDIR name. These changes are
pretty much the same for adminutil, setuputil, adminserver, and ldapserver.
For ldapserver, I had to change nsarch (adminserver changed nsarch in a
different way). I also got rid of the 32 bit specific setup stuff. I
assume this was due to 32 bit NES admin server, so we can get rid of
this for the future, because we will have all native 64 bit apps. I also
went ahead and rolled in the gcc4 changes since they are safe for gcc3
as well.
|
commit 7dc6aaa83b9f854c81a1284a380f13e1aaab37d0
Author: Rich Megginson <[email protected]>
Date: Wed Feb 15 22:54:07 2006 +0000
The correct naming convention for RHEL is
RHEL4_x86_64_gcc3_OPT.OBJ
The makefiles were assuming that if the string 86 was found in uname -m
it should use x86 for the arch. However, it should only do this if
uname -m is not x86_64. Also, for RHEL/Linux, we do not have to add the
NS64TAG just before the _OPT (or _DBG) since it's already in the arch.
Other platforms continue to use the other naming convention. The
default naming convention for the mozilla components is
Linux2.6_x86_64_glibc_PTH_64_OPT.OBJ. I considered using Wan-Teh's
instructions about source builds, but that would cause many changes to
be made to our makefiles, so I just changed the way we calculate the
mozilla OBJDIR name from the regular OBJDIR name. These changes are
pretty much the same for adminutil, setuputil, adminserver, and ldapserver.
For ldapserver, I had to change nsarch (adminserver changed nsarch in a
different way). I also got rid of the 32 bit specific setup stuff. I
assume this was due to 32 bit NES admin server, so we can get rid of
this for the future, because we will have all native 64 bit apps. I also
went ahead and rolled in the gcc4 changes since they are safe for gcc3
as well.
diff --git a/buildpaths.mk b/buildpaths.mk
index 590b7f532..fab8ec9cc 100644
--- a/buildpaths.mk
+++ b/buildpaths.mk
@@ -71,10 +71,10 @@ ifdef MOZILLA_SOURCE_ROOT
# subdir of mozilla/dist, and their naming convention is different than
# ours - we need to map ours to theirs
ifneq (,$(findstring RHEL3,$(NSOBJDIR_NAME)))
- MOZ_OBJDIR_NAME = $(subst _gcc3_,_glibc_PTH_,$(subst RHEL3,Linux2.4,$(NSOBJDIR_NAME)))
+ MOZ_OBJDIR_NAME = $(subst _gcc3_,_glibc_PTH$(NS64TAG)_,$(subst RHEL3,Linux2.4,$(NSOBJDIR_NAME)))
else
ifneq (,$(findstring RHEL4,$(NSOBJDIR_NAME)))
- MOZ_OBJDIR_NAME = $(subst _gcc3_,_glibc_PTH_,$(subst RHEL4,Linux2.6,$(NSOBJDIR_NAME)))
+ MOZ_OBJDIR_NAME = $(subst _gcc3_,_glibc_PTH$(NS64TAG)_,$(subst RHEL4,Linux2.6,$(NSOBJDIR_NAME)))
else
MOZ_OBJDIR_NAME = $(NSOBJDIR_NAME)
endif
diff --git a/ldap/Makefile b/ldap/Makefile
index ba9ea3c8e..660b69d0d 100644
--- a/ldap/Makefile
+++ b/ldap/Makefile
@@ -62,16 +62,7 @@ ifneq ($(ARCH), WINNT)
cd systools; $(MAKE) $(MFLAGS) all
# new unix installer
ifeq ($(USE_SETUPUTIL), 1)
- # passing $(OBJDIR) as ORIGINAL_OBJDIR since USE_64 info is cleaned up
- # and lost in cm/newinst
- cd cm/newinst; $(MAKE) $(MFLAGS) ORIGINAL_OBJDIR=$(ABS_OBJDIR) all
-ifeq ($(USE_64),1)
- # In 64-bit builds, we build the installer 32-bit, which has the side-effect that the uninstaller and ns-update scripts
- # get copied into the 32-bit output directory by the makefile above. However, we later want to package them and expect
- # to see them in the 64-bit output directory. So, here we copy them over.
- $(CP) $(RELDIR_32)/bin/slapd/admin/bin/ns-update $(LDAP_ADMIN_BIN_RELDIR)
- $(CP) $(RELDIR_32)/bin/slapd/admin/bin/uninstall $(LDAP_ADMIN_BIN_RELDIR)
-endif # USE_64
+ cd cm/newinst; $(MAKE) $(MFLAGS) all
endif # USE_SETUPUTIL
else # not WINNT
ifeq ($(USE_SETUPUTIL), 1)
diff --git a/ldap/cm/Makefile b/ldap/cm/Makefile
index be1b04cc6..f4da6be37 100644
--- a/ldap/cm/Makefile
+++ b/ldap/cm/Makefile
@@ -254,11 +254,15 @@ ifeq ($(ARCH), Linux)
ZIP_FLAGS=-r -T -n .gif
endif
+ifeq ($(ARCH), Linux)
+MAKEARCH=$(ARCH)
+else
ifeq ($(USE_64), 1)
MAKEARCH=$(ARCH)64
else
MAKEARCH=$(ARCH)
endif
+endif
PACKAGE_SETUP_LIBS_32=$(subst $(NS64TAG),,$(PACKAGE_SETUP_LIBS))
@@ -598,7 +602,7 @@ ifeq ($(USE_SETUPUTIL),1)
endif
# copy in our product .inf files
- $(INSTALL) -m 755 $(OBJDIR_32)/*.inf $(INSTDIR)/slapd
+ $(INSTALL) -m 755 $(OBJDIR)/*.inf $(INSTDIR)/slapd
# strip the executables in the optimized build
ifeq ($(DEBUG), optimize)
@@ -668,10 +672,10 @@ endif
# do one last check for aix. aix zip doesn't like -r -T
$(ZIP) -T $(INSTDIR)/slapd/ns$(DIR).zip
# install the ns-config file into the slapd package directory
- $(INSTALL) -m 755 $(RELDIR_32)/bin/slapd/admin/bin/ns-config $(INSTDIR)/slapd
+ $(INSTALL) -m 755 $(RELDIR)/bin/slapd/admin/bin/ns-config $(INSTDIR)/slapd
# if we are packaging our own version of the components, we need them during setup too
- -@for file in $(PACKAGE_SETUP_LIBS_32) ; \
+ -@for file in $(PACKAGE_SETUP_LIBS) ; \
do if [ -f $$file ] ; \
then $(INSTALL) -m 755 $$file $(INSTDIR)/slapd ; \
fi ; \
diff --git a/ldap/cm/newinst/Makefile b/ldap/cm/newinst/Makefile
index b4442593b..bc51e922c 100644
--- a/ldap/cm/newinst/Makefile
+++ b/ldap/cm/newinst/Makefile
@@ -41,12 +41,6 @@
.SUFFIXES: .cc
-# We do this to force a 32-bit build of this stuff, even in a 64-bit build
-# (because we want to avoid various complexities inherenet in having a 64-bit
-# installer rubbing shoulders with other 32-bit stuff at install time).
-COMPONENT_DEPS := 1
-override USE_64=
-
BUILD_ROOT = ../../..
LDAP_SRC = ../..
@@ -96,7 +90,7 @@ else
BINS=$(addprefix $(BINDEST)/, $(PROGS))
endif
INFO= $(OBJDIR)/$(DIR)
-PATCHINFO= $(ORIGINAL_OBJDIR)/$(DIR)
+PATCHINFO= $(ABS_OBJDIR)/$(DIR)
# Source for staged installation utilities
INCDIR=$(SETUPUTIL_INCLUDE) -I$(LDAP_SRC)/admin/include -I$(LDAP_SRC)/admin/lib -I$(LDAP_SRC)/admin/src
diff --git a/ldap/nsldap.mk b/ldap/nsldap.mk
index 42aa3efdc..b9dbf41a0 100644
--- a/ldap/nsldap.mk
+++ b/ldap/nsldap.mk
@@ -1490,7 +1490,7 @@ ifeq ($(ARCH), Linux)
#
# compiler to use, e.g. CC=cc or CC=gcc
-CC=/usr/bin/gcc -fwritable-strings
+CC=/usr/bin/gcc
# give full path to hostname since it may not be in user's path
HOSTNAME=/bin/hostname
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 0ea94e6c9..8ab8ee48c 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -108,9 +108,9 @@ static void _replica_update_state (time_t when, void *arg);
static char * _replica_get_config_dn (const Slapi_DN *root);
static char * _replica_type_as_string (const Replica *r);
/* DBDB, I think this is probably bogus : */
-int replica_create_ruv_tombstone(Replica *r);
-void assign_csn_callback(const CSN *csn, void *data);
-void abort_csn_callback(const CSN *csn, void *data);
+static int replica_create_ruv_tombstone(Replica *r);
+static void assign_csn_callback(const CSN *csn, void *data);
+static void abort_csn_callback(const CSN *csn, void *data);
static void eq_cb_reap_tombstones(time_t when, void *arg);
static CSN *_replica_get_purge_csn_nolock (const Replica *r);
static void replica_get_referrals_nolock (const Replica *r, char ***referrals);
diff --git a/nsarch b/nsarch
index ae5d6f92a..c9e5c9351 100755
--- a/nsarch
+++ b/nsarch
@@ -607,6 +607,16 @@ EOF
fi
ns_printf
exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_x86_64"; then
+ #echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
+ GNU_NAME="${UNAME_MACHINE}-unknown-linux"
+ NS_NAME="${UNAME_SYSTEM}"
+ NS_RELEASE="${UNAME_RELEASE}"
+ if echo "$NS_RELEASE" | grep >/dev/null 2>&1 "2.0."; then
+ NS_RELEASE="2.0"
+ fi
+ ns_printf
+ exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
#echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
GNU_NAME="${UNAME_MACHINE}-unknown-linuxaout"
diff --git a/nsconfig.mk b/nsconfig.mk
index 8d0fc22bf..cb2fa5dae 100644
--- a/nsconfig.mk
+++ b/nsconfig.mk
@@ -256,8 +256,10 @@ endif
NSOS_TEST1 := $(shell uname -m)
ifeq ($(NSOS_ARCH),Linux)
- ifeq (86,$(findstring 86,$(NSOS_TEST1)))
- NSOS_TEST1 = x86
+ ifneq (x86_64, $(NSOS_TEST1))
+ ifeq (86,$(findstring 86,$(NSOS_TEST1)))
+ NSOS_TEST1 = x86
+ endif
endif
ifeq ($(USE_LIBC),1)
@@ -273,8 +275,10 @@ ifeq ($(NSOS_ARCH),Linux)
NSCONFIG_NOTAG = $(NSCONFIG)
else
ifeq ($(NSOS_ARCH),RHEL)
- ifeq (86,$(findstring 86,$(NSOS_TEST1)))
- NSOS_TEST1 = x86
+ ifneq (x86_64, $(NSOS_TEST1))
+ ifeq (86,$(findstring 86,$(NSOS_TEST1)))
+ NSOS_TEST1 = x86
+ endif
endif
NSCONFIG = $(NSOS_ARCH)$(NSOS_RELEASE)_$(NSOS_TEST1)_$(GCC_VERSION)
NSCONFIG_NOTAG = $(NSCONFIG)
@@ -297,6 +301,8 @@ else
NSCONFIG_NOTAG = $(NSOS_ARCH)$(NSOS_RELEASE_NOTAG)
endif
endif
+ NSCONFIG += $(NS64TAG)
+ NSCONFIG_NOTAG += $(NS64TAG)
endif
endif
@@ -337,13 +343,9 @@ ifeq ($(NSOS_ARCH),WINNT)
NSOBJDIR_NAME_32 = $(NSCONFIG)$(NSOBJDIR_TAG).OBJ
endif
else
- NSOBJDIR_NAME = $(NSCONFIG)$(NS64TAG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAME_32 = $(NSCONFIG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAME1 = $(NSCONFIG)$(NS64TAG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAMEeh = $(NSCONFIG)_eh$(NS64TAG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAMEaCC = $(NSCONFIG)$(NS64TAG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAME_NOTAG = $(NSCONFIG_NOTAG)$(NS64TAG)$(NSOBJDIR_TAG).OBJ
- NSOBJDIR_NAME1_NOTAG = $(NSCONFIG_NOTAG)$(NS64TAG)$(NSOBJDIR_TAG).OBJ
+ NSOBJDIR_NAME = $(NSCONFIG)$(NSOBJDIR_TAG).OBJ
+ NSOBJDIR_NAME_32 = $(subst $(NS64TAG),,$(NSOBJDIR_NAME))
+ NSOBJDIR_NAME1 = $(NSOBJDIR_NAME)
endif
@@ -667,8 +669,8 @@ export NO_DB2=1
else
ifeq ($(ARCH), Linux)
OSVERSION := $(basename $(shell uname -r))
-CC=/usr/bin/gcc -fwritable-strings
-CXX=/usr/bin/g++ -fwritable-strings
+CC=/usr/bin/gcc
+CXX=/usr/bin/g++
CCC=$(CXX)
LD=$(CXX)
ARCH_DEBUG=-g
| 0 |
d6a32479320e98de9662eb40c8bb970b3daae3cc
|
389ds/389-ds-base
|
Use PKG_CHECK_MODULES to detect the cmocka library
|
commit d6a32479320e98de9662eb40c8bb970b3daae3cc
Author: Hugh McMaster <[email protected]>
Date: Wed Mar 20 21:11:22 2019 +1100
Use PKG_CHECK_MODULES to detect the cmocka library
diff --git a/Makefile.am b/Makefile.am
index 57f42f835..3b84de50e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,7 @@ UBSAN_CFLAGS = @ubsan_cflags@
SYSTEMD_DEFINES = @systemd_defs@
-CMOCKA_INCLUDES = @cmocka_inc@
+CMOCKA_INCLUDES = $(CMOCKA_CFLAGS)
PROFILING_DEFINES = @profiling_defs@
NSPR_INCLUDES = $(NSPR_CFLAGS)
@@ -151,7 +151,7 @@ NUNCSTANS_CPPFLAGS = $(NSPR_INCLUDES) $(NUNCSTANS_INCLUDES) $(SDS_INCLUDES) $(EV
# Linker Flags
#------------------------
SYSTEMD_LINK = @systemd_lib@
-CMOCKA_LINKS = @cmocka_lib@
+CMOCKA_LINKS = $(CMOCKA_LIBS)
PROFILING_LINKS = @profiling_links@
NSPR_LINK = $(NSPR_LIBS)
@@ -612,7 +612,7 @@ dist_noinst_HEADERS += \
src/libsds/external/liblfds711/src/lfds711_queue_unbounded_manyproducer_manyconsumer/lfds711_queue_unbounded_manyproducer_manyconsumer_internal.h
endif
-if WITH_CMOCKA
+if ENABLE_CMOCKA
dist_noinst_HEADERS += \
test/test_slapd.h \
src/libsds/test/test_sds.h \
@@ -2125,7 +2125,7 @@ rsearch_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKE
#-------------------------
# CMOCKA TEST PROGRAMS
#-------------------------
-if WITH_CMOCKA
+if ENABLE_CMOCKA
check_PROGRAMS = test_slapd \
test_libsds \
diff --git a/configure.ac b/configure.ac
index bd2b7bba5..a5434bf57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -845,7 +845,18 @@ m4_include(m4/kerberos.m4)
m4_include(m4/pcre.m4)
m4_include(m4/selinux.m4)
m4_include(m4/systemd.m4)
-m4_include(m4/cmocka.m4)
+
+AC_MSG_CHECKING(whether to enable cmocka unit tests)
+AC_ARG_ENABLE(cmocka, AS_HELP_STRING([--enable-cmocka], [Enable cmocka unit tests (default: no)]))
+if test "x$enable_cmocka" = "xyes"; then
+ AC_MSG_RESULT(yes)
+ PKG_CHECK_MODULES([CMOCKA], [cmocka])
+ AC_DEFINE([ENABLE_CMOCKA], [1], [Enable cmocka unit tests])
+else
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL([ENABLE_CMOCKA], [test "x$enable_cmocka" = "xyes"])
+
m4_include(m4/doxygen.m4)
PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
diff --git a/m4/cmocka.m4 b/m4/cmocka.m4
deleted file mode 100644
index bb7d4d3b4..000000000
--- a/m4/cmocka.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-## BEGIN COPYRIGHT BLOCK
-## Copyright (c) 2016, William Brown <william at blackhats dot net dot au>
-## All rights reserved.
-##
-## License: License: GPL (version 3 or any later version).
-## See LICENSE for details.
-## END COPYRIGHT BLOCK
-
-AC_MSG_CHECKING(for --enable-cmocka)
-AC_ARG_ENABLE(cmocka, AS_HELP_STRING([--enable-cmocka], [Enable cmocka based tests (default: no)]),
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE([WITH_CMOCKA], [1], [With cmocka unit tests])
- with_cmocka="yes"
- AC_MSG_CHECKING(for cmocka)
- if $PKG_CONFIG --exists cmocka; then
- cmocka_inc=`$PKG_CONFIG --cflags cmocka`
- cmocka_lib=`$PKG_CONFIG --libs cmocka`
- AC_MSG_RESULT([using system cmocka])
- else
- AC_MSG_ERROR([pkg-config could not find cmocka!])
- fi
-],
-[
- AC_MSG_RESULT(no)
- with_cmocka="0"
-])
-
-AM_CONDITIONAL([WITH_CMOCKA], [test "$with_cmocka" = "yes"])
-AC_SUBST(cmocka_inc)
-AC_SUBST(cmocka_lib)
-
-
| 0 |
8745246ed1c1a247e3a78b318cdc4e91d32ead73
|
389ds/389-ds-base
|
Updated nss, nspr, dbm, and jss component versions
|
commit 8745246ed1c1a247e3a78b318cdc4e91d32ead73
Author: Nathan Kinder <[email protected]>
Date: Mon Feb 14 19:52:13 2005 +0000
Updated nss, nspr, dbm, and jss component versions
diff --git a/component_versions.mk b/component_versions.mk
index 2cdd46b39..d5aaa0890 100644
--- a/component_versions.mk
+++ b/component_versions.mk
@@ -20,12 +20,12 @@
# naming scheme.
# NSPR
ifndef NSPR_RELDATE
- NSPR_RELDATE = DS7.0
+ NSPR_RELDATE = v4.4.1
endif
# SECURITY (NSS) LIBRARY
ifndef SECURITY_RELDATE
- SECURITY_RELDATE = DS7.0
+ SECURITY_RELDATE = NSS_3_9_3_RTM
endif
# LIBDB
@@ -39,7 +39,7 @@ endif
# DBM Library
ifndef DBM_RELDATE
- DBM_RELDATE = DS7.0
+ DBM_RELDATE = DBM_1_61_RTM
endif
# SMARTHEAP
@@ -151,11 +151,11 @@ ifndef JSS_COMP
endif
ifndef JSS_VERSION
- JSS_VERSION=DS7.0
+ JSS_VERSION=JSS_3_5_1_RTM
endif
ifndef JSS_JAR_VERSION
- JSS_JAR_VERSION=3
+ JSS_JAR_VERSION=351
endif
ifndef SASL_VERSDIR
diff --git a/components.mk b/components.mk
index 7f222b4e1..477088ff7 100644
--- a/components.mk
+++ b/components.mk
@@ -182,7 +182,11 @@ NSPR_BUILD_DIR = $(NSCP_DISTDIR_FULL_RTL)/nspr
NSPR_ABS_BUILD_DIR = $(NSCP_ABS_DISTDIR_FULL_RTL)/nspr
NSPR_LIBPATH = $(NSPR_BUILD_DIR)/lib
NSPR_INCLUDE = -I$(NSPR_BUILD_DIR)/include
+ifeq ($(ARCH), Linux)
+NSPR_IMPORT = $(COMPONENTS_DIR)/nspr20/$(NSPR_RELDATE)/RHEL3/$(FULL_RTL_OBJDIR)
+else
NSPR_IMPORT = $(COMPONENTS_DIR)/nspr20/$(NSPR_RELDATE)/$(FULL_RTL_OBJDIR)
+endif
NSPR_LIBS_TO_PKG = $(addsuffix .$(DLL_SUFFIX),$(addprefix $(NSPR_LIBPATH)/lib,$(NSPR_LIBNAMES)))
LIBS_TO_PKG += $(NSPR_LIBS_TO_PKG)
@@ -224,7 +228,11 @@ DBM_BUILD_DIR = $(NSCP_DISTDIR_FULL_RTL)/dbm
DBM_LIBPATH = $(DBM_BUILD_DIR)/lib
DBM_INCDIR = $(DBM_BUILD_DIR)/include
DBM_DEP = $(DBM_LIBPATH)/libdbm.$(LIB_SUFFIX)
+ifeq ($(ARCH), Linux)
+DBM_IMPORT = $(COMPONENTS_DIR)/dbm/$(DBM_RELDATE)/RHEL3/$(NSOBJDIR_NAME)
+else
DBM_IMPORT = $(COMPONENTS_DIR)/dbm/$(DBM_RELDATE)/$(NSOBJDIR_NAME)
+endif
DBM_INCLUDE = -I$(DBM_INCDIR)
DBM_LIBNAMES = dbm
@@ -273,7 +281,11 @@ else
SECURITY_BINNAMES = certutil derdump pp pk12util ssltap modutil shlibsign
endif
SECURITY_LIBNAMES = ssl3 nss3 softokn3
+ifeq ($(ARCH), Linux)
+SECURITY_IMPORT = $(COMPONENTS_DIR)/nss/$(SECURITY_RELDATE)/RHEL3/$(FULL_RTL_OBJDIR)
+else
SECURITY_IMPORT = $(COMPONENTS_DIR)/nss/$(SECURITY_RELDATE)/$(FULL_RTL_OBJDIR)
+endif
SECURITY_LIBNAMES.pkg = $(SECURITY_LIBNAMES)
SECURITY_LIBNAMES.pkg += smime3
| 0 |
6cb6ef1308e1676cf132e312a45eef3716150dff
|
389ds/389-ds-base
|
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13068 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_ldif2ldbm_deluxe in import.c
|
commit 6cb6ef1308e1676cf132e312a45eef3716150dff
Author: Noriko Hosoi <[email protected]>
Date: Tue Feb 24 15:13:05 2015 -0800
Ticket #48048 - Fix coverity issues - 2015/2/24
Coverity defect 13068 - Explicit null dereferenced (FORWARD_NULL)
Description: Added NULL check for be.
modified: ldbm_back_ldif2ldbm_deluxe in import.c
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 45ea68aee..0694b621b 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1596,15 +1596,12 @@ int ldbm_back_ldif2ldbm_deluxe(Slapi_PBlock *pb)
int up_flags = 0;
PRThread *thread = NULL;
- job = CALLOC(ImportJob);
- if (job == NULL) {
- LDAPDebug(LDAP_DEBUG_ANY, "not enough memory to do import job\n",
- 0, 0, 0);
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (be == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm_back_ldif2ldbm_deluxe: backend is not set\n");
return -1;
}
-
- slapi_pblock_get( pb, SLAPI_BACKEND, &be);
- PR_ASSERT(NULL != be);
+ job = CALLOC(ImportJob);
job->inst = (ldbm_instance *)be->be_instance_info;
slapi_pblock_get( pb, SLAPI_LDIF2DB_NOATTRINDEXES, &noattrindexes );
slapi_pblock_get( pb, SLAPI_LDIF2DB_FILE, &name_array );
| 0 |
8c216a99cc752e6be2d73fd91a446f9d1d44a701
|
389ds/389-ds-base
|
Use defines for backend error handling
|
commit 8c216a99cc752e6be2d73fd91a446f9d1d44a701
Author: Ludwig Krispenz <[email protected]>
Date: Fri Sep 13 10:03:31 2013 +0200
Use defines for backend error handling
diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c
index 4dee4c145..a567832b7 100644
--- a/ldap/servers/plugins/replication/replutil.c
+++ b/ldap/servers/plugins/replication/replutil.c
@@ -947,9 +947,9 @@ repl_chain_on_update(Slapi_PBlock *pb, Slapi_DN * target_dn,
if (root_mode == CHAIN_ROOT_UPDATE_LOCAL)
return local_backend;
else if (root_mode == CHAIN_ROOT_UPDATE_REJECT)
- return (-2);
+ return (SLAPI_BE_NO_BACKEND);
else if (root_mode == CHAIN_ROOT_UPDATE_REFERRAL)
- return (-3);
+ return (SLAPI_BE_REMOTE_BACKEND);
}
/* if the operation is a replicated operation
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 53df04a15..d0801e781 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -2572,7 +2572,7 @@ mtn_get_be_distributed(Slapi_PBlock *pb, mapping_tree_node * target_node,
}
/* check if distribution plugi returned a special mode for
* updates as root */
- else if (index == -2 || index == -3)
+ else if (index == SLAPI_BE_NO_BACKEND || index == SLAPI_BE_REMOTE_BACKEND)
{
/* nothing special to do */
}
@@ -2686,17 +2686,17 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
} else {
*index = mtn_get_be_distributed(pb, target_node,
target_sdn, &flag_stop);
- if (*index == -2)
+ if (*index == SLAPI_BE_NO_BACKEND)
result = LDAP_UNWILLING_TO_PERFORM;
}
}
- if (*index == -3) {
+ if (*index == SLAPI_BE_REMOTE_BACKEND) {
*be = NULL;
*referral = (target_node->mtn_referral_entry ?
slapi_entry_dup(target_node->mtn_referral_entry) :
NULL);
(*index)++;
- }else if ((*index == -2) || (*index >= target_node->mtn_be_count)) {
+ }else if ((*index == SLAPI_BE_NO_BACKEND) || (*index >= target_node->mtn_be_count)) {
/* we have already returned all backends -> return NULL */
*be = NULL;
*referral = NULL;
@@ -2739,7 +2739,7 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
*be = defbackend_get_backend();
}
if (flag_stop)
- *index = -2;
+ *index = SLAPI_BE_NO_BACKEND;
else
(*index)++;
}
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 6cb6d744e..233dbe9a1 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6163,8 +6163,13 @@ int slapi_unregister_backend_state_change(void * handle);
/* SLAPI_BE_ALL_BACKENDS is a special value that is returned by
* a distribution plugin function to indicate that all backends
* should be searched (it is only used for search operations).
+ *
+ * SLAPI_BE_NO_BACKEND indicates no more backend is available or allowed
+ * SLAPI_BE_REMOTE_BACKEND indicates that the are not locally available
*/
#define SLAPI_BE_ALL_BACKENDS -1
+#define SLAPI_BE_NO_BACKEND -2
+#define SLAPI_BE_REMOTE_BACKEND -3
| 0 |
36a2f1d5e4e2265140320087104c6799a97c28d9
|
389ds/389-ds-base
|
Security fix for CVE-2024-2199
Description:
A denial of service vulnerability was found in the 389 Directory Server.
This issue may allow an authenticated user to cause a server crash while
modifying userPassword using malformed input.
Fix Description:
When doing a mod on userPassword we reset the pblock modifier after we
set the modified timestamp, ensuring the pblock data stays valid.
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-2199
- https://access.redhat.com/security/cve/CVE-2024-2199
- https://bugzilla.redhat.com/show_bug.cgi?id=2267976
|
commit 36a2f1d5e4e2265140320087104c6799a97c28d9
Author: James Chapman <[email protected]>
Date: Wed May 1 15:01:33 2024 +0100
Security fix for CVE-2024-2199
Description:
A denial of service vulnerability was found in the 389 Directory Server.
This issue may allow an authenticated user to cause a server crash while
modifying userPassword using malformed input.
Fix Description:
When doing a mod on userPassword we reset the pblock modifier after we
set the modified timestamp, ensuring the pblock data stays valid.
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-2199
- https://access.redhat.com/security/cve/CVE-2024-2199
- https://bugzilla.redhat.com/show_bug.cgi?id=2267976
diff --git a/dirsrvtests/tests/suites/password/password_test.py b/dirsrvtests/tests/suites/password/password_test.py
index 1245feb31..e4abd9907 100644
--- a/dirsrvtests/tests/suites/password/password_test.py
+++ b/dirsrvtests/tests/suites/password/password_test.py
@@ -63,6 +63,62 @@ def test_password_delete_specific_password(topology_st):
log.info('test_password_delete_specific_password: PASSED')
+def test_password_modify_non_utf8(topology_st):
+ """Attempt a modify of the userPassword attribute with
+ an invalid non utf8 value
+
+ :id: a31af9d5-d665-42b9-8d6e-fea3d0837d36
+ :setup: Standalone instance
+ :steps:
+ 1. Add a user if it doesnt exist and set its password
+ 2. Verify password with a bind
+ 3. Modify userPassword attr with invalid value
+ 4. Attempt a bind with invalid password value
+ 5. Verify original password with a bind
+ :expectedresults:
+ 1. The user with userPassword should be added successfully
+ 2. Operation should be successful
+ 3. Server returns ldap.UNWILLING_TO_PERFORM
+ 4. Server returns ldap.INVALID_CREDENTIALS
+ 5. Operation should be successful
+ """
+
+ log.info('Running test_password_modify_non_utf8...')
+
+ # Create user and set password
+ standalone = topology_st.standalone
+ users = UserAccounts(standalone, DEFAULT_SUFFIX)
+ if not users.exists(TEST_USER_PROPERTIES['uid'][0]):
+ user = users.create(properties=TEST_USER_PROPERTIES)
+ else:
+ user = users.get(TEST_USER_PROPERTIES['uid'][0])
+ user.set('userpassword', PASSWORD)
+
+ # Verify password
+ try:
+ user.bind(PASSWORD)
+ except ldap.LDAPError as e:
+ log.fatal('Failed to bind as {}, error: '.format(user.dn) + e.args[0]['desc'])
+ assert False
+
+ # Modify userPassword with an invalid value
+ password = b'tes\x82t-password' # A non UTF-8 encoded password
+ with pytest.raises(ldap.UNWILLING_TO_PERFORM):
+ user.replace('userpassword', password)
+
+ # Verify a bind fails with invalid pasword
+ with pytest.raises(ldap.INVALID_CREDENTIALS):
+ user.bind(password)
+
+ # Verify we can still bind with original password
+ try:
+ user.bind(PASSWORD)
+ except ldap.LDAPError as e:
+ log.fatal('Failed to bind as {}, error: '.format(user.dn) + e.args[0]['desc'])
+ assert False
+
+ log.info('test_password_modify_non_utf8: PASSED')
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index a20984e0b..fb65d58b3 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -762,8 +762,10 @@ op_shared_modify(Slapi_PBlock *pb, int pw_change, char *old_pw)
* flagged - leave mod attributes alone */
if (!repl_op && !skip_modified_attrs && lastmod) {
modify_update_last_modified_attr(pb, &smods);
+ slapi_pblock_set(pb, SLAPI_MODIFY_MODS, slapi_mods_get_ldapmods_byref(&smods));
}
+
if (0 == slapi_mods_get_num_mods(&smods)) {
/* nothing to do - no mods - this is not an error - just
send back LDAP_SUCCESS */
@@ -930,8 +932,10 @@ op_shared_modify(Slapi_PBlock *pb, int pw_change, char *old_pw)
/* encode password */
if (pw_encodevals_ext(pb, sdn, va)) {
- slapi_log_err(SLAPI_LOG_CRIT, "op_shared_modify", "Unable to hash userPassword attribute for %s.\n", slapi_entry_get_dn_const(e));
- send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL, "Unable to store attribute \"userPassword\" correctly\n", 0, NULL);
+ slapi_log_err(SLAPI_LOG_CRIT, "op_shared_modify", "Unable to hash userPassword attribute for %s, "
+ "check value is utf8 string.\n", slapi_entry_get_dn_const(e));
+ send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL, "Unable to hash \"userPassword\" attribute, "
+ "check value is utf8 string.\n", 0, NULL);
valuearray_free(&va);
goto free_and_return;
}
| 0 |
f64e827b9c3011b07b5d78dd52466236dc77346e
|
389ds/389-ds-base
|
Add long hostname support for HP-UX
|
commit f64e827b9c3011b07b5d78dd52466236dc77346e
Author: David Boreham <[email protected]>
Date: Mon Feb 21 21:43:08 2005 +0000
Add long hostname support for HP-UX
diff --git a/ldap/servers/slapd/localhost.c b/ldap/servers/slapd/localhost.c
index fedf8a198..ee8316473 100644
--- a/ldap/servers/slapd/localhost.c
+++ b/ldap/servers/slapd/localhost.c
@@ -37,6 +37,13 @@
#define NO_DOMAINNAME 1
#endif
+#if defined (__hpux)
+#if (MAXHOSTNAMELEN < 256)
+# undef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN 256
+#endif
+#endif
+
static char*
find_localhost_DNS()
{
| 0 |
48470e7a6b0a350149ced0a1377e625b836dba64
|
389ds/389-ds-base
|
Ticket 47931 - lib389 test - memberof and retrocl deadlock
Description: lib389 test to verify deadlock is resolved by setting
the retrocl scope to a single backend.
https://fedorahosted.org/389/ticket/47931
Reviewed by: ?
|
commit 48470e7a6b0a350149ced0a1377e625b836dba64
Author: Mark Reynolds <[email protected]>
Date: Fri Aug 28 15:01:58 2015 -0400
Ticket 47931 - lib389 test - memberof and retrocl deadlock
Description: lib389 test to verify deadlock is resolved by setting
the retrocl scope to a single backend.
https://fedorahosted.org/389/ticket/47931
Reviewed by: ?
diff --git a/dirsrvtests/tickets/ticket47931_test.py b/dirsrvtests/tickets/ticket47931_test.py
new file mode 100644
index 000000000..9aa54fc25
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47931_test.py
@@ -0,0 +1,207 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+import threading
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+SECOND_SUFFIX = "dc=deadlock"
+SECOND_BACKEND = "deadlock"
+RETROCL_PLUGIN_DN = ('cn=' + PLUGIN_RETRO_CHANGELOG + ',cn=plugins,cn=config')
+MEMBEROF_PLUGIN_DN = ('cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config')
+GROUP_DN = ("cn=group," + DEFAULT_SUFFIX)
+MEMBER_DN_COMP = "uid=member"
+TIME_OUT = 5
+
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+class modifySecondBackendThread(threading.Thread):
+ def __init__(self, inst, timeout):
+ threading.Thread.__init__(self)
+ self.daemon = True
+ self.inst = inst
+ self.timeout = timeout
+
+ def run(self):
+ conn = self.inst.openConnection()
+ conn.set_option(ldap.OPT_TIMEOUT, self.timeout)
+ log.info('Modify second suffix...')
+ for x in range(0, 5000):
+ try:
+ conn.modify_s(SECOND_SUFFIX,
+ [(ldap.MOD_REPLACE,
+ 'description',
+ 'new description')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to modify second suffix - error: %s' %
+ (e.message['desc']))
+ assert False
+
+ conn.close()
+ log.info('Finished modifying second suffix')
+
+
[email protected](scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_prefix
+
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ # Delete each instance in the end
+ def fin():
+ standalone.delete()
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ standalone.clearTmpDir(__file__)
+
+ return TopologyStandalone(standalone)
+
+
+def test_ticket47931(topology):
+ """Test Retro Changelog and MemberOf deadlock fix.
+ Verification steps:
+ - Enable retro cl and memberOf.
+ - Create two backends: A & B.
+ - Configure retrocl scoping for backend A.
+ - Configure memberOf plugin for uniquemember
+ - Create group in backend A.
+ - In parallel, add members to the group on A, and make modifications
+ to entries in backend B.
+ - Make sure the server does not hang during the updates to both
+ backends.
+
+ """
+
+ # Enable dynamic plugins to make plugin configuration easier
+ try:
+ topology.standalone.modify_s(DN_CONFIG,
+ [(ldap.MOD_REPLACE,
+ 'nsslapd-dynamic-plugins',
+ 'on')])
+ except ldap.LDAPError as e:
+ ldap.error('Failed to enable dynamic plugins! ' + e.message['desc'])
+ assert False
+
+ # Enable the plugins
+ topology.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
+ topology.standalone.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
+
+ # Create second backend
+ topology.standalone.backend.create(SECOND_SUFFIX, {BACKEND_NAME: SECOND_BACKEND})
+ topology.standalone.mappingtree.create(SECOND_SUFFIX, bename=SECOND_BACKEND)
+
+ # Create the root node of the second backend
+ try:
+ topology.standalone.add_s(Entry((SECOND_SUFFIX,
+ {'objectclass': 'top domain'.split(),
+ 'dc': 'deadlock'})))
+ except ldap.LDAPError as e:
+ log.fatal('Failed to create suffix entry: error ' + e.message['desc'])
+ assert False
+
+ # Configure retrocl scope
+ try:
+ topology.standalone.modify_s(RETROCL_PLUGIN_DN,
+ [(ldap.MOD_REPLACE,
+ 'nsslapd-include-suffix',
+ DEFAULT_SUFFIX)])
+ except ldap.LDAPError as e:
+ ldap.error('Failed to configure retrocl plugin: ' + e.message['desc'])
+ assert False
+
+ # Configure memberOf group attribute
+ try:
+ topology.standalone.modify_s(MEMBEROF_PLUGIN_DN,
+ [(ldap.MOD_REPLACE,
+ 'memberofgroupattr',
+ 'uniquemember')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to configure memberOf plugin: error ' + e.message['desc'])
+ assert False
+
+ # Create group
+ try:
+ topology.standalone.add_s(Entry((GROUP_DN,
+ {'objectclass': 'top extensibleObject'.split(),
+ 'cn': 'group'})))
+ except ldap.LDAPError as e:
+ log.fatal('Failed to add grouo: error ' + e.message['desc'])
+ assert False
+
+ # Create 1500 entries (future members of the group)
+ for idx in range(1, 1500):
+ try:
+ USER_DN = ("uid=member%d,%s" % (idx, DEFAULT_SUFFIX))
+ topology.standalone.add_s(Entry((USER_DN,
+ {'objectclass': 'top extensibleObject'.split(),
+ 'uid': 'member%d' % (x)})))
+ except ldap.LDAPError as e:
+ log.fatal('Failed to add user (%s): error %s' % (USER_DN, e.message['desc']))
+ assert False
+
+ # Modify second backend (separate thread)
+ mod_backend_thrd = modifySecondBackendThread(topology.standalone, TIME_OUT)
+ mod_backend_thrd.start()
+
+ # Add members to the group - set timeout
+ log.info('Adding members to the group...')
+ topology.standalone.set_option(ldap.OPT_TIMEOUT, TIME_OUT)
+ for idx in range(1, 1500):
+ try:
+ MEMBER_VAL = ("uid=member%d,%s" % (idx, DEFAULT_SUFFIX))
+ topology.standalone.modify_s(GROUP_DN,
+ [(ldap.MOD_ADD,
+ 'uniquemember',
+ MEMBER_VAL)])
+ except ldap.TIMEOUT:
+ log.fatal('Deadlock! Bug verification failed.')
+ assert False
+ except ldap.LDAPError as e:
+ log.fatal('Failed to update group(not a deadlock) member (%s) - error: %s' %
+ (MEMBER_VAL, e.message['desc']))
+ assert False
+ log.info('Finished adding members to the group.')
+
+ # Wait for the thread to finish
+ mod_backend_thrd.join()
+
+ # No timeout, test passed!
+ log.info('Test complete\n')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
\ No newline at end of file
| 0 |
711b9de13ce13adb5b13c4252cb516db433621b3
|
389ds/389-ds-base
|
Ticket 49624 cont - DB Deadlock on modrdn appears to corrupt database and entry cache
Bug: If there are deadlocks a transaction will be retried. In the case
of modrdn operation there is an error in handling the newsuperior
dn, which has to be reset when the txn is repeated.
There is also an error in freeing the entry stored in the pblock which can
lead to a double free
There is also a memory leak for ec entries
Fix: check if the newsuperior in the pblock was changed before the retry and
only then free and reset it.
check and protect pblock entry from double free
remove ec entry from cache
fix the txn_test_thread to run
There is also a message at shutdown that entries remain in the entry cache
although no leaks are reported and a hash dump didn't show entries.
Change log level to avoid confusion
Reviewed by: Thierry, William, Viktor - Thanks
|
commit 711b9de13ce13adb5b13c4252cb516db433621b3
Author: Ludwig Krispenz <[email protected]>
Date: Wed Jan 15 13:40:36 2020 +0100
Ticket 49624 cont - DB Deadlock on modrdn appears to corrupt database and entry cache
Bug: If there are deadlocks a transaction will be retried. In the case
of modrdn operation there is an error in handling the newsuperior
dn, which has to be reset when the txn is repeated.
There is also an error in freeing the entry stored in the pblock which can
lead to a double free
There is also a memory leak for ec entries
Fix: check if the newsuperior in the pblock was changed before the retry and
only then free and reset it.
check and protect pblock entry from double free
remove ec entry from cache
fix the txn_test_thread to run
There is also a message at shutdown that entries remain in the entry cache
although no leaks are reported and a hash dump didn't show entries.
Change log level to avoid confusion
Reviewed by: Thierry, William, Viktor - Thanks
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index a03cdaa83..89f958a35 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -723,7 +723,7 @@ entrycache_clear_int(struct cache *cache)
}
cache->c_maxsize = size;
if (cache->c_curentries > 0) {
- slapi_log_err(SLAPI_LOG_WARNING,
+ slapi_log_err(SLAPI_LOG_CACHE,
"entrycache_clear_int", "There are still %" PRIu64 " entries "
"in the entry cache.\n",
cache->c_curentries);
diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
index 167852991..ac45770c1 100644
--- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
+++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_layer.c
@@ -3064,7 +3064,7 @@ txn_test_threadmain(void *param)
txn_test_init_cfg(&cfg);
- if(BDB_CONFIG(li)->bdb_enable_transactions) {
+ if(!BDB_CONFIG(li)->bdb_enable_transactions) {
goto end;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 433ed88fb..26698012a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -67,6 +67,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb)
Slapi_DN *dn_newsuperiordn = NULL;
Slapi_DN dn_parentdn;
Slapi_DN *orig_dn_newsuperiordn = NULL;
+ Slapi_DN *pb_dn_newsuperiordn = NULL; /* used to check what is currently in the pblock */
Slapi_Entry *target_entry = NULL;
Slapi_Entry *original_targetentry = NULL;
int rc;
@@ -248,30 +249,45 @@ ldbm_back_modrdn(Slapi_PBlock *pb)
slapi_sdn_set_dn_byref(&dn_newrdn, original_newrdn);
original_newrdn = slapi_ch_strdup(original_newrdn);
- slapi_pblock_get(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &dn_newsuperiordn);
- slapi_sdn_free(&dn_newsuperiordn);
- slapi_pblock_set(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, orig_dn_newsuperiordn);
- dn_newsuperiordn = slapi_sdn_dup(orig_dn_newsuperiordn);
+ /* we need to restart with the original newsuperiordn which could have
+ * been modified. So check what is in the pblock, if it was changed
+ * free it, reset orig dn in th epblock and recreate a working superior
+ */
+ slapi_pblock_get(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &pb_dn_newsuperiordn);
+ if (pb_dn_newsuperiordn != orig_dn_newsuperiordn) {
+ slapi_sdn_free(&pb_dn_newsuperiordn);
+ slapi_pblock_set(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, orig_dn_newsuperiordn);
+ dn_newsuperiordn = slapi_sdn_dup(orig_dn_newsuperiordn);
+ }
/* must duplicate ec before returning it to cache,
* which could free the entry. */
- if ((tmpentry = backentry_dup(original_entry ? original_entry : ec)) == NULL) {
+ if (!original_entry) {
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_modrdn",
+ "retrying transaction, but no original entry found\n");
+ ldap_result_code = LDAP_OPERATIONS_ERROR;
+ goto error_return;
+ }
+ if ((tmpentry = backentry_dup(original_entry)) == NULL) {
ldap_result_code = LDAP_OPERATIONS_ERROR;
goto error_return;
}
slapi_pblock_get(pb, SLAPI_MODRDN_EXISTING_ENTRY, &ent);
if (cache_is_in_cache(&inst->inst_cache, ec)) {
CACHE_REMOVE(&inst->inst_cache, ec);
- if (ent && (ent == ec->ep_entry)) {
- /*
- * On a retry, it's possible that ec is now stored in the
- * pblock as SLAPI_MODRDN_EXISTING_ENTRY. "ec" will be freed
- * by CACHE_RETURN below, so set ent to NULL so don't free
- * it again.
- */
- ent = NULL;
- }
+ }
+ if (ent && (ent == ec->ep_entry)) {
+ /*
+ * On a retry, it's possible that ec is now stored in the
+ * pblock as SLAPI_MODRDN_EXISTING_ENTRY. "ec" will be freed
+ * by CACHE_RETURN below, so set ent to NULL so don't free
+ * it again.
+ * And it needs to be checked always.
+ */
+ ent = NULL;
}
CACHE_RETURN(&inst->inst_cache, &ec);
+
+ /* LK why do we need this ????? */
if (!cache_is_in_cache(&inst->inst_cache, e)) {
if (CACHE_ADD(&inst->inst_cache, e, NULL) < 0) {
slapi_log_err(SLAPI_LOG_CACHE,
@@ -1087,8 +1103,9 @@ ldbm_back_modrdn(Slapi_PBlock *pb)
if (slapi_sdn_get_dn(dn_newsuperiordn) != NULL) {
retval = ldbm_ancestorid_move_subtree(be, sdn, &dn_newdn, e->ep_id, children, &txn);
if (retval != 0) {
- if (retval == DB_LOCK_DEADLOCK)
+ if (retval == DB_LOCK_DEADLOCK) {
continue;
+ }
if (retval == DB_RUNRECOVERY || LDBM_OS_ERR_IS_DISKFULL(retval))
disk_full = 1;
MOD_SET_ERROR(ldap_result_code,
@@ -1108,8 +1125,9 @@ ldbm_back_modrdn(Slapi_PBlock *pb)
e->ep_id, &txn, is_tombstone);
slapi_rdn_done(&newsrdn);
if (retval != 0) {
- if (retval == DB_LOCK_DEADLOCK)
+ if (retval == DB_LOCK_DEADLOCK) {
continue;
+ }
if (retval == DB_RUNRECOVERY || LDBM_OS_ERR_IS_DISKFULL(retval))
disk_full = 1;
MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -1500,7 +1518,12 @@ common_return:
done_with_pblock_entry(pb, SLAPI_MODRDN_NEWPARENT_ENTRY);
done_with_pblock_entry(pb, SLAPI_MODRDN_TARGET_ENTRY);
slapi_ch_free_string(&original_newrdn);
- slapi_sdn_free(&orig_dn_newsuperiordn);
+ slapi_pblock_get(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &pb_dn_newsuperiordn);
+ if (pb_dn_newsuperiordn != orig_dn_newsuperiordn) {
+ slapi_sdn_free(&orig_dn_newsuperiordn);
+ } else {
+ slapi_sdn_free(&dn_newsuperiordn);
+ }
backentry_free(&original_entry);
backentry_free(&tmpentry);
slapi_entry_free(original_targetentry);
@@ -1561,6 +1584,9 @@ moddn_unlock_and_return_entry(
/* Something bad happened so we should give back all the entries */
if (*targetentry != NULL) {
cache_unlock_entry(&inst->inst_cache, *targetentry);
+ if (cache_is_in_cache(&inst->inst_cache, *targetentry)) {
+ CACHE_REMOVE(&inst->inst_cache, *targetentry);
+ }
CACHE_RETURN(&inst->inst_cache, targetentry);
*targetentry = NULL;
}
| 0 |
13e53f4655f4812f7412d333bb285c9d390a4a0f
|
389ds/389-ds-base
|
Bug 690649 - (cov#10731) Use of free'd pointer in indexing code
There is a very unlikely chance that we can use a free'd pointer
in the indexing code when attribute encryption is used and there is
a problem encrypting the index key. The bug requires debug logging
to be enabled as well as an attribute name longer than 255 chars to
be used.
We have a 256 byte buffer that we attempt to use to store the
attribute name. The call to slapi_attr_basetype() will try to fill
this buffer in, but it will malloc space if the buffer is too small.
The pointer to this allocated memory is basetmp, which will be NULL
if we just used the buffer. In the event that we do allocate memory,
basetype will point to the allocated memory, otherwise it will point
to the buffer.
At line 912, we free basetmp if it was allocated, yet we use
basetype for debug logging at line 922 (which points to the same
memory if we indeed allocated memory). We should just free basetmp
at the end of the function instead of at line 912. This will allow
us to use basetype safely at line 922.
|
commit 13e53f4655f4812f7412d333bb285c9d390a4a0f
Author: Nathan Kinder <[email protected]>
Date: Thu Mar 24 16:02:00 2011 -0700
Bug 690649 - (cov#10731) Use of free'd pointer in indexing code
There is a very unlikely chance that we can use a free'd pointer
in the indexing code when attribute encryption is used and there is
a problem encrypting the index key. The bug requires debug logging
to be enabled as well as an attribute name longer than 255 chars to
be used.
We have a 256 byte buffer that we attempt to use to store the
attribute name. The call to slapi_attr_basetype() will try to fill
this buffer in, but it will malloc space if the buffer is too small.
The pointer to this allocated memory is basetmp, which will be NULL
if we just used the buffer. In the event that we do allocate memory,
basetype will point to the allocated memory, otherwise it will point
to the buffer.
At line 912, we free basetmp if it was allocated, yet we use
basetype for debug logging at line 922 (which points to the same
memory if we indeed allocated memory). We should just free basetmp
at the end of the function instead of at line 912. This will allow
us to use basetype safely at line 922.
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 03ea5e408..5d2b4998a 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -909,7 +909,6 @@ index_read_ext(
slapi_ch_free_string( &basetmp );
return( NULL );
}
- slapi_ch_free_string( &basetmp );
if ( val != NULL ) {
size_t plen, vlen;
@@ -959,6 +958,7 @@ index_read_ext(
} else if ( *err != 0 && *err != DB_NOTFOUND ) {
ldbm_nasty(errmsg, 1050, *err);
}
+ slapi_ch_free_string( &basetmp );
slapi_ch_free_string(&tmpbuf);
dblayer_release_index_file( be, ai, db );
| 0 |
c0d233b60311e2bf65dc13eee6f12abe221be932
|
389ds/389-ds-base
|
Ticket 47991 - upgrade script fails if /etc and /var are on different file systems
Bug Description: the script to upgrade configfiles creates a backup dir in /var
and tries to move files fro /etc to this backup dir
using the perl rename function.
this fails if /etc and /var are different fiel systems
Fix Description: create the backup dir also in /etc
https://fedorahosted.org/389/ticket/47991
Reviewed by: Mark, Thanks
|
commit c0d233b60311e2bf65dc13eee6f12abe221be932
Author: Ludwig Krispenz <[email protected]>
Date: Tue Jan 20 10:34:41 2015 +0100
Ticket 47991 - upgrade script fails if /etc and /var are on different file systems
Bug Description: the script to upgrade configfiles creates a backup dir in /var
and tries to move files fro /etc to this backup dir
using the perl rename function.
this fails if /etc and /var are different fiel systems
Fix Description: create the backup dir also in /etc
https://fedorahosted.org/389/ticket/47991
Reviewed by: Mark, Thanks
diff --git a/ldap/admin/src/scripts/60upgradeconfigfiles.pl b/ldap/admin/src/scripts/60upgradeconfigfiles.pl
index 4b37353d3..189eb0376 100644
--- a/ldap/admin/src/scripts/60upgradeconfigfiles.pl
+++ b/ldap/admin/src/scripts/60upgradeconfigfiles.pl
@@ -16,7 +16,7 @@ sub runinst {
# make a backup directory to store the deleted config file, then
# don't really delete it, just move it to that directory
my $mode = (stat($inf->{slapd}->{config_dir}))[2];
- my $bakdir = $inf->{slapd}->{bak_dir} . ".bak";
+ my $bakdir = $inf->{slapd}->{config_dir} . "/bak" ;
if (! -d $bakdir) {
$! = 0; # clear
mkdir $bakdir, $mode;
| 0 |
211962858aef9dfc1ae8b5fa16919a94310b3d47
|
389ds/389-ds-base
|
Resolves: 463776
Summary: Make "back" reponse in setup code work correctly.
|
commit 211962858aef9dfc1ae8b5fa16919a94310b3d47
Author: Nathan Kinder <[email protected]>
Date: Wed Dec 17 18:58:21 2008 +0000
Resolves: 463776
Summary: Make "back" reponse in setup code work correctly.
diff --git a/ldap/admin/src/scripts/DialogManager.pm b/ldap/admin/src/scripts/DialogManager.pm
index ff596b738..a9f493bcb 100644
--- a/ldap/admin/src/scripts/DialogManager.pm
+++ b/ldap/admin/src/scripts/DialogManager.pm
@@ -104,7 +104,7 @@ sub isBack {
}
# the word "back"
- if ($ans =~ /back/i) {
+ if ($ans =~ /^\s*back\s*$/i) {
return 1;
}
# a Ctrl-B sequence
diff --git a/ldap/admin/src/scripts/setup-ds.res.in b/ldap/admin/src/scripts/setup-ds.res.in
index 531585e7e..fa2562750 100644
--- a/ldap/admin/src/scripts/setup-ds.res.in
+++ b/ldap/admin/src/scripts/setup-ds.res.in
@@ -7,7 +7,7 @@ setup_err_exit = Setup cannot proceed. Exiting.\n\n
dialog_use_different_type = When using Silent or Express mode, some of the\ndialogs are skipped, but validation is still performed\non the default or given answers. You should run this program again and\nchoose Typical or Custom mode in order to provide a valid input\nfor the problem dialog.\n\n
# ------------ Welcome Dialog Resource ------------
-dialog_welcome_text = This program will set up the %s Directory Server.\n\nIt is recommended that you have "root" privilege to set up the software.\nTips for using this program:\n - Press "Enter" to choose the default and go to the next screen\n - Type "Control-B" then "Enter" to go back to the previous screen\n - Type "Control-C" to cancel the setup program\n\n
+dialog_welcome_text = This program will set up the %s Directory Server.\n\nIt is recommended that you have "root" privilege to set up the software.\nTips for using this program:\n - Press "Enter" to choose the default and go to the next screen\n - Type "Control-B" or the word "back" then "Enter" to go back to the previous screen\n - Type "Control-C" to cancel the setup program\n\n
# %s -> brand
dialog_welcome_prompt = Would you like to continue with set up?
@@ -68,7 +68,7 @@ dialog_dssuffix_prompt = Suffix
dialog_dssuffix_error = The suffix '%s' is not a valid DN. Please choose another one.\n\n
# ----------- DS Root DN and password Dialog Resource ----------------
-dialog_dsrootdn_text = Certain directory server operations require an administrative user.\nThis user is referred to as the Directory Manager and typically has a\nbind Distinguished Name (DN) of cn=Directory Manager.\nYou will also be prompted for the password for this user. The password must\nbe at least 8 characters long, and contain no spaces.\nPress Control-B then Enter to back up and start over.\n\n
+dialog_dsrootdn_text = Certain directory server operations require an administrative user.\nThis user is referred to as the Directory Manager and typically has a\nbind Distinguished Name (DN) of cn=Directory Manager.\nYou will also be prompted for the password for this user. The password must\nbe at least 8 characters long, and contain no spaces.\nPress Control-B or type the word "back", then Enter to back up and start over.\n\n
dialog_dsrootdn_prompt = Directory Manager DN
dialog_dsrootdn_error = The input '%s' is not a valid DN. Please choose another one.\n\n
dialog_dsrootpw_prompt1 = Password
@@ -126,4 +126,4 @@ error_server_already_exists = Error: the server already exists at '%s'\
Please remove it first if you really want to recreate it,\
or use a different ServerIdentifier to create another instance.\n
error_opening_init_ldif = Could not open the initial LDIF file '%s'.\
-The file was not found or could not be read.\n
\ No newline at end of file
+The file was not found or could not be read.\n
| 0 |
ef04fbc92b0ce819bfeb1a7671f573996c72b5ba
|
389ds/389-ds-base
|
Bug 744946 - (cov#11046) NULL dereference in IDL code
There is a chance of a NULL dereference of the idl pointer in idl_new_fetch()
that was reported by a Coverity scan. We should check if idl is NULL before
dereferencing it.
|
commit ef04fbc92b0ce819bfeb1a7671f573996c72b5ba
Author: Nathan Kinder <[email protected]>
Date: Mon Oct 10 15:02:45 2011 -0700
Bug 744946 - (cov#11046) NULL dereference in IDL code
There is a chance of a NULL dereference of the idl pointer in idl_new_fetch()
that was reported by a Coverity scan. We should check if idl is NULL before
dereferencing it.
diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c b/ldap/servers/slapd/back-ldbm/idl_new.c
index aa6996086..4667c87e2 100644
--- a/ldap/servers/slapd/back-ldbm/idl_new.c
+++ b/ldap/servers/slapd/back-ldbm/idl_new.c
@@ -272,8 +272,8 @@ IDList * idl_new_fetch(
LDAPDebug(LDAP_DEBUG_TRACE, "bulk fetch buffer nids=%d\n", count, 0, 0);
#if defined(DB_ALLIDS_ON_READ)
/* enforce the allids read limit */
- if (NEW_IDL_NO_ALLID != *flag_err &&
- NULL != a && idl_new_exceeds_allidslimit(count, a, allidslimit)) {
+ if ((NEW_IDL_NO_ALLID != *flag_err) && (NULL != a) &&
+ (idl != NULL) && idl_new_exceeds_allidslimit(count, a, allidslimit)) {
idl->b_nids = 1;
idl->b_ids[0] = ALLID;
ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */
@@ -301,7 +301,7 @@ IDList * idl_new_fetch(
}
#if defined(DB_ALLIDS_ON_READ)
/* enforce the allids read limit */
- if (idl_new_exceeds_allidslimit(count, a, allidslimit)) {
+ if ((idl != NULL) && idl_new_exceeds_allidslimit(count, a, allidslimit)) {
idl->b_nids = 1;
idl->b_ids[0] = ALLID;
ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */
| 0 |
a0d15b46b7c060b745e2677679aa4c216c462a55
|
389ds/389-ds-base
|
Issue 5446 - Fix some covscan issues (#5451)
Problem:
covscan reported a number of important issues.
Solution:
Most of those were false positive but a few were genuine errors. I annotated the false positive so the issues does not get reported ( except the COPY_PASTE_ERROR whose annotation seems ignored (coverity bug?) but at least the comment visible in the detailed report shows it is a false positive without even having to look at the code)
Except copy_[paste_errors only 2 errors in jemalloc third party code are reported.
Now the scan-results-imp-summary.txt is getting minimal:
some issue in jemalloc code
a few COPY_PASTE_ERROR false positive error (that have been commented so by reading the detailed report we know it is a false positive) For some reason covscan annotation does not work for copy_paste_error category
Issue: 5446
Reviewed by: @mreynolds389 , @droideck
|
commit a0d15b46b7c060b745e2677679aa4c216c462a55
Author: progier389 <[email protected]>
Date: Mon Sep 19 15:05:06 2022 +0200
Issue 5446 - Fix some covscan issues (#5451)
Problem:
covscan reported a number of important issues.
Solution:
Most of those were false positive but a few were genuine errors. I annotated the false positive so the issues does not get reported ( except the COPY_PASTE_ERROR whose annotation seems ignored (coverity bug?) but at least the comment visible in the detailed report shows it is a false positive without even having to look at the code)
Except copy_[paste_errors only 2 errors in jemalloc third party code are reported.
Now the scan-results-imp-summary.txt is getting minimal:
some issue in jemalloc code
a few COPY_PASTE_ERROR false positive error (that have been commented so by reading the detailed report we know it is a false positive) For some reason covscan annotation does not work for copy_paste_error category
Issue: 5446
Reviewed by: @mreynolds389 , @droideck
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index fdf6e945a..ce1fdecb9 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -3993,8 +3993,8 @@ bail:
/* mods may have been updated and must be put back into place. */
mods = slapi_mods_get_ldapmods_passout(smods);
slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
- slapi_mods_free(&smods);
}
+ slapi_mods_free(&smods);
if (ret) {
slapi_log_err(SLAPI_LOG_PLUGIN, DNA_PLUGIN_SUBSYSTEM,
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 54a805e22..7f5e15337 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -1255,9 +1255,9 @@ cldb_SetReplicaDB(Replica *replica, void *arg)
if (_cldb_CheckAndSetEnv(be, cldb) != CL5_SUCCESS) {
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,
"cldb_SetReplicaDB - Failed to check be environment\n");
- return CL5_SYSTEM_ERROR;
/* Coverity false positive: cldb is not leaking has it is now linked in the backend context */
/* coverity[leaked_storage] */
+ return CL5_SYSTEM_ERROR;
}
_cl5ReadRUV(cldb, PR_TRUE);
_cl5ReadRUV(cldb, PR_FALSE);
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index 2f32fdf96..0e6ec1bd5 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -448,6 +448,8 @@ substr_dn_normalize_orig(char *dn, char *end)
sort_rdn_avs(rdn_avs, rdn_av_count, 0);
}
if (rdn_av_count > 0) {
+ /* Code is ok because rdn_avs is freed only if it has grown */
+ /* coverity[incorrect_free] */
reset_rdn_avs(&rdn_avs, &rdn_av_count);
}
/* Trim trailing spaces */
@@ -1110,6 +1112,8 @@ slapi_dn_normalize_ext(char *src, size_t src_len, char **dest, size_t *dest_len)
sort_rdn_avs(rdn_avs, rdn_av_count, 0);
}
if (rdn_av_count > 0) {
+ /* Code is ok because rdn_avs is freed only if it has grown */
+ /* coverity[incorrect_free] */
reset_rdn_avs(&rdn_avs, &rdn_av_count);
}
/* Trim trailing spaces */
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index c5b42516f..2a7102828 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -642,6 +642,9 @@ test_substring_filter(
rc = -1;
for (a = e->e_attrs; a != NULL; a = a->a_next) {
if (slapi_attr_type_cmp(f->f_sub_type, a->a_type, SLAPI_TYPE_CMP_SUBTYPE) == 0) {
+ /* covscan false positive: "plugin_call_syntax_filter_sub" frees "pb->pb_op". */
+ /* coverity[deref_arg] */
+ /* coverity[double_free] */
rc = plugin_call_syntax_filter_sub(pb, a, &f->f_sub);
if (rc == 0) {
break;
@@ -673,6 +676,9 @@ test_substring_filter(
rc = -1;
for (a = e->e_attrs; a != NULL; a = a->a_next) {
if (slapi_attr_type_cmp(f->f_sub_type, a->a_type, SLAPI_TYPE_CMP_SUBTYPE) == 0) {
+ /* covscan false positive: "plugin_call_syntax_filter_sub" frees "pb->pb_op". */
+ /* coverity[deref_arg] */
+ /* coverity[double_free] */
rc = plugin_call_syntax_filter_sub(pb, a, &f->f_sub);
if (rc == 0 || rc == LDAP_TIMELIMIT_EXCEEDED) {
break;
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 55427e2b8..539bd651e 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -2648,6 +2648,8 @@ slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int sen
if (!slapi_entry_attr_hasvalue(bind_target_entry, "pwdTPRReset", "TRUE")) {
/* the password was not reset by an admin while a TRP pwp was set, just returned */
+ /* covscan false positive: new_passwdPolicy anchor the policy in the pblock */
+ /* coverity[leaked_storage] */
return 0;
}
diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c
index 8a9127840..a47a443b0 100644
--- a/ldap/servers/slapd/pw_mgmt.c
+++ b/ldap/servers/slapd/pw_mgmt.c
@@ -52,6 +52,8 @@ check_must_change_pw(Slapi_PBlock *pb, Slapi_Entry *e)
}
}
}
+/* covscan false positive: new_passwdPolicy anchor the policy in the pblock */
+/* coverity[leaked_storage] */
}
/*
diff --git a/ldap/servers/slapd/pw_retry.c b/ldap/servers/slapd/pw_retry.c
index d75f5ed0a..df59281f8 100644
--- a/ldap/servers/slapd/pw_retry.c
+++ b/ldap/servers/slapd/pw_retry.c
@@ -189,6 +189,8 @@ set_tpr_usecount_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
rc = LDAP_CONSTRAINT_VIOLATION;
}
}
+ /* covscan false positive: new_passwdPolicy anchor the policy in the pblock */
+ /* coverity[leaked_storage] */
return rc;
}
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index a065dd61a..dc52bb19e 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -5363,6 +5363,7 @@ schema_oc_compare_strict(struct objclass *oc_1, struct objclass *oc_2, const cha
moved_must_to_may = PR_FALSE;
if (oc_2->oc_orig_allowed) {
for (j = 0; oc_2->oc_orig_allowed[j] != NULL; j++) {
+ /* coverity[copy_paste_error] */
if (strcasecmp(oc_2->oc_orig_allowed[j], oc_1->oc_orig_required[i]) == 0) {
moved_must_to_may = PR_TRUE;
break;
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 61218ab4e..3dc84b7e6 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -139,7 +139,7 @@ snmp_collator_init(void)
/* Initialize the global interaction table */
for (i = 0; i < NUM_SNMP_INT_TBL_ROWS; i++) {
snmp_vars->int_tbl[i].dsIntIndex = i + 1;
- strncpy(snmp_vars->int_tbl[i].dsName, "Not Available",
+ PL_strncpyz(snmp_vars->int_tbl[i].dsName, "Not Available",
sizeof (snmp_vars->int_tbl[i].dsName));
snmp_vars->int_tbl[i].dsTimeOfCreation = 0;
snmp_vars->int_tbl[i].dsTimeOfLastAttempt = 0;
@@ -147,7 +147,7 @@ snmp_collator_init(void)
snmp_vars->int_tbl[i].dsFailuresSinceLastSuccess = 0;
snmp_vars->int_tbl[i].dsFailures = 0;
snmp_vars->int_tbl[i].dsSuccesses = 0;
- strncpy(snmp_vars->int_tbl[i].dsURL, "Not Available",
+ PL_strncpyz(snmp_vars->int_tbl[i].dsURL, "Not Available",
sizeof (snmp_vars->int_tbl[i].dsURL));
}
}
@@ -159,7 +159,7 @@ snmp_collator_init(void)
memset((void *)stats, 0, sizeof(*stats));
/* Load header stats table */
- strncpy(stats->hdr_stats.dsVersion, SLAPD_VERSION_STR,
+ PL_strncpyz(stats->hdr_stats.dsVersion, SLAPD_VERSION_STR,
(sizeof(stats->hdr_stats.dsVersion) / sizeof(char)) - 1);
stats->hdr_stats.restarted = 0;
stats->hdr_stats.startTime = time(0); /* This is a bit off, hope it's ok */
@@ -220,7 +220,7 @@ set_snmp_interaction_row(char *host, int port, int error)
if (isnew) {
/* fillin the new row from scratch*/
snmp_vars->int_tbl[index].dsIntIndex = index;
- strncpy(snmp_vars->int_tbl[index].dsName, dsName,
+ PL_strncpyz(snmp_vars->int_tbl[index].dsName, dsName,
sizeof(snmp_vars->int_tbl[index].dsName));
snmp_vars->int_tbl[index].dsTimeOfCreation = time(0);
snmp_vars->int_tbl[index].dsTimeOfLastAttempt = time(0);
@@ -235,7 +235,7 @@ set_snmp_interaction_row(char *host, int port, int error)
snmp_vars->int_tbl[index].dsFailures = 1;
snmp_vars->int_tbl[index].dsSuccesses = 0;
}
- strncpy(snmp_vars->int_tbl[index].dsURL, dsURL,
+ PL_strncpyz(snmp_vars->int_tbl[index].dsURL, dsURL,
sizeof(snmp_vars->int_tbl[index].dsURL));
} else {
/* just update the appropriate fields */
@@ -796,7 +796,7 @@ snmp_update_interactions_table(void)
for (i = 0; i < NUM_SNMP_INT_TBL_ROWS; i++) {
stats->int_stats[i].dsIntIndex = i;
- strncpy(stats->int_stats[i].dsName, snmp_vars->int_tbl[i].dsName,
+ PL_strncpyz(stats->int_stats[i].dsName, snmp_vars->int_tbl[i].dsName,
sizeof(stats->int_stats[i].dsName));
stats->int_stats[i].dsTimeOfCreation = snmp_vars->int_tbl[i].dsTimeOfCreation;
stats->int_stats[i].dsTimeOfLastAttempt = snmp_vars->int_tbl[i].dsTimeOfLastAttempt;
@@ -804,7 +804,7 @@ snmp_update_interactions_table(void)
stats->int_stats[i].dsFailuresSinceLastSuccess = snmp_vars->int_tbl[i].dsFailuresSinceLastSuccess;
stats->int_stats[i].dsFailures = snmp_vars->int_tbl[i].dsFailures;
stats->int_stats[i].dsSuccesses = snmp_vars->int_tbl[i].dsSuccesses;
- strncpy(stats->int_stats[i].dsURL, snmp_vars->int_tbl[i].dsURL,
+ PL_strncpyz(stats->int_stats[i].dsURL, snmp_vars->int_tbl[i].dsURL,
sizeof(stats->int_stats[i].dsURL));
}
}
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index a7c09a000..28dc954e7 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -1108,11 +1108,13 @@ importdb(const char *dbimpl_name, const char *filename, const char *dump_name)
if (!dump) {
printf("Failed to open dump file %s. Error %d: %s\n", dump_name, errno, strerror(errno));
+ fclose(dump);
return 1;
}
if (dblayer_private_open(dbimpl_name, filename, 1, &be, &env, &db)) {
printf("Can't initialize db plugin: %s\n", dbimpl_name);
+ fclose(dump);
return 1;
}
@@ -1158,6 +1160,7 @@ exportdb(const char *dbimpl_name, const char *filename, const char *dump_name)
if (dblayer_private_open(dbimpl_name, filename, 0, &be, &env, &db)) {
printf("Can't initialize db plugin: %s\n", dbimpl_name);
+ fclose(dump);
return 1;
}
@@ -1166,6 +1169,7 @@ exportdb(const char *dbimpl_name, const char *filename, const char *dump_name)
ret = dblayer_new_cursor(be, db, NULL, &cursor);
if (ret != 0) {
printf("Can't create db cursor: %s\n", dblayer_strerror(ret));
+ fclose(dump);
return 1;
}
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index d387f3038..da7d244c2 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -654,6 +654,9 @@ vattr_test_filter(Slapi_PBlock *pb,
rc = plugin_call_syntax_filter_ava(a,
f->f_choice, &f->f_ava);
} else if (filter_type == FILTER_TYPE_SUBSTRING) {
+ /* covscan false positive: plugin_call_syntax_filter_sub does not free pb->pb_op */
+ /* coverity[deref_arg] */
+ /* coverity[double_free] */
rc = plugin_call_syntax_filter_sub(pb, a,
&f->f_sub);
}
@@ -889,6 +892,8 @@ slapi_vattr_values_get_sp(vattr_context *c,
} else {
vattr_context_ungrok(&c);
}
+ /* covscan false positive: ctx is stored in pblock */
+ /* coverity[leaked_storage] */
return rc;
}
diff --git a/lib/libaccess/oneeval.cpp b/lib/libaccess/oneeval.cpp
index d8bdd9a87..17bfa6fb0 100644
--- a/lib/libaccess/oneeval.cpp
+++ b/lib/libaccess/oneeval.cpp
@@ -507,6 +507,9 @@ ACLEvalBuildContext(
/* This must be done last to avoid a race in initialization */
acleval->acllist->cache = (void *)cache;
+
+ /* covscan false positive acelast is linked in the cache */
+ /* coverity[leaked_storage] */
return 0;
error:
@@ -519,6 +522,8 @@ error:
}
acleval->acllist->cache = NULL;
+ /* covscan false positive acelast is linked in the cache */
+ /* coverity[leaked_storage] */
return ACL_RES_ERROR;
}
diff --git a/lib/libaccess/register.cpp b/lib/libaccess/register.cpp
index 099068a56..634e9e364 100644
--- a/lib/libaccess/register.cpp
+++ b/lib/libaccess/register.cpp
@@ -820,6 +820,8 @@ ACL_AttrGetterRegister(NSErr_t *errp, const char *attr, ACLAttrGetterFn_t fn,
}
ACL_CritExit();
+ /* covscan false positive getter is stored in hash table */
+ /* coverity[leaked_storage] */
return 0;
}
diff --git a/lib/libaccess/usrcache.cpp b/lib/libaccess/usrcache.cpp
index b6ac58d3c..7bbd79fe2 100644
--- a/lib/libaccess/usrcache.cpp
+++ b/lib/libaccess/usrcache.cpp
@@ -174,14 +174,18 @@ int acl_usr_cache_init ()
/* Allocate rest of the UserCacheObj and put them in the link list */
for(i = 0; i < num_usrobj; i++){
- usrobj = (UserCacheObj *)pool_malloc(usrcache_pool,
- sizeof(UserCacheObj));
-
- if (!usrobj) return -1;
- memset((void *)usrobj, 0, sizeof(UserCacheObj));
- PR_INSERT_AFTER(&usrobj->list, usrobj_list);
+ /* covscan false positive usrobj is linked in the cache */
+ /* coverity[overwrite_var] */
+ usrobj = (UserCacheObj *)pool_malloc(usrcache_pool,
+ sizeof(UserCacheObj));
+
+ if (!usrobj) return -1;
+ memset((void *)usrobj, 0, sizeof(UserCacheObj));
+ PR_INSERT_AFTER(&usrobj->list, usrobj_list);
}
+ /* covscan false positive usrobj is linked in the cache */
+ /* coverity[leaked_storage] */
return (singleDbTable || databaseUserCacheTable) ? 0 : -1;
}
diff --git a/src/cockpit/389-console/src/LDAPEditor.jsx b/src/cockpit/389-console/src/LDAPEditor.jsx
index a78423a82..aa5a6ea3b 100644
--- a/src/cockpit/389-console/src/LDAPEditor.jsx
+++ b/src/cockpit/389-console/src/LDAPEditor.jsx
@@ -1131,6 +1131,7 @@ export class LDAPEditor extends React.Component {
treeViewRootSuffixes={this.state.treeViewRootSuffixes}
setWizardOperationInfo={this.setWizardOperationInfo}
onReload={this.handleReloadNoop}
+ // coverity[copy_paste_error]
onModrdnReload={this.handleReload}
allObjectclasses={this.state.allObjectclasses}
addNotification={this.props.addNotification}
diff --git a/src/lib389/lib389/dirsrv_log.py b/src/lib389/lib389/dirsrv_log.py
index 1ace25568..9ad227ebd 100644
--- a/src/lib389/lib389/dirsrv_log.py
+++ b/src/lib389/lib389/dirsrv_log.py
@@ -138,10 +138,7 @@ class DirsrvLog(DSLint):
@param ts - The timestamp string from a log
@return - a "datetime" object
"""
- if self.jsonFormat:
- timedata = self.prog_timestamp.match(ts).groupdict()
- else:
- timedata = self.prog_timestamp.match(ts).groupdict()
+ timedata = self.prog_timestamp.match(ts).groupdict()
# Now, have to convert month to an int.
dt_str = '{YEAR}-{MONTH}-{DAY} {HOUR}-{MINUTE}-{SECOND} {TZ}'.format(
diff --git a/src/lib389/lib389/migrate/plan.py b/src/lib389/lib389/migrate/plan.py
index 524946151..11cc84845 100644
--- a/src/lib389/lib389/migrate/plan.py
+++ b/src/lib389/lib389/migrate/plan.py
@@ -635,7 +635,7 @@ class Migration(object):
self.plan.append(SchemaClassUnsupported(obj))
continue
if obj.oid.lower().startswith('x-'):
- self.plan.append(SchemaClassInvalid(attr, "descr-oid format is ambiguous with x- prefix. You MUST use a numeric oid."))
+ self.plan.append(SchemaClassInvalid(obj, "descr-oid format is ambiguous with x- prefix. You MUST use a numeric oid."))
continue
# For the attr, find if anything has a name overlap in any capacity.
overlaps = [ ds_obj for ds_obj in schema_objects if ds_obj.oid == obj.oid]
| 0 |
c9b914b1610f6c03af4bcae9d311186807220068
|
389ds/389-ds-base
|
Ticket #346 - Fixing memory leaks
Description:
There was a leak in attrlist_replace/attrlist_replace_with_flags
when attr_replace failed to replace the attribute values.
commit 708a56b8d524131362e2d71b7fbc2eb257075e14 for Ticket #47834
tried to fix it, but it was wrong and introduced a double free.
This patch fixes it so that ...
If attr_replace fails and if to be replaced Slapi_Attr is newly
created in attrlist_replace//attrlist_replace_with_flags, the
Slapi_Attr is removed from the attrlist (alist) and Slapi_Attr
is freed. Otherwise, values and Slapi_Attr are not freed since
Slapi_Attr is just pointing the attribute in the attrlist and
values are consumed in attr_replace.
https://fedorahosted.org/389/ticket/346
Reviewed by [email protected] (Thank you, Rich!!)
|
commit c9b914b1610f6c03af4bcae9d311186807220068
Author: Noriko Hosoi <[email protected]>
Date: Thu Jul 24 10:48:23 2014 -0700
Ticket #346 - Fixing memory leaks
Description:
There was a leak in attrlist_replace/attrlist_replace_with_flags
when attr_replace failed to replace the attribute values.
commit 708a56b8d524131362e2d71b7fbc2eb257075e14 for Ticket #47834
tried to fix it, but it was wrong and introduced a double free.
This patch fixes it so that ...
If attr_replace fails and if to be replaced Slapi_Attr is newly
created in attrlist_replace//attrlist_replace_with_flags, the
Slapi_Attr is removed from the attrlist (alist) and Slapi_Attr
is freed. Otherwise, values and Slapi_Attr are not freed since
Slapi_Attr is just pointing the attribute in the attrlist and
values are consumed in attr_replace.
https://fedorahosted.org/389/ticket/346
Reviewed by [email protected] (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/attrlist.c b/ldap/servers/slapd/attrlist.c
index 6743bde64..55221ac5b 100644
--- a/ldap/servers/slapd/attrlist.c
+++ b/ldap/servers/slapd/attrlist.c
@@ -305,19 +305,20 @@ int attrlist_replace(Slapi_Attr **alist, const char *type, struct berval **vals)
if (vals == NULL || vals[0] == NULL) {
(void)attrlist_delete(alist, type);
} else {
- attrlist_find_or_create(alist, type, &a);
+ int created = attrlist_find_or_create(alist, type, &a);
valuearray_init_bervalarray(vals, &values);
if (slapi_attr_is_dn_syntax_attr(*a)) {
valuearray_dn_normalize_value(values);
(*a)->a_flags |= SLAPI_ATTR_FLAG_NORMALIZED_CES;
}
- rc = attr_replace(*a, values);
+ rc = attr_replace(*a, values); /* values is consumed */
if (rc) {
slapi_log_error(SLAPI_LOG_FATAL, "attrlist_replace",
"attr_replace (%s, %s) failed.\n",
type, vals[0]->bv_val);
- valuearray_free(&values);
- slapi_attr_free(a);
+ if (created) {
+ attrlist_delete(alist, type);
+ }
}
}
return rc;
@@ -339,13 +340,21 @@ int attrlist_replace_with_flags(Slapi_Attr **alist, const char *type, struct ber
if (vals == NULL || vals[0] == NULL) {
(void)attrlist_delete(alist, type);
} else {
- attrlist_find_or_create(alist, type, &a);
+ int created = attrlist_find_or_create(alist, type, &a);
valuearray_init_bervalarray_with_flags(vals, &values, flags);
if (slapi_attr_is_dn_syntax_attr(*a)) {
valuearray_dn_normalize_value(values);
(*a)->a_flags |= SLAPI_ATTR_FLAG_NORMALIZED_CES;
}
rc = attr_replace(*a, values);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, "attrlist_replace",
+ "attr_replace (%s, %s) failed.\n",
+ type, vals[0]->bv_val);
+ if (created) {
+ attrlist_delete(alist, type);
+ }
+ }
}
return rc;
}
| 0 |
70ab219aa7986a58501ca38aa0f66a254f81ff9f
|
389ds/389-ds-base
|
Issue 5497 - boolean attributes should be case insensitive
Description: Boolean values are supposed to be case insensitive, but in our
code it is senstiive even though the code is in the "cis" file.
relates: https://github.com/389ds/389-ds-base/issues/5497
Reviewed by: spichugi(Thanks!)
|
commit 70ab219aa7986a58501ca38aa0f66a254f81ff9f
Author: Mark Reynolds <[email protected]>
Date: Thu Jan 26 08:16:49 2023 -0500
Issue 5497 - boolean attributes should be case insensitive
Description: Boolean values are supposed to be case insensitive, but in our
code it is senstiive even though the code is in the "cis" file.
relates: https://github.com/389ds/389-ds-base/issues/5497
Reviewed by: spichugi(Thanks!)
diff --git a/dirsrvtests/tests/suites/syntax/acceptance_test.py b/dirsrvtests/tests/suites/syntax/acceptance_test.py
index 1a7c7c12d..807936892 100644
--- a/dirsrvtests/tests/suites/syntax/acceptance_test.py
+++ b/dirsrvtests/tests/suites/syntax/acceptance_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2020 Red Hat, Inc.
+# Copyright (C) 2023 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -213,6 +213,34 @@ def test_dn_syntax_spaces_delete(topo, props, rawdn):
group.delete()
+def test_boolean_case(topo):
+ """Test that we can a boolean value in any case
+
+ :id: 56777c1d-b058-41e1-abd5-87a6f1512db2
+ :customerscenario: True
+ :setup: Standalone Instance
+ :steps:
+ 1. Create test user
+ 2. Add boolean attribute value that is lowercase "false"
+ :expectedresults:
+ 1. Success
+ 2. Success
+ """
+ inst = topo.standalone
+ users = UserAccounts(inst, DEFAULT_SUFFIX)
+ user = users.create_test_user(uid=1011)
+
+ user.add('objectclass', 'extensibleObject')
+ user.add('pamsecure', 'false')
+ user.replace('pamsecure', 'FALSE')
+ user.replace('pamsecure', 'true')
+ user.replace('pamsecure', 'TRUE')
+
+ # Test some invalid syntax
+ with pytest.raises(ldap.INVALID_SYNTAX):
+ user.replace('pamsecure', 'blah')
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c
index e1242e3f4..c9274f37f 100644
--- a/ldap/servers/plugins/syntaxes/cis.c
+++ b/ldap/servers/plugins/syntaxes/cis.c
@@ -853,12 +853,12 @@ boolean_validate(
*/
if (val != NULL) {
if (val->bv_len == 4) {
- if (strncmp(val->bv_val, "TRUE", 4) != 0) {
+ if (strncasecmp(val->bv_val, "TRUE", 4) != 0) {
rc = 1;
goto exit;
}
} else if (val->bv_len == 5) {
- if (strncmp(val->bv_val, "FALSE", 5) != 0) {
+ if (strncasecmp(val->bv_val, "FALSE", 5) != 0) {
rc = 1;
goto exit;
}
| 0 |
a2edd8d2be8d0114ca5d7756ebda91420c0e9d1d
|
389ds/389-ds-base
|
Resolves: #243820
Summary: Online browsing indexing hangs
Description:
1. adding more shutdown checks in the indexing code to achieve the swift
shutdown even in the long running browsing indexing.
2. in the error case, cleaning up the index file.
3. found minor memory leaks.
|
commit a2edd8d2be8d0114ca5d7756ebda91420c0e9d1d
Author: Noriko Hosoi <[email protected]>
Date: Thu Sep 20 16:58:41 2007 +0000
Resolves: #243820
Summary: Online browsing indexing hangs
Description:
1. adding more shutdown checks in the indexing code to achieve the swift
shutdown even in the long running browsing indexing.
2. in the error case, cleaning up the index file.
3. found minor memory leaks.
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 9c78068f5..464125955 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1264,7 +1264,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
int numvlv = 0;
int return_value = -1;
ID temp_id;
- int i, j;
+ int i, j, vlvidx;
ID lastid;
struct backentry *ep;
char *type;
@@ -1277,6 +1277,9 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
int index_aid = 0; /* index ancestorid */
LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_ldbm2index\n", 0, 0, 0 );
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ return -1;
+ }
slapi_pblock_get(pb, SLAPI_BACKEND_INSTANCE_NAME, &instance_name);
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &li);
@@ -1387,6 +1390,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
slapi_pblock_get(pb, SLAPI_DB2INDEX_ATTRS, &attrs);
for (i = 0; attrs[i] != NULL; i++) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ ret = -1;
+ goto out;
+ }
switch(attrs[i][0]) {
case 't': /* attribute type to index */
db2index_add_indexed_attr(be, attrs[i]);
@@ -1495,6 +1502,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
*/
vlv_acquire_lock(be);
while (1) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ ret = -1;
+ goto out;
+ }
if (idl) {
if (idindex >= idl->b_nids)
break;
@@ -1597,6 +1608,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
slapi_attr_get_type( attr, &type );
for ( j = 0; indexAttrs[j] != NULL; j++ ) {
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ ret = -1;
+ goto out;
+ }
if (slapi_attr_type_cmp(indexAttrs[j], type,
SLAPI_TYPE_CMP_SUBTYPE) == 0 ) {
back_txn txn;
@@ -1679,9 +1694,13 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
/*
* Update the Virtual List View indexes
*/
- for ( j = 0; j<numvlv; j++ ) {
+ for ( vlvidx = 0; vlvidx < numvlv; vlvidx++ ) {
back_txn txn;
int rc = 0;
+ if ( g_get_shutdown() || c_get_shutdown() ) {
+ ret = -1;
+ goto out;
+ }
if (run_from_cmdline)
{
txn.back_txn_txn = NULL;
@@ -1693,7 +1712,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: ERROR: failed to begin txn for update index '%s'\n",
- inst->inst_name, indexAttrs[j], 0);
+ inst->inst_name, indexAttrs[vlvidx], 0);
LDAPDebug(LDAP_DEBUG_ANY,
"%s: Error %d: %s\n", inst->inst_name, rc,
dblayer_strerror(rc));
@@ -1701,20 +1720,20 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
slapi_task_log_notice(task,
"%s: ERROR: failed to begin txn for update index '%s' "
"(err %d: %s)", inst->inst_name,
- indexAttrs[j], rc, dblayer_strerror(rc));
+ indexAttrs[vlvidx], rc, dblayer_strerror(rc));
}
ret = -2;
goto out;
}
}
- vlv_update_index(pvlv[j], &txn, li, pb, NULL, ep);
+ vlv_update_index(pvlv[vlvidx], &txn, li, pb, NULL, ep);
if (!run_from_cmdline)
{
rc = dblayer_txn_commit(li, &txn);
if (0 != rc) {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: ERROR: failed to commit txn for update index '%s'\n",
- inst->inst_name, indexAttrs[j], 0);
+ inst->inst_name, indexAttrs[vlvidx], 0);
LDAPDebug(LDAP_DEBUG_ANY,
"%s: Error %d: %s\n", inst->inst_name, rc,
dblayer_strerror(rc));
@@ -1722,7 +1741,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
slapi_task_log_notice(task,
"%s: ERROR: failed to commit txn for update index '%s' "
"(err %d: %s)", inst->inst_name,
- indexAttrs[j], rc, dblayer_strerror(rc));
+ indexAttrs[vlvidx], rc, dblayer_strerror(rc));
}
ret = -2;
goto out;
@@ -1810,6 +1829,16 @@ out:
} else {
dbc->c_close(dbc);
}
+ if (ret < 0) {/* error case: undo vlv indexing */
+ struct vlvIndex *p = NULL;
+ /* if jumped to out due to an error, vlv lock has not been released */
+ vlv_release_lock(be);
+ for ( vlvidx = 0; vlvidx < numvlv; vlvidx++ ) {
+ p = pvlv[vlvidx];
+ vlvIndex_go_offline(p, be);
+ vlvIndex_delete(&p);
+ }
+ }
dblayer_release_id2entry( be, db );
instance_set_not_busy(inst);
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index 0c673c210..ace763d4d 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -245,9 +245,9 @@ vlvSearch_delete(struct vlvSearch** ppvs)
for(pi= (*ppvs)->vlv_index;pi!=NULL;)
{
ni= pi->vlv_next;
- if(pi->vlv_be != NULL) {
- vlvIndex_go_offline(pi,pi->vlv_be);
- }
+ if(pi->vlv_be != NULL) {
+ vlvIndex_go_offline(pi,pi->vlv_be);
+ }
vlvIndex_delete(&pi);
pi= ni;
}
@@ -569,6 +569,8 @@ vlvIndex_delete(struct vlvIndex** ppvs)
}
ldap_free_sort_keylist((*ppvs)->vlv_sortkey);
attrinfo_delete(&((*ppvs)->vlv_attrinfo));
+ slapi_ch_free((void**)&((*ppvs)->vlv_name));
+ slapi_ch_free((void**)&((*ppvs)->vlv_filename));
slapi_ch_free((void**)&((*ppvs)->vlv_mrpb));
slapi_ch_free((void**)&((*ppvs)->vlv_syntax_plugin));
PR_DestroyLock((*ppvs)->vlv_indexlength_lock);
| 0 |
591055105f700ceb0b40cccb76ccd55d0370f63c
|
389ds/389-ds-base
|
csn_init_as_string should not use sscanf
Added new slapi functions to convert decimal/hex strings to their integral
values. Use these in csn_init_as_string to convert the csn string values
to their integral values. Similar to removing sprintf, using these functions
instead of sscanf provides a large performance gain.
I also got rid of the use of PR_Counter in favor of slapi_counter, and
only use the counters if DEBUG is set.
Reviewed by: nkinder (Thanks!)
|
commit 591055105f700ceb0b40cccb76ccd55d0370f63c
Author: Rich Megginson <[email protected]>
Date: Wed Nov 16 17:34:46 2011 -0700
csn_init_as_string should not use sscanf
Added new slapi functions to convert decimal/hex strings to their integral
values. Use these in csn_init_as_string to convert the csn string values
to their integral values. Similar to removing sprintf, using these functions
instead of sscanf provides a large performance gain.
I also got rid of the use of PR_Counter in favor of slapi_counter, and
only use the counters if DEBUG is set.
Reviewed by: nkinder (Thanks!)
diff --git a/ldap/servers/slapd/csn.c b/ldap/servers/slapd/csn.c
index 04800362c..9fb5b4ac7 100644
--- a/ldap/servers/slapd/csn.c
+++ b/ldap/servers/slapd/csn.c
@@ -47,19 +47,6 @@
#include <string.h>
#include "slap.h"
-#include <prcountr.h>
-
-#define _CSN_TSTAMP_STRSIZE_STR "8"
-#define _CSN_SEQNUM_STRSIZE_STR "4"
-#define _CSN_REPLID_STRSIZE_STR "4"
-#define _CSN_SUBSEQNUM_STRSIZE_STR "4"
-
-#define _CSN_TSTAMP_SCANSTR "%"_CSN_TSTAMP_STRSIZE_STR"lx"
-#define _CSN_SEQNUM_SCANSTR "%"_CSN_SEQNUM_STRSIZE_STR"hx"
-#define _CSN_REPLID_SCANSTR "%"_CSN_REPLID_STRSIZE_STR"hx"
-#define _CSN_SUBSEQNUM_SCANSTR "%"_CSN_SUBSEQNUM_STRSIZE_STR"hx"
-
-#define _CSN_TSORDER_SPRINTSTR "%08x%04x%04x%04x"
#define _CSN_TSORDER_TSTAMP_OFFSET 0
#define _CSN_TSORDER_SEQNUM_OFFSET 8
@@ -71,10 +58,12 @@ static PRBool _csnIsValidString(const char *csnStr);
/*
* Debugging counters.
*/
+#ifdef DEBUG
static int counters_created= 0;
-PR_DEFINE_COUNTER(slapi_csn_counter_created);
-PR_DEFINE_COUNTER(slapi_csn_counter_deleted);
-PR_DEFINE_COUNTER(slapi_csn_counter_exist);
+static Slapi_Counter *slapi_csn_counter_created;
+static Slapi_Counter *slapi_csn_counter_deleted;
+static Slapi_Counter *slapi_csn_counter_exist;
+#endif
/*
* **************************************************************************
@@ -82,23 +71,27 @@ PR_DEFINE_COUNTER(slapi_csn_counter_exist);
* **************************************************************************
*/
+#ifdef DEBUG
static void
csn_create_counters()
{
- PR_CREATE_COUNTER(slapi_csn_counter_created,"Slapi_CSN","created","");
- PR_CREATE_COUNTER(slapi_csn_counter_deleted,"Slapi_CSN","deleted","");
- PR_CREATE_COUNTER(slapi_csn_counter_exist,"Slapi_CSN","exist","");
+ slapi_csn_counter_created = slapi_counter_new();
+ slapi_csn_counter_deleted = slapi_counter_new();
+ slapi_csn_counter_exist = slapi_counter_new();
counters_created= 1;
}
+#endif
CSN *csn_new()
{
+#ifdef DEBUG
if(!counters_created)
{
csn_create_counters();
}
- PR_INCREMENT_COUNTER(slapi_csn_counter_created);
- PR_INCREMENT_COUNTER(slapi_csn_counter_exist);
+ slapi_counter_increment(slapi_csn_counter_created);
+ slapi_counter_increment(slapi_csn_counter_exist);
+#endif
return (CSN*)slapi_ch_calloc(sizeof(CSN),1);
}
@@ -138,22 +131,13 @@ void csn_init_by_csn(CSN *csn1,const CSN *csn2)
void csn_init_by_string(CSN *csn, const char *s)
{
- time_t csnTime= 0;
- PRUint16 csnSeqNum= 0;
- ReplicaId rid= 0;
- PRUint16 csnSubSeqNum= 0;
-
- if(_csnIsValidString(s))
- {
- /* JCM - char2hex faster */
- sscanf((s+_CSN_TSORDER_TSTAMP_OFFSET), _CSN_TSTAMP_SCANSTR, &csnTime); /* JCM - scanf is very slow */
- sscanf((s+_CSN_TSORDER_SEQNUM_OFFSET), _CSN_SEQNUM_SCANSTR, &csnSeqNum);/* JCM - scanf is very slow */
- sscanf((s+_CSN_TSORDER_REPLID_OFFSET), _CSN_REPLID_SCANSTR, &rid);/* JCM - scanf is very slow */
- sscanf((s+_CSN_TSORDER_SUBSEQNUM_OFFSET), _CSN_SUBSEQNUM_SCANSTR, &csnSubSeqNum);/* JCM - scanf is very slow */
- csn->tstamp= csnTime;
- csn->seqnum= csnSeqNum;
- csn->rid= rid;
- csn->subseqnum= csnSubSeqNum;
+ if(_csnIsValidString(s)) {
+ /* yes - time_t is long - but the CSN will only ever store the lowest 4 bytes of
+ the timestamp */
+ csn->tstamp = slapi_str_to_u32(s+_CSN_TSORDER_TSTAMP_OFFSET);
+ csn->seqnum = slapi_str_to_u16(s+_CSN_TSORDER_SEQNUM_OFFSET);
+ csn->rid = slapi_str_to_u16(s+_CSN_TSORDER_REPLID_OFFSET);
+ csn->subseqnum = slapi_str_to_u16(s+_CSN_TSORDER_SUBSEQNUM_OFFSET);
}
}
@@ -176,12 +160,14 @@ void csn_free(CSN **csn)
{
if(csn!=NULL && *csn!=NULL)
{
+#ifdef DEBUG
if(!counters_created)
{
csn_create_counters();
}
- PR_INCREMENT_COUNTER(slapi_csn_counter_deleted);
- PR_DECREMENT_COUNTER(slapi_csn_counter_exist);
+ slapi_counter_increment(slapi_csn_counter_deleted);
+ slapi_counter_increment(slapi_csn_counter_exist);
+#endif
slapi_ch_free((void **)csn);
}
return;
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 446c5f7ca..cc1977729 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6826,6 +6826,53 @@ char *slapi_u32_to_hex(uint32_t val, char *s, uint8_t upper);
*/
char *slapi_u64_to_hex(uint64_t val, char *s, uint8_t upper);
+/**
+ * Convert a char to its integral hex value e.g. '0' -> 0 or 'a' -> 10.
+ * This only works on one caller at a time. If you want to convert a string
+ * of decimal/hex numbers to its integral value, see slapi_str_to_u8 et. al.
+ * This uses a lookup table so it should be extremely fast.
+ *
+ * \param c character value to convert
+ * \return integral value of the given char or -1 if not a valid decimal/hex digit
+ */
+int slapi_hexchar2int(char c);
+
+/**
+ * Convert a string of 2 decimal/hex characters to a 1 byte (8-bit) unsigned value.
+ * This function does no checking - it assumes s is non-NULL and well-formed.
+ *
+ * \param s convert the first 2 chars of this decimal/hex char string to its integral value
+ * \return the integral value
+ */
+uint8_t slapi_str_to_u8(const char *s);
+
+/**
+ * Convert a string of 4 decimal/hex characters to a 2 byte (16-bit) unsigned value.
+ * This function does no checking - it assumes s is non-NULL and well-formed.
+ *
+ * \param s convert the first 4 chars of this decimal/hex char string to its integral value
+ * \return the integral value
+ */
+uint16_t slapi_str_to_u16(const char *s);
+
+/**
+ * Convert a string of 8 decimal/hex characters to a 4 byte (32-bit) unsigned value.
+ * This function does no checking - it assumes s is non-NULL and well-formed.
+ *
+ * \param s convert the first 8 chars of this decimal/hex char string to its integral value
+ * \return the integral value
+ */
+uint32_t slapi_str_to_u32(const char *s);
+
+/**
+ * Convert a string of 16 decimal/hex characters to a 8 byte (64-bit) unsigned value.
+ * This function does no checking - it assumes s is non-NULL and well-formed.
+ *
+ * \param s convert the first 16 chars of this decimal/hex char string to its integral value
+ * \return the integral value
+ */
+uint64_t slapi_str_to_u64(const char *s);
+
#ifdef __cplusplus
}
#endif
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index e2970b4db..58d4dfa60 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1004,3 +1004,86 @@ slapi_u64_to_hex(uint64_t val, char *s, uint8_t upper) {
s[15] = digits[val & 0xf];
return &s[16];
}
+
+static const int char2intarray[] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+};
+
+static const int char2intarray_size = sizeof(char2intarray)/sizeof(char2intarray[0]);
+
+int
+slapi_hexchar2int(char c)
+{
+ return char2intarray[(unsigned char)c];
+}
+
+uint8_t
+slapi_str_to_u8(const char *s)
+{
+ uint8_t v0 = (uint8_t)slapi_hexchar2int(s[0]);
+ uint8_t v1 = (uint8_t)slapi_hexchar2int(s[1]);
+ return (v0 << 4) | v1;
+}
+
+uint16_t
+slapi_str_to_u16(const char *s)
+{
+ uint16_t v0 = (uint16_t)slapi_hexchar2int(s[0]);
+ uint16_t v1 = (uint16_t)slapi_hexchar2int(s[1]);
+ uint16_t v2 = (uint16_t)slapi_hexchar2int(s[2]);
+ uint16_t v3 = (uint16_t)slapi_hexchar2int(s[3]);
+ return (v0 << 12) | (v1 << 8) | (v2 << 4) | v3;
+}
+
+uint32_t
+slapi_str_to_u32(const char *s)
+{
+ uint32_t v0 = (uint32_t)slapi_hexchar2int(s[0]);
+ uint32_t v1 = (uint32_t)slapi_hexchar2int(s[1]);
+ uint32_t v2 = (uint32_t)slapi_hexchar2int(s[2]);
+ uint32_t v3 = (uint32_t)slapi_hexchar2int(s[3]);
+ uint32_t v4 = (uint32_t)slapi_hexchar2int(s[4]);
+ uint32_t v5 = (uint32_t)slapi_hexchar2int(s[5]);
+ uint32_t v6 = (uint32_t)slapi_hexchar2int(s[6]);
+ uint32_t v7 = (uint32_t)slapi_hexchar2int(s[7]);
+ return (v0 << 28) | (v1 << 24) | (v2 << 20) | (v3 << 16) | (v4 << 12) | (v5 << 8) | (v6 << 4) | v7;
+}
+
+uint64_t
+slapi_str_to_u64(const char *s)
+{
+ uint64_t v0 = (uint64_t)slapi_hexchar2int(s[0]);
+ uint64_t v1 = (uint64_t)slapi_hexchar2int(s[1]);
+ uint64_t v2 = (uint64_t)slapi_hexchar2int(s[2]);
+ uint64_t v3 = (uint64_t)slapi_hexchar2int(s[3]);
+ uint64_t v4 = (uint64_t)slapi_hexchar2int(s[4]);
+ uint64_t v5 = (uint64_t)slapi_hexchar2int(s[5]);
+ uint64_t v6 = (uint64_t)slapi_hexchar2int(s[6]);
+ uint64_t v7 = (uint64_t)slapi_hexchar2int(s[7]);
+ uint64_t v8 = (uint64_t)slapi_hexchar2int(s[8]);
+ uint64_t v9 = (uint64_t)slapi_hexchar2int(s[9]);
+ uint64_t v10 = (uint64_t)slapi_hexchar2int(s[10]);
+ uint64_t v11 = (uint64_t)slapi_hexchar2int(s[11]);
+ uint64_t v12 = (uint64_t)slapi_hexchar2int(s[12]);
+ uint64_t v13 = (uint64_t)slapi_hexchar2int(s[13]);
+ uint64_t v14 = (uint64_t)slapi_hexchar2int(s[14]);
+ uint64_t v15 = (uint64_t)slapi_hexchar2int(s[15]);
+ return (v0 << 60) | (v1 << 56) | (v2 << 52) | (v3 << 48) | (v4 << 44) | (v5 << 40) |
+ (v6 << 36) | (v7 << 32) | (v8 << 28) | (v9 << 24) | (v10 << 20) | (v11 << 16) |
+ (v12 << 12) | (v13 << 8) | (v14 << 4) | v15;
+}
| 0 |
210573b340f875ba25b495a4cceab416a3968f18
|
389ds/389-ds-base
|
Ticket 48239 - Fix for prefix allocation of un-initialised dirsrv objects
From: William Brown <[email protected]>
Date: Thu, 6 Aug 2015 10:11:25 +0930
Reviewed by: mreynolds
|
commit 210573b340f875ba25b495a4cceab416a3968f18
Author: Mark Reynolds <[email protected]>
Date: Thu Aug 6 07:50:07 2015 -0400
Ticket 48239 - Fix for prefix allocation of un-initialised dirsrv objects
From: William Brown <[email protected]>
Date: Thu, 6 Aug 2015 10:11:25 +0930
Reviewed by: mreynolds
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 10bf0df04..059186ddc 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -374,7 +374,7 @@ class DirSrv(SimpleLDAPObject):
self.timeout = timeout
# Reset the args (py.test reuses the args_instance for each test case)
- args_instance[SER_DEPLOYED_DIR] = os.environ.get('PREFIX', None)
+ args_instance[SER_DEPLOYED_DIR] = os.environ.get('PREFIX', '/')
args_instance[SER_BACKUP_INST_DIR] = os.environ.get('BACKUPDIR', DEFAULT_BACKUPDIR)
args_instance[SER_ROOT_DN] = DN_DM
args_instance[SER_ROOT_PW] = PW_DM
@@ -386,6 +386,12 @@ class DirSrv(SimpleLDAPObject):
args_instance[SER_USER_ID] = None
args_instance[SER_GROUP_ID] = None
+ # We allocate a "default" prefix here which allows an un-allocate or un-instantiated DirSrv
+ # instance to be able to do an an instance discovery. For example:
+ # ds = lib389.DirSrv()
+ # ds.list(all=True)
+ self.prefix = args_instance[SER_DEPLOYED_DIR]
+
self.__wrapmethods()
self.__add_brookers__()
@@ -440,7 +446,7 @@ class DirSrv(SimpleLDAPObject):
self.serverid = args.get(SER_SERVERID_PROP, None)
self.groupid = args.get(SER_GROUP_ID, self.userid)
self.backupdir = args.get(SER_BACKUP_INST_DIR, DEFAULT_BACKUPDIR)
- self.prefix = args.get(SER_DEPLOYED_DIR) or '/'
+ self.prefix = args.get(SER_DEPLOYED_DIR)
# Those variables needs to be revisited (sroot for 64 bits)
#self.sroot = os.path.join(self.prefix, "lib/dirsrv")
@@ -600,7 +606,8 @@ class DirSrv(SimpleLDAPObject):
# inst: <prefix>/etc/dirsrv/slapd-<serverid> (conf)
#
- prefix = self.prefix or '/'
+ # Don't need a default value now since it's set in init.
+ prefix = self.prefix
# first identify the directories we will scan
confdir = os.getenv('INITCONFIGDIR')
| 0 |
559d70e0a1e3df75a66e41fd1c009b25ca6f6a08
|
389ds/389-ds-base
|
Ticket 47766 - Tombstone purging can crash the server if the backend is stopped/disabled
Bug Description: The tombstone purge thread issues a callback search that will start
reading id2entry, even if the backend is stopped. This can crash the
server.
Fix Description: When performing a search and returning entries, check if the backend
is started before reading id2entry.
https://fedorahosted.org/389/ticket/47766
Reviewed by: nhosoi(Thanks!)
|
commit 559d70e0a1e3df75a66e41fd1c009b25ca6f6a08
Author: Mark Reynolds <[email protected]>
Date: Fri Apr 4 13:16:27 2014 -0400
Ticket 47766 - Tombstone purging can crash the server if the backend is stopped/disabled
Bug Description: The tombstone purge thread issues a callback search that will start
reading id2entry, even if the backend is stopped. This can crash the
server.
Fix Description: When performing a search and returning entries, check if the backend
is started before reading id2entry.
https://fedorahosted.org/389/ticket/47766
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index f70388f35..00a1f5163 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -1532,6 +1532,16 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
++sr->sr_lookthroughcount; /* checked above */
+ /* Make sure the backend is available */
+ if( be->be_state != BE_STATE_STARTED ){
+ slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
+ "Backend is stopped", 0, NULL );
+ slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
+ delete_search_result_set(pb, &sr);
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
+ }
+
/* get the entry */
e = id2entry( be, id, &txn, &err );
if ( e == NULL )
| 0 |
61bba3a6bd95fe83c651339018c1d36eae48b620
|
389ds/389-ds-base
|
Ticket #49761 - Fix CI test suite issues
Problem Description:
tickets/ticket47966_test.py is FAIL in CI nightly runs
Fix Description:
Remove tickets/ticket47966_test.py as it has already been ported to vlv/regression_test.py::test_bulk_import_when_the_backend_with_vlv_was_recreated
Add a blank line in test header to avoid potential problem when parsing
Relates: https://pagure.io/389-ds-base/issue/49761
Author: sgouvern
Review by: tbordaz, mhonek
|
commit 61bba3a6bd95fe83c651339018c1d36eae48b620
Author: Sylvie Gouverneyre <[email protected]>
Date: Wed Dec 11 08:02:59 2019 +0000
Ticket #49761 - Fix CI test suite issues
Problem Description:
tickets/ticket47966_test.py is FAIL in CI nightly runs
Fix Description:
Remove tickets/ticket47966_test.py as it has already been ported to vlv/regression_test.py::test_bulk_import_when_the_backend_with_vlv_was_recreated
Add a blank line in test header to avoid potential problem when parsing
Relates: https://pagure.io/389-ds-base/issue/49761
Author: sgouvern
Review by: tbordaz, mhonek
diff --git a/dirsrvtests/tests/suites/vlv/regression_test.py b/dirsrvtests/tests/suites/vlv/regression_test.py
index acf595700..646cd97ba 100644
--- a/dirsrvtests/tests/suites/vlv/regression_test.py
+++ b/dirsrvtests/tests/suites/vlv/regression_test.py
@@ -27,6 +27,7 @@ def test_bulk_import_when_the_backend_with_vlv_was_recreated(topology_m2):
"""
Testing bulk import when the backend with VLV was recreated.
If the test passes without the server crash, 47966 is verified.
+
:id: 512963fa-fe02-11e8-b1d3-8c16451d917b
:setup: Replication with two masters.
:steps:
diff --git a/dirsrvtests/tests/tickets/ticket47966_test.py b/dirsrvtests/tests/tickets/ticket47966_test.py
deleted file mode 100644
index 80e331876..000000000
--- a/dirsrvtests/tests/tickets/ticket47966_test.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2016 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-#
-import pytest
-from lib389.tasks import *
-from lib389.utils import *
-from lib389.topologies import topology_m2
-
-from lib389._constants import (DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2,
- ReplicaRole, REPLICAID_MASTER_2, BACKEND_NAME)
-
-pytestmark = pytest.mark.tier2
-
-logging.getLogger(__name__).setLevel(logging.DEBUG)
-log = logging.getLogger(__name__)
-
-
-def test_ticket47966(topology_m2):
- '''
- Testing bulk import when the backend with VLV was recreated.
- If the test passes without the server crash, 47966 is verified.
- '''
- log.info('Testing Ticket 47966 - [VLV] slapd crashes during Dogtag clone reinstallation')
- M1 = topology_m2.ms["master1"]
- M2 = topology_m2.ms["master2"]
- m1_m2_agmt = M1.agreement.list(suffix=DEFAULT_SUFFIX)[0].dn
-
- log.info('0. Create a VLV index on Master 2.')
- # get the backend entry
- be = M2.replica.conn.backend.list(suffix=DEFAULT_SUFFIX)
- if not be:
- log.fatal("ticket47966: enable to retrieve the backend for %s" % DEFAULT_SUFFIX)
- raise ValueError("no backend for suffix %s" % DEFAULT_SUFFIX)
- bent = be[0]
- beName = bent.getValue('cn')
- beDn = "cn=%s,cn=ldbm database,cn=plugins,cn=config" % beName
-
- # generate vlvSearch entry
- vlvSrchDn = "cn=vlvSrch,%s" % beDn
- log.info('0-1. vlvSearch dn: %s' % vlvSrchDn)
- vlvSrchEntry = Entry(vlvSrchDn)
- vlvSrchEntry.setValues('objectclass', 'top', 'vlvSearch')
- vlvSrchEntry.setValues('cn', 'vlvSrch')
- vlvSrchEntry.setValues('vlvBase', DEFAULT_SUFFIX)
- vlvSrchEntry.setValues('vlvFilter', '(|(objectclass=*)(objectclass=ldapsubentry))')
- vlvSrchEntry.setValues('vlvScope', '2')
- M2.add_s(vlvSrchEntry)
-
- # generate vlvIndex entry
- vlvIndexDn = "cn=vlvIdx,%s" % vlvSrchDn
- log.info('0-2. vlvIndex dn: %s' % vlvIndexDn)
- vlvIndexEntry = Entry(vlvIndexDn)
- vlvIndexEntry.setValues('objectclass', 'top', 'vlvIndex')
- vlvIndexEntry.setValues('cn', 'vlvIdx')
- vlvIndexEntry.setValues('vlvSort', 'cn ou sn')
- M2.add_s(vlvIndexEntry)
-
- log.info('1. Initialize Master 2 from Master 1.')
- M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- M1.waitForReplInit(m1_m2_agmt)
-
- # Check replication is working...
- if M1.testReplication(DEFAULT_SUFFIX, M2):
- log.info('1-1. Replication is working.')
- else:
- log.fatal('1-1. Replication is not working.')
- assert False
-
- log.info('2. Delete the backend instance on Master 2.')
- M2.delete_s(vlvIndexDn)
- M2.delete_s(vlvSrchDn)
- # delete the agreement, replica, and mapping tree, too.
- M2.replica.disableReplication(DEFAULT_SUFFIX)
- mappingTree = 'cn="%s",cn=mapping tree,cn=config' % DEFAULT_SUFFIX
- M2.mappingtree.delete(DEFAULT_SUFFIX, beName, mappingTree)
- M2.backend.delete(DEFAULT_SUFFIX, beDn, beName)
-
- log.info('3. Recreate the backend and the VLV index on Master 2.')
- M2.mappingtree.create(DEFAULT_SUFFIX, beName)
- M2.backend.create(DEFAULT_SUFFIX, {BACKEND_NAME: beName})
- log.info('3-1. Recreating %s and %s on Master 2.' % (vlvSrchDn, vlvIndexDn))
- M2.add_s(vlvSrchEntry)
- M2.add_s(vlvIndexEntry)
- M2.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=ReplicaRole.MASTER, replicaId=REPLICAID_MASTER_2)
- # agreement m2_m1_agmt is not needed... :p
-
- log.info('4. Initialize Master 2 from Master 1 again.')
- M1.agreement.init(DEFAULT_SUFFIX, HOST_MASTER_2, PORT_MASTER_2)
- M1.waitForReplInit(m1_m2_agmt)
-
- # Check replication is working...
- if M1.testReplication(DEFAULT_SUFFIX, M2):
- log.info('4-1. Replication is working.')
- else:
- log.fatal('4-1. Replication is not working.')
- assert False
-
- log.info('5. Check Master 2 is up.')
- entries = M2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(cn=*)')
- assert len(entries) > 0
- log.info('5-1. %s entries are returned from M2.' % len(entries))
-
- log.info('Test complete')
-
-
-if __name__ == '__main__':
- # Run isolated
- # -s for DEBUG mode
- CURRENT_FILE = os.path.realpath(__file__)
- pytest.main("-s %s" % CURRENT_FILE)
| 0 |
050adf6a910bdc204436469eb88956ad2b92d84e
|
389ds/389-ds-base
|
Ticket #308 - Automembership plugin fails if data and config area mixed in the plugin configuration
Bug Description: If you set the nsslapd-pluginConfigArea, and set your default/target groups
to be underneath the config area, you will deadlock the server when you add
an entry that triggers the plugin. We grab a lock to see if the entry is
within the plugin scope/filter. Then we try and update the group, but since
the group is in the config area it thinks it's a config entry and grabs the
lock again --> deadlock
Fix Description: This is a misconfiguation so we need to verify the config at startup. Skip
definition entries if they are under the config area, and log a error.
Reviewed by: richm (Thanks Rich!)
https://fedorahosted.org/389/ticket/308
|
commit 050adf6a910bdc204436469eb88956ad2b92d84e
Author: Mark Reynolds <[email protected]>
Date: Thu Mar 8 12:37:26 2012 -0500
Ticket #308 - Automembership plugin fails if data and config area mixed in the plugin configuration
Bug Description: If you set the nsslapd-pluginConfigArea, and set your default/target groups
to be underneath the config area, you will deadlock the server when you add
an entry that triggers the plugin. We grab a lock to see if the entry is
within the plugin scope/filter. Then we try and update the group, but since
the group is in the config area it thinks it's a config entry and grabs the
lock again --> deadlock
Fix Description: This is a misconfiguation so we need to verify the config at startup. Skip
definition entries if they are under the config area, and log a error.
Reviewed by: richm (Thanks Rich!)
https://fedorahosted.org/389/ticket/308
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index 9dcc65a85..391dde75a 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -531,6 +531,7 @@ automember_parse_config_entry(Slapi_Entry * e, int apply)
Slapi_PBlock *search_pb = NULL;
Slapi_Entry **rule_entries = NULL;
char *filter_str = NULL;
+ Slapi_DN *dn = NULL;
Slapi_Filter *filter = NULL;
int result;
int entry_added = 0;
@@ -626,6 +627,27 @@ automember_parse_config_entry(Slapi_Entry * e, int apply)
if (values) {
/* Just hand off the values */
entry->default_groups = values;
+
+ /*
+ * If we set the config area, we need to make sure that the default groups are not
+ * in the config area, or else we could deadlock on updates.
+ */
+ if(automember_get_config_area()){
+ for(i = 0; values && values[i]; i++){
+ dn = slapi_sdn_new_dn_byref(values[i]);
+ if(slapi_sdn_issuffix(dn, automember_get_config_area())){
+ /* The groups are under the config area - not good */
+ slapi_log_error(SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "automember_parse_config_entry: The default group \"%s\" can not be "
+ "a child of the plugin config area \"%s\".\n",
+ values[i], slapi_sdn_get_dn(automember_get_config_area()));
+ slapi_sdn_free(&dn);
+ ret = -1;
+ goto bail;
+ }
+ slapi_sdn_free(&dn);
+ }
+ }
values = NULL;
}
@@ -976,6 +998,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
{
char *target_group = NULL;
char **values = NULL;
+ Slapi_DN *group_dn = NULL;
PRCList *list;
int i = 0;
@@ -1001,6 +1024,21 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
goto bail;
}
+ /* normalize the group dn and compare it to the configArea DN */
+ if(automember_get_config_area()){
+ group_dn = slapi_sdn_new_dn_byref(target_group);
+ if(slapi_sdn_issuffix(group_dn, automember_get_config_area())){
+ /* The target group is under the plugin config area - not good */
+ slapi_log_error(SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "automember_parse_regex_entry: The target group \"%s\" can not be "
+ "a child of the plugin config area \"%s\".\n",
+ slapi_sdn_get_dn(group_dn), slapi_sdn_get_dn(automember_get_config_area()));
+ slapi_sdn_free(&group_dn);
+ goto bail;
+ }
+ slapi_sdn_free(&group_dn);
+ }
+
/* Load inclusive rules */
values = slapi_entry_attr_get_charray(e, AUTOMEMBER_INC_REGEX_TYPE);
if (values) {
| 0 |
a23e607e3368f009e26f0e65e5ad8f34665da4f1
|
389ds/389-ds-base
|
Resolves: 474945
Summary: Consistently deal with attr syntax info struct ref count when fetcvhing and returning them to the global hashtables.
|
commit a23e607e3368f009e26f0e65e5ad8f34665da4f1
Author: Nathan Kinder <[email protected]>
Date: Wed Jan 21 00:00:32 2009 +0000
Resolves: 474945
Summary: Consistently deal with attr syntax info struct ref count when fetcvhing and returning them to the global hashtables.
diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c
index 6054df0fe..6c3a6a0f6 100644
--- a/ldap/servers/slapd/attr.c
+++ b/ldap/servers/slapd/attr.c
@@ -226,11 +226,11 @@ slapi_attr_new()
Slapi_Attr *
slapi_attr_init(Slapi_Attr *a, const char *type)
{
- return slapi_attr_init_locking_optional(a, type, PR_TRUE, PR_TRUE);
+ return slapi_attr_init_locking_optional(a, type, PR_TRUE);
}
Slapi_Attr *
-slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_lock, PRBool ref_count)
+slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_lock)
{
PR_ASSERT(a!=NULL);
@@ -249,7 +249,7 @@ slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_loc
{
basetype = tmp; /* basetype was malloc'd */
}
- asi = attr_syntax_get_by_name_locking_optional(basetype, use_lock, ref_count);
+ asi = attr_syntax_get_by_name_locking_optional(basetype, use_lock);
}
if(NULL == asi)
{
@@ -260,7 +260,7 @@ slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_loc
* attribute type that has that syntax.
*/
asi = attr_syntax_get_by_name_locking_optional(
- ATTR_WITH_DIRSTRING_SYNTAX, use_lock, ref_count);
+ ATTR_WITH_DIRSTRING_SYNTAX, use_lock);
}
else
{
diff --git a/ldap/servers/slapd/attrlist.c b/ldap/servers/slapd/attrlist.c
index 6946c0cc8..b200472b7 100644
--- a/ldap/servers/slapd/attrlist.c
+++ b/ldap/servers/slapd/attrlist.c
@@ -63,11 +63,11 @@ attrlist_free(Slapi_Attr *alist)
int
attrlist_find_or_create(Slapi_Attr **alist, const char *type, Slapi_Attr ***a)
{
- return attrlist_find_or_create_locking_optional(alist, type, a, PR_TRUE, PR_TRUE);
+ return attrlist_find_or_create_locking_optional(alist, type, a, PR_TRUE);
}
int
-attrlist_find_or_create_locking_optional(Slapi_Attr **alist, const char *type, Slapi_Attr ***a, PRBool use_lock, PRBool ref_count)
+attrlist_find_or_create_locking_optional(Slapi_Attr **alist, const char *type, Slapi_Attr ***a, PRBool use_lock)
{
int rc= 0; /* found */
if ( *a==NULL )
@@ -82,7 +82,7 @@ attrlist_find_or_create_locking_optional(Slapi_Attr **alist, const char *type, S
if( **a==NULL )
{
**a = slapi_attr_new();
- slapi_attr_init_locking_optional(**a, type, use_lock, ref_count);
+ slapi_attr_init_locking_optional(**a, type, use_lock);
rc= 1; /* created */
}
return rc;
diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c
index a65d0a997..32ad41051 100644
--- a/ldap/servers/slapd/attrsyntax.c
+++ b/ldap/servers/slapd/attrsyntax.c
@@ -78,7 +78,7 @@ static void *attr_syntax_get_plugin_by_name_with_default( const char *type );
static void attr_syntax_delete_no_lock( struct asyntaxinfo *asip,
PRBool remove_from_oid_table );
static struct asyntaxinfo *attr_syntax_get_by_oid_locking_optional( const
- char *oid, PRBool use_lock, PRBool ref_count);
+ char *oid, PRBool use_lock);
#ifdef ATTR_LDAP_DEBUG
static void attr_syntax_print();
@@ -236,12 +236,20 @@ hashNocaseCompare(const void *v1, const void *v2)
struct asyntaxinfo *
attr_syntax_get_by_oid(const char *oid)
{
- return attr_syntax_get_by_oid_locking_optional( oid, PR_TRUE, PR_TRUE);
+ return attr_syntax_get_by_oid_locking_optional( oid, PR_TRUE);
}
+/*
+ * A version of attr_syntax_get_by_oid() that allows you to bypass using
+ * a lock to access the global oid hash table.
+ *
+ * Note: once the caller is finished using it, the structure must be
+ * returned by calling attr_syntax_return_locking_optional() with the
+ * same use_lock parameter.
+ */
static struct asyntaxinfo *
-attr_syntax_get_by_oid_locking_optional( const char *oid, PRBool use_lock, PRBool ref_count )
+attr_syntax_get_by_oid_locking_optional( const char *oid, PRBool use_lock )
{
struct asyntaxinfo *asi = 0;
if (oid2asi)
@@ -250,7 +258,7 @@ attr_syntax_get_by_oid_locking_optional( const char *oid, PRBool use_lock, PRBoo
asi = (struct asyntaxinfo *)PL_HashTableLookup_const(oid2asi, oid);
if (asi)
{
- if(ref_count) PR_AtomicIncrement( &asi->asi_refcnt );
+ PR_AtomicIncrement( &asi->asi_refcnt );
}
if ( use_lock ) AS_UNLOCK_READ(oid2asi_lock);
}
@@ -290,12 +298,20 @@ attr_syntax_add_by_oid(const char *oid, struct asyntaxinfo *a, int lock)
struct asyntaxinfo *
attr_syntax_get_by_name(const char *name)
{
- return attr_syntax_get_by_name_locking_optional(name, PR_TRUE, PR_TRUE);
+ return attr_syntax_get_by_name_locking_optional(name, PR_TRUE);
}
+/*
+ * A version of attr_syntax_get_by_name() that allows you to bypass using
+ * a lock around the global name hashtable.
+ *
+ * Note: once the caller is finished using it, the structure must be
+ * returned by calling attr_syntax_return_locking_optional() with the
+ * same use_lock parameter.
+ */
struct asyntaxinfo *
-attr_syntax_get_by_name_locking_optional(const char *name, PRBool use_lock, PRBool ref_count)
+attr_syntax_get_by_name_locking_optional(const char *name, PRBool use_lock)
{
struct asyntaxinfo *asi = 0;
if (name2asi)
@@ -303,12 +319,12 @@ attr_syntax_get_by_name_locking_optional(const char *name, PRBool use_lock, PRBo
if ( use_lock ) AS_LOCK_READ(name2asi_lock);
asi = (struct asyntaxinfo *)PL_HashTableLookup_const(name2asi, name);
if ( NULL != asi ) {
- if(ref_count) PR_AtomicIncrement( &asi->asi_refcnt );
+ PR_AtomicIncrement( &asi->asi_refcnt );
}
if ( use_lock ) AS_UNLOCK_READ(name2asi_lock);
}
if (!asi) /* given name may be an OID */
- asi = attr_syntax_get_by_oid_locking_optional(name, use_lock, ref_count);
+ asi = attr_syntax_get_by_oid_locking_optional(name, use_lock);
return asi;
}
@@ -343,6 +359,8 @@ attr_syntax_return_locking_optional( struct asyntaxinfo *asi, PRBool use_lock )
AS_LOCK_WRITE(name2asi_lock); /* get a write lock */
if ( asi->asi_marked_for_delete ) /* one final check */
{
+ /* ref count is 0 and it's flagged for
+ * deletion, so it's safe to free now */
attr_syntax_free(asi);
}
AS_UNLOCK_WRITE(name2asi_lock);
@@ -427,6 +445,10 @@ attr_syntax_delete_no_lock( struct asyntaxinfo *asi,
if ( asi->asi_refcnt > 0 ) {
asi->asi_marked_for_delete = PR_TRUE;
} else {
+ /* This is ok, but the correct thing is to call delete first,
+ * then to call return. The last return will then take care of
+ * the free. The only way this free would happen here is if
+ * you return the syntax before calling delete. */
attr_syntax_free(asi);
}
}
@@ -450,7 +472,7 @@ slapi_attr_syntax_normalize( const char *s )
char *r;
- if((asi=attr_syntax_get_by_name_locking_optional(s, PR_TRUE, PR_FALSE)) != NULL ) {
+ if((asi=attr_syntax_get_by_name(s)) != NULL ) {
r = slapi_ch_strdup(asi->asi_name);
attr_syntax_return( asi );
}
@@ -480,7 +502,7 @@ attr_syntax_exists(const char *attr_name)
return 0;
}
-/* check syntax without incrementing refcount -- handles locking itself */
+/* check syntax */
static void *
attr_syntax_get_plugin_by_name_with_default( const char *type )
@@ -491,14 +513,13 @@ attr_syntax_get_plugin_by_name_with_default( const char *type )
/*
* first we look for this attribute type explictly
*/
- if ( (asi = attr_syntax_get_by_name_locking_optional(type, PR_TRUE, PR_FALSE)) == NULL ) {
+ if ( (asi = attr_syntax_get_by_name(type)) == NULL ) {
/*
* no syntax for this type... return DirectoryString
* syntax. we accomplish this by looking up a well known
* attribute type that has that syntax.
*/
- asi = attr_syntax_get_by_name_locking_optional(
- ATTR_WITH_DIRSTRING_SYNTAX, PR_TRUE, PR_FALSE);
+ asi = attr_syntax_get_by_name(ATTR_WITH_DIRSTRING_SYNTAX);
}
if ( NULL != asi ) {
plugin = asi->asi_plugin;
@@ -548,7 +569,7 @@ attr_syntax_add( struct asyntaxinfo *asip )
/* make sure the oid is unique */
if ( NULL != ( oldas_from_oid = attr_syntax_get_by_oid_locking_optional(
- asip->asi_oid, !nolock, PR_TRUE))) {
+ asip->asi_oid, !nolock))) {
if ( 0 == (asip->asi_flags & SLAPI_ATTR_FLAG_OVERRIDE)) {
/* failure - OID is in use; no override flag */
rc = LDAP_TYPE_OR_VALUE_EXISTS;
@@ -560,13 +581,15 @@ attr_syntax_add( struct asyntaxinfo *asip )
* the primary name and OID point to the same schema definition.
*/
if ( NULL != ( oldas_from_name = attr_syntax_get_by_name_locking_optional(
- asip->asi_name, !nolock, PR_TRUE))) {
+ asip->asi_name, !nolock))) {
if ( 0 == (asip->asi_flags & SLAPI_ATTR_FLAG_OVERRIDE)
|| ( oldas_from_oid != oldas_from_name )) {
/* failure; no override flag OR OID and name don't match */
rc = LDAP_TYPE_OR_VALUE_EXISTS;
goto cleanup_and_return;
}
+ /* Flag for deletion. We are going to override this attr */
+ attr_syntax_delete(oldas_from_name);
} else if ( NULL != oldas_from_oid ) {
/* failure - OID is in use but name does not exist */
rc = LDAP_TYPE_OR_VALUE_EXISTS;
@@ -580,15 +603,17 @@ attr_syntax_add( struct asyntaxinfo *asip )
if ( NULL != ( tmpasi =
attr_syntax_get_by_name_locking_optional(
- asip->asi_aliases[i], !nolock,PR_TRUE))) {
+ asip->asi_aliases[i], !nolock))) {
if (asip->asi_flags & SLAPI_ATTR_FLAG_OVERRIDE) {
+ /* Flag for tmpasi for deletion. It will be free'd
+ * when attr_syntax_return is called. */
attr_syntax_delete(tmpasi);
} else {
/* failure - one of the aliases is already in use */
rc = LDAP_TYPE_OR_VALUE_EXISTS;
}
- attr_syntax_return( tmpasi );
+ attr_syntax_return_locking_optional( tmpasi, !nolock );
if ( LDAP_SUCCESS != rc ) {
goto cleanup_and_return;
}
@@ -605,8 +630,8 @@ attr_syntax_add( struct asyntaxinfo *asip )
attr_syntax_add_by_name( asip, !nolock);
cleanup_and_return:
- attr_syntax_return( oldas_from_oid );
- attr_syntax_return( oldas_from_name );
+ attr_syntax_return_locking_optional( oldas_from_oid, !nolock );
+ attr_syntax_return_locking_optional( oldas_from_name, !nolock );
return rc;
}
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 01d45b26d..72b3e340d 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -304,7 +304,7 @@ str2entry_fast( char *s, int flags, int read_stateinfo )
switch(attr_state)
{
case ATTRIBUTE_PRESENT:
- if(attrlist_find_or_create_locking_optional(&e->e_attrs, type, &a, PR_FALSE, PR_TRUE)==0 /* Found */)
+ if(attrlist_find_or_create_locking_optional(&e->e_attrs, type, &a, PR_FALSE)==0 /* Found */)
{
LDAPDebug (LDAP_DEBUG_ANY, "str2entry_fast: Error. Non-contiguous attribute values for %s\n", type, 0, 0);
PR_ASSERT(0);
@@ -312,7 +312,7 @@ str2entry_fast( char *s, int flags, int read_stateinfo )
}
break;
case ATTRIBUTE_DELETED:
- if(attrlist_find_or_create_locking_optional(&e->e_deleted_attrs, type, &a, PR_FALSE, PR_TRUE)==0 /* Found */)
+ if(attrlist_find_or_create_locking_optional(&e->e_deleted_attrs, type, &a, PR_FALSE)==0 /* Found */)
{
LDAPDebug (LDAP_DEBUG_ANY, "str2entry_fast: Error. Non-contiguous deleted attribute values for %s\n", type, 0, 0);
PR_ASSERT(0);
@@ -940,7 +940,7 @@ str2entry_dupcheck( char *s, int flags, int read_stateinfo )
{
int maxvals = 0;
Slapi_Attr **a= NULL;
- attrlist_find_or_create_locking_optional(alist, sa->sa_type, &a, PR_FALSE, PR_TRUE);
+ attrlist_find_or_create_locking_optional(alist, sa->sa_type, &a, PR_FALSE);
valuearray_add_valuearray_fast( /* JCM should be calling a valueset function */
&(*a)->a_present_values.va, /* JCM .va is private */
sa->sa_present_values.va,
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index e088f7d15..4a8a2e089 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -76,7 +76,7 @@ int attr_check_minmax ( const char *attr_name, char *value, long minval, long ma
void attrlist_free(Slapi_Attr *alist);
int attrlist_find_or_create(Slapi_Attr **alist, const char *type, Slapi_Attr ***a);
-int attrlist_find_or_create_locking_optional(Slapi_Attr **alist, const char *type, Slapi_Attr ***a, PRBool use_lock, PRBool ref_count);
+int attrlist_find_or_create_locking_optional(Slapi_Attr **alist, const char *type, Slapi_Attr ***a, PRBool use_lock);
void attrlist_merge( Slapi_Attr **alist, const char *type, struct berval **vals );
void attrlist_merge_valuearray( Slapi_Attr **alist, const char *type, Slapi_Value **vals );
int attrlist_delete( Slapi_Attr **attrs, const char *type );
@@ -110,7 +110,7 @@ void attr_syntax_all_clear_flag( unsigned long flag );
void attr_syntax_delete_all_not_flagged( unsigned long flag );
struct asyntaxinfo *attr_syntax_get_by_oid ( const char *oid );
struct asyntaxinfo *attr_syntax_get_by_name ( const char *name );
-struct asyntaxinfo *attr_syntax_get_by_name_locking_optional ( const char *name, PRBool use_lock, PRBool ref_count );
+struct asyntaxinfo *attr_syntax_get_by_name_locking_optional ( const char *name, PRBool use_lock );
/*
* Call attr_syntax_return() when you are done using a value returned
* by attr_syntax_get_by_oid() or attr_syntax_get_by_name().
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 29230f950..2cea6afd2 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -160,7 +160,6 @@ slapi_pw_find_sv(
/* Checks if the specified value is encoded.
Returns 1 if it is and 0 otherwise
*/
-/* NGK - Use this for checking if the password is hashed */
int slapi_is_encoded (char *value)
{
struct pw_scheme *is_hashed = NULL;
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 5383006dc..04b13d09d 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -2443,6 +2443,7 @@ schema_replace_attributes ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
LDAPDebug( LDAP_DEBUG_TRACE, "schema_replace_attributes:"
" replacing type %s (OID %s)\n",
newasip->asi_name, newasip->asi_oid, 0 );
+ /* flag for deletion */
attr_syntax_delete( oldasip );
}
@@ -3149,7 +3150,8 @@ slapi_check_at_sup_dependency(char *sup, char *oid)
/*
* if asipp is NULL, the attribute type is added to the global set of schema.
- * if asipp is not NULL, the AT is not added but *asipp is set.
+ * if asipp is not NULL, the AT is not added but *asipp is set. When you are
+ * finished with *asipp, use attr_syntax_free() to dispose of it.
*
* schema_flags: Any or none of the following bits could be set
* DSE_SCHEMA_NO_CHECK -- schema won't be checked
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index cbd7d32eb..8ff5caef8 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -344,7 +344,7 @@ void entry_add_rdn_csn(Slapi_Entry *e, const CSN *csn);
int entry_add_dncsn_ext(Slapi_Entry *entry, const CSN *csn, PRUint32 flags);
/* attr.c */
-Slapi_Attr *slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_lock, PRBool ref_count);
+Slapi_Attr *slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_lock);
int attr_set_csn( Slapi_Attr *a, const CSN *csn);
int attr_set_deletion_csn( Slapi_Attr *a, const CSN *csn);
const CSN *attr_get_deletion_csn(const Slapi_Attr *a);
| 0 |
b4b87efa99f5dff4907c15fbb93c726f24f91ec3
|
389ds/389-ds-base
|
Bug(s) fixed: 185364
Bug Description: Can't update scripts (e.g., start-slapd) in the instance directory
Reviewed by: ???
Fix Description: ns-update needs to run ds_create -r for each instance in the server root because the start-slapd et. al. scripts that it needs to recreate are per-instance. The install.inf passed in from setup only contains the information in the [General] and [admin] section. We need to supply the missing information for the [slapd] section to make both create_scripts() and reconfigure_instance() happy.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
|
commit b4b87efa99f5dff4907c15fbb93c726f24f91ec3
Author: Rich Megginson <[email protected]>
Date: Thu Oct 12 19:38:14 2006 +0000
Bug(s) fixed: 185364
Bug Description: Can't update scripts (e.g., start-slapd) in the instance directory
Reviewed by: ???
Fix Description: ns-update needs to run ds_create -r for each instance in the server root because the start-slapd et. al. scripts that it needs to recreate are per-instance. The install.inf passed in from setup only contains the information in the [General] and [admin] section. We need to supply the missing information for the [slapd] section to make both create_scripts() and reconfigure_instance() happy.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
diff --git a/ldap/cm/newinst/ns-update b/ldap/cm/newinst/ns-update
index dd16a36a2..31a80c33c 100755
--- a/ldap/cm/newinst/ns-update
+++ b/ldap/cm/newinst/ns-update
@@ -46,6 +46,42 @@
sroot=`echo $0 | sed s#/bin/slapd/admin/bin/.\*##g`
PERL=perl # just use perl from PATH
+# run_ds_create "$sroot" "$dir" "$inffile"
+run_ds_create()
+{
+ sroot="$1"
+ shift
+ dir="$1"
+ shift
+ inffile="$1"
+
+ # the inffile is incomplete - it needs the instance specific stuff
+ dseldif=$sroot/$dir/config/dse.ldif
+ port=`grep \^nsslapd-port: $dseldif | sed -e s/\^nsslapd-port:[\ \ ]*//`
+ rootdn=`grep \^nsslapd-rootdn: $dseldif | sed -e s/\^nsslapd-rootdn:[\ \ ]*//`
+ id=`echo $dir | sed -e s/^slapd-//`
+ suffix="o=NetscapeRoot"
+
+ realfile=/tmp/fds$$.inf
+ cp $inffile $realfile
+ echo "" >> $realfile
+ echo "[slapd]" >> $realfile
+ echo "ServerIdentifier= $id" >> $realfile
+ echo "ServerPort= $port" >> $realfile
+ echo "RootDN= $rootdn" >> $realfile
+ # dummy password
+ echo "RootDNPwd= password" >> $realfile
+ echo "Suffix= $suffix" >> $realfile
+
+ cwd=`pwd`
+ cd `dirname $0`
+
+ ./ds_create -r -f $realfile
+
+ rm -f $realfile
+ cd $cwd
+}
+
start_server()
{
NETSITE_ROOT=$1
@@ -60,16 +96,26 @@ start_server()
cd $cwd
}
+# get the inf file name
+seenfarg=
+inffile=
+
# if the -r flag is present, this means we're doing a
# reinstall or an upgrade, so restart the servers
-for arg in $* ; do
+for arg in "$@" ; do
if [ "$arg" = "-r" ]; then
reconfig=1
fi
if [ "$arg" = "-S" ]; then
iDSISolaris=1
fi
-
+ if [ $seenfarg ]; then
+ inffile="$arg"
+ seenfarg=
+ fi
+ if [ "$arg" = "-f" ]; then
+ seenfarg=1
+ fi
done
extraflags=
@@ -114,6 +160,10 @@ if [ $reconfig ] ; then
echo Starting $dir . . .
start_server $sroot $dir
echo ""
+
+ # more reconfiguration
+ run_ds_create "$sroot" "$dir" "$inffile" "$extraflags" "$@"
+
done
# fix any non-instance specific files - omit server instance argument
$PERL $sroot/bin/slapd/admin/bin/upgradeServer $sroot
@@ -124,19 +174,6 @@ cd `dirname $0`
# we need to make sure the alias directory is owned by the server user/group
# in order for the server to be able to create the initial key/cert db files
-# get the inf file name
-seenfarg=
-inffile=
-for arg in "$@" ; do
- if [ $seenfarg ] ; then
- inffile=$arg
- break
- fi
- if [ "$arg" = "-f" ] ; then
- seenfarg=1
- fi
-done
-
if [ ! -f "$inffile" ] ; then
echo "WARNING: Could not read the setup info file $inffile"
else
@@ -149,7 +186,10 @@ else
fi
rc=0
-./ds_create $* $extraflags
+# not reconfig - run ds_create as usual
+if test -z "$reconfig" ; then
+ ./ds_create $* $extraflags
+fi
rc=$?
# chown the cookie directory - bug 175098
| 0 |
68659b64ce8ecb12a62d0984ed026e6dd3fc73ec
|
389ds/389-ds-base
|
Ticket #48144 - Add /usr/sbin/status-dirsrv script to get the status of the directory server instance.
Description: derived files by autogen.
|
commit 68659b64ce8ecb12a62d0984ed026e6dd3fc73ec
Author: Noriko Hosoi <[email protected]>
Date: Wed Jan 20 21:58:35 2016 -0800
Ticket #48144 - Add /usr/sbin/status-dirsrv script to get the status of the directory server instance.
Description: derived files by autogen.
diff --git a/Makefile.in b/Makefile.in
index f5941eb18..87ba2f902 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,17 @@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -93,12 +103,6 @@ noinst_PROGRAMS = makstrdb$(EXEEXT)
@SOLARIS_TRUE@am__append_2 = -lrt
@SOLARIS_TRUE@am__append_3 = ldap/servers/slapd/tools/ldclt/opCheck.c
subdir = .
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/configure $(am__configure_deps) \
- $(srcdir)/config.h.in $(top_srcdir)/rpm/389-ds-base.spec.in \
- depcomp $(dist_man_MANS) $(dist_noinst_DATA) \
- $(dist_noinst_HEADERS) $(serverinc_HEADERS) README compile \
- config.guess config.sub install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@@ -113,6 +117,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/systemd.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
+ $(am__configure_deps) $(dist_noinst_DATA) \
+ $(dist_noinst_HEADERS) $(serverinc_HEADERS) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
@@ -1253,6 +1260,10 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
AM_RECURSIVE_TARGETS = cscope
+am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(top_srcdir)/rpm/389-ds-base.spec.in \
+ README compile config.guess config.sub depcomp install-sh \
+ ltmain.sh missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -1590,6 +1601,7 @@ CLEANFILES = dberrstrs.h ns-slapd.properties \
ldap/admin/src/scripts/setup-ds.pl ldap/admin/src/scripts/setup-ds.res \
ldap/admin/src/scripts/start-dirsrv ldap/admin/src/scripts/stop-dirsrv \
ldap/admin/src/scripts/restart-dirsrv ldap/admin/src/scripts/Setup.pm \
+ ldap/admin/src/scripts/status-dirsrv \
ldap/admin/src/scripts/template-bak2db ldap/admin/src/scripts/template-bak2db.pl \
ldap/admin/src/scripts/template-db2bak ldap/admin/src/scripts/template-db2bak.pl \
ldap/admin/src/scripts/template-db2index ldap/admin/src/scripts/template-db2index.pl \
@@ -1993,6 +2005,7 @@ sbin_SCRIPTS = ldap/admin/src/scripts/setup-ds.pl \
ldap/admin/src/scripts/start-dirsrv \
ldap/admin/src/scripts/stop-dirsrv \
ldap/admin/src/scripts/restart-dirsrv \
+ ldap/admin/src/scripts/status-dirsrv \
ldap/admin/src/scripts/bak2db \
ldap/admin/src/scripts/db2bak \
ldap/admin/src/scripts/db2index \
@@ -2157,6 +2170,7 @@ dist_man_MANS = man/man1/dbscan.1 \
man/man8/setup-ds.pl.8 \
man/man8/start-dirsrv.8 \
man/man8/stop-dirsrv.8 \
+ man/man8/status-dirsrv.8 \
man/man8/bak2db.8 man/man8/bak2db.pl.8 \
man/man8/db2bak.8 man/man8/db2bak.pl.8 \
man/man8/db2ldif.8 man/man8/db2ldif.pl.8 \
@@ -3228,7 +3242,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -3249,8 +3262,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
- @if test ! -f $@; then rm -f stamp-h1; else :; fi
- @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+ @test -f $@ || rm -f stamp-h1
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@@ -10336,10 +10349,16 @@ dist-xz: distdir
$(am__post_remove_distdir)
dist-tarZ: distdir
+ @echo WARNING: "Support for distribution archives compressed with" \
+ "legacy program 'compress' is deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
@@ -10374,16 +10393,17 @@ distcheck: dist
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
- mkdir $(distdir)/_build $(distdir)/_inst
+ mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
- && $(am__cd) $(distdir)/_build \
- && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ && $(am__cd) $(distdir)/_build/sub \
+ && ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
@@ -10711,6 +10731,8 @@ uninstall-man: uninstall-man1 uninstall-man8
uninstall-systemdsystemunitDATA uninstall-taskSCRIPTS \
uninstall-updateDATA uninstall-updateSCRIPTS
+.PRECIOUS: Makefile
+
clean-local:
-rm -rf dist
diff --git a/aclocal.m4 b/aclocal.m4
index 5b32a97f2..5a62115bf 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
+# generated automatically by aclocal 1.15 -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -220,7 +220,22 @@ m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
+
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -232,10 +247,10 @@ m4_popdef([pkg_description])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.13'
+[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.13.4], [],
+m4_if([$1], [1.15], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -251,14 +266,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.13.4])dnl
+[AM_AUTOMAKE_VERSION([1.15])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -278,7 +293,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -323,15 +338,14 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
])
# AM_COND_IF -*- Autoconf -*-
-# Copyright (C) 2008-2013 Free Software Foundation, Inc.
+# Copyright (C) 2008-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -368,7 +382,7 @@ fi[]dnl
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -399,7 +413,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -590,7 +604,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -666,7 +680,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -675,6 +689,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
@@ -750,8 +770,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
@@ -783,6 +803,51 @@ dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell [email protected] about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi
+dnl The trailing newline in this macro's definition is deliberate, for
+dnl backward compatibility and to allow trailing 'dnl'-style comments
+dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
@@ -791,7 +856,6 @@ dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
@@ -813,7 +877,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -824,7 +888,7 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -834,7 +898,7 @@ if test x"${install_sh}" != xset; then
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2013 Free Software Foundation, Inc.
+# Copyright (C) 2003-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -856,7 +920,7 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -891,7 +955,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -939,41 +1003,9 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_CC_C_O
-# --------------
-# Like AC_PROG_CC_C_O, but changed for automake.
-AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
- # Losing compiler, so override with the script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
-fi
-dnl Make sure AC_PROG_CC is never called again, or it will override our
-dnl setting of CC.
-m4_define([AC_PROG_CC],
- [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
-])
-
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2013 Free Software Foundation, Inc.
+# Copyright (C) 1997-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1012,7 +1044,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1041,7 +1073,54 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+ [whether $CC understands -c and -o together],
+ [am_cv_prog_cc_c_o],
+ [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
+
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1060,7 +1139,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1141,7 +1220,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
-# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2009-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1201,7 +1280,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+# Copyright (C) 2001-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1229,7 +1308,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1248,7 +1327,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2013 Free Software Foundation, Inc.
+# Copyright (C) 2004-2014 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/compile b/compile
index 531136b06..a85b723c7 100755
--- a/compile
+++ b/compile
@@ -3,7 +3,7 @@
scriptversion=2012-10-14.11; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <[email protected]>.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/config.guess b/config.guess
index b79252d6b..dbfb9786c 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2013 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2013-06-10'
+timestamp='2015-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2013-06-10'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
-# Please send patches with a ChangeLog entry to [email protected].
+# Please send patches to <[email protected]>.
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
LIBC=gnu
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
@@ -579,8 +579,9 @@ EOF
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
+ if [ -x /usr/bin/lslpp ] ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@@ -826,7 +827,7 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- i*:MSYS*:*)
+ *:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
@@ -969,10 +970,10 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
- or1k:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ openrisc*:Linux:*:*)
+ echo or1k-unknown-linux-${LIBC}
exit ;;
- or32:Linux:*:*)
+ or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
@@ -1260,16 +1261,26 @@ EOF
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
@@ -1361,154 +1372,6 @@ EOF
exit ;;
esac
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
cat >&2 <<EOF
$0: unable to guess system type
diff --git a/config.h.in b/config.h.in
index 041a18f46..918c13e23 100644
--- a/config.h.in
+++ b/config.h.in
@@ -354,9 +354,6 @@
/* no getdomainname */
#undef NO_DOMAINNAME
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
/* OS version */
#undef OSVERSION
diff --git a/config.sub b/config.sub
index c765b34b7..6467c95af 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2013 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2013-04-24'
+timestamp='2015-01-01'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ timestamp='2013-04-24'
# of the GNU General Public License, version 3 ("GPLv3").
-# Please send patches with a ChangeLog entry to [email protected].
+# Please send patches to <[email protected]>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -68,7 +68,7 @@ Report bugs and patches to <[email protected]>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -257,14 +257,15 @@ case $basic_machine in
| avr | avr32 \
| be32 | be64 \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
- | fido | fr30 | frv \
+ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
@@ -282,8 +283,10 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
@@ -295,11 +298,11 @@ case $basic_machine in
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
- | open8 \
- | or1k | or32 \
+ | open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
+ | riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
@@ -310,6 +313,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@@ -324,7 +328,10 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ leon|leon[3-9])
+ basic_machine=sparc-$basic_machine
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -372,7 +379,7 @@ case $basic_machine in
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -381,6 +388,7 @@ case $basic_machine in
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
@@ -400,8 +408,10 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
@@ -413,6 +423,7 @@ case $basic_machine in
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
+ | or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
@@ -430,6 +441,7 @@ case $basic_machine in
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
+ | visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -767,6 +779,9 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
+ leon-*|leon[3-9]-*)
+ basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+ ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
@@ -794,7 +809,7 @@ case $basic_machine in
os=-mingw64
;;
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
@@ -822,6 +837,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
msdos)
basic_machine=i386-pc
os=-msdos
@@ -830,7 +849,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
@@ -1367,14 +1386,14 @@ case $os in
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1546,6 +1565,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
hexagon-*)
os=-elf
;;
@@ -1589,9 +1611,6 @@ case $basic_machine in
mips*-*)
os=-elf
;;
- or1k-*)
- os=-elf
- ;;
or32-*)
os=-coff
;;
diff --git a/configure b/configure
index 0fa677203..c996da5f8 100755
--- a/configure
+++ b/configure
@@ -2804,7 +2804,7 @@ cat >>confdefs.h <<_ACEOF
#define DS_PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
-am__api_version='1.13'
+am__api_version='1.15'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -3005,8 +3005,8 @@ test "$program_suffix" != NONE &&
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+# Expand $ac_aux_dir to an absolute path.
+am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
@@ -3025,7 +3025,7 @@ else
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
-if test x"${install_sh}" != xset; then
+if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@@ -3344,8 +3344,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
+# We need awk for the "check" target (and possibly the TAP driver). The
+# system "awk" is bad on some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
@@ -3446,6 +3446,48 @@ $as_echo "$am_cv_prog_tar_pax" >&6; }
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell [email protected] about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+ fi
+fi
+
# define these for automake distdir
VERSION=$PACKAGE_VERSION
PACKAGE=$PACKAGE_TARNAME
@@ -4795,6 +4837,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ # Make sure it works both with $CC and with simple cc.
+ # Following AC_PROG_CC_C_O, we do the test twice because some
+ # compilers refuse to overwrite an existing .o file with -o,
+ # though they will create one.
+ am_cv_prog_cc_c_o=yes
+ for am_i in 1 2; do
+ if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+ ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } \
+ && test -f conftest2.$ac_objext; then
+ : OK
+ else
+ am_cv_prog_cc_c_o=no
+ break
+ fi
+ done
+ rm -f core conftest*
+ unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
@@ -4923,131 +5024,6 @@ else
fi
-if test "x$CC" != xcc; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
-$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
-$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
-fi
-set dummy $CC; ac_cc=`$as_echo "$2" |
- sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } &&
- test -f conftest2.$ac_objext && { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; };
-then
- eval ac_cv_prog_cc_${ac_cc}_c_o=yes
- if test "x$CC" != xcc; then
- # Test first that cc exists at all.
- if { ac_try='cc -c conftest.$ac_ext >&5'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
- rm -f conftest2.*
- if { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } &&
- test -f conftest2.$ac_objext && { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; };
- then
- # cc works too.
- :
- else
- # cc exists but doesn't like -o.
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
- fi
- fi
- fi
-else
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
-fi
-rm -f core conftest*
-
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
-
-fi
-
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
- # Losing compiler, so override with the script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
-fi
-
# By default we simply use the C compiler to build assembly code.
@@ -7553,7 +7529,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7571,7 +7547,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -7590,7 +7569,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff --git a/depcomp b/depcomp
index 4ebd5b3a2..fc98710e2 100755
--- a/depcomp
+++ b/depcomp
@@ -3,7 +3,7 @@
scriptversion=2013-05-30.07; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/install-sh b/install-sh
index 377bb8687..0b0fdcbba 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-11-20.07; # UTC
+scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -41,19 +41,15 @@ scriptversion=2011-11-20.07; # UTC
# This script is compatible with the BSD install script, but was written
# from scratch.
+tab=' '
nl='
'
-IFS=" "" $nl"
+IFS=" $tab$nl"
-# set DOITPROG to echo to test this script
+# Set DOITPROG to "echo" to test this script.
-# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
+doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
posix_mkdir=
# Desired mode of installed file.
@@ -97,7 +82,7 @@ dir_arg=
dst_arg=
copy_on_change=false
-no_target_directory=
+is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -137,46 +122,57 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
- -t) dst_arg=$2
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
- -T) no_target_directory=true;;
+ -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
shift
done
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
@@ -207,6 +203,15 @@ if test $# -eq 0; then
exit 0
fi
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
@@ -223,16 +228,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -269,41 +274,15 @@ do
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
+ dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
@@ -314,74 +293,74 @@ do
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
@@ -391,53 +370,51 @@ do
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
esac
- eval "$initialize_posix_glob"
-
oIFS=$IFS
IFS=/
- $posix_glob set -f
+ set -f
set fnord $dstdir
shift
- $posix_glob set +f
+ set +f
IFS=$oIFS
prefixes=
for d
do
- test X"$d" = X && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -472,15 +449,12 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
- eval "$initialize_posix_glob" &&
- $posix_glob set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- $posix_glob set +f &&
-
+ set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -493,24 +467,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 56666f0ec..f12cfdf0b 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1312,7 +1312,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1326,7 +1326,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1345,7 +1348,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff --git a/missing b/missing
index cdea51493..f62bbae30 100755
--- a/missing
+++ b/missing
@@ -1,9 +1,9 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
-scriptversion=2012-06-26.16; # UTC
+scriptversion=2013-10-28.13; # UTC
-# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <[email protected]>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -160,7 +160,7 @@ give_advice ()
;;
autom4te*)
echo "You might have modified some maintainer files that require"
- echo "the 'automa4te' program to be rebuilt."
+ echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
| 0 |
10c01e297d6f4cf31787c78d1a0b9996418914c9
|
389ds/389-ds-base
|
Bug 689537 - (cov#10699) Fix Coverity NULL pointer dereferences
We should check if replicas is NULL before dereferencing it.
|
commit 10c01e297d6f4cf31787c78d1a0b9996418914c9
Author: Nathan Kinder <[email protected]>
Date: Mon Mar 21 11:15:41 2011 -0700
Bug 689537 - (cov#10699) Fix Coverity NULL pointer dereferences
We should check if replicas is NULL before dereferencing it.
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index b3078b0a1..b668852e5 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -852,7 +852,7 @@ done:;
Description: imports ldif file into changelog; changelog must be in the closed state
Parameters: clDir - changelog dir
ldifFile - absolute path to the ldif file to import
- replicas - optional list of replicas whose data should be imported.
+ replicas - list of replicas whose data should be imported.
Return: CL5_SUCCESS if function is successfull;
CL5_BAD_DATA if invalid parameter is passed;
CL5_BAD_STATE if changelog is open or not inititalized;
@@ -902,6 +902,13 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
return CL5_BAD_STATE;
}
+ if (replicas == NULL)
+ {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "cl5ImportLDIF: null list of replicas\n");
+ return CL5_BAD_DATA;
+ }
+
prim_replica_obj = replicas[0];
if (NULL == prim_replica_obj)
{
| 0 |
e7aabb539a8f05bc9c1c5e90c4e4a2cbfbc826cb
|
389ds/389-ds-base
|
Ticket 48872 - Fix segfault and use after free in plugin shutdown
Bug Description: Plugin_closeall would free the plugin password name scheme
value *even* if the plugin was not a password scheme.
backend manager would call be_cleanup on the plugin *after* plugin_closeall was
run. This means plugin_closeall now does not close backends, and we call
plugin_free from the backend to do this.
Fix Description: Check the union type to make sure we free the pwdscheme
only on password plugins.
Expose plugin_free, and call it from the backend manager. Don't close backends
during the call to plugin_closeall.
https://fedorahosted.org/389/ticket/48872
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit e7aabb539a8f05bc9c1c5e90c4e4a2cbfbc826cb
Author: William Brown <[email protected]>
Date: Tue Jun 7 13:49:20 2016 +1000
Ticket 48872 - Fix segfault and use after free in plugin shutdown
Bug Description: Plugin_closeall would free the plugin password name scheme
value *even* if the plugin was not a password scheme.
backend manager would call be_cleanup on the plugin *after* plugin_closeall was
run. This means plugin_closeall now does not close backends, and we call
plugin_free from the backend to do this.
Fix Description: Check the union type to make sure we free the pwdscheme
only on password plugins.
Expose plugin_free, and call it from the backend manager. Don't close backends
during the call to plugin_closeall.
https://fedorahosted.org/389/ticket/48872
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c
index 9084d95f0..979144a59 100644
--- a/ldap/servers/slapd/backend_manager.c
+++ b/ldap/servers/slapd/backend_manager.c
@@ -323,6 +323,7 @@ be_cleanupall()
slapi_pblock_set( &pb, SLAPI_BACKEND, backends[i] );
(*backends[i]->be_cleanup)( &pb );
+ plugin_free(backends[i]->be_database);
slapi_be_free(&backends[i]);
}
}
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 862f6e7a5..90d1f7d8e 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1318,7 +1318,7 @@ void slapd_daemon( daemon_ports_t *ports )
uniqueIDGenCleanup ();
}
- plugin_closeall( 1 /* Close Backends */, 1 /* Close Globals */);
+ plugin_closeall( 0 /* Close Backends */, 1 /* Close Globals */);
if ( ! in_referral_mode ) {
/* Close SNMP collator after the plugins closed...
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 39bfcef21..a2b2d75f0 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -52,7 +52,6 @@ static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData
static void plugin_config_init (struct pluginconfig *config);
static void plugin_config_cleanup (struct pluginconfig *config);
-static void plugin_free(struct slapdplugin *plugin);
static int plugin_config_set_action (int *action, char *value);
static struct pluginconfig* plugin_get_config (struct slapdplugin *plugin);
static void default_plugin_init();
@@ -1951,6 +1950,10 @@ plugin_closeall(int close_backends, int close_globals)
iterp = dep_plugin_entries;
while (iterp) {
nextp = iterp->next;
+ if (close_backends == 0 && iterp->plugin->plg_type == SLAPI_PLUGIN_DATABASE) {
+ iterp = nextp;
+ continue;
+ }
slapi_entry_free(iterp->e);
plugin_free(iterp->plugin);
slapi_ch_free((void **)&iterp);
@@ -2703,15 +2706,18 @@ plugin_add_descriptive_attributes( Slapi_Entry *e, struct slapdplugin *plugin )
/*
clean up the memory associated with the plugin
*/
-static void
+void
plugin_free(struct slapdplugin *plugin)
{
+ slapi_log_error(SLAPI_LOG_TRACE, "plugin_free", "Freeing %s \n", plugin->plg_name );
charray_free(plugin->plg_argv);
slapi_ch_free_string(&plugin->plg_libpath);
slapi_ch_free_string(&plugin->plg_initfunc);
slapi_ch_free_string(&plugin->plg_name);
slapi_ch_free_string(&plugin->plg_dn);
- slapi_ch_free_string(&plugin->plg_pwdstorageschemename);
+ if (plugin->plg_type == SLAPI_PLUGIN_PWD_STORAGE_SCHEME) {
+ slapi_ch_free_string(&plugin->plg_pwdstorageschemename);
+ }
release_componentid(plugin->plg_identity);
slapi_counter_destroy(&plugin->plg_op_counter);
if (!plugin->plg_group)
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index b8d7b86f3..1de1e38d4 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -879,6 +879,7 @@ void global_plugin_init();
int plugin_call_plugins( Slapi_PBlock *, int );
int plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
slapi_plugin_init_fnptr initfunc, int add_to_dit, char *returntext);
+void plugin_free(struct slapdplugin *plugin);
int plugin_determine_exop_plugins( const char *oid, struct slapdplugin **plugin );
int plugin_call_exop_plugins( Slapi_PBlock *pb, struct slapdplugin *p );
Slapi_Backend * plugin_extended_op_getbackend( Slapi_PBlock *pb, struct slapdplugin *p);
| 0 |
cdaa81c5085c3188a5a8e19561cede093a3dd3fd
|
389ds/389-ds-base
|
Bump version to 2.0.0
|
commit cdaa81c5085c3188a5a8e19561cede093a3dd3fd
Author: Mark Reynolds <[email protected]>
Date: Thu Oct 29 23:07:40 2020 -0400
Bump version to 2.0.0
diff --git a/VERSION.sh b/VERSION.sh
index d47f7512d..912dce82a 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -8,9 +8,9 @@ capbrand=389
vendor="389 Project"
# PACKAGE_VERSION is constructed from these
-VERSION_MAJOR=1
-VERSION_MINOR=4
-VERSION_MAINT=5.0
+VERSION_MAJOR=2
+VERSION_MINOR=0
+VERSION_MAINT=0.0
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
| 0 |
57edbb0f52649d2d4c643b58da360619ae078b7d
|
389ds/389-ds-base
|
Bug 630093 - (cov#15511) Don't use unintialized search_results in refint plugin
The refint plug-in code currently looks as if it could use the
search_result variable when it is uninitialized. I don't believe
that this is possible since it would require the filter variable
to be NULL, which should not occur since slapi_ch_smprintf() would
make the process exit if it failed to allocate memory. Even so,
the correct thing to do from a code cleanliness standpoint is to
move all code that assumes we performed a search into the "if (filter)"
block.
|
commit 57edbb0f52649d2d4c643b58da360619ae078b7d
Author: Nathan Kinder <[email protected]>
Date: Wed Sep 8 08:28:37 2010 -0700
Bug 630093 - (cov#15511) Don't use unintialized search_results in refint plugin
The refint plug-in code currently looks as if it could use the
search_result variable when it is uninitialized. I don't believe
that this is possible since it would require the filter variable
to be NULL, which should not occur since slapi_ch_smprintf() would
make the process exit if it failed to allocate memory. Even so,
the correct thing to do from a code cleanliness standpoint is to
move all code that assumes we performed a search into the "if (filter)"
block.
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
index 3207e5b35..3ef9de6b8 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -690,7 +690,6 @@ update_integrity(char **argv, char *origDN,
size_t len = strlen(origDN);
filter = slapi_ch_smprintf("(%s=*%s)", argv[i], escape_filter_value(origDN, len, buf));
if ( filter ) {
-
/* Need only the current attribute and its subtypes */
char *attrs[2];
attrs[0] = argv[i];
@@ -705,79 +704,79 @@ update_integrity(char **argv, char *origDN,
slapi_pblock_get( search_result_pb, SLAPI_PLUGIN_INTOP_RESULT,
&search_result);
- }
-
- /* if search successfull then do integrity update */
- if(search_result == LDAP_SUCCESS)
- {
- slapi_pblock_get(search_result_pb,
- SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
- &search_entries);
- for(j=0; search_entries[j] != NULL; j++)
+ /* if search successfull then do integrity update */
+ if(search_result == LDAP_SUCCESS)
{
- Slapi_Attr *attr = NULL;
- char *attrName = NULL;
+ slapi_pblock_get(search_result_pb,
+ SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
+ &search_entries);
- /* Loop over all the attributes of the entry and search
- * for the integrity attribute and its subtypes */
- for (slapi_entry_first_attr(search_entries[j], &attr); attr;
- slapi_entry_next_attr(search_entries[j], attr, &attr))
+ for(j=0; search_entries[j] != NULL; j++)
{
- /* Take into account only the subtypes of the attribute
- * in argv[i] having the necessary value - origDN */
- slapi_attr_get_type(attr, &attrName);
- if (slapi_attr_type_cmp(argv[i], attrName,
- SLAPI_TYPE_CMP_SUBTYPE) == 0)
+ Slapi_Attr *attr = NULL;
+ char *attrName = NULL;
+
+ /* Loop over all the attributes of the entry and search
+ * for the integrity attribute and its subtypes */
+ for (slapi_entry_first_attr(search_entries[j], &attr); attr;
+ slapi_entry_next_attr(search_entries[j], attr, &attr))
{
- int nval = 0;
- slapi_attr_get_numvalues(attr, &nval);
-
- /*
- * We want to reduce the "modify" call as much as
- * possible. But if an entry contains 1000s of
- * attributes which need to be updated by the
- * referint plugin (e.g., a group containing 1000s
- * of members), we want to avoid to allocate too
- * many mods * in one "modify" call.
- * This is a compromise: If an attribute type has
- * more than 128 values, we update the attribute
- * value one by one. Otherwise, update all values
- * in one "modify" call.
- */
- if (nval > 128) {
- rc = _update_one_per_mod(
- slapi_entry_get_dn(search_entries[j]),
- attr, attrName,
- origDN, norm_origDN,
- newrDN, newsuperior,
- mod_pb);
- } else {
- rc = _update_all_per_mod(
- slapi_entry_get_dn(search_entries[j]),
- attr, attrName,
- origDN, norm_origDN,
- newrDN, newsuperior,
- mod_pb);
+ /* Take into account only the subtypes of the attribute
+ * in argv[i] having the necessary value - origDN */
+ slapi_attr_get_type(attr, &attrName);
+ if (slapi_attr_type_cmp(argv[i], attrName,
+ SLAPI_TYPE_CMP_SUBTYPE) == 0)
+ {
+ int nval = 0;
+ slapi_attr_get_numvalues(attr, &nval);
+
+ /*
+ * We want to reduce the "modify" call as much as
+ * possible. But if an entry contains 1000s of
+ * attributes which need to be updated by the
+ * referint plugin (e.g., a group containing 1000s
+ * of members), we want to avoid to allocate too
+ * many mods * in one "modify" call.
+ * This is a compromise: If an attribute type has
+ * more than 128 values, we update the attribute
+ * value one by one. Otherwise, update all values
+ * in one "modify" call.
+ */
+ if (nval > 128) {
+ rc = _update_one_per_mod(
+ slapi_entry_get_dn(search_entries[j]),
+ attr, attrName,
+ origDN, norm_origDN,
+ newrDN, newsuperior,
+ mod_pb);
+ } else {
+ rc = _update_all_per_mod(
+ slapi_entry_get_dn(search_entries[j]),
+ attr, attrName,
+ origDN, norm_origDN,
+ newrDN, newsuperior,
+ mod_pb);
+ }
+ /* Should we stop if one modify returns an error? */
}
- /* Should we stop if one modify returns an error? */
}
}
+ } else {
+ if (isFatalSearchError(search_result))
+ {
+ /* NPCTE fix for bugid 531225, esc 0. <P.R> <30-May-2001> */
+ slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
+ "update_integrity search (base=%s filter=%s) returned "
+ "error %d\n", search_base, filter, search_result);
+ /* end of NPCTE fix for bugid 531225 */
+ rc = -1;
+ goto free_and_return;
+ }
}
- } else {
- if (isFatalSearchError(search_result))
- {
- /* NPCTE fix for bugid 531225, esc 0. <P.R> <30-May-2001> */
- slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
- "update_integrity search (base=%s filter=%s) returned "
- "error %d\n", search_base, filter, search_result);
- /* end of NPCTE fix for bugid 531225 */
- rc = -1;
- goto free_and_return;
- }
- }
- slapi_ch_free_string(&filter);
+ slapi_ch_free_string(&filter);
+ }
if (search_result_pb) {
slapi_free_search_results_internal(search_result_pb);
| 0 |
89ae28bc038759b0fd5a96f5f07e2cfbbafdbfea
|
389ds/389-ds-base
|
Subject: [PATCH] Ticket 47840 - fix lib389 to use sbin scripts
https://fedorahosted.org/389/ticket/47840
Bug Description: Now that https://fedorahosted.org/389/ticket/528 is fixed,
the next step is to allow building the server with the instance specific scripts
disabled.
Fix Description: As we do not install instance scripts by default we cannot
rely on their existance. This patch fixes the serverCmd function in lib389 to
use the sbin scripts, as well as providing two clitools for start/stop that can
be used to prove this functionality works.
Example:
python lib389/clitools/ds_start.py
python lib389/clitools/ds_stop.py
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit 89ae28bc038759b0fd5a96f5f07e2cfbbafdbfea
Author: William Brown <[email protected]>
Date: Mon Nov 9 09:22:25 2015 +1000
Subject: [PATCH] Ticket 47840 - fix lib389 to use sbin scripts
https://fedorahosted.org/389/ticket/47840
Bug Description: Now that https://fedorahosted.org/389/ticket/528 is fixed,
the next step is to allow building the server with the instance specific scripts
disabled.
Fix Description: As we do not install instance scripts by default we cannot
rely on their existance. This patch fixes the serverCmd function in lib389 to
use the sbin scripts, as well as providing two clitools for start/stop that can
be used to prove this functionality works.
Example:
python lib389/clitools/ds_start.py
python lib389/clitools/ds_stop.py
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/src/lib389/clitools/ds_start.py b/src/lib389/clitools/ds_start.py
new file mode 100644
index 000000000..b572f13d9
--- /dev/null
+++ b/src/lib389/clitools/ds_start.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+#from clitools import clitools_parser, get_instance_dict, get_rootdn_pass
+from clitools import CliTool, clitools_parser
+#from lib389 import DirSrv
+from lib389._constants import *
+from lib389.tools import DirSrvTools
+import ldap
+
+class StartTool(CliTool):
+ def start(self):
+ try:
+ self.populate_instance_dict(self.args.instance)
+ self.ds.allocate(self.inst)
+
+ DirSrvTools.serverCmd(self.ds, "start", True)
+ finally:
+ pass
+ #self.disconnect()
+
+if __name__ == '__main__':
+ # Do some arg parse stuff
+ ## You can always add a child parser here too ...
+ args = clitools_parser.parse_args()
+ tool = StartTool(args)
+ tool.start()
diff --git a/src/lib389/clitools/ds_stop.py b/src/lib389/clitools/ds_stop.py
new file mode 100644
index 000000000..fdbed3515
--- /dev/null
+++ b/src/lib389/clitools/ds_stop.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+#from clitools import clitools_parser, get_instance_dict, get_rootdn_pass
+from clitools import CliTool, clitools_parser
+#from lib389 import DirSrv
+from lib389._constants import *
+from lib389.tools import DirSrvTools
+import ldap
+
+class StartTool(CliTool):
+ def start(self):
+ try:
+ self.populate_instance_dict(self.args.instance)
+ self.ds.allocate(self.inst)
+
+ DirSrvTools.serverCmd(self.ds, "stop", True)
+ finally:
+ pass
+ #self.disconnect()
+
+if __name__ == '__main__':
+ # Do some arg parse stuff
+ ## You can always add a child parser here too ...
+ args = clitools_parser.parse_args()
+ tool = StartTool(args)
+ tool.start()
diff --git a/src/lib389/lib389/tools.py b/src/lib389/lib389/tools.py
index 7d6c9fdae..6f5da082b 100644
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -172,7 +172,8 @@ class DirSrvTools(object):
assert len(props) == 1
self.sroot = props[0][CONF_SERVER_DIR]
- instanceDir = os.path.join(self.sroot, "slapd-" + self.inst)
+ #instanceDir = os.path.join(self.sroot, "slapd-" + self.inst)
+ sbinDir = os.path.join(self.prefix + '/sbin')
if hasattr(self, 'errlog'):
errLog = self.errlog
@@ -182,10 +183,13 @@ class DirSrvTools(object):
started = True
lastLine = ""
cmd = cmd.lower()
- fullCmd = instanceDir + "/" + cmd + "-slapd"
+ #fullCmd = instanceDir + "/" + cmd + "-slapd"
+ fullCmd = None
if cmd == 'start':
+ fullCmd = os.path.join(sbinDir, 'start-dirsrv')
cmdPat = 'slapd started.'
else:
+ fullCmd = os.path.join(sbinDir, 'stop-dirsrv')
cmdPat = 'slapd stopped.'
if "USE_GDB" in os.environ or "USE_VALGRIND" in os.environ:
@@ -205,7 +209,7 @@ class DirSrvTools(object):
pos = logfp.tell() # get current position
logfp.seek(pos, os.SEEK_SET) # reset the EOF flag
- log.warn("Running command: %r" % fullCmd)
+ log.warn("Running command: %r %s" % (fullCmd, self.serverid ))
rc = os.system(fullCmd)
while not done and int(time.time()) < timeout:
line = logfp.readline()
@@ -219,12 +223,12 @@ class DirSrvTools(object):
done = True
elif line.find("Initialization Failed") >= 0:
# sometimes the server fails to start - try again
- rc = os.system(fullCmd)
+ rc = os.system("%s %s" % (fullCmd, self.serverid))
pos = logfp.tell()
break
elif line.find("exiting.") >= 0:
# possible transient condition - try again
- rc = os.system(fullCmd)
+ rc = os.system("%s %s" % (fullCmd, self.serverid))
pos = logfp.tell()
break
pos = logfp.tell()
| 0 |
fc5db54b96e3781e598195cb3d9e231cf8599caf
|
389ds/389-ds-base
|
Bug 668619 - slapd stops responding
https://bugzilla.redhat.com/show_bug.cgi?id=668619
Description: This patch contains 2 fixes:
1) I am moving the disconnect_server_nomutex into the section
where it adds the fd to the poll list - if we are going to
disconnect the connection due to timelimit, we should not add
the fd to the poll list - we should also remove the connection
from the active list. (by [email protected])
2) If simple paged search result request hits timelimit,
the request is abandoned and the search result set allocated in
the backend module is released. The release is executed by the
main thread, which is protected by the c_mutex (in Connection).
The search result is sent back to the client by a worker thread.
The worker thread had accessed the search result set without any
checking. This patch adds the protection using c_mutex if the
search is simple paged.
|
commit fc5db54b96e3781e598195cb3d9e231cf8599caf
Author: Noriko Hosoi <[email protected]>
Date: Thu May 26 10:26:41 2011 -0700
Bug 668619 - slapd stops responding
https://bugzilla.redhat.com/show_bug.cgi?id=668619
Description: This patch contains 2 fixes:
1) I am moving the disconnect_server_nomutex into the section
where it adds the fd to the poll list - if we are going to
disconnect the connection due to timelimit, we should not add
the fd to the poll list - we should also remove the connection
from the active list. (by [email protected])
2) If simple paged search result request hits timelimit,
the request is abandoned and the search result set allocated in
the backend module is released. The release is executed by the
main thread, which is protected by the c_mutex (in Connection).
The search result is sent back to the client by a worker thread.
The worker thread had accessed the search result set without any
checking. This patch adds the protection using c_mutex if the
search is simple paged.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 2ca416fba..ddebaafe8 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -140,7 +140,7 @@ ldbm_back_search_cleanup(Slapi_PBlock *pb,
slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr );
if ( (NULL != sr) && (function_result != 0) ) {
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 0);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
delete_search_result_set(&sr);
@@ -1160,7 +1160,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
int tlimit, llimit, slimit, isroot;
struct berval **urls = NULL;
int err;
- Slapi_DN basesdn;
+ Slapi_DN basesdn = {0};
char *target_uniqueid;
int rc = 0;
int estimate = 0; /* estimated search result count */
@@ -1177,8 +1177,12 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_get( pb, SLAPI_OPINITIATED_TIME, &optime );
slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot );
slapi_pblock_get( pb, SLAPI_SEARCH_REFERRALS, &urls );
- slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr );
slapi_pblock_get( pb, SLAPI_TARGET_UNIQUEID, &target_uniqueid );
+ slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr );
+
+ if (NULL == sr) {
+ goto bail;
+ }
if (sr->sr_current_sizelimit >= 0) {
/*
@@ -1221,10 +1225,10 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
{
/* check for abandon */
- if ( slapi_op_abandoned( pb ))
+ if ( slapi_op_abandoned( pb ) || (NULL == sr) )
{
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 1);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
if ( use_extension ) {
@@ -1241,7 +1245,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
if ( tlimit != -1 && curtime > stoptime )
{
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 1);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
if ( use_extension ) {
@@ -1258,7 +1262,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
if ( llimit != -1 && sr->sr_lookthroughcount >= llimit )
{
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 1);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
if ( use_extension ) {
@@ -1278,7 +1282,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
/* No more entries */
/* destroy back_search_result_set */
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 1);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
if ( use_extension ) {
@@ -1421,7 +1425,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
if ( --slimit < 0 ) {
CACHE_RETURN( &inst->inst_cache, &e );
/* in case paged results, clean up the conn */
- pagedresults_set_search_result(pb->pb_conn, NULL);
+ pagedresults_set_search_result(pb->pb_conn, NULL, 1);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate );
delete_search_result_set( &sr );
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 9be11382b..d6b23f543 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -2727,8 +2727,6 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) ) {
- pagedresults_cleanup(conn); /* In case the connection is on pagedresult */
-
/*
* PR_Close must be called before anything else is done because
* of NSPR problem on NT which requires that the socket on which
@@ -2769,6 +2767,9 @@ disconnect_server_nomutex( Connection *conn, PRUint64 opconnid, int opid, PRErro
conn->c_gettingber = 0;
connection_abandon_operations( conn );
+ pagedresults_cleanup(conn); /* In case the connection is on pagedresult.
+ Better to call it after the op is abandened. */
+
if (! config_check_referral_mode()) {
/*
* If any of the outstanding operations on this
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index cda4a0437..312db6abc 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1209,29 +1209,35 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
if ((!c->c_gettingber)
&& (c->c_threadnumber < max_threads_per_conn))
{
- ct->fd[count].fd = c->c_prfd;
- ct->fd[count].in_flags = SLAPD_POLL_FLAGS;
- /* slot i of the connection table is mapped to slot
- * count of the fds array */
- c->c_fdi = count;
- count++;
+ int add_fd = 1;
+ /* check timeout for PAGED RESULTS */
+ if (c->c_current_be && (c->c_timelimit > 0))
+ {
+ time_t ctime = current_time();
+ if (ctime > c->c_timelimit)
+ {
+ /* Exceeded the timelimit; disconnect the client */
+ disconnect_server_nomutex(c, c->c_connid, -1,
+ SLAPD_DISCONNECT_IO_TIMEOUT, 0);
+ connection_table_move_connection_out_of_active_list(ct,c);
+ add_fd = 0; /* do not poll on this fd */
+ }
+ }
+ if (add_fd)
+ {
+ ct->fd[count].fd = c->c_prfd;
+ ct->fd[count].in_flags = SLAPD_POLL_FLAGS;
+ /* slot i of the connection table is mapped to slot
+ * count of the fds array */
+ c->c_fdi = count;
+ count++;
+ }
}
else
{
c->c_fdi = SLAPD_INVALID_SOCKET_INDEX;
}
}
- /* check timeout for PAGED RESULTS */
- if (c->c_current_be && (c->c_timelimit > 0))
- {
- time_t ctime = current_time();
- if (ctime > c->c_timelimit)
- {
- /* Exceeded the timelimit; disconnect the client */
- disconnect_server_nomutex(c, c->c_connid, -1,
- SLAPD_DISCONNECT_IO_TIMEOUT, 0);
- }
- }
PR_Unlock( c->c_mutex );
}
c = next;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index d398cd664..3f022aa72 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -600,7 +600,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
/* search result could be reset in the backend/dse */
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- pagedresults_set_search_result(pb->pb_conn, sr);
+ pagedresults_set_search_result(pb->pb_conn, sr, 0);
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
/* no more entries to send in the backend */
@@ -753,7 +753,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);
if (pagedresults_set_current_be(pb->pb_conn, be) < 0 ||
- pagedresults_set_search_result(pb->pb_conn, sr) < 0 ||
+ pagedresults_set_search_result(pb->pb_conn, sr, 0) < 0 ||
pagedresults_set_search_result_count(pb->pb_conn,
curr_search_count) < 0 ||
pagedresults_set_search_result_set_size_estimate(pb->pb_conn,
@@ -1128,6 +1128,9 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result,
char **attrs = NULL;
unsigned int pr_stat = 0;
+ if ( NULL == pb ) {
+ return rval;
+ }
slapi_pblock_get(pb, SLAPI_SEARCH_ATTRS, &attrs);
slapi_pblock_get(pb, SLAPI_SEARCH_ATTRSONLY, &attrsonly);
@@ -1137,8 +1140,23 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result,
{
Slapi_Entry *gerentry = NULL;
Slapi_Operation *operation;
+ int is_paged = 0;
+ slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
+ is_paged = operation->o_flags & OP_FLAG_PAGED_RESULTS;
+ /*
+ * If it is paged results, the search result set could be released when
+ * it reaches the timelimit. This lock protects the search result set
+ * not to be released while sending a next entry.
+ * (see pagedresults_cleanup called from disconnect_server_nomutex)
+ */
+ if ( is_paged && pb->pb_conn && pb->pb_conn->c_mutex ) {
+ PR_Lock( pb->pb_conn->c_mutex );
+ }
rc = be->be_next_search_entry(pb);
+ if ( is_paged && pb->pb_conn && pb->pb_conn->c_mutex ) {
+ PR_Unlock( pb->pb_conn->c_mutex );
+ }
if (rc < 0)
{
/*
@@ -1159,7 +1177,6 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result,
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY, &e);
/* Check for possible get_effective_rights control */
- slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
if ( operation->o_flags & OP_FLAG_GET_EFFECTIVE_RIGHTS )
{
char *errbuf = NULL;
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index 652d4e1a2..0ec63a623 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -212,13 +212,13 @@ pagedresults_get_search_result(Connection *conn)
}
int
-pagedresults_set_search_result(Connection *conn, void *sr)
+pagedresults_set_search_result(Connection *conn, void *sr, int locked)
{
int rc = -1;
if (conn) {
- PR_Lock(conn->c_mutex);
+ if (!locked) PR_Lock(conn->c_mutex);
conn->c_search_result_set = sr;
- PR_Unlock(conn->c_mutex);
+ if (!locked) PR_Unlock(conn->c_mutex);
rc = 0;
}
return rc;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 7bd94d470..e24e1ffbb 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1374,7 +1374,7 @@ void pagedresults_set_response_control(Slapi_PBlock *pb, int iscritical, ber_int
Slapi_Backend *pagedresults_get_current_be(Connection *conn);
int pagedresults_set_current_be(Connection *conn, Slapi_Backend *be);
void *pagedresults_get_search_result(Connection *conn);
-int pagedresults_set_search_result(Connection *conn, void *sr);
+int pagedresults_set_search_result(Connection *conn, void *sr, int locked);
int pagedresults_get_search_result_count(Connection *conn);
int pagedresults_set_search_result_count(Connection *conn, int cnt);
int pagedresults_get_search_result_set_size_estimate(Connection *conn);
| 0 |
f227f11c46f6e57fb28f348cef6e2334008297d7
|
389ds/389-ds-base
|
Suppress alert on unavailable port with forced setup
|
commit f227f11c46f6e57fb28f348cef6e2334008297d7
Author: Jeroen van Meeuwen (Kolab Systems) <[email protected]>
Date: Sat Apr 21 14:15:57 2012 +0100
Suppress alert on unavailable port with forced setup
diff --git a/ldap/admin/src/scripts/DSDialogs.pm b/ldap/admin/src/scripts/DSDialogs.pm
index 60bc11555..08c8b2b10 100644
--- a/ldap/admin/src/scripts/DSDialogs.pm
+++ b/ldap/admin/src/scripts/DSDialogs.pm
@@ -66,7 +66,7 @@ my $dsport = new Dialog (
my $res = $DialogManager::SAME;
if ($ans !~ /^\d+$/) {
$self->{manager}->alert("dialog_dsport_invalid", $ans);
- } elsif (!portAvailable($ans)) {
+ } elsif (!portAvailable($ans) && !$self->{manager}->{setup}->{force}) {
$self->{manager}->alert("dialog_dsport_error", $ans);
} else {
$res = $DialogManager::NEXT;
| 0 |
0e6a04afbaf1eef58eb780bd2529703e4d751d98
|
389ds/389-ds-base
|
Ticket 50618 - support cgroupv2
Bug Description: fedora 31 changes to cgroup v2 and I expect suse
to do the same soon. We should support this natively as part of
the memory limit detection.
Fix Description: Add support for cgroup v2
https://pagure.io/389-ds-base/issue/50618
Author: William Brown <[email protected]>
Review by: tbordaz (Thanks!)
|
commit 0e6a04afbaf1eef58eb780bd2529703e4d751d98
Author: William Brown <[email protected]>
Date: Thu Feb 6 14:13:49 2020 +1000
Ticket 50618 - support cgroupv2
Bug Description: fedora 31 changes to cgroup v2 and I expect suse
to do the same soon. We should support this natively as part of
the memory limit detection.
Fix Description: Add support for cgroup v2
https://pagure.io/389-ds-base/issue/50618
Author: William Brown <[email protected]>
Review by: tbordaz (Thanks!)
diff --git a/ldap/servers/slapd/slapi_pal.c b/ldap/servers/slapd/slapi_pal.c
index 600d03d4d..3ae7d12b3 100644
--- a/ldap/servers/slapd/slapi_pal.c
+++ b/ldap/servers/slapd/slapi_pal.c
@@ -27,6 +27,9 @@
#include <sys/time.h>
#include <sys/resource.h>
+/* directory check */
+#include <dirent.h>
+
#ifdef OS_solaris
#include <sys/procfs.h>
#endif
@@ -35,6 +38,14 @@
#include <sys/pstat.h>
#endif
+#include <sys/param.h>
+
+/* This warns if we have less than 128M avail */
+#define SPAL_WARN_MIN_BYTES 134217728
+
+#define CG2_HEADER_FORMAT "0::"
+#define CG2_HEADER_LEN strlen(CG2_HEADER_FORMAT)
+
static int_fast32_t
_spal_rlimit_get(int resource, uint64_t *soft_limit, uint64_t *hard_limit)
{
@@ -101,6 +112,48 @@ _spal_uint64_t_file_get(char *name, char *prefix, uint64_t *dest)
return retval;
}
+static int_fast32_t
+_spal_dir_exist(char *path)
+{
+ DIR* dir = opendir(path);
+ if (dir) {
+ closedir(dir);
+ return 1;
+ }
+ return 0;
+}
+
+static char *
+_spal_cgroupv2_path() {
+ FILE *f;
+ char s[256] = {0};
+ char *res = NULL;
+ /* We discover our path by looking at /proc/self/cgroup */
+ f = fopen("/proc/self/cgroup", "r");
+ if (!f) {
+ int errsrv = errno;
+ slapi_log_err(SLAPI_LOG_ERR, "_spal_get_uint64_t_file", "Unable to open file \"/proc/self/cgroup\". errno=%d\n", errsrv);
+ return NULL;
+ }
+
+ if (feof(f) == 0) {
+ if (fgets(s, MAXPATHLEN, f) != NULL) {
+ /* we now have a path in s, and the last byte must be NULL */
+ if ((strlen(s) >= CG2_HEADER_LEN) && strncmp(s, CG2_HEADER_FORMAT, CG2_HEADER_LEN) == 0) {
+ res = slapi_ch_calloc(1, MAXPATHLEN + 17);
+ snprintf(res, MAXPATHLEN + 16, "/sys/fs/cgroup%s", s + CG2_HEADER_LEN);
+ /* This always has a new line, so replace it if possible. */
+ size_t nl = strlen(res) - 1;
+ res[nl] = '\0';
+ }
+ }
+ }
+ /* Will return something like /sys/fs/cgroup/system.slice/system-dirsrv.slice/[email protected] */
+
+ fclose(f);
+ return res;
+}
+
slapi_pal_meminfo *
spal_meminfo_get()
@@ -172,34 +225,73 @@ spal_meminfo_get()
uint64_t cg_mem_usage = 0;
uint64_t cg_mem_soft_avail = 0;
- char *f_cg_soft = "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes";
- char *f_cg_hard = "/sys/fs/cgroup/memory/memory.limit_in_bytes";
- char *f_cg_usage = "/sys/fs/cgroup/memory/memory.usage_in_bytes";
+ /* We have cgroup v1, so attempt to use it. */
+ if (_spal_dir_exist("/sys/fs/cgroup/memory")) {
+ char *f_cg_soft = "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes";
+ char *f_cg_hard = "/sys/fs/cgroup/memory/memory.limit_in_bytes";
+ char *f_cg_usage = "/sys/fs/cgroup/memory/memory.usage_in_bytes";
+ slapi_log_err(SLAPI_LOG_INFO, "spal_meminfo_get", "Found cgroup v1\n");
- if (_spal_uint64_t_file_get(f_cg_soft, NULL, &cg_mem_soft)) {
- slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_soft);
- }
+ if (_spal_uint64_t_file_get(f_cg_soft, NULL, &cg_mem_soft)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_soft);
+ }
- if (_spal_uint64_t_file_get(f_cg_hard, NULL, &cg_mem_hard)) {
- slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_hard);
- }
+ if (_spal_uint64_t_file_get(f_cg_hard, NULL, &cg_mem_hard)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_hard);
+ }
- if (_spal_uint64_t_file_get(f_cg_usage, NULL, &cg_mem_usage)) {
- slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_hard);
+ if (_spal_uint64_t_file_get(f_cg_usage, NULL, &cg_mem_usage)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_usage);
+ }
+
+ } else {
+ /* We might have cgroup v2. Attempt to get the controller path ... */
+ char *ctrlpath = _spal_cgroupv2_path();
+ if (ctrlpath != NULL) {
+
+ char s[MAXPATHLEN + 33] = {0};
+ slapi_log_err(SLAPI_LOG_INFO, "spal_meminfo_get", "Found cgroup v2 -> %s\n", ctrlpath);
+ /* There are now three files we care about - memory.current, memory.high and memory.max */
+ /* For simplicity we re-use soft and hard */
+ /* If _spal_uint64_t_file_get() hit's "max" then these remain at 0 */
+ snprintf(s, MAXPATHLEN + 32, "%s/memory.current", ctrlpath);
+ if (_spal_uint64_t_file_get(s, NULL, &cg_mem_usage)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", s);
+ }
+
+ snprintf(s, MAXPATHLEN + 32, "%s/memory.high", ctrlpath);
+ if (_spal_uint64_t_file_get(s, NULL, &cg_mem_soft)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", s);
+ }
+
+ snprintf(s, MAXPATHLEN + 32, "%s/memory.max", ctrlpath);
+ if (_spal_uint64_t_file_get(s, NULL, &cg_mem_hard)) {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", s);
+ }
+
+ slapi_ch_free_string(&ctrlpath);
+ } else {
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "cgroups v1 or v2 unable to be read - may not be on this platform ...\n");
+ }
}
/*
* In some conditions, like docker, we only have a *hard* limit set.
* This obviously breaks our logic, so we need to make sure we correct this
*/
-
- if (cg_mem_hard != 0 && cg_mem_soft != 0 && cg_mem_hard < cg_mem_soft) {
- /* Right, we only have a hard limit. Impose a 10% watermark. */
- cg_mem_soft = cg_mem_hard * 0.9;
+ if ((cg_mem_hard != 0 && cg_mem_soft == 0) || (cg_mem_hard < cg_mem_soft)) {
+ /* Right, we only have a hard limit. Impose a 20% watermark. */
+ cg_mem_soft = cg_mem_hard * 0.8;
}
- if (cg_mem_soft != 0 && cg_mem_usage != 0 && cg_mem_soft > cg_mem_usage) {
- cg_mem_soft_avail = cg_mem_soft - cg_mem_usage;
+ if (cg_mem_usage != 0 && (cg_mem_soft != 0 || cg_mem_hard != 0)) {
+ if (cg_mem_soft > cg_mem_usage) {
+ cg_mem_soft_avail = cg_mem_soft - cg_mem_usage;
+ } else if (cg_mem_hard > cg_mem_usage) {
+ cg_mem_soft_avail = cg_mem_hard - cg_mem_usage;
+ } else {
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "Your cgroup memory usage exceeds your hard limit?");
+ }
}
@@ -253,6 +345,13 @@ spal_meminfo_get()
return NULL;
}
+ if (mi->system_available_bytes < SPAL_WARN_MIN_BYTES) {
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "Your system is reporting %" PRIu64" bytes available, which is less than the minimum recommended %" PRIu64 " bytes\n",
+ mi->system_available_bytes, SPAL_WARN_MIN_BYTES);
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "This indicates heavy memory pressure or incorrect system resource allocation\n");
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "Directory Server *may* crash as a result!!!\n");
+ }
+
slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "{pagesize_bytes = %" PRIu64 ", system_total_pages = %" PRIu64 ", system_total_bytes = %" PRIu64 ", process_consumed_pages = %" PRIu64 ", process_consumed_bytes = %" PRIu64 ", system_available_pages = %" PRIu64 ", system_available_bytes = %" PRIu64 "},\n",
mi->pagesize_bytes, mi->system_total_pages, mi->system_total_bytes, mi->process_consumed_pages, mi->process_consumed_bytes, mi->system_available_pages, mi->system_available_bytes);
| 0 |
e7a6b56059ded84518a18505325e25761687929a
|
389ds/389-ds-base
|
Issue 6756 - CLI, UI - Properly handle disabled NDN cache (#6757)
Description: Fix the db_monitor function in monitor.py to check if
nsslapd-ndn-cache-enabled is off and conditionally include NDN cache
statistics only when enabled.
Update dbMonitor.jsx components to detect when NDN cache is disabled and
conditionally render NDN cache tabs, charts, and related content with proper
fallback display when disabled.
Add test_ndn_cache_disabled to verify both JSON and non-JSON output formats
correctly handle when NDN cache is turned off and on.
Fixes: https://github.com/389ds/389-ds-base/issues/6756
Reviewed by: @mreynolds389 (Thanks!)
|
commit e7a6b56059ded84518a18505325e25761687929a
Author: Simon Pichugin <[email protected]>
Date: Thu Jul 10 11:53:12 2025 -0700
Issue 6756 - CLI, UI - Properly handle disabled NDN cache (#6757)
Description: Fix the db_monitor function in monitor.py to check if
nsslapd-ndn-cache-enabled is off and conditionally include NDN cache
statistics only when enabled.
Update dbMonitor.jsx components to detect when NDN cache is disabled and
conditionally render NDN cache tabs, charts, and related content with proper
fallback display when disabled.
Add test_ndn_cache_disabled to verify both JSON and non-JSON output formats
correctly handle when NDN cache is turned off and on.
Fixes: https://github.com/389ds/389-ds-base/issues/6756
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/dirsrvtests/tests/suites/clu/dbmon_test.py b/dirsrvtests/tests/suites/clu/dbmon_test.py
index 5eeaca162..bf57690c4 100644
--- a/dirsrvtests/tests/suites/clu/dbmon_test.py
+++ b/dirsrvtests/tests/suites/clu/dbmon_test.py
@@ -11,6 +11,7 @@ import subprocess
import pytest
import json
import glob
+import re
from lib389.tasks import *
from lib389.utils import *
@@ -272,6 +273,95 @@ def test_dbmon_mp_pagesize(topology_st):
assert real_free_percentage == dbmon_free_percentage
+def test_ndn_cache_disabled(topology_st):
+ """Test dbmon output when ndn-cache-enabled is turned off
+
+ :id: 760e217c-70e8-4767-b504-dda7ba2e1f64
+ :setup: Standalone instance
+ :steps:
+ 1. Run dbmon with nsslapd-ndn-cache-enabled=on (default)
+ 2. Verify NDN cache stats are present in the output
+ 3. Set nsslapd-ndn-cache-enabled=off and restart
+ 4. Run dbmon again and verify NDN cache stats are not present
+ 5. Set nsslapd-ndn-cache-enabled=on and restart
+ 6. Run dbmon again and verify NDN cache stats are back
+ :expectedresults:
+ 1. Success
+ 2. Should display NDN cache data
+ 3. Success
+ 4. Should not display NDN cache data
+ 5. Success
+ 6. Should display NDN cache data
+ """
+ inst = topology_st.standalone
+ args = FakeArgs()
+ args.backends = None
+ args.indexes = False
+ args.json = True
+ lc = LogCapture()
+
+ log.info("Testing with NDN cache enabled (default)")
+ db_monitor(inst, DEFAULT_SUFFIX, lc.log, args)
+ db_mon_as_str = "".join((str(rec) for rec in lc.outputs))
+ db_mon_as_str = re.sub("^[^{]*{", "{", db_mon_as_str)[:-2]
+ db_mon = json.loads(db_mon_as_str)
+
+ assert 'ndncache' in db_mon
+ assert 'hit_ratio' in db_mon['ndncache']
+ lc.flush()
+
+ log.info("Setting nsslapd-ndn-cache-enabled to OFF")
+ inst.config.set('nsslapd-ndn-cache-enabled', 'off')
+ inst.restart()
+
+ log.info("Testing with NDN cache disabled")
+ db_monitor(inst, DEFAULT_SUFFIX, lc.log, args)
+ db_mon_as_str = "".join((str(rec) for rec in lc.outputs))
+ db_mon_as_str = re.sub("^[^{]*{", "{", db_mon_as_str)[:-2]
+ db_mon = json.loads(db_mon_as_str)
+
+ assert 'ndncache' not in db_mon
+ lc.flush()
+
+ log.info("Setting nsslapd-ndn-cache-enabled to ON")
+ inst.config.set('nsslapd-ndn-cache-enabled', 'on')
+ inst.restart()
+
+ log.info("Testing with NDN cache re-enabled")
+ db_monitor(inst, DEFAULT_SUFFIX, lc.log, args)
+ db_mon_as_str = "".join((str(rec) for rec in lc.outputs))
+ db_mon_as_str = re.sub("^[^{]*{", "{", db_mon_as_str)[:-2]
+ db_mon = json.loads(db_mon_as_str)
+
+ assert 'ndncache' in db_mon
+ assert 'hit_ratio' in db_mon['ndncache']
+ lc.flush()
+
+ args.json = False
+
+ log.info("Testing with NDN cache enabled - non-JSON output")
+ db_monitor(inst, DEFAULT_SUFFIX, lc.log, args)
+ output = "".join((str(rec) for rec in lc.outputs))
+
+ assert "Normalized DN Cache:" in output
+ assert "Cache Hit Ratio:" in output
+ lc.flush()
+
+ log.info("Setting nsslapd-ndn-cache-enabled to OFF")
+ inst.config.set('nsslapd-ndn-cache-enabled', 'off')
+ inst.restart()
+
+ log.info("Testing with NDN cache disabled - non-JSON output")
+ db_monitor(inst, DEFAULT_SUFFIX, lc.log, args)
+ output = "".join((str(rec) for rec in lc.outputs))
+
+ assert "Normalized DN Cache:" not in output
+ lc.flush()
+
+ inst.config.set('nsslapd-ndn-cache-enabled', 'on')
+ inst.restart()
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/src/cockpit/389-console/src/database.jsx b/src/cockpit/389-console/src/database.jsx
index 276125dfc..86b642b92 100644
--- a/src/cockpit/389-console/src/database.jsx
+++ b/src/cockpit/389-console/src/database.jsx
@@ -198,7 +198,7 @@ export class Database extends React.Component {
});
const cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
- "config", "get", "nsslapd-ndn-cache-max-size"
+ "config", "get", "nsslapd-ndn-cache-max-size", "nsslapd-ndn-cache-enabled"
];
log_cmd("loadNDN", "Load NDN cache size", cmd);
cockpit
@@ -206,10 +206,12 @@ export class Database extends React.Component {
.done(content => {
const config = JSON.parse(content);
const attrs = config.attrs;
+ const ndn_cache_enabled = attrs['nsslapd-ndn-cache-enabled'][0] === "on";
this.setState(prevState => ({
globalDBConfig: {
...prevState.globalDBConfig,
ndncachemaxsize: attrs['nsslapd-ndn-cache-max-size'][0],
+ ndn_cache_enabled: ndn_cache_enabled,
},
configUpdated: 0,
loaded: true,
diff --git a/src/cockpit/389-console/src/lib/database/databaseConfig.jsx b/src/cockpit/389-console/src/lib/database/databaseConfig.jsx
index 4c7fce706..adb8227d7 100644
--- a/src/cockpit/389-console/src/lib/database/databaseConfig.jsx
+++ b/src/cockpit/389-console/src/lib/database/databaseConfig.jsx
@@ -2,12 +2,16 @@ import cockpit from "cockpit";
import React from "react";
import { log_cmd } from "../tools.jsx";
import {
+ Alert,
Button,
Checkbox,
+ Form,
Grid,
GridItem,
+ Hr,
NumberInput,
Spinner,
+ Switch,
Tab,
Tabs,
TabTitleText,
@@ -852,12 +856,29 @@ export class GlobalDatabaseConfig extends React.Component {
<Tab eventKey={3} title={<TabTitleText>{_("NDN Cache")}</TabTitleText>}>
<div className="ds-left-indent-md">
+ <Grid
+ title={_("Warning: Normalized DN Cache is disabled")}
+ className="ds-margin-top-xlg"
+ >
+ {this.props.data.ndn_cache_enabled === false && (
+ <GridItem span={8}>
+ <Alert
+ variant="warning"
+ isInline
+ title={_("Normalized DN Cache is disabled")}
+ className="ds-margin-bottom"
+ >
+ {_("The Normalized DN Cache is currently disabled. To enable it, go to Server Settings → Tuning & Limits and enable 'Normalized DN Cache', then restart the server for the changes to take effect.")}
+ </Alert>
+ </GridItem>
+ )}
+ </Grid>
<Grid
title={_("Set the maximum size in bytes for the Normalized DN Cache (nsslapd-ndn-cache-max-size).")}
className="ds-margin-top-xlg"
>
<GridItem className="ds-label" span={4}>
- {_("Normalized DN Cache Max Size")}
+ {_("Normalized DN Cache Max Size") }
</GridItem>
<GridItem span={8}>
<NumberInput
@@ -873,9 +894,9 @@ export class GlobalDatabaseConfig extends React.Component {
plusBtnAriaLabel="plus"
widthChars={10}
validated={'ndncachemaxsize' in this.state.error &&
- this.state.error['ndncachemaxsize']
- ? ValidatedOptions.error
- : ValidatedOptions.default}
+ this.state.error['ndncachemaxsize']
+ ? ValidatedOptions.error
+ : ValidatedOptions.default}
/>
</GridItem>
</Grid>
@@ -1470,7 +1491,7 @@ export class GlobalDatabaseConfigMDB extends React.Component {
<Tab eventKey={0} title={<TabTitleText>{_("Database Size")}</TabTitleText>}>
<div className="ds-left-indent-md">
<Grid
- title={_("Database maximum size in megabytes. The practical maximum size of an LMDB database is limited by the system’s addressable memory (nsslapd-mdb-max-size).")}
+ title={_("Database maximum size in megabytes. The practical maximum size of an LMDB database is limited by the system's addressable memory (nsslapd-mdb-max-size).")}
className="ds-margin-top-xlg"
>
<GridItem className="ds-label" span={4}>
@@ -1641,6 +1662,23 @@ export class GlobalDatabaseConfigMDB extends React.Component {
<Tab eventKey={4} title={<TabTitleText>{_("NDN Cache")}</TabTitleText>}>
<div className="ds-left-indent-md">
+ <Grid
+ title={_("Warning: Normalized DN Cache is disabled")}
+ className="ds-margin-top-xlg"
+ >
+ {this.props.data.ndn_cache_enabled === false && (
+ <GridItem span={8}>
+ <Alert
+ variant="warning"
+ isInline
+ title={_("Normalized DN Cache is disabled")}
+ className="ds-margin-bottom"
+ >
+ {_("The Normalized DN Cache is currently disabled. To enable it, go to Server Settings → Tuning & Limits and enable 'Normalized DN Cache', then restart the server for the changes to take effect.")}
+ </Alert>
+ </GridItem>
+ )}
+ </Grid>
<Grid
title={_("Set the maximum size in bytes for the Normalized DN Cache (nsslapd-ndn-cache-max-size).")}
className="ds-margin-top-xlg"
diff --git a/src/cockpit/389-console/src/lib/monitor/dbMonitor.jsx b/src/cockpit/389-console/src/lib/monitor/dbMonitor.jsx
index bb9950ccd..c7c7c954f 100644
--- a/src/cockpit/389-console/src/lib/monitor/dbMonitor.jsx
+++ b/src/cockpit/389-console/src/lib/monitor/dbMonitor.jsx
@@ -39,7 +39,8 @@ export class DatabaseMonitor extends React.Component {
ndnCount: 5,
dbCacheList: [],
ndnCacheList: [],
- ndnCacheUtilList: []
+ ndnCacheUtilList: [],
+ ndn_cache_enabled: false
};
// Toggle currently active tab
@@ -110,6 +111,7 @@ export class DatabaseMonitor extends React.Component {
{ name: "", x: "4", y: 0 },
{ name: "", x: "5", y: 0 },
],
+ ndn_cache_enabled: false
});
}
@@ -136,19 +138,27 @@ export class DatabaseMonitor extends React.Component {
chart_data.shift();
chart_data.push({ name: _("Cache Hit Ratio"), x: count.toString(), y: parseInt(dbratio) });
- // Build up the NDN Cache chart data
- const ndnratio = config.attrs.normalizeddncachehitratio[0];
- const ndn_chart_data = this.state.ndnCacheList;
- ndn_chart_data.shift();
- ndn_chart_data.push({ name: _("Cache Hit Ratio"), x: count.toString(), y: parseInt(ndnratio) });
-
- // Build up the DB Cache Util chart data
- const ndn_util_chart_data = this.state.ndnCacheUtilList;
- const currNDNSize = parseInt(config.attrs.currentnormalizeddncachesize[0]);
- const maxNDNSize = parseInt(config.attrs.maxnormalizeddncachesize[0]);
- const ndn_utilization = (currNDNSize / maxNDNSize) * 100;
- ndn_util_chart_data.shift();
- ndn_util_chart_data.push({ name: _("Cache Utilization"), x: ndnCount.toString(), y: parseInt(ndn_utilization) });
+ // Check if NDN cache is enabled
+ const ndn_cache_enabled = config.attrs.normalizeddncachehitratio &&
+ config.attrs.normalizeddncachehitratio.length > 0;
+ let ndn_chart_data = this.state.ndnCacheList;
+ let ndn_util_chart_data = this.state.ndnCacheUtilList;
+
+ // Only build NDN cache chart data if NDN cache is enabled
+ if (ndn_cache_enabled) {
+ const ndnratio = config.attrs.normalizeddncachehitratio[0];
+ ndn_chart_data = this.state.ndnCacheList;
+ ndn_chart_data.shift();
+ ndn_chart_data.push({ name: _("Cache Hit Ratio"), x: count.toString(), y: parseInt(ndnratio) });
+
+ // Build up the NDN Cache Util chart data
+ ndn_util_chart_data = this.state.ndnCacheUtilList;
+ const currNDNSize = parseInt(config.attrs.currentnormalizeddncachesize[0]);
+ const maxNDNSize = parseInt(config.attrs.maxnormalizeddncachesize[0]);
+ const ndn_utilization = (currNDNSize / maxNDNSize) * 100;
+ ndn_util_chart_data.shift();
+ ndn_util_chart_data.push({ name: _("Cache Utilization"), x: ndnCount.toString(), y: parseInt(ndn_utilization) });
+ }
this.setState({
data: config.attrs,
@@ -157,7 +167,8 @@ export class DatabaseMonitor extends React.Component {
ndnCacheList: ndn_chart_data,
ndnCacheUtilList: ndn_util_chart_data,
count,
- ndnCount
+ ndnCount,
+ ndn_cache_enabled
});
})
.fail(() => {
@@ -197,13 +208,20 @@ export class DatabaseMonitor extends React.Component {
if (!this.state.loading) {
dbcachehit = parseInt(this.state.data.dbcachehitratio[0]);
- ndncachehit = parseInt(this.state.data.normalizeddncachehitratio[0]);
- ndncachemax = parseInt(this.state.data.maxnormalizeddncachesize[0]);
- ndncachecurr = parseInt(this.state.data.currentnormalizeddncachesize[0]);
- utilratio = Math.round((ndncachecurr / ndncachemax) * 100);
- if (utilratio === 0) {
- // Just round up to 1
- utilratio = 1;
+
+ // Check if NDN cache is enabled
+ const ndn_cache_enabled = this.state.data.normalizeddncachehitratio &&
+ this.state.data.normalizeddncachehitratio.length > 0;
+
+ if (ndn_cache_enabled) {
+ ndncachehit = parseInt(this.state.data.normalizeddncachehitratio[0]);
+ ndncachemax = parseInt(this.state.data.maxnormalizeddncachesize[0]);
+ ndncachecurr = parseInt(this.state.data.currentnormalizeddncachesize[0]);
+ utilratio = Math.round((ndncachecurr / ndncachemax) * 100);
+ if (utilratio === 0) {
+ // Just round up to 1
+ utilratio = 1;
+ }
}
// Database cache
@@ -214,119 +232,131 @@ export class DatabaseMonitor extends React.Component {
} else {
chartColor = ChartThemeColor.purple;
}
- // NDN cache ratio
- if (ndncachehit > 89) {
- ndnChartColor = ChartThemeColor.green;
- } else if (ndncachehit > 74) {
- ndnChartColor = ChartThemeColor.orange;
- } else {
- ndnChartColor = ChartThemeColor.purple;
- }
- // NDN cache utilization
- if (utilratio > 95) {
- ndnUtilColor = ChartThemeColor.purple;
- } else if (utilratio > 90) {
- ndnUtilColor = ChartThemeColor.orange;
- } else {
- ndnUtilColor = ChartThemeColor.green;
+
+ // NDN cache colors only if enabled
+ if (ndn_cache_enabled) {
+ // NDN cache ratio
+ if (ndncachehit > 89) {
+ ndnChartColor = ChartThemeColor.green;
+ } else if (ndncachehit > 74) {
+ ndnChartColor = ChartThemeColor.orange;
+ } else {
+ ndnChartColor = ChartThemeColor.purple;
+ }
+ // NDN cache utilization
+ if (utilratio > 95) {
+ ndnUtilColor = ChartThemeColor.purple;
+ } else if (utilratio > 90) {
+ ndnUtilColor = ChartThemeColor.orange;
+ } else {
+ ndnUtilColor = ChartThemeColor.green;
+ }
}
- content = (
- <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
- <Tab eventKey={0} title={<TabTitleText>{_("Database Cache")}</TabTitleText>}>
- <div className="ds-margin-top">
- <Card isSelectable>
- <CardBody>
- <div className="ds-container">
- <div className="ds-center">
- <TextContent className="ds-margin-top-xlg" title={_("The database cache hit ratio (dbcachehitratio).")}>
- <Text component={TextVariants.h3}>
- {_("Cache Hit Ratio")}
- </Text>
- </TextContent>
- <TextContent>
- <Text component={TextVariants.h2}>
- <b>{dbcachehit}%</b>
- </Text>
- </TextContent>
- </div>
- <div className="ds-margin-left" style={{ height: '200px', width: '500px' }}>
- <Chart
- ariaDesc="Database Cache"
- ariaTitle={_("Live Database Cache Statistics")}
- containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
- height={200}
- maxDomain={{ y: 100 }}
- minDomain={{ y: 0 }}
- padding={{
- bottom: 30,
- left: 40,
- top: 10,
- right: 10,
- }}
- width={500}
- themeColor={chartColor}
- >
- <ChartAxis />
- <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
- <ChartGroup>
- <ChartArea
- data={this.state.dbCacheList}
- />
- </ChartGroup>
- </Chart>
- </div>
+ // Create tabs based on what caches are available
+ const tabs = [];
+
+ // Database Cache tab is always available
+ tabs.push(
+ <Tab eventKey={0} key="db-cache-tab" title={<TabTitleText>{_("Database Cache")}</TabTitleText>}>
+ <div className="ds-margin-top">
+ <Card isSelectable>
+ <CardBody>
+ <div className="ds-container">
+ <div className="ds-center">
+ <TextContent className="ds-margin-top-xlg" title={_("The database cache hit ratio (dbcachehitratio).")}>
+ <Text component={TextVariants.h3}>
+ {_("Cache Hit Ratio")}
+ </Text>
+ </TextContent>
+ <TextContent>
+ <Text component={TextVariants.h2}>
+ <b>{dbcachehit}%</b>
+ </Text>
+ </TextContent>
</div>
- </CardBody>
- </Card>
- </div>
+ <div className="ds-margin-left" style={{ height: '200px', width: '500px' }}>
+ <Chart
+ ariaDesc="Database Cache"
+ ariaTitle={_("Live Database Cache Statistics")}
+ containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
+ height={200}
+ maxDomain={{ y: 100 }}
+ minDomain={{ y: 0 }}
+ padding={{
+ bottom: 30,
+ left: 40,
+ top: 10,
+ right: 10,
+ }}
+ width={500}
+ themeColor={chartColor}
+ >
+ <ChartAxis />
+ <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
+ <ChartGroup>
+ <ChartArea
+ data={this.state.dbCacheList}
+ />
+ </ChartGroup>
+ </Chart>
+ </div>
+ </div>
+ </CardBody>
+ </Card>
+ </div>
+
+ <Grid hasGutter className="ds-margin-top-xlg">
+ <GridItem span={3}>
+ {_("Database Cache Hit Ratio:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{this.state.data.dbcachehitratio}%</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Database Cache Tries:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcachetries)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Database Cache Hits:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcachehits)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Cache Pages Read:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcachepagein)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Cache Pages Written:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcachepageout)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Read-Only Page Evictions:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcacheroevict)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("Read-Write Page Evictions:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.dbcacherwevict)}</b>
+ </GridItem>
+ </Grid>
+ </Tab>
+ );
- <Grid hasGutter className="ds-margin-top-xlg">
- <GridItem span={3}>
- {_("Database Cache Hit Ratio:")}
- </GridItem>
- <GridItem span={2}>
- <b>{this.state.data.dbcachehitratio}%</b>
- </GridItem>
- <GridItem span={3}>
- {_("Database Cache Tries:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcachetries)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("Database Cache Hits:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcachehits)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("Cache Pages Read:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcachepagein)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("Cache Pages Written:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcachepageout)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("Read-Only Page Evictions:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcacheroevict)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("Read-Write Page Evictions:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.dbcacherwevict)}</b>
- </GridItem>
- </Grid>
- </Tab>
- <Tab eventKey={1} title={<TabTitleText>{_("Normalized DN Cache")}</TabTitleText>}>
+ // Only add NDN Cache tab if NDN cache is enabled
+ if (ndn_cache_enabled) {
+ tabs.push(
+ <Tab eventKey={1} key="ndn-cache-tab" title={<TabTitleText>{_("Normalized DN Cache")}</TabTitleText>}>
<div className="ds-margin-top-lg">
<Grid hasGutter>
<GridItem span={6}>
@@ -487,6 +517,12 @@ export class DatabaseMonitor extends React.Component {
</Grid>
</div>
</Tab>
+ );
+ }
+
+ content = (
+ <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
+ {tabs}
</Tabs>
);
}
@@ -533,7 +569,8 @@ export class DatabaseMonitorMDB extends React.Component {
ndnCount: 5,
dbCacheList: [],
ndnCacheList: [],
- ndnCacheUtilList: []
+ ndnCacheUtilList: [],
+ ndn_cache_enabled: false
};
// Toggle currently active tab
@@ -585,6 +622,7 @@ export class DatabaseMonitorMDB extends React.Component {
{ name: "", x: "4", y: 0 },
{ name: "", x: "5", y: 0 },
],
+ ndn_cache_enabled: false
});
}
@@ -605,19 +643,28 @@ export class DatabaseMonitorMDB extends React.Component {
count = 1;
}
- // Build up the NDN Cache chart data
- const ndnratio = config.attrs.normalizeddncachehitratio[0];
- const ndn_chart_data = this.state.ndnCacheList;
- ndn_chart_data.shift();
- ndn_chart_data.push({ name: _("Cache Hit Ratio"), x: count.toString(), y: parseInt(ndnratio) });
-
- // Build up the DB Cache Util chart data
- const ndn_util_chart_data = this.state.ndnCacheUtilList;
- const currNDNSize = parseInt(config.attrs.currentnormalizeddncachesize[0]);
- const maxNDNSize = parseInt(config.attrs.maxnormalizeddncachesize[0]);
- const ndn_utilization = (currNDNSize / maxNDNSize) * 100;
- ndn_util_chart_data.shift();
- ndn_util_chart_data.push({ name: _("Cache Utilization"), x: ndnCount.toString(), y: parseInt(ndn_utilization) });
+ // Check if NDN cache is enabled
+ const ndn_cache_enabled = config.attrs.normalizeddncachehitratio &&
+ config.attrs.normalizeddncachehitratio.length > 0;
+ let ndn_chart_data = this.state.ndnCacheList;
+ let ndn_util_chart_data = this.state.ndnCacheUtilList;
+
+ // Only build NDN cache chart data if NDN cache is enabled
+ if (ndn_cache_enabled) {
+ // Build up the NDN Cache chart data
+ const ndnratio = config.attrs.normalizeddncachehitratio[0];
+ ndn_chart_data = this.state.ndnCacheList;
+ ndn_chart_data.shift();
+ ndn_chart_data.push({ name: _("Cache Hit Ratio"), x: count.toString(), y: parseInt(ndnratio) });
+
+ // Build up the DB Cache Util chart data
+ ndn_util_chart_data = this.state.ndnCacheUtilList;
+ const currNDNSize = parseInt(config.attrs.currentnormalizeddncachesize[0]);
+ const maxNDNSize = parseInt(config.attrs.maxnormalizeddncachesize[0]);
+ const ndn_utilization = (currNDNSize / maxNDNSize) * 100;
+ ndn_util_chart_data.shift();
+ ndn_util_chart_data.push({ name: _("Cache Utilization"), x: ndnCount.toString(), y: parseInt(ndn_utilization) });
+ }
this.setState({
data: config.attrs,
@@ -625,7 +672,8 @@ export class DatabaseMonitorMDB extends React.Component {
ndnCacheList: ndn_chart_data,
ndnCacheUtilList: ndn_util_chart_data,
count,
- ndnCount
+ ndnCount,
+ ndn_cache_enabled
});
})
.fail(() => {
@@ -662,197 +710,214 @@ export class DatabaseMonitorMDB extends React.Component {
);
if (!this.state.loading) {
- ndncachehit = parseInt(this.state.data.normalizeddncachehitratio[0]);
- ndncachemax = parseInt(this.state.data.maxnormalizeddncachesize[0]);
- ndncachecurr = parseInt(this.state.data.currentnormalizeddncachesize[0]);
- utilratio = Math.round((ndncachecurr / ndncachemax) * 100);
- if (utilratio === 0) {
- // Just round up to 1
- utilratio = 1;
- }
-
- // NDN cache ratio
- if (ndncachehit > 89) {
- ndnChartColor = ChartThemeColor.green;
- } else if (ndncachehit > 74) {
- ndnChartColor = ChartThemeColor.orange;
- } else {
- ndnChartColor = ChartThemeColor.purple;
- }
- // NDN cache utilization
- if (utilratio > 95) {
- ndnUtilColor = ChartThemeColor.purple;
- } else if (utilratio > 90) {
- ndnUtilColor = ChartThemeColor.orange;
- } else {
- ndnUtilColor = ChartThemeColor.green;
- }
-
- content = (
- <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
- <Tab eventKey={0} title={<TabTitleText>{_("Normalized DN Cache")}</TabTitleText>}>
- <div className="ds-margin-top-lg">
- <Grid hasGutter>
- <GridItem span={6}>
- <Card isSelectable>
- <CardBody>
- <div className="ds-container">
- <div className="ds-center">
- <TextContent className="ds-margin-top-xlg" title={_("The normalized DN cache hit ratio (normalizeddncachehitratio).")}>
- <Text component={TextVariants.h3}>
- {_("Cache Hit Ratio")}
- </Text>
- </TextContent>
- <TextContent>
- <Text component={TextVariants.h2}>
- <b>{ndncachehit}%</b>
- </Text>
- </TextContent>
- </div>
- <div className="ds-margin-left" style={{ height: '200px', width: '350px' }}>
- <Chart
- ariaDesc="NDN Cache"
- ariaTitle={_("Live Normalized DN Cache Statistics")}
- containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
- height={200}
- maxDomain={{ y: 100 }}
- minDomain={{ y: 0 }}
- padding={{
- bottom: 40,
- left: 60,
- top: 10,
- right: 15,
- }}
- width={350}
- themeColor={ndnChartColor}
- >
- <ChartAxis />
- <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
- <ChartGroup>
- <ChartArea
- data={this.state.ndnCacheList}
- />
- </ChartGroup>
- </Chart>
- </div>
- </div>
- </CardBody>
- </Card>
- </GridItem>
- <GridItem span={6}>
- <Card isSelectable>
- <CardBody>
- <div className="ds-container">
- <div className="ds-center">
- <TextContent className="ds-margin-top-lg" title={_("The amount of the cache that is being used: max size (maxnormalizeddncachesize) vs current size (currentnormalizeddncachesize)")}>
- <Text component={TextVariants.h2}>
- {_("Cache Utilization")}
- </Text>
- </TextContent>
- <TextContent>
- <Text component={TextVariants.h3}>
- <b>{utilratio}%</b>
- </Text>
- </TextContent>
- <TextContent className="ds-margin-top-xlg">
- <Text component={TextVariants.h5}>
- {_("Cached DN's")}
- </Text>
- </TextContent>
- <b>{numToCommas(this.state.data.currentnormalizeddncachecount[0])}</b>
+ // Check if NDN cache is enabled
+ const ndn_cache_enabled = this.state.data.normalizeddncachehitratio &&
+ this.state.data.normalizeddncachehitratio.length > 0;
+
+ if (ndn_cache_enabled) {
+ ndncachehit = parseInt(this.state.data.normalizeddncachehitratio[0]);
+ ndncachemax = parseInt(this.state.data.maxnormalizeddncachesize[0]);
+ ndncachecurr = parseInt(this.state.data.currentnormalizeddncachesize[0]);
+ utilratio = Math.round((ndncachecurr / ndncachemax) * 100);
+ if (utilratio === 0) {
+ // Just round up to 1
+ utilratio = 1;
+ }
+
+ // NDN cache ratio
+ if (ndncachehit > 89) {
+ ndnChartColor = ChartThemeColor.green;
+ } else if (ndncachehit > 74) {
+ ndnChartColor = ChartThemeColor.orange;
+ } else {
+ ndnChartColor = ChartThemeColor.purple;
+ }
+ // NDN cache utilization
+ if (utilratio > 95) {
+ ndnUtilColor = ChartThemeColor.purple;
+ } else if (utilratio > 90) {
+ ndnUtilColor = ChartThemeColor.orange;
+ } else {
+ ndnUtilColor = ChartThemeColor.green;
+ }
+
+ content = (
+ <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
+ <Tab eventKey={0} title={<TabTitleText>{_("Normalized DN Cache")}</TabTitleText>}>
+ <div className="ds-margin-top-lg">
+ <Grid hasGutter>
+ <GridItem span={6}>
+ <Card isSelectable>
+ <CardBody>
+ <div className="ds-container">
+ <div className="ds-center">
+ <TextContent className="ds-margin-top-xlg" title={_("The normalized DN cache hit ratio (normalizeddncachehitratio).")}>
+ <Text component={TextVariants.h3}>
+ {_("Cache Hit Ratio")}
+ </Text>
+ </TextContent>
+ <TextContent>
+ <Text component={TextVariants.h2}>
+ <b>{ndncachehit}%</b>
+ </Text>
+ </TextContent>
+ </div>
+ <div className="ds-margin-left" style={{ height: '200px', width: '350px' }}>
+ <Chart
+ ariaDesc="NDN Cache"
+ ariaTitle={_("Live Normalized DN Cache Statistics")}
+ containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
+ height={200}
+ maxDomain={{ y: 100 }}
+ minDomain={{ y: 0 }}
+ padding={{
+ bottom: 40,
+ left: 60,
+ top: 10,
+ right: 15,
+ }}
+ width={350}
+ themeColor={ndnChartColor}
+ >
+ <ChartAxis />
+ <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
+ <ChartGroup>
+ <ChartArea
+ data={this.state.ndnCacheList}
+ />
+ </ChartGroup>
+ </Chart>
+ </div>
</div>
- <div className="ds-margin-left" style={{ height: '200px', width: '350px' }}>
- <Chart
- ariaDesc="NDN Cache Utilization"
- ariaTitle={_("Live Normalized DN Cache Utilization Statistics")}
- containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
- height={200}
- maxDomain={{ y: 100 }}
- minDomain={{ y: 0 }}
- padding={{
- bottom: 40,
- left: 60,
- top: 10,
- right: 15,
- }}
- width={350}
- themeColor={ndnUtilColor}
- >
- <ChartAxis />
- <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
- <ChartGroup>
- <ChartArea
- data={this.state.ndnCacheUtilList}
- />
- </ChartGroup>
- </Chart>
+ </CardBody>
+ </Card>
+ </GridItem>
+ <GridItem span={6}>
+ <Card isSelectable>
+ <CardBody>
+ <div className="ds-container">
+ <div className="ds-center">
+ <TextContent className="ds-margin-top-lg" title={_("The amount of the cache that is being used: max size (maxnormalizeddncachesize) vs current size (currentnormalizeddncachesize)")}>
+ <Text component={TextVariants.h2}>
+ {_("Cache Utilization")}
+ </Text>
+ </TextContent>
+ <TextContent>
+ <Text component={TextVariants.h3}>
+ <b>{utilratio}%</b>
+ </Text>
+ </TextContent>
+ <TextContent className="ds-margin-top-xlg">
+ <Text component={TextVariants.h5}>
+ {_("Cached DN's")}
+ </Text>
+ </TextContent>
+ <b>{numToCommas(this.state.data.currentnormalizeddncachecount[0])}</b>
+ </div>
+ <div className="ds-margin-left" style={{ height: '200px', width: '350px' }}>
+ <Chart
+ ariaDesc="NDN Cache Utilization"
+ ariaTitle={_("Live Normalized DN Cache Utilization Statistics")}
+ containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />}
+ height={200}
+ maxDomain={{ y: 100 }}
+ minDomain={{ y: 0 }}
+ padding={{
+ bottom: 40,
+ left: 60,
+ top: 10,
+ right: 15,
+ }}
+ width={350}
+ themeColor={ndnUtilColor}
+ >
+ <ChartAxis />
+ <ChartAxis dependentAxis showGrid tickValues={[25, 50, 75, 100]} />
+ <ChartGroup>
+ <ChartArea
+ data={this.state.ndnCacheUtilList}
+ />
+ </ChartGroup>
+ </Chart>
+ </div>
</div>
- </div>
- </CardBody>
- </Card>
- </GridItem>
- </Grid>
-
- <Grid hasGutter className="ds-margin-top-xlg">
- <GridItem span={3}>
- {_("NDN Cache Hit Ratio:")}
- </GridItem>
- <GridItem span={2}>
- <b>{this.state.data.normalizeddncachehitratio}%</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Max Size:")}
- </GridItem>
- <GridItem span={2}>
- <b>{displayBytes(this.state.data.maxnormalizeddncachesize)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Tries:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.normalizeddncachetries)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Current Cache Size:")}
- </GridItem>
- <GridItem span={2}>
- <b>{displayBytes(this.state.data.currentnormalizeddncachesize)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Hits:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.normalizeddncachehits)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache DN Count:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.currentnormalizeddncachecount)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Evictions:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.normalizeddncacheevictions)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Thread Size:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.normalizeddncachethreadsize)}</b>
- </GridItem>
- <GridItem span={3}>
- {_("NDN Cache Thread Slots:")}
- </GridItem>
- <GridItem span={2}>
- <b>{numToCommas(this.state.data.normalizeddncachethreadslots)}</b>
- </GridItem>
- </Grid>
- </div>
- </Tab>
- </Tabs>
- );
+ </CardBody>
+ </Card>
+ </GridItem>
+ </Grid>
+
+ <Grid hasGutter className="ds-margin-top-xlg">
+ <GridItem span={3}>
+ {_("NDN Cache Hit Ratio:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{this.state.data.normalizeddncachehitratio}%</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Max Size:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{displayBytes(this.state.data.maxnormalizeddncachesize)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Tries:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.normalizeddncachetries)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Current Cache Size:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{displayBytes(this.state.data.currentnormalizeddncachesize)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Hits:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.normalizeddncachehits)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache DN Count:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.currentnormalizeddncachecount)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Evictions:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.normalizeddncacheevictions)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Thread Size:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.normalizeddncachethreadsize)}</b>
+ </GridItem>
+ <GridItem span={3}>
+ {_("NDN Cache Thread Slots:")}
+ </GridItem>
+ <GridItem span={2}>
+ <b>{numToCommas(this.state.data.normalizeddncachethreadslots)}</b>
+ </GridItem>
+ </Grid>
+ </div>
+ </Tab>
+ </Tabs>
+ );
+ } else {
+ // No NDN cache available
+ content = (
+ <div className="ds-margin-top-xlg ds-center">
+ <TextContent>
+ <Text component={TextVariants.h3}>
+ {_("Normalized DN Cache is disabled")}
+ </Text>
+ </TextContent>
+ </div>
+ );
+ }
}
return (
diff --git a/src/lib389/lib389/cli_conf/monitor.py b/src/lib389/lib389/cli_conf/monitor.py
index b01796549..c7f9322d1 100644
--- a/src/lib389/lib389/cli_conf/monitor.py
+++ b/src/lib389/lib389/cli_conf/monitor.py
@@ -129,6 +129,14 @@ def db_monitor(inst, basedn, log, args):
# Gather the global DB stats
report_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
ldbm_mon = ldbm_monitor.get_status()
+ ndn_cache_enabled = inst.config.get_attr_val_utf8('nsslapd-ndn-cache-enabled') == 'on'
+
+ # Build global cache stats
+ result = {
+ 'date': report_time,
+ 'backends': {},
+ }
+
if ldbm_monitor.inst_db_impl == DB_IMPL_BDB:
dbcachesize = int(ldbm_mon['nsslapd-db-cache-size-bytes'][0])
# Warning: there are two different page sizes associated with bdb:
@@ -153,32 +161,6 @@ def db_monitor(inst, basedn, log, args):
dbcachefree = max(int(dbcachesize - (pagesize * dbpages)), 0)
dbcachefreeratio = dbcachefree/dbcachesize
- ndnratio = ldbm_mon['normalizeddncachehitratio'][0]
- ndncursize = int(ldbm_mon['currentnormalizeddncachesize'][0])
- ndnmaxsize = int(ldbm_mon['maxnormalizeddncachesize'][0])
- ndncount = ldbm_mon['currentnormalizeddncachecount'][0]
- ndnevictions = ldbm_mon['normalizeddncacheevictions'][0]
- if ndncursize > ndnmaxsize:
- ndnfree = 0
- ndnfreeratio = 0
- else:
- ndnfree = ndnmaxsize - ndncursize
- ndnfreeratio = "{:.1f}".format(ndnfree / ndnmaxsize * 100)
-
- # Build global cache stats
- result = {
- 'date': report_time,
- 'ndncache': {
- 'hit_ratio': ndnratio,
- 'free': convert_bytes(str(ndnfree)),
- 'free_percentage': ndnfreeratio,
- 'count': ndncount,
- 'evictions': ndnevictions
- },
- 'backends': {},
- }
-
- if ldbm_monitor.inst_db_impl == DB_IMPL_BDB:
result['dbcache'] = {
'hit_ratio': dbhitratio,
'free': convert_bytes(str(dbcachefree)),
@@ -188,6 +170,32 @@ def db_monitor(inst, basedn, log, args):
'pageout': dbcachepageout
}
+ # Add NDN cache stats only if enabled
+ if ndn_cache_enabled:
+ try:
+ ndnratio = ldbm_mon['normalizeddncachehitratio'][0]
+ ndncursize = int(ldbm_mon['currentnormalizeddncachesize'][0])
+ ndnmaxsize = int(ldbm_mon['maxnormalizeddncachesize'][0])
+ ndncount = ldbm_mon['currentnormalizeddncachecount'][0]
+ ndnevictions = ldbm_mon['normalizeddncacheevictions'][0]
+ if ndncursize > ndnmaxsize:
+ ndnfree = 0
+ ndnfreeratio = 0
+ else:
+ ndnfree = ndnmaxsize - ndncursize
+ ndnfreeratio = "{:.1f}".format(ndnfree / ndnmaxsize * 100)
+
+ result['ndncache'] = {
+ 'hit_ratio': ndnratio,
+ 'free': convert_bytes(str(ndnfree)),
+ 'free_percentage': ndnfreeratio,
+ 'count': ndncount,
+ 'evictions': ndnevictions
+ }
+ # In case, the user enabled NDN cache but still have not restarted the instance
+ except IndexError:
+ ndn_cache_enabled = False
+
# Build the backend results
for be in backend_objs:
be_name = be.rdn
@@ -277,13 +285,16 @@ def db_monitor(inst, basedn, log, args):
log.info(" - Pages In: {}".format(result['dbcache']['pagein']))
log.info(" - Pages Out: {}".format(result['dbcache']['pageout']))
log.info("")
- log.info("Normalized DN Cache:")
- log.info(" - Cache Hit Ratio: {}%".format(result['ndncache']['hit_ratio']))
- log.info(" - Free Space: {}".format(result['ndncache']['free']))
- log.info(" - Free Percentage: {}%".format(result['ndncache']['free_percentage']))
- log.info(" - DN Count: {}".format(result['ndncache']['count']))
- log.info(" - Evictions: {}".format(result['ndncache']['evictions']))
- log.info("")
+
+ if ndn_cache_enabled:
+ log.info("Normalized DN Cache:")
+ log.info(" - Cache Hit Ratio: {}%".format(result['ndncache']['hit_ratio']))
+ log.info(" - Free Space: {}".format(result['ndncache']['free']))
+ log.info(" - Free Percentage: {}%".format(result['ndncache']['free_percentage']))
+ log.info(" - DN Count: {}".format(result['ndncache']['count']))
+ log.info(" - Evictions: {}".format(result['ndncache']['evictions']))
+ log.info("")
+
log.info("Backends:")
for be_name, attr_dict in result['backends'].items():
log.info(f" - {attr_dict['suffix']} ({be_name}):")
| 0 |
4df4aad94f05ec9f8fde32bfe71b453d31092627
|
389ds/389-ds-base
|
Ticket #47420 - An upgrade script 80upgradednformat.pl fails to handle a server instance name incuding '-'
Bug description: If a server instance name contains '-', e.g.,
slapd-TEST-SERVER, it accidentally picks up the first part of
the instance name 'TEST'.
Fix description: Replacing "split(/-/, $instancedir)" with
"split(/-/, $instancedir, 2)".
https://fedorahosted.org/389/ticket/47420
Reviewed by Rich (Thank you!!)
|
commit 4df4aad94f05ec9f8fde32bfe71b453d31092627
Author: Noriko Hosoi <[email protected]>
Date: Tue Jul 2 15:21:54 2013 -0700
Ticket #47420 - An upgrade script 80upgradednformat.pl fails to handle a server instance name incuding '-'
Bug description: If a server instance name contains '-', e.g.,
slapd-TEST-SERVER, it accidentally picks up the first part of
the instance name 'TEST'.
Fix description: Replacing "split(/-/, $instancedir)" with
"split(/-/, $instancedir, 2)".
https://fedorahosted.org/389/ticket/47420
Reviewed by Rich (Thank you!!)
diff --git a/ldap/admin/src/scripts/80upgradednformat.pl.in b/ldap/admin/src/scripts/80upgradednformat.pl.in
index aa433e34b..c566b42b8 100644
--- a/ldap/admin/src/scripts/80upgradednformat.pl.in
+++ b/ldap/admin/src/scripts/80upgradednformat.pl.in
@@ -86,7 +86,7 @@ sub runinst {
my $ldifdir = $config_entry->{"nsslapd-ldifdir"}[0];
my $instancedir = $config_entry->{"nsslapd-instancedir"}[0];
- my ($slapd, $serverID) = split(/-/, $instancedir);
+ my ($slapd, $serverID) = split(/-/, $instancedir, 2);
my $upgradednformat = "@sbindir@/upgradednformat -Z $serverID";
my $reindex = "@sbindir@/db2index -Z $serverID";
| 0 |
fd9acfe0e47451b29edc638ff717230873cec3ab
|
389ds/389-ds-base
|
Issue 6359 - Fix incorrect License tag
Description:
License tag generated by bundle-rust-npm.py had misplaced 'AND' for
the default license.
Relates: https://github.com/389ds/389-ds-base/issues/6359
Reviewed by: @droideck (Thanks!)
|
commit fd9acfe0e47451b29edc638ff717230873cec3ab
Author: Viktor Ashirov <[email protected]>
Date: Mon Dec 16 21:08:46 2024 +0100
Issue 6359 - Fix incorrect License tag
Description:
License tag generated by bundle-rust-npm.py had misplaced 'AND' for
the default license.
Relates: https://github.com/389ds/389-ds-base/issues/6359
Reviewed by: @droideck (Thanks!)
diff --git a/rpm/bundle-rust-npm.py b/rpm/bundle-rust-npm.py
index affc8fd13..89cfc56fb 100644
--- a/rpm/bundle-rust-npm.py
+++ b/rpm/bundle-rust-npm.py
@@ -146,11 +146,11 @@ def replace_license(spec_file: str, license_string: str):
for line in contents:
if line.startswith("License: "):
if args.fix_it:
- result.append(f"License: GPL-3.0-or-later AND WITH GPL-3.0-389-ds-base-exception {license_string}\n")
+ result.append(f"License: GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND {license_string}\n")
else:
result.append("# IMPORTANT - Check if it looks right. Additionally, "
"compare with the original line. Then, remove this comment and # FIXME - part.\n")
- result.append(f"# FIXME - License: GPL-3.0-or-later AND WITH GPL-3.0-389-ds-base-exception {license_string}\n")
+ result.append(f"# FIXME - License: GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND {license_string}\n")
else:
result.append(line)
with open(spec_file, "w") as file:
| 0 |
89fb3420c9137cb2c9813fec527b89fec3b6d63e
|
389ds/389-ds-base
|
Ticket 471 - logconv.pl tool removes the access logs contents if "-M" is not correctly used
Bug Description: If you fail to specifiy the output file, the access log is overwritten.
Fix Description: Check if the proper files have been provbided to the script, and report error otherwise.
https://fedorahosted.org/389/ticket/471
Reviewed by: nhosoi(Thanks!)
|
commit 89fb3420c9137cb2c9813fec527b89fec3b6d63e
Author: Mark Reynolds <[email protected]>
Date: Tue Jan 8 13:47:25 2013 -0500
Ticket 471 - logconv.pl tool removes the access logs contents if "-M" is not correctly used
Bug Description: If you fail to specifiy the output file, the access log is overwritten.
Fix Description: Check if the proper files have been provbided to the script, and report error otherwise.
https://fedorahosted.org/389/ticket/471
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index f5342af63..0ec596a41 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -71,6 +71,7 @@ $endFlag = 0;
$endTime = 0;
$s_stats = new_stats_block( );
$m_stats = new_stats_block( );
+$report_opt = "";
GetOptions(
'd|rootDN=s' => \$manager,
@@ -81,8 +82,8 @@ GetOptions(
'S|startTime=s' => \$startTime,
'E|endTime=s' => \$endTime,
'B|bind=s' => sub { $reportBinds = "yes"; $bindReportDN=($_[1]) },
- 'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); },
- 'M|reportFileMins=s' => sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); },
+ 'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); $report_opt = "-m"; },
+ 'M|reportFileMins=s' => sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); $report_opt = "-M"; },
'h|help' => sub { displayUsage() },
# usage options '-efcibaltnxgjuiryp'
'e' => sub { $usage = $usage . "e"; },
@@ -132,6 +133,15 @@ while($sn <= $#ARGV){
$sn++;
}
+if($fc == 0){
+ if($report_opt ne ""){
+ print "Usage error for option $report_opt, either the output file or access log is missing!\n\n";
+ } else {
+ print "There are no access logs specified!\n\n";
+ }
+ exit 1;
+}
+
if ($sizeCount eq "all"){$sizeCount = "100000";}
#######################################
@@ -261,7 +271,7 @@ $err[68] = "Already Exists\n";
$err[69] = "No Objectclass Mods\n";
$err[70] = "Results Too Large\n";
$err[71] = "Effect Multiple DSA's\n";
-$err[80] = "Other :-)\n";
+$err[80] = "Other\n";
$err[81] = "Server Down\n";
$err[82] = "Local Error\n";
$err[83] = "Encoding Error\n";
| 0 |
2cc32e62b6890860d4abe74cd88ee382b9c3bb54
|
389ds/389-ds-base
|
Ticket 47612 - ns-slapd eats all the memory
Bug Description: slpad process quickly grows and runs out of memory
The reason is that an entry is copied and one of teh attributes
has a next reference to itself, so that it will try to copy it
infinitely.
The state is an effect of moving an attribute to the deleted
attributes if the present valueset is empty, but in urp this
is also called for deleted attributes and so ti will be added
again.
Fix Description: check if attribute is present before moving to deleted
https://fedorahosted.org/389/ticket/47612
Reviewed by: richm, thanks
|
commit 2cc32e62b6890860d4abe74cd88ee382b9c3bb54
Author: Ludwig Krispenz <[email protected]>
Date: Thu Dec 5 13:52:27 2013 +0100
Ticket 47612 - ns-slapd eats all the memory
Bug Description: slpad process quickly grows and runs out of memory
The reason is that an entry is copied and one of teh attributes
has a next reference to itself, so that it will try to copy it
infinitely.
The state is an effect of moving an attribute to the deleted
attributes if the present valueset is empty, but in urp this
is also called for deleted attributes and so ti will be added
again.
Fix Description: check if attribute is present before moving to deleted
https://fedorahosted.org/389/ticket/47612
Reviewed by: richm, thanks
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index a725ddb2a..afaf019c3 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -785,7 +785,9 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
{
int retVal= LDAP_SUCCESS;
Slapi_Attr *a= NULL;
+ int attr_state;
entry_attr_find_wsi(e, type, &a);
+ attr_state = entry_attr_find_wsi(e, type, &a);
/* The attribute is on the present list, or the deleted list and we're doing URP */
if ( vals == NULL || vals[0] == NULL )
{
@@ -800,7 +802,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
*/
valueset_purge(&a->a_present_values, csn);
valueset_purge(&a->a_deleted_values, csn);
- if(valueset_isempty(&a->a_present_values))
+ if(attr_state==ATTRIBUTE_PRESENT && valueset_isempty(&a->a_present_values))
entry_present_attribute_to_deleted_attribute(e, a);
}
else
@@ -842,7 +844,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
valuearray_update_csn(valuestodelete,CSN_TYPE_VALUE_DELETED,csn);
slapi_valueset_add_attr_valuearray_ext (a, &a->a_deleted_values, valuestodelete, valuearray_count(valuestodelete), SLAPI_VALUE_FLAG_PASSIN, NULL);
- if(valueset_isempty(&a->a_present_values))
+ if(attr_state==ATTRIBUTE_PRESENT && valueset_isempty(&a->a_present_values))
entry_present_attribute_to_deleted_attribute(e, a);
/* all the elements in valuestodelete are passed;
* should free valuestodelete only (don't call valuearray_free)
| 0 |
c11820adf38ce4ffaeb216622eeabd60fa3bf6d2
|
389ds/389-ds-base
|
Resolves: 170461
Summary: Remove dependency on Term::ReadKey for password prompting in Perl scripts.
|
commit c11820adf38ce4ffaeb216622eeabd60fa3bf6d2
Author: Nathan Kinder <[email protected]>
Date: Mon Jan 12 16:26:14 2009 +0000
Resolves: 170461
Summary: Remove dependency on Term::ReadKey for password prompting in Perl scripts.
diff --git a/ldap/admin/src/scripts/template-bak2db.pl.in b/ldap/admin/src/scripts/template-bak2db.pl.in
index 9a3fd6bc5..0d057e7d2 100644
--- a/ldap/admin/src/scripts/template-bak2db.pl.in
+++ b/ldap/admin/src/scripts/template-bak2db.pl.in
@@ -91,17 +91,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
diff --git a/ldap/admin/src/scripts/template-db2bak.pl.in b/ldap/admin/src/scripts/template-db2bak.pl.in
index 54ddf49aa..fac526d21 100644
--- a/ldap/admin/src/scripts/template-db2bak.pl.in
+++ b/ldap/admin/src/scripts/template-db2bak.pl.in
@@ -88,17 +88,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
diff --git a/ldap/admin/src/scripts/template-db2index.pl.in b/ldap/admin/src/scripts/template-db2index.pl.in
index 94d2bfa9b..e993d8818 100644
--- a/ldap/admin/src/scripts/template-db2index.pl.in
+++ b/ldap/admin/src/scripts/template-db2index.pl.in
@@ -127,17 +127,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "" )
diff --git a/ldap/admin/src/scripts/template-db2ldif.pl.in b/ldap/admin/src/scripts/template-db2ldif.pl.in
index 127c72fe7..af5f0d7e8 100644
--- a/ldap/admin/src/scripts/template-db2ldif.pl.in
+++ b/ldap/admin/src/scripts/template-db2ldif.pl.in
@@ -179,17 +179,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if (($instances[0] eq "" && $included[0] eq "") || $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
@@ -262,7 +260,7 @@ if ($verbose != 0) { $vstr = "-v"; }
$ENV{'PATH'} = "$prefix@ldapsdk_bindir@:$prefix/usr/bin:@ldapsdk_bindir@:/usr/bin";
$ENV{'LD_LIBRARY_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
$ENV{'SHLIB_PATH'} = "$prefix@nss_libdir@:$prefix/usr/lib:@nss_libdir@:/usr/lib";
-print("Exported ldif file: ${ldiffile}\n");
+print("Exporting to ldif file: ${ldiffile}\n");
open(FOO, "| ldapmodify $vstr -h {{SERVER-NAME}} -p {{SERVER-PORT}} -D \"$rootdn\" -w \"$passwd\" -a" );
print(FOO "$entry");
close(FOO);
diff --git a/ldap/admin/src/scripts/template-fixup-memberof.pl.in b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
index db8662937..3f04d4a13 100644
--- a/ldap/admin/src/scripts/template-fixup-memberof.pl.in
+++ b/ldap/admin/src/scripts/template-fixup-memberof.pl.in
@@ -118,17 +118,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "" || $basedn_arg eq "" )
diff --git a/ldap/admin/src/scripts/template-ldif2db.pl.in b/ldap/admin/src/scripts/template-ldif2db.pl.in
index 15793e79a..1d99123ab 100644
--- a/ldap/admin/src/scripts/template-ldif2db.pl.in
+++ b/ldap/admin/src/scripts/template-ldif2db.pl.in
@@ -167,17 +167,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if (($instance eq "" && $included[0] eq "") || $ldiffiles[0] eq "" || $rootdn eq "" || $passwd eq "") { &usage; exit(1); }
($s, $m, $h, $dy, $mn, $yr, $wdy, $ydy, $r) = localtime(time);
diff --git a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
index d6e28d0b7..258a6027b 100644
--- a/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
+++ b/ldap/admin/src/scripts/template-ns-accountstatus.pl.in
@@ -463,17 +463,15 @@ if ($pwfile ne ""){
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $rootpw = ReadLine(0);
-# chomp($rootpw);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $rootpw = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($rootpw); # trim trailing newline
}
if( $rootpw eq "" )
diff --git a/ldap/admin/src/scripts/template-ns-activate.pl.in b/ldap/admin/src/scripts/template-ns-activate.pl.in
index d6e28d0b7..258a6027b 100644
--- a/ldap/admin/src/scripts/template-ns-activate.pl.in
+++ b/ldap/admin/src/scripts/template-ns-activate.pl.in
@@ -463,17 +463,15 @@ if ($pwfile ne ""){
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $rootpw = ReadLine(0);
-# chomp($rootpw);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $rootpw = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($rootpw); # trim trailing newline
}
if( $rootpw eq "" )
diff --git a/ldap/admin/src/scripts/template-ns-inactivate.pl.in b/ldap/admin/src/scripts/template-ns-inactivate.pl.in
index d6e28d0b7..258a6027b 100644
--- a/ldap/admin/src/scripts/template-ns-inactivate.pl.in
+++ b/ldap/admin/src/scripts/template-ns-inactivate.pl.in
@@ -463,17 +463,15 @@ if ($pwfile ne ""){
close(RPASS);
} elsif ($rootpw eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $rootpw = ReadLine(0);
-# chomp($rootpw);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $rootpw = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($rootpw); # trim trailing newline
}
if( $rootpw eq "" )
diff --git a/ldap/admin/src/scripts/template-schema-reload.pl.in b/ldap/admin/src/scripts/template-schema-reload.pl.in
index f9dc29d04..d4a510f09 100644
--- a/ldap/admin/src/scripts/template-schema-reload.pl.in
+++ b/ldap/admin/src/scripts/template-schema-reload.pl.in
@@ -108,17 +108,15 @@ if ($passwdfile ne ""){
close(RPASS);
} elsif ($passwd eq "-"){
# Read the password from terminal
- die "The '-w -' option requires an extension library (Term::ReadKey) which is not\n",
- "part of the standard perl distribution. If you want to use it, you must\n",
- "download and install the module. You can find it at\n",
- "http://www.perl.com/CPAN/CPAN.html\n";
-# Remove the previous line and uncomment the following 6 lines once you have installed Term::ReadKey module.
-# use Term::ReadKey;
-# print "Bind Password: ";
-# ReadMode('noecho');
-# $passwd = ReadLine(0);
-# chomp($passwd);
-# ReadMode('normal');
+ print "Bind Password: ";
+ # Disable console echo
+ system("stty -echo");
+ # read the answer
+ $passwd = <STDIN>;
+ # Enable console echo
+ system("stty echo");
+ print "\n";
+ chop($passwd); # trim trailing newline
}
if ( $rootdn eq "" || $passwd eq "" )
| 0 |
185963ef3a51b518896d49d9f564d9eb7b6fe925
|
389ds/389-ds-base
|
Ticket 49832 - remove tcmalloc references
Description: We now bundle jemalloc, so stop building the server
with tcmalloc.
https://pagure.io/389-ds-base/issue/49832
Reviewed by: mreynolds(one line commit rule)
|
commit 185963ef3a51b518896d49d9f564d9eb7b6fe925
Author: Mark Reynolds <[email protected]>
Date: Fri Jul 6 12:48:58 2018 -0400
Ticket 49832 - remove tcmalloc references
Description: We now bundle jemalloc, so stop building the server
with tcmalloc.
https://pagure.io/389-ds-base/issue/49832
Reviewed by: mreynolds(one line commit rule)
diff --git a/Makefile.am b/Makefile.am
index 2ba98bdb7..16e3f58b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -177,7 +177,6 @@ PCRE_LINK = @pcre_lib@ -lpcre
NETSNMP_LINK = @netsnmp_lib@ @netsnmp_link@
PAM_LINK = -lpam
KERBEROS_LINK = $(kerberos_lib)
-TCMALLOC_LINK = @tcmalloc_lib@
EVENT_LINK = @event_lib@
LIBSOCKET=@LIBSOCKET@
@@ -193,8 +192,7 @@ if HPUX
AM_LDFLAGS = -lpthread
else
#AM_LDFLAGS = -Wl,-z,defs
-# Provide the tcmalloc links if needed
-AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(TCMALLOC_LINK) $(CLANG_LDFLAGS)
+AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CLANG_LDFLAGS)
endif #end hpux
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
diff --git a/configure.ac b/configure.ac
index 78a7a422f..c994e88f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -652,7 +652,6 @@ case $host in
platform="linux"
initdir='$(sysconfdir)/rc.d/init.d'
# do arch specific linux stuff here
- # TCMalloc is only on i686, x86_64, ppc64 and arm, so we pick that here.
case $host in
i*86-*-linux*)
AC_DEFINE([CPU_x86], [], [cpu type x86])
@@ -849,7 +848,6 @@ m4_include(m4/selinux.m4)
m4_include(m4/systemd.m4)
m4_include(m4/cmocka.m4)
m4_include(m4/doxygen.m4)
-m4_include(m4/tcmalloc.m4)
PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
AC_SUBST(PACKAGE_BASE_VERSION)
diff --git a/m4/tcmalloc.m4 b/m4/tcmalloc.m4
deleted file mode 100644
index af8ac0a9e..000000000
--- a/m4/tcmalloc.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2017 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# END COPYRIGHT BLOCK
-
-AC_CHECKING(for --enable-tcmalloc)
-
-AC_ARG_ENABLE(tcmalloc, AS_HELP_STRING([--enable-tcmalloc], [Enable tcmalloc based tests (default: no)]),
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE([WITH_TCMALLOC], [1], [With tcmalloc])
- with_tcmalloc="yes"
-
- if test "$enable_asan" = "yes" ; then
- AC_MSG_ERROR([CRITICAL: You may not enable ASAN and TCMALLOC simultaneously])
- fi
-
- case $host in
- s390-*-linux*)
- AC_MSG_ERROR([tcmalloc not support on s390])
- ;;
- *)
- AC_MSG_CHECKING(for tcmalloc)
- if $PKG_CONFIG --exists libtcmalloc; then
- tcmalloc_inc=`$PKG_CONFIG --cflags libtcmalloc`
- tcmalloc_lib=`$PKG_CONFIG --libs libtcmalloc`
- AC_MSG_RESULT([using system tcmalloc])
- else
- AC_MSG_ERROR([pkg-config could not find tcmalloc!])
- fi
- esac
-
-],
-[
- AC_MSG_RESULT(no)
- with_tcmalloc="0"
-])
-
-AM_CONDITIONAL([WITH_TCMALLOC], [test "$with_tcmalloc" = "yes"])
-AC_SUBST(tcmalloc_inc)
-AC_SUBST(tcmalloc_lib)
-
-
| 0 |
24731b3d13029d651c6fd24056b1268d3dcee8b6
|
389ds/389-ds-base
|
Ticket #161 - Review and address latest Coverity issues
https://fedorahosted.org/389/ticket/161
Resolves: Ticket #161
Bug Description: Review and address latest Coverity issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
12486 12485 12484 Resource leak In
linked_attrs_add_backlinks_callback(): Leak of memory or pointers to
system resources
the return -1 left targetsdn, targets, and pb dangling
allocate targetsdn after shutdown check - instead of return -1, goto done and free resources at done:
12481 Resource leak In config_set_default_naming_context(): Leak of
memory or pointers to system resources
free suffix before return
12477 Uninitialized pointer read In index_addordel_entry(): Reads an
uninitialized pointer or its target
use LDBM_PARENTID_STR instead of type
12476 Dereference after null check In string_assertion2keys_ava():
Pointer is checked against null but then dereferenced anyway
check for NULL val
12475 Logically dead code In _entryrdn_insert_key(): Code can never be
reached because of a logical contradiction
get rid of dead code
12448 Time of check time of use In INTdir_create_all(): A check occurs
on a file's attributes before the file is used in a privileged
operation, but things may have changed
get rid of unused code
12447-12444 Time of check time of use
use open() to open the file, then use the functions that take an fd to
further test or access the file - this prevents someone changing the file
between functions that only use the filename
12434-12425 Copy into fixed size buffer
use strncpy or snprintf and make sure the string is null terminated
Platforms tested: RHEL6 x86_64, Fedora 16
Flag Day: no
Doc impact: no
|
commit 24731b3d13029d651c6fd24056b1268d3dcee8b6
Author: Rich Megginson <[email protected]>
Date: Thu Jan 26 12:13:54 2012 -0700
Ticket #161 - Review and address latest Coverity issues
https://fedorahosted.org/389/ticket/161
Resolves: Ticket #161
Bug Description: Review and address latest Coverity issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
12486 12485 12484 Resource leak In
linked_attrs_add_backlinks_callback(): Leak of memory or pointers to
system resources
the return -1 left targetsdn, targets, and pb dangling
allocate targetsdn after shutdown check - instead of return -1, goto done and free resources at done:
12481 Resource leak In config_set_default_naming_context(): Leak of
memory or pointers to system resources
free suffix before return
12477 Uninitialized pointer read In index_addordel_entry(): Reads an
uninitialized pointer or its target
use LDBM_PARENTID_STR instead of type
12476 Dereference after null check In string_assertion2keys_ava():
Pointer is checked against null but then dereferenced anyway
check for NULL val
12475 Logically dead code In _entryrdn_insert_key(): Code can never be
reached because of a logical contradiction
get rid of dead code
12448 Time of check time of use In INTdir_create_all(): A check occurs
on a file's attributes before the file is used in a privileged
operation, but things may have changed
get rid of unused code
12447-12444 Time of check time of use
use open() to open the file, then use the functions that take an fd to
further test or access the file - this prevents someone changing the file
between functions that only use the filename
12434-12425 Copy into fixed size buffer
use strncpy or snprintf and make sure the string is null terminated
Platforms tested: RHEL6 x86_64, Fedora 16
Flag Day: no
Doc impact: no
diff --git a/include/base/file.h b/include/base/file.h
index 496c33e77..fa53eb5ef 100644
--- a/include/base/file.h
+++ b/include/base/file.h
@@ -86,8 +86,6 @@ NSAPI_PUBLIC SYS_DIRENT *INTdir_read(SYS_DIR ds);
NSAPI_PUBLIC void INTdir_close(SYS_DIR ds);
#endif /* XP_WIN32 */
-NSAPI_PUBLIC int INTdir_create_all(char *dir);
-
/* --- OBSOLETE ----------------------------------------------------------
* The following macros/functions are obsolete and are only maintained for
* compatibility. Do not use them. 11-19-96
@@ -131,7 +129,6 @@ NSPR_END_EXTERN_C
#define dir_read INTdir_read
#define dir_close INTdir_close
#endif /* XP_WIN32 */
-#define dir_create_all INTdir_create_all
/* Obsolete */
#ifdef XP_WIN32
diff --git a/ldap/servers/plugins/linkedattrs/fixup_task.c b/ldap/servers/plugins/linkedattrs/fixup_task.c
index b92c6b7e1..c1af2f269 100644
--- a/ldap/servers/plugins/linkedattrs/fixup_task.c
+++ b/ldap/servers/plugins/linkedattrs/fixup_task.c
@@ -369,12 +369,14 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
for (i = 0; targets && targets[i]; ++i) {
char *targetdn = (char *)targets[i];
int perform_update = 0;
- Slapi_DN *targetsdn = slapi_sdn_new_normdn_byref(targetdn);
+ Slapi_DN *targetsdn = NULL;
if (g_get_shutdown()) {
- return -1;
+ rc = -1;
+ goto done;
}
+ targetsdn = slapi_sdn_new_normdn_byref(targetdn);
if (config->scope) {
/* Check if the target is within the scope. */
perform_update = slapi_dn_issuffix(targetdn, config->scope);
@@ -408,6 +410,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
slapi_sdn_free(&targetsdn);
}
+done:
slapi_ch_array_free(targets);
slapi_pblock_destroy(pb);
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index f48272374..3840c2e9d 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -678,8 +678,8 @@ string_assertion2keys_ava(
break;
case LDAP_FILTER_EQUALITY:
(*ivals) = (Slapi_Value **) slapi_ch_malloc( 2 * sizeof(Slapi_Value *) );
- (*ivals)[0] = slapi_value_dup( val );
- if (!(flags & SLAPI_ATTR_FLAG_NORMALIZED)) {
+ (*ivals)[0] = val ? slapi_value_dup( val ) : NULL;
+ if (val && !(flags & SLAPI_ATTR_FLAG_NORMALIZED)) {
/* 3rd arg: 1 - trim leading blanks */
value_normalize_ext( (*ivals)[0]->bv.bv_val, syntax, 1, &alt );
if (alt) {
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index d00fd14bc..65ad867a9 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -379,7 +379,7 @@ index_addordel_entry(
back_txn *txn
)
{
- char *type;
+ char *type = NULL;
Slapi_Value **svals;
int rc, result;
Slapi_Attr *attr;
@@ -430,7 +430,7 @@ index_addordel_entry(
slapi_entry_attr_find(e->ep_entry, LDBM_PARENTID_STR, &attr);
if (attr) {
svals = attr_get_present_values(attr);
- result = index_addordel_values_sv(be, type, svals, NULL,
+ result = index_addordel_values_sv(be, LDBM_PARENTID_STR, svals, NULL,
e->ep_id, flags, txn);
if ( result != 0 ) {
ldbm_nasty(errmsg, 1020, result);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index 953129ecb..40b2f1ef9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -2278,6 +2278,7 @@ _entryrdn_insert_key(backend *be,
goto bail;
/* done */
} else {
+ ID currid = 0;
rc = _entryrdn_get_tombstone_elem(cursor, tmpsrdn, &key,
childnrdn, &tmpelem);
if (rc || (NULL == tmpelem)) {
@@ -2296,41 +2297,14 @@ _entryrdn_insert_key(backend *be,
goto bail;
}
/* Node is a tombstone. */
- ID currid = 0;
slapi_ch_free((void **)&elem);
elem = tmpelem;
currid = id_stored_to_internal(elem->rdn_elem_id);
- if (0 == rdnidx) { /* Child is a Leaf RDN to be added */
- if (currid == id) {
- /* already in the file */
- /* do nothing and return. */
- rc = 0;
- slapi_log_error(SLAPI_LOG_BACKLDBM, ENTRYRDN_TAG,
- "_entryrdn_insert_key: ID %d is already "
- "in the index. NOOP.\n", currid);
- } else { /* different id, error return */
- char *dn = NULL;
- int tmprc = slapi_rdn_get_dn(srdn, &dn);
- slapi_log_error(SLAPI_LOG_FATAL,
- ENTRYRDN_TAG,
- "_entryrdn_insert_key: Same DN (%s: %s) "
- "is already in the %s file with different ID "
- "%d. Expected ID is %d.\n",
- tmprc?"rdn":"dn", tmprc?childnrdn:dn,
- LDBM_ENTRYRDN_STR, currid, id);
- slapi_ch_free_string(&dn);
- /* returning special error code for the upgrade */
- rc = LDBM_ERROR_FOUND_DUPDN;
- }
- slapi_ch_free((void **)&tmpelem);
- goto bail;
- } else { /* if (0 != rdnidx) */
- nrdn = childnrdn;
- workid = currid;
- slapi_ch_free((void **)&parentelem);
- parentelem = elem;
- elem = NULL;
- }
+ nrdn = childnrdn;
+ workid = currid;
+ slapi_ch_free((void **)&parentelem);
+ parentelem = elem;
+ elem = NULL;
}
} else {
char *dn = NULL;
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index fa179ae44..3e8a6154c 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -5899,6 +5899,7 @@ config_set_default_naming_context(const char *attrname,
}
if (!apply) {
+ slapi_ch_free_string(&suffix);
return LDAP_SUCCESS;
}
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index e90e00a72..f656df955 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -1497,7 +1497,6 @@ char* slapd_get_tmp_dir()
unsigned ilen;
char pch;
#endif
- struct stat ffinfo;
tmp[0] = '\0';
@@ -1535,25 +1534,32 @@ char* slapd_get_tmp_dir()
}
#endif
- if(stat(tmpdir, &ffinfo) == -1)
#if defined( XP_WIN32 )
- if(CreateDirectory(tmpdir, NULL) == 0)
- {
- slapi_log_error(
+ if(CreateDirectory(tmpdir, NULL) == 0)
+ {
+ slapi_log_error(
SLAPI_LOG_FATAL,
"slapd_get_tmp_dir",
"CreateDirectory(%s, NULL) Error: %s\n",
tmpdir, strerror(errno));
- }
+ }
#else
- if(mkdir(tmpdir, 00770) == -1)
- {
+ if(mkdir(tmpdir, 00770) == -1)
+ {
+ if (errno == EEXIST) {
+ slapi_log_error(
+ SLAPI_LOG_TRACE,
+ "slapd_get_tmp_dir",
+ "mkdir(%s, 00770) - already exists\n",
+ tmpdir);
+ } else {
slapi_log_error(
SLAPI_LOG_FATAL,
"slapd_get_tmp_dir",
"mkdir(%s, 00770) Error: %s\n",
- tmpdir, strerror(errno));
+ tmpdir, strerror(errno));
}
+ }
#endif
return ( tmpdir );
}
diff --git a/ldap/servers/slapd/tools/ldclt/data.c b/ldap/servers/slapd/tools/ldclt/data.c
index 33de017d6..e0eac55e5 100644
--- a/ldap/servers/slapd/tools/ldclt/data.c
+++ b/ldap/servers/slapd/tools/ldclt/data.c
@@ -234,18 +234,8 @@ int loadImages (
/*
* Read the image size
*/
- strcpy (name, dirpath);
- strcat (name, "/");
- strcat (name, fileName);
- if (stat (name, &stat_buf) < 0)
- {
- perror (name);
- fprintf (stderr, "Cannot stat(%s)\n", name);
- fflush (stderr);
- rc = -1;
- goto exit;
- }
- mctx.images[mctx.imagesNb-1].length = stat_buf.st_size;
+ snprintf (name, sizeof(name), "%s/%s", dirpath, fileName);
+ name[sizeof(name)-1] = '\0';
/*
* Open the image
@@ -260,6 +250,16 @@ int loadImages (
goto exit;
}
+ if (fstat (fd, &stat_buf) < 0)
+ {
+ perror (name);
+ fprintf (stderr, "Cannot stat(%s)\n", name);
+ fflush (stderr);
+ rc = -1;
+ goto exit;
+ }
+ mctx.images[mctx.imagesNb-1].length = stat_buf.st_size;
+
#ifdef _WIN32
/*
* Allocate buffer and read the data :-(
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index fd291bb42..76fc9c2ad 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -2624,9 +2624,8 @@ doRename (
*/
if (buildRandomRdnOrFilter (tttctx) < 0)
return (-1);
- strcpy (oldDn, tttctx->bufFilter);
- strcat (oldDn, ",");
- strcat (oldDn, tttctx->bufBaseDN);
+ snprintf (oldDn, sizeof(oldDn), "%s,%s", tttctx->bufFilter, tttctx->bufBaseDN);
+ oldDn[sizeof(oldDn)-1] = '\0';
/*
* Now, build a random new name for this entry
@@ -3585,9 +3584,8 @@ doDeleteEntry (
*/
if (buildRandomRdnOrFilter (tttctx) < 0)
return (-1);
- strcpy (delDn, tttctx->bufFilter);
- strcat (delDn, ",");
- strcat (delDn, tttctx->bufBaseDN);
+ snprintf(delDn, sizeof(delDn), "%s,%s", tttctx->bufFilter, tttctx->bufBaseDN);
+ delDn[sizeof(delDn)-1] = '\0';
ret = ldap_delete_ext_s (tttctx->ldapCtx, delDn, NULL, NULL);
if (ret != LDAP_SUCCESS)
diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c b/ldap/servers/slapd/tools/ldclt/ldclt.c
index cabdea84c..a00058bc0 100644
--- a/ldap/servers/slapd/tools/ldclt/ldclt.c
+++ b/ldap/servers/slapd/tools/ldclt/ldclt.c
@@ -1270,6 +1270,7 @@ basicInit (void)
int ret; /* Return value */
int oflags;/* open() flags */ /*JLS 05-04-01*/
struct stat file_st ; /* file status checker for attreplacefile option */
+ int fd = -1;
FILE *attrF; /* file pointer for attreplacefile option */
char buffer[BUFFERSIZE]; /* buffer used to read attreplacefile content */
@@ -1539,9 +1540,18 @@ basicInit (void)
(3) save the content into mctx.attrplFileContent
*/
+ fd = open(mctx.attrplFile, O_RDONLY);
+ if (fd == -1)
+ {
+ printf("ERROR reading attr file [%s]\n",mctx.attrplFile);
+ return (-1);
+ }else{
+ printf("file opened for reading\n");
+ }
/* determine file size here */
- if (stat(mctx.attrplFile, &file_st) < 0){
+ if (fstat(fd, &file_st) < 0){
printf ("attr replace file [%s] does not exist, exit\n", mctx.attrplFile);
+ close(fd);
return (-1);
}else{
mctx.attrplFileSize = file_st.st_size;
@@ -1549,9 +1559,10 @@ basicInit (void)
}
/* open file to read */
- if ((attrF = fopen(mctx.attrplFile, "r")) == NULL )
+ if ((attrF = fdopen(fd, "r")) == NULL )
{
printf("ERROR reading attr file [%s]\n",mctx.attrplFile);
+ close(fd);
return (-1);
}else{
printf("file opened for reading\n");
diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c
index 049e5f629..e64734a31 100644
--- a/ldap/servers/slapd/tools/ldclt/scalab01.c
+++ b/ldap/servers/slapd/tools/ldclt/scalab01.c
@@ -429,7 +429,8 @@ scalab01_addLogin (
return -1;
}
- strcpy (new->dn, dn);
+ strncpy (new->dn, dn, sizeof(new->dn));
+ new->dn[sizeof(new->dn)-1] = '\0';
new->cost = new->counter = duration;
new->next = NULL;
@@ -537,9 +538,8 @@ scalab01_connectSuperuser (void)
unsigned int mod2 = mctx.mod2;
if (!(mode & CLTAUTH)) {
- strcpy (bindDN, SCALAB01_SUPER_USER_RDN);
- strcat (bindDN, ",");
- strcat (bindDN, mctx.baseDN);
+ snprintf (bindDN, sizeof(bindDN), "%s,%s", SCALAB01_SUPER_USER_RDN, mctx.baseDN);
+ bindDN[sizeof(bindDN)-1] = '\0';
}
/* clear bits not applicable to this mode */
mod2 &= ~M2_RNDBINDFILE;
diff --git a/ldap/servers/slapd/tools/ldclt/threadMain.c b/ldap/servers/slapd/tools/ldclt/threadMain.c
index f6a2428b5..1d2ed59f5 100644
--- a/ldap/servers/slapd/tools/ldclt/threadMain.c
+++ b/ldap/servers/slapd/tools/ldclt/threadMain.c
@@ -627,7 +627,8 @@ msgIdAdd (
tttctx->lastMsgId->next = NULL;
tttctx->lastMsgId->msgid = msgid;
strcpy (tttctx->lastMsgId->str, str);
- strcpy (tttctx->lastMsgId->dn, dn);
+ strncpy (tttctx->lastMsgId->dn, dn, sizeof(tttctx->lastMsgId->dn));
+ tttctx->lastMsgId->dn[sizeof(tttctx->lastMsgId->dn)-1] = '\0';
tttctx->lastMsgId->attribs = attribs;
return (0);
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index fd5ebcbb0..9cd365628 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -50,6 +50,7 @@
#include <pwd.h>
#include <stdint.h>
#endif
+#include <fcntl.h>
#include <libgen.h>
#include <pk11func.h>
#include "slap.h"
@@ -876,21 +877,27 @@ strarray2str( char **a, char *buf, size_t buflen, int include_quotes )
int
slapd_chown_if_not_owner(const char *filename, uid_t uid, gid_t gid)
{
+ int fd = -1;
struct stat statbuf;
int result = 1;
if (!filename)
return result;
+ fd = open(filename, O_RDONLY);
+ if (fd == -1) {
+ return result;
+ }
memset(&statbuf, '\0', sizeof(statbuf));
- if (!(result = stat(filename, &statbuf)))
+ if (!(result = fstat(fd, &statbuf)))
{
if (((uid != -1) && (uid != statbuf.st_uid)) ||
((gid != -1) && (gid != statbuf.st_gid)))
{
- result = chown(filename, uid, gid);
+ result = fchown(fd, uid, gid);
}
}
+ close(fd);
return result;
}
#endif
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c
index 238225987..a16c27cab 100644
--- a/ldap/systools/idsktune.c
+++ b/ldap/systools/idsktune.c
@@ -2731,7 +2731,8 @@ static int check_fs_options(char *reqdir,char mntbuf[MAXPATHLEN])
if (mntdir_matches(reqdir,reqlen,mep->IDDS_MNTENT_DIRNAME,mntbuf) == 0) {
found = 0;
#if defined(IDDS_MNTENT_OPTIONS)
- strcpy(optbuf,mep->IDDS_MNTENT_OPTIONS);
+ strncpy(optbuf,mep->IDDS_MNTENT_OPTIONS,sizeof(optbuf));
+ optbuf[sizeof(optbuf)-1] = '\0';
#else
strcpy(optbuf,"");
#endif
@@ -3318,7 +3319,8 @@ int main(int argc,char *argv[])
flag_carrier = 1;
break;
case 'i':
- strcpy(install_dir,optarg);
+ strncpy(install_dir,optarg,sizeof(install_dir));
+ install_dir[sizeof(install_dir)-1] = '\0';
break;
default:
usage(argv[0]);
diff --git a/lib/base/file.cpp b/lib/base/file.cpp
index c7a1a9e23..6dc39e650 100644
--- a/lib/base/file.cpp
+++ b/lib/base/file.cpp
@@ -503,30 +503,6 @@ NSAPI_PUBLIC int file_notfound(void)
#endif
}
-NSAPI_PUBLIC int dir_create_all(char *dir)
-{
- struct stat fi;
- char *t;
-
-#ifdef XP_WIN32
- t = dir + 3;
-#else /* XP_UNIX */
- t = dir + 1;
-#endif
- while(1) {
- t = strchr(t, FILE_PATHSEP);
- if(t) *t = '\0';
- if(stat(dir, &fi) == -1) {
- if(dir_create(dir) == -1)
- return -1;
- }
- if(t) *t++ = FILE_PATHSEP;
- else break;
- }
- return 0;
-}
-
-
#ifdef XP_UNIX
#if !defined(SNI) && !defined(LINUX)
extern char *sys_errlist[];
diff --git a/lib/libaccess/acl.tab.cpp b/lib/libaccess/acl.tab.cpp
index ad828ac2c..27c8c1b3c 100644
--- a/lib/libaccess/acl.tab.cpp
+++ b/lib/libaccess/acl.tab.cpp
@@ -1213,8 +1213,8 @@ case 13:
if (!use_generic_rights) {
acl_string_lower(aclpvt[-0].string);
- strcpy(acl_tmp_arg, "http_");
- strcat(acl_tmp_arg, aclpvt[-0].string);
+ snprintf(acl_tmp_arg, sizeof(acl_tmp_arg), "http_%s", aclpvt[-0].string);
+ acl_tmp_arg[sizeof(acl_tmp_arg)-1] = '\0';
PERM_FREE(aclpvt[-0].string);
acl_new_arg = PERM_STRDUP(acl_tmp_arg);
acl_add_arg(curr_args_list, acl_new_arg);
diff --git a/lib/libaccess/acltext.y b/lib/libaccess/acltext.y
index 368e7ad5f..6ec9567d3 100644
--- a/lib/libaccess/acltext.y
+++ b/lib/libaccess/acltext.y
@@ -350,8 +350,8 @@ arg_v2: ACL_VARIABLE_TOK
if (!use_generic_rights) {
acl_string_lower($<string>1);
- strcpy(acl_tmp_arg, "http_");
- strcat(acl_tmp_arg, $<string>1);
+ snprintf(acl_tmp_arg, sizeof(acl_tmp_arg), "http_%s", $<string>1);
+ acl_tmp_arg[sizeof(acl_tmp_arg)-1] = '\0';
PERM_FREE($<string>1);
acl_new_arg = PERM_STRDUP(acl_tmp_arg);
acl_add_arg(curr_args_list, acl_new_arg);
| 0 |
6d98ad4a8e3c103986e7986e827fe83bfb16bac4
|
389ds/389-ds-base
|
Issue 6015 - Fix typo remeber (#6014)
In the logs of my ldap instance when running dsconf slapd-localhost security ciphers set command, I saw this typo which I want to fix with this PR.
Issue: #6015
Reviewed by: @progier389
|
commit 6d98ad4a8e3c103986e7986e827fe83bfb16bac4
Author: Max <[email protected]>
Date: Tue Dec 19 14:40:49 2023 +0100
Issue 6015 - Fix typo remeber (#6014)
In the logs of my ldap instance when running dsconf slapd-localhost security ciphers set command, I saw this typo which I want to fix with this PR.
Issue: #6015
Reviewed by: @progier389
diff --git a/src/lib389/lib389/config.py b/src/lib389/lib389/config.py
index e2513f353..23a60d979 100644
--- a/src/lib389/lib389/config.py
+++ b/src/lib389/lib389/config.py
@@ -333,7 +333,7 @@ class Encryption(DSLdapObject):
:type ciphers: list of str
"""
self.set('nsSSL3Ciphers', ','.join(ciphers))
- self._log.info('Remeber to restart the server to apply the new cipher set.')
+ self._log.info('Remember to restart the server to apply the new cipher set.')
self._log.info('Some ciphers may be disabled anyway due to allowWeakCipher attribute.')
def _get_listed_ciphers(self, attr):
| 0 |
0d0cc2374ec0c63864b752eae72a5bcf294aa54e
|
389ds/389-ds-base
|
Resolves: 158342
Summary: db backend path handling could be impoved to deal with "//", "..", etc.
Changes:
util.c:
modified rel2abspath so that if the given path contains "//", calls the
normalize function, and the normalize function eliminates the repeated
separators.
ldbm_config.c, ldbm_instance_config.c:
before setting the nsslapd-directory paths, pass them to rel2abspath to clean
up the paths.
|
commit 0d0cc2374ec0c63864b752eae72a5bcf294aa54e
Author: Noriko Hosoi <[email protected]>
Date: Mon Dec 4 18:36:57 2006 +0000
Resolves: 158342
Summary: db backend path handling could be impoved to deal with "//", "..", etc.
Changes:
util.c:
modified rel2abspath so that if the given path contains "//", calls the
normalize function, and the normalize function eliminates the repeated
separators.
ldbm_config.c, ldbm_instance_config.c:
before setting the nsslapd-directory paths, pass them to rel2abspath to clean
up the paths.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index d9c298b48..32403a682 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -227,7 +227,8 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
if (CONFIG_PHASE_RUNNING == phase) {
slapi_ch_free((void **) &(li->li_new_directory));
- li->li_new_directory = slapi_ch_strdup(val);
+ li->li_new_directory = rel2abspath(val); /* normalize the path;
+ strdup'ed in rel2abspath */
LDAPDebug(LDAP_DEBUG_ANY, "New db directory location will not take affect until the server is restarted\n", 0, 0, 0);
} else {
if (!strcmp(val, "get default")) {
@@ -294,8 +295,9 @@ done:
}
slapi_ch_free((void **) &(li->li_new_directory));
slapi_ch_free((void **) &(li->li_directory));
- li->li_new_directory = slapi_ch_strdup(val);
- li->li_directory = slapi_ch_strdup(val);
+ li->li_new_directory = rel2abspath(val); /* normalize the path;
+ strdup'ed in rel2abspath */
+ li->li_directory = rel2abspath(val); /* ditto */
}
return retval;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 0616bc0fe..7dfc826f6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -189,15 +189,19 @@ ldbm_instance_config_instance_dir_set(void *arg, void *value, char *errorbuf, in
{
char sep = get_sep(dir);
char *p = strrchr(dir, sep);
- if (NULL == p) /* never happens, tho */
+ if (NULL == p) /* should not happens, tho */
{
inst->inst_parent_dir_name = NULL;
- inst->inst_dir_name = slapi_ch_strdup(dir);
+ inst->inst_dir_name = rel2abspath(dir); /* normalize dir;
+ strdup'ed in
+ rel2abspath */
}
else
{
*p = '\0';
- inst->inst_parent_dir_name = slapi_ch_strdup(dir);
+ inst->inst_parent_dir_name = rel2abspath(dir); /* normalize dir;
+ strdup'ed in
+ rel2abspath */
inst->inst_dir_name = slapi_ch_strdup(p+1);
*p = sep;
}
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 0ef040d81..3145e7361 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -61,9 +61,11 @@
#if defined( _WIN32 )
#define _PSEP "\\"
+#define _PSEP2 "\\\\"
#define _CSEP '\\'
#else
#define _PSEP "/"
+#define _PSEP2 "//"
#define _CSEP '/'
#endif
@@ -422,9 +424,9 @@ normalize_path(char *path)
if (NULL == bnamep) {
bnamep = dnamep;
} else {
- *bnamep = '\0';
- bnamep++;
- }
+ *bnamep = '\0';
+ bnamep++;
+ }
if (0 != strcmp(bnamep, ".")) {
*dp++ = slapi_ch_strdup(bnamep); /* remove "/./" in the path */
}
@@ -447,9 +449,10 @@ normalize_path(char *path)
if (rdp > rdirs)
rdp--;
}
- if (*dp)
+ if (*dp && strlen(*dp) > 0)
*rdp++ = slapi_ch_strdup(*dp);
}
+ *rdp = NULL;
clean_path(dirs);
slapi_ch_free_string(&dname);
@@ -518,14 +521,14 @@ rel2abspath_ext( char *relpath, char *cwd )
if ( abspath[ 0 ] != '\0' &&
abspath[ strlen( abspath ) - 1 ] != _CSEP )
{
- PL_strcatn( abspath, sizeof(abspath), "/" );
+ PL_strcatn( abspath, sizeof(abspath), _PSEP );
}
PL_strcatn( abspath, sizeof(abspath), relpath );
}
}
retpath = slapi_ch_strdup(abspath);
/* if there's no '.', no need to call normalize_path */
- if (NULL != strchr(abspath, '.'))
+ if (NULL != strchr(abspath, '.') || NULL != strstr(abspath, _PSEP2))
{
char **norm_path = normalize_path(abspath);
char **np, *rp;
| 0 |
ba3b8442abd4bd558d5467b07880d1c89613df9a
|
389ds/389-ds-base
|
Ticket #48854 - Running db2index with no options breaks replication
Bug Description: It was a bug in import_foreman which was not adjusted
when the backend RUV entry was redesigned. The backend RUV entry has
no parent entry by nature. But import-forman mistakenly skipped to
handle the entry. If the 'db2index' command line is executed on a
consumer, this error message is logged.
error log on a consumer:
reindex userRoot: WARNING: Skipping entry "nsuniqueid=ffffffff-ffffffff-
ffffffff-ffffffff" which has no parent, ending at line 18 of file "id2entry.db"
reindex userRoot: WARNING: bad entry: ID 18
Due to this skip, the RUV entry is not found at the following start up
and a new RUV is generated by the MMR plugin. And the supplier finds the
generation ID mismatch.
error log on a supplier:
NSMMReplicationPlugin - agmt="cn=0_1" (HOST:PORT): The remote replica
has a different database generation ID than the local database. You
may have to reinitialize the remote replica, or the local replica.
Fix Description: Even if there is no parent entry, do not skip the RUV
entry as done for the suffix entry.
https://fedorahosted.org/389/ticket/48854
Reviewed by [email protected] (Thank you, William!)
|
commit ba3b8442abd4bd558d5467b07880d1c89613df9a
Author: Noriko Hosoi <[email protected]>
Date: Thu May 26 17:58:51 2016 -0700
Ticket #48854 - Running db2index with no options breaks replication
Bug Description: It was a bug in import_foreman which was not adjusted
when the backend RUV entry was redesigned. The backend RUV entry has
no parent entry by nature. But import-forman mistakenly skipped to
handle the entry. If the 'db2index' command line is executed on a
consumer, this error message is logged.
error log on a consumer:
reindex userRoot: WARNING: Skipping entry "nsuniqueid=ffffffff-ffffffff-
ffffffff-ffffffff" which has no parent, ending at line 18 of file "id2entry.db"
reindex userRoot: WARNING: bad entry: ID 18
Due to this skip, the RUV entry is not found at the following start up
and a new RUV is generated by the MMR plugin. And the supplier finds the
generation ID mismatch.
error log on a supplier:
NSMMReplicationPlugin - agmt="cn=0_1" (HOST:PORT): The remote replica
has a different database generation ID than the local database. You
may have to reinitialize the remote replica, or the local replica.
Fix Description: Even if there is no parent entry, do not skip the RUV
entry as done for the suffix entry.
https://fedorahosted.org/389/ticket/48854
Reviewed by [email protected] (Thank you, William!)
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index d27905612..175947860 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -2542,7 +2542,9 @@ import_foreman(void *param)
* we reject the entry but carry on since we've not stored
* anything related to this entry.
*/
- if (! slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry))) {
+#define RUVRDN SLAPI_ATTR_UNIQUEID "=" RUV_STORAGE_ENTRY_UNIQUEID
+ if (!slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry)) &&
+ strcasecmp(backentry_get_ndn(fi->entry), RUVRDN) /* NOT nsuniqueid=ffffffff-... */) {
import_log_notice(job, "WARNING: Skipping entry \"%s\" "
"which has no parent, ending at line %d "
"of file \"%s\"",
@@ -2568,8 +2570,7 @@ import_foreman(void *param)
goto cont; /* skip entry */
}
}
- if ((job->flags & FLAG_UPGRADEDNFORMAT) &&
- (LDBM_ERROR_FOUND_DUPDN == ret)) {
+ if ((job->flags & FLAG_UPGRADEDNFORMAT) && (LDBM_ERROR_FOUND_DUPDN == ret)) {
/*
* Duplicated DN is detected.
*
| 0 |
aa57d4bc32944718a10d1cb1c5dbd61be19d983a
|
389ds/389-ds-base
|
Ticket 48831 - Autotune dncache with entry cache.
Bug Description: Previously we only tuned db and entry cache. We
needed to tune the dncache to prevent over-access to id2entry.
Fix Description: Tune the dncache as 10% of the entrycache value
and entrycache now gets 90% of the allocation previously.
https://pagure.io/389-ds-base/issue/48831
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit aa57d4bc32944718a10d1cb1c5dbd61be19d983a
Author: William Brown <[email protected]>
Date: Tue Sep 5 14:15:31 2017 +1000
Ticket 48831 - Autotune dncache with entry cache.
Bug Description: Previously we only tuned db and entry cache. We
needed to tune the dncache to prevent over-access to id2entry.
Fix Description: Tune the dncache as 10% of the entrycache value
and entrycache now gets 90% of the allocation previously.
https://pagure.io/389-ds-base/issue/48831
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/dirsrvtests/tests/suites/config/autotuning_test.py b/dirsrvtests/tests/suites/config/autotuning_test.py
index e81270b55..b099f8171 100644
--- a/dirsrvtests/tests/suites/config/autotuning_test.py
+++ b/dirsrvtests/tests/suites/config/autotuning_test.py
@@ -37,7 +37,7 @@ def test_threads_basic(topo):
topo.standalone.config.set("nsslapd-threadnumber", "-1")
log.info("Assert nsslapd-threadnumber is equal to the documented expected value")
- assert topo.standalone.config.get_attr_val("nsslapd-threadnumber") > 0
+ assert topo.standalone.config.get_attr_val_int("nsslapd-threadnumber") > 0
@pytest.mark.parametrize("invalid_value", ('-2', '0', 'invalid'))
@@ -71,18 +71,18 @@ def test_threads_back_from_manual_value(topo):
log.info("Set nsslapd-threadnumber: -1 to enable autotuning and save the new value")
topo.standalone.config.set("nsslapd-threadnumber", "-1")
- autotuned_value = topo.standalone.config.get_attr_val("nsslapd-threadnumber")
+ autotuned_value = topo.standalone.config.get_attr_val_utf8("nsslapd-threadnumber")
log.info("Set nsslapd-threadnumber to the autotuned value decreased by 2")
new_value = str(int(autotuned_value) - 2)
topo.standalone.config.set("nsslapd-threadnumber", new_value)
- assert topo.standalone.config.get_attr_val("nsslapd-threadnumber") == new_value
+ assert topo.standalone.config.get_attr_val_utf8("nsslapd-threadnumber") == new_value
log.info("Set nsslapd-threadnumber: -1 to enable autotuning")
topo.standalone.config.set("nsslapd-threadnumber", "-1")
log.info("Assert nsslapd-threadnumber is back to the autotuned value")
- assert topo.standalone.config.get_attr_val("nsslapd-threadnumber") == autotuned_value
+ assert topo.standalone.config.get_attr_val_utf8("nsslapd-threadnumber") == autotuned_value
@pytest.mark.parametrize("autosize,autosize_split", (('', ''), ('', '0'), ('10', '40'), ('', '40'),
@@ -114,12 +114,14 @@ def test_cache_autosize_non_zero(topo, autosize, autosize_split):
dbcachesize_val = config_ldbm.get_attr_val('nsslapd-dbcachesize')
cachenensize_val = userroot_ldbm.get_attr_val('nsslapd-cachememsize')
+ dncachenensize_val = userroot_ldbm.get_attr_val('nsslapd-dncachememsize')
autosize_val = config_ldbm.get_attr_val('nsslapd-cache-autosize')
autosize_split_val = config_ldbm.get_attr_val('nsslapd-cache-autosize-split')
log.info("Check nsslapd-dbcachesize and nsslapd-cachememsize before the test")
log.info("nsslapd-dbcachesize == {}".format(dbcachesize_val))
log.info("nsslapd-cachememsize == {}".format(cachenensize_val))
+ log.info("nsslapd-dncachememsize == {}".format(dncachenensize_val))
log.info("nsslapd-cache-autosize == {}".format(autosize_val))
log.info("nsslapd-cache-autosize-split == {}".format(autosize_split_val))
@@ -153,18 +155,19 @@ def test_cache_autosize_non_zero(topo, autosize, autosize_split):
dbcachesize_val = config_ldbm.get_attr_val('nsslapd-dbcachesize')
cachenensize_val = userroot_ldbm.get_attr_val('nsslapd-cachememsize')
+ dncachenensize_val = userroot_ldbm.get_attr_val('nsslapd-dncachememsize')
autosize_val = config_ldbm.get_attr_val('nsslapd-cache-autosize')
autosize_split_val = config_ldbm.get_attr_val('nsslapd-cache-autosize-split')
log.info("Check nsslapd-dbcachesize and nsslapd-cachememsize in the appropriate range.")
log.info("nsslapd-dbcachesize == {}".format(dbcachesize_val))
log.info("nsslapd-cachememsize == {}".format(cachenensize_val))
+ log.info("nsslapd-dncachememsize == {}".format(dncachenensize_val))
log.info("nsslapd-cache-autosize == {}".format(autosize_val))
log.info("nsslapd-cache-autosize-split == {}".format(autosize_split_val))
assert int(dbcachesize_val) >= 512000
- assert int(dbcachesize_val) <= sys.maxint
assert int(cachenensize_val) >= 512000
- assert int(cachenensize_val) <= sys.maxint
+ assert int(dncachenensize_val) >= 512000
@pytest.mark.parametrize("autosize_split", ('0', '', '40'))
@@ -196,6 +199,7 @@ def test_cache_autosize_basic_sane(topo, autosize_split):
for cachesize in ('0', '33333333'):
dbcachesize_val = config_ldbm.get_attr_val('nsslapd-dbcachesize')
cachenensize_val = userroot_ldbm.get_attr_val('nsslapd-cachememsize')
+ dncachenensize_val = userroot_ldbm.get_attr_val('nsslapd-dncachememsize')
autosize_val = config_ldbm.get_attr_val('nsslapd-cache-autosize')
autosize_split_val = config_ldbm.get_attr_val('nsslapd-cache-autosize-split')
@@ -223,18 +227,19 @@ def test_cache_autosize_basic_sane(topo, autosize_split):
dbcachesize_val = config_ldbm.get_attr_val('nsslapd-dbcachesize')
cachenensize_val = userroot_ldbm.get_attr_val('nsslapd-cachememsize')
+ dncachenensize_val = userroot_ldbm.get_attr_val('nsslapd-dncachememsize')
autosize_val = config_ldbm.get_attr_val('nsslapd-cache-autosize')
autosize_split_val = config_ldbm.get_attr_val('nsslapd-cache-autosize-split')
log.info("Check nsslapd-dbcachesize and nsslapd-cachememsize in the appropriate range.")
log.info("nsslapd-dbcachesize == {}".format(dbcachesize_val))
log.info("nsslapd-cachememsize == {}".format(cachenensize_val))
+ log.info("nsslapd-dncachememsize == {}".format(dncachenensize_val))
log.info("nsslapd-cache-autosize == {}".format(autosize_val))
log.info("nsslapd-cache-autosize-split == {}".format(autosize_split_val))
assert int(dbcachesize_val) >= 512000
- assert int(dbcachesize_val) <= sys.maxint
assert int(cachenensize_val) >= 512000
- assert int(cachenensize_val) <= sys.maxint
+ assert int(dncachenensize_val) >= 512000
@pytest.mark.parametrize("invalid_value", ('-2', '102', 'invalid'))
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index e4d9d5396..d2b25a7ea 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -567,10 +567,11 @@ struct ldbminfo
* use for the libdb cache.
* the rest is split up among
* the instance entry caches */
- unsigned long li_cache_autosize_ec; /* new instances created while
+ uint64_t li_cache_autosize_ec; /* new instances created while
* the server is up, should
* use this as the entry cache
* size (0 = autosize off) */
+ uint64_t li_dncache_autosize_ec; /* Same as above, but dncache. */
size_t li_import_cachesize; /* size of the mpool for
* imports */
PRLock *li_dbcache_mutex;
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index fc70bf692..45ed09117 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -34,9 +34,9 @@ ldbm_back_start_autotune(struct ldbminfo *li)
/* size_t is a platform unsigned int, IE uint64_t */
uint64_t total_cache_size = 0;
uint64_t entry_size = 0;
+ uint64_t dn_size = 0;
uint64_t zone_size = 0;
uint64_t import_size = 0;
- uint64_t cache_size = 0;
uint64_t db_size = 0;
/* For clamping the autotune value to a 64Mb boundary */
uint64_t clamp_div = 0;
@@ -151,6 +151,9 @@ ldbm_back_start_autotune(struct ldbminfo *li)
if (backend_count > 0) {
/* Number of entry cache pages per backend. */
entry_size = (zone_size - db_size) / backend_count;
+ /* Now split this into dn and entry */
+ dn_size = entry_size * 0.1;
+ entry_size = entry_size * 0.9;
/* Now, clamp this value to a 64mb boundary. */
/* Now divide the entry pages by this, and also mod. If mod != 0, we need
* to add 1 to the diveded number. This should give us:
@@ -167,6 +170,11 @@ ldbm_back_start_autotune(struct ldbminfo *li)
clamp_div = (entry_size / (64 * MEGABYTE)) + 1;
entry_size = clamp_div * (64 * MEGABYTE);
}
+ if (dn_size % (64 * MEGABYTE) != 0) {
+ /* If we want to clamp down, remove the "+1". This would change the above from 510mb -> 448mb. */
+ clamp_div = (dn_size / (64 * MEGABYTE)) + 1;
+ dn_size = clamp_div * (64 * MEGABYTE);
+ }
}
slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk physical memory\n", mi->system_total_bytes / 1024);
@@ -199,13 +207,15 @@ ldbm_back_start_autotune(struct ldbminfo *li)
/* apply the appropriate cache size if 0 */
if (backend_count > 0) {
li->li_cache_autosize_ec = entry_size;
+ li->li_dncache_autosize_ec = dn_size;
}
for (inst_obj = objset_first_obj(li->li_instance_set); inst_obj;
inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
inst = (ldbm_instance *)object_get_data(inst_obj);
- cache_size = (PRUint64)cache_get_max_size(&(inst->inst_cache));
+ uint64_t cache_size = (uint64_t)cache_get_max_size(&(inst->inst_cache));
+ uint64_t dncache_size = (uint64_t)cache_get_max_size(&(inst->inst_dncache));
/* This is the point where we decide to apply or not.
* We have to check for the mincachesize as setting 0 resets
@@ -217,6 +227,11 @@ ldbm_back_start_autotune(struct ldbminfo *li)
cache_set_max_entries(&(inst->inst_cache), -1);
cache_set_max_size(&(inst->inst_cache), li->li_cache_autosize_ec, CACHE_TYPE_ENTRY);
}
+ if (dncache_size == 0 || dncache_size == MINCACHESIZE || li->li_cache_autosize > 0) {
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s dn cache (%lu total): %luk\n", inst->inst_name, backend_count, dn_size / 1024);
+ cache_set_max_entries(&(inst->inst_dncache), -1);
+ cache_set_max_size(&(inst->inst_dncache), li->li_dncache_autosize_ec, CACHE_TYPE_DN);
+ }
/* Refresh this value now. */
cache_size = (PRUint64)cache_get_max_size(&(inst->inst_cache));
db_size = dblayer_get_id2entry_size(inst);
@@ -228,11 +243,8 @@ ldbm_back_start_autotune(struct ldbminfo *li)
"nsslapd-cachememsize.\n",
inst->inst_name, cache_size, db_size);
}
- /* We need to get each instances dncache size to add to the total */
- /* Else we can't properly check the cache allocations below */
- /* Trac 48831 exists to allow this to be auto-sized too ... */
- total_cache_size += (PRUint64)cache_get_max_size(&(inst->inst_dncache));
total_cache_size += cache_size;
+ total_cache_size += dncache_size;
}
/* autosizing importCache */
if (li->li_import_cache_autosize > 0) {
| 0 |
58beff0b8a06fa37ba459d978ed16a93c6a2f55f
|
389ds/389-ds-base
|
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server - navigation
Fix Description: Some minor cleanup:
1) Fixed navigation. Now you can go back through several dialogs.
2) Need to create a new Inf even if no file given
Platforms tested: RHEL4
Flag Day: No.
Doc impact: No.
|
commit 58beff0b8a06fa37ba459d978ed16a93c6a2f55f
Author: Rich Megginson <[email protected]>
Date: Wed Jun 20 16:27:50 2007 +0000
Resolves: bug 237356
Description: Move DS Admin Code into Admin Server - navigation
Fix Description: Some minor cleanup:
1) Fixed navigation. Now you can go back through several dialogs.
2) Need to create a new Inf even if no file given
Platforms tested: RHEL4
Flag Day: No.
Doc impact: No.
diff --git a/ldap/admin/src/scripts/Dialog.pm b/ldap/admin/src/scripts/Dialog.pm
index 71fc48a73..e01e62620 100644
--- a/ldap/admin/src/scripts/Dialog.pm
+++ b/ldap/admin/src/scripts/Dialog.pm
@@ -136,6 +136,7 @@ sub disable {
# you can set the 0 to a 1 if the user has chosen to use security
sub run {
my $self = shift;
+ my $direction = shift;
my $resp = $DialogManager::SAME;
# display the dialog text
@@ -181,6 +182,12 @@ sub run {
}
} elsif ($resp == $DialogManager::ERR) {
last;
+ } elsif (!$self->isDisplayed() && ($direction < 0) &&
+ ($resp == $DialogManager::NEXT)) {
+ # we did not display this dialog, and the current navigation
+ # direction is BACK, so we should return BACK, to allow
+ # the user to go back through several dialogs
+ $resp = $DialogManager::BACK;
}
}
diff --git a/ldap/admin/src/scripts/DialogManager.pm b/ldap/admin/src/scripts/DialogManager.pm
index bbf85c9fa..27040ed0a 100644
--- a/ldap/admin/src/scripts/DialogManager.pm
+++ b/ldap/admin/src/scripts/DialogManager.pm
@@ -206,7 +206,7 @@ sub run {
my $dialog = $self->{dialogs}->[$index];
if ($dialog->isEnabled()) {
my $resp = $NEXT;
- $resp = $dialog->run();
+ $resp = $dialog->run($incr);
if ($resp == $BACK) {
$incr = -1;
} elsif ($resp == $NEXT) {
diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in
index 48ca474e5..1aae1a790 100644
--- a/ldap/admin/src/scripts/Setup.pm.in
+++ b/ldap/admin/src/scripts/Setup.pm.in
@@ -135,6 +135,8 @@ sub new {
# if user supplied inf file, use that to initialize
if (defined($self->{inffile})) {
$self->{inf} = new Inf($self->{inffile});
+ } else {
+ $self->{inf} = new Inf;
}
my $fh;
# create a temp inf file for writing for other processes
| 0 |
2dbbb9df4691590f788049a822c47eb501182c85
|
389ds/389-ds-base
|
Ticket #47757 - Unable to dereference unqiemember attribute because it is dn [#UID] not dn syntax
Description: In addtion to DN syntax, adding Name and Optional UID
syntax to the deref attr's OID check.
https://fedorahosted.org/389/ticket/47757
Reviewed by [email protected] (Thank you, Mark!!)
|
commit 2dbbb9df4691590f788049a822c47eb501182c85
Author: Noriko Hosoi <[email protected]>
Date: Mon Aug 24 16:13:12 2015 -0700
Ticket #47757 - Unable to dereference unqiemember attribute because it is dn [#UID] not dn syntax
Description: In addtion to DN syntax, adding Name and Optional UID
syntax to the deref attr's OID check.
https://fedorahosted.org/389/ticket/47757
Reviewed by [email protected] (Thank you, Mark!!)
diff --git a/ldap/servers/plugins/deref/deref.c b/ldap/servers/plugins/deref/deref.c
index 35c2564c2..f476a4d6c 100644
--- a/ldap/servers/plugins/deref/deref.c
+++ b/ldap/servers/plugins/deref/deref.c
@@ -20,6 +20,9 @@
#ifndef DN_SYNTAX_OID
#define DN_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.12"
#endif
+#ifndef NAME_AND_OPTIONAL_UID_SYNTAX_OID
+#define NAME_AND_OPTIONAL_UID_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.34"
+#endif
/*
* Plug-in globals
@@ -290,7 +293,7 @@ deref_check_for_dn_syntax(const char *derefattr)
slapi_attr_init(attr, derefattr);
slapi_attr_get_syntax_oid_copy(attr, &oid);
- ret = oid && !strcmp(oid, DN_SYNTAX_OID);
+ ret = oid && (!strcmp(oid, DN_SYNTAX_OID) || !strcmp(oid, NAME_AND_OPTIONAL_UID_SYNTAX_OID));
slapi_ch_free_string(&oid);
slapi_attr_free(&attr);
}
| 0 |
1fe2c761103c36090ab67df0271dfdb3012037fb
|
389ds/389-ds-base
|
Ticket 49038 - remove legacy replication - change cleanup script precedence
Description: Bump the cleanup scripts precendance so it happens after the
main plugin upgrade scripts are called.
https://pagure.io/389-ds-base/issue/49038
Reviewed by: firstyear(Thanks!)
|
commit 1fe2c761103c36090ab67df0271dfdb3012037fb
Author: Mark Reynolds <[email protected]>
Date: Wed Oct 4 12:55:30 2017 -0400
Ticket 49038 - remove legacy replication - change cleanup script precedence
Description: Bump the cleanup scripts precendance so it happens after the
main plugin upgrade scripts are called.
https://pagure.io/389-ds-base/issue/49038
Reviewed by: firstyear(Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 003ac7c33..c491fd963 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -940,7 +940,7 @@ update_DATA = ldap/admin/src/scripts/exampleupdate.pl \
ldap/admin/src/scripts/50telexnumbersyntaxplugin.ldif \
ldap/admin/src/scripts/50guidesyntaxplugin.ldif \
ldap/admin/src/scripts/50targetuniqueid.ldif \
- ldap/admin/src/scripts/50removeLegacyReplication.ldif \
+ ldap/admin/src/scripts/60removeLegacyReplication.ldif \
ldap/admin/src/scripts/50linkedattrsplugin.ldif \
ldap/admin/src/scripts/50usnplugin.ldif \
ldap/admin/src/scripts/50smd5pwdstorageplugin.ldif \
diff --git a/ldap/admin/src/scripts/50removeLegacyReplication.ldif b/ldap/admin/src/scripts/60removeLegacyReplication.ldif
similarity index 100%
rename from ldap/admin/src/scripts/50removeLegacyReplication.ldif
rename to ldap/admin/src/scripts/60removeLegacyReplication.ldif
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 1e5c2cfd3..30a1d7d9a 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -395,9 +395,9 @@ echo remove pid files . . . >> $output 2>&1 || :
echo upgrading instances . . . >> $output 2>&1 || :
DEBUGPOSTSETUPOPT=`/usr/bin/echo $DEBUGPOSTSETUP | /usr/bin/sed -e "s/[^d]//g"`
if [ -n "$DEBUGPOSTSETUPOPT" ] ; then
- %{_sbindir}/setup-ds.pl -l $output2 -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
+ %{_sbindir}/setup-ds.pl -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
else
- %{_sbindir}/setup-ds.pl -l $output2 -u -s General.UpdateMode=offline >> $output 2>&1 || :
+ %{_sbindir}/setup-ds.pl -u -s General.UpdateMode=offline >> $output 2>&1 || :
fi
# restart instances that require it
| 0 |
a33899fc73cfc6f522823af1f5961679010fd477
|
389ds/389-ds-base
|
bump version to 1.3.5.9
|
commit a33899fc73cfc6f522823af1f5961679010fd477
Author: Noriko Hosoi <[email protected]>
Date: Wed Jun 29 16:33:52 2016 -0700
bump version to 1.3.5.9
diff --git a/VERSION.sh b/VERSION.sh
index f9222b2ea..3c94c1ff6 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=3
-VERSION_MAINT=5.8
+VERSION_MAINT=5.9
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=`date -u +%Y%m%d%H%M%S`
| 0 |
a199440a2dd93c20c8e0618c9be424797537426e
|
389ds/389-ds-base
|
Issue 5322 - optime & wtime on rejected connections is not properly set
Description: We were not setting the operation start time before
aborting a connection because of minssf or anonymous access being
denied. This can lead to an overflow and unexpected values for
the wtime & optime keywords in the access log.
relates: https://github.com/389ds/389-ds-base/issues/5322
Reviewed by: firstyear & tbordaz (Thanks!!)
|
commit a199440a2dd93c20c8e0618c9be424797537426e
Author: Mark Reynolds <[email protected]>
Date: Fri Jul 22 15:14:34 2022 -0400
Issue 5322 - optime & wtime on rejected connections is not properly set
Description: We were not setting the operation start time before
aborting a connection because of minssf or anonymous access being
denied. This can lead to an overflow and unexpected values for
the wtime & optime keywords in the access log.
relates: https://github.com/389ds/389-ds-base/issues/5322
Reviewed by: firstyear & tbordaz (Thanks!!)
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index afc830c63..4d675613b 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -564,6 +564,9 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
ber_sockbuf_ctrl(conn->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &maxbersize);
}
+ /* Set the start time */
+ slapi_operation_set_time_started(op);
+
/* If the minimum SSF requirements are not met, only allow
* bind and extended operations through. The bind and extop
* code will ensure that only SASL binds and startTLS are
| 0 |
d7ee83435b306b5f4a96c42c0e5f45ae783f5595
|
389ds/389-ds-base
|
Fix ruv update on skipped change
|
commit d7ee83435b306b5f4a96c42c0e5f45ae783f5595
Author: David Boreham <[email protected]>
Date: Wed Apr 27 23:30:32 2005 +0000
Fix ruv update on skipped change
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c
index fcf9eb441..df09fe97f 100644
--- a/ldap/servers/plugins/replication/windows_inc_protocol.c
+++ b/ldap/servers/plugins/replication/windows_inc_protocol.c
@@ -1244,6 +1244,7 @@ send_updates(Private_Repl_Protocol *prp, RUV *remote_update_vector, PRUint32 *nu
memset ( (void*)&op, 0, sizeof (op) );
entry.op = &op;
do {
+ int mark_record_done = 0;
w_cl5_operation_parameters_done ( entry.op );
memset ( (void*)entry.op, 0, sizeof (op) );
rc = cl5GetNextOperationToReplay(changelog_iterator, &entry);
@@ -1278,6 +1279,7 @@ send_updates(Private_Repl_Protocol *prp, RUV *remote_update_vector, PRUint32 *nu
else
{
agmt_inc_last_update_changecount (prp->agmt, csn_get_replicaid(entry.op->csn), 1 /*skipped*/);
+ mark_record_done = 1;
}
slapi_log_error(finished ? SLAPI_LOG_FATAL : slapi_log_urp, windows_repl_plugin_name,
"%s: Consumer failed to replay change (uniqueid %s, CSN %s): %s. %s.\n",
@@ -1331,6 +1333,10 @@ send_updates(Private_Repl_Protocol *prp, RUV *remote_update_vector, PRUint32 *nu
/* Positive response received */
(*num_changes_sent)++;
agmt_inc_last_update_changecount (prp->agmt, csn_get_replicaid(entry.op->csn), 0 /*replayed*/);
+ mark_record_done = 1;
+ }
+ if (mark_record_done)
+ {
/* bring the consumers (AD) RUV up to date */
ruv_force_csn_update(current_ruv, entry.op->csn);
}
| 0 |
9ad83ba1c311d15cb5b28d19702b2b307322ff76
|
389ds/389-ds-base
|
bump version to 1.2.9.1
|
commit 9ad83ba1c311d15cb5b28d19702b2b307322ff76
Author: Rich Megginson <[email protected]>
Date: Wed Jul 27 20:47:56 2011 -0600
bump version to 1.2.9.1
diff --git a/VERSION.sh b/VERSION.sh
index 922111970..314101e13 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=2
-VERSION_MAINT=9.0
+VERSION_MAINT=9.1
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
| 0 |
04208edbd18a818ef6105cbdedaf48b40f54e717
|
389ds/389-ds-base
|
Issue 50497 - Port cl-dump.pl tool to Python using lib389
Bug Description: We're going to deprecate all Perl scripts in 389-ds
so cl-dump.pl should be ported as soon as possible.
Fix Description: Put the tool to dsconf replication dump-changelog.
Preserve all the functionality and output format.
Depricate ChangelogLegacy object.
Move Changelog5 object to replica.py so we can avoid import loops.
Also it makes more sense to have it there because it is part of Replication.
Add ChangelogLDIF object.
Add process_and_dump_changelog() method to Replicas object.
https://pagure.io/389-ds-base/issue/50497
Reviewed by: mreynolds, mhonek, wibrown (Thanks!)
|
commit 04208edbd18a818ef6105cbdedaf48b40f54e717
Author: Simon Pichugin <[email protected]>
Date: Tue Jul 16 21:32:27 2019 +0200
Issue 50497 - Port cl-dump.pl tool to Python using lib389
Bug Description: We're going to deprecate all Perl scripts in 389-ds
so cl-dump.pl should be ported as soon as possible.
Fix Description: Put the tool to dsconf replication dump-changelog.
Preserve all the functionality and output format.
Depricate ChangelogLegacy object.
Move Changelog5 object to replica.py so we can avoid import loops.
Also it makes more sense to have it there because it is part of Replication.
Add ChangelogLDIF object.
Add process_and_dump_changelog() method to Replicas object.
https://pagure.io/389-ds-base/issue/50497
Reviewed by: mreynolds, mhonek, wibrown (Thanks!)
diff --git a/dirsrvtests/tests/suites/replication/changelog_trimming_test.py b/dirsrvtests/tests/suites/replication/changelog_trimming_test.py
index 7f9da597f..ed7b2798c 100644
--- a/dirsrvtests/tests/suites/replication/changelog_trimming_test.py
+++ b/dirsrvtests/tests/suites/replication/changelog_trimming_test.py
@@ -6,7 +6,7 @@ import time
from lib389._constants import *
from lib389.properties import *
from lib389.topologies import topology_m1 as topo
-from lib389.changelog import Changelog5
+from lib389.replica import Changelog5
from lib389.idm.domain import Domain
pytestmark = pytest.mark.tier1
@@ -132,4 +132,3 @@ if __name__ == '__main__':
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s %s" % CURRENT_FILE)
-
diff --git a/dirsrvtests/tests/suites/replication/regression_test.py b/dirsrvtests/tests/suites/replication/regression_test.py
index 2ee0a99af..62c4c3423 100644
--- a/dirsrvtests/tests/suites/replication/regression_test.py
+++ b/dirsrvtests/tests/suites/replication/regression_test.py
@@ -18,9 +18,8 @@ from lib389.idm.user import UserAccount
from lib389.idm.group import Groups, Group
from lib389.idm.domain import Domain
from lib389.idm.directorymanager import DirectoryManager
-from lib389.replica import Replicas, ReplicationManager
+from lib389.replica import Replicas, ReplicationManager, Changelog5
from lib389.agreement import Agreements
-from lib389.changelog import Changelog5
from lib389 import pid_from_file
diff --git a/src/lib389/lib389/changelog.py b/src/lib389/lib389/changelog.py
deleted file mode 100644
index cb218d496..000000000
--- a/src/lib389/lib389/changelog.py
+++ /dev/null
@@ -1,204 +0,0 @@
-# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# License: GPL (version 3 or any later version).
-# See LICENSE for details.
-# --- END COPYRIGHT BLOCK ---
-
-import os
-import ldap
-
-from lib389._constants import *
-from lib389.properties import *
-from lib389 import DirSrv, Entry, InvalidArgumentError
-
-from lib389._mapped_object import DSLdapObject
-from lib389.utils import ds_is_older
-
-
-class Changelog5(DSLdapObject):
- """Represents the Directory Server changelog. This is used for
- replication. Only one changelog is needed for every server.
-
- :param instance: An instance
- :type instance: lib389.DirSrv
- """
-
- def __init__(self, instance, dn='cn=changelog5,cn=config'):
- super(Changelog5, self).__init__(instance, dn)
- self._rdn_attribute = 'cn'
- self._must_attributes = ['cn', 'nsslapd-changelogdir']
- self._create_objectclasses = [
- 'top',
- 'nsChangelogConfig',
- ]
- if ds_is_older('1.4.0'):
- self._create_objectclasses = [
- 'top',
- 'extensibleobject',
- ]
- self._protected = False
-
- def set_max_entries(self, value):
- """Configure the max entries the changelog can hold.
-
- :param value: the number of entries.
- :type value: str
- """
- self.replace('nsslapd-changelogmaxentries', value)
-
- def set_trim_interval(self, value):
- """The time between changelog trims in seconds.
-
- :param value: The time in seconds
- :type value: str
- """
- self.replace('nsslapd-changelogtrim-interval', value)
-
- def set_max_age(self, value):
- """The maximum age of entries in the changelog.
-
- :param value: The age with a time modifier of s, m, h, d, w.
- :type value: str
- """
- self.replace('nsslapd-changelogmaxage', value)
-
-
-class ChangelogLegacy(object):
- """An object that helps to work with changelog entry
-
- :param conn: An instance
- :type conn: lib389.DirSrv
- """
-
- proxied_methods = 'search_s getEntry'.split()
-
- def __init__(self, conn):
- self.conn = conn
- self.log = conn.log
-
- def __getattr__(self, name):
- if name in Changelog.proxied_methods:
- return DirSrv.__getattr__(self.conn, name)
-
- def list(self, suffix=None, changelogdn=DN_CHANGELOG):
- """Get a changelog entry using changelogdn parameter
-
- :param suffix: Not used
- :type suffix: str
- :param changelogdn: DN of the changelog entry, DN_CHANGELOG by default
- :type changelogdn: str
-
- :returns: Search result of the replica agreements.
- Enpty list if nothing was found
- """
-
- base = changelogdn
- filtr = "(objectclass=extensibleobject)"
-
- # now do the effective search
- try:
- ents = self.conn.search_s(base, ldap.SCOPE_BASE, filtr)
- except ldap.NO_SUCH_OBJECT:
- # There are no objects to select from, se we return an empty array
- # as we do in DSLdapObjects
- ents = []
- return ents
-
- def create(self, dbname=DEFAULT_CHANGELOG_DB):
- """Add and return the replication changelog entry.
-
- :param dbname: Database name, it will be used for creating
- a changelog dir path
- :type dbname: str
- """
-
- dn = DN_CHANGELOG
- attribute, changelog_name = dn.split(",")[0].split("=", 1)
- dirpath = os.path.join(os.path.dirname(self.conn.dbdir), dbname)
- entry = Entry(dn)
- entry.update({
- 'objectclass': ("top", "extensibleobject"),
- CHANGELOG_PROPNAME_TO_ATTRNAME[CHANGELOG_NAME]: changelog_name,
- CHANGELOG_PROPNAME_TO_ATTRNAME[CHANGELOG_DIR]: dirpath
- })
- self.log.debug("adding changelog entry: %r", entry)
- self.conn.changelogdir = dirpath
- try:
- self.conn.add_s(entry)
- except ldap.ALREADY_EXISTS:
- self.log.warning("entry %s already exists", dn)
- return dn
-
- def delete(self):
- """Delete the changelog entry
-
- :raises: LDAPError - failed to delete changelog entry
- """
-
- try:
- self.conn.delete_s(DN_CHANGELOG)
- except ldap.LDAPError as e:
- self.log.error('Failed to delete the changelog: %s', e)
- raise
-
- def setProperties(self, changelogdn=None, properties=None):
- """Set the properties of the changelog entry.
-
- :param changelogdn: DN of the changelog
- :type changelogdn: str
- :param properties: Dictionary of properties
- :type properties: dict
-
- :returns: None
- :raises: - ValueError - if invalid properties
- - ValueError - if changelog entry is not found
- - InvalidArgumentError - changelog DN is missing
-
- :supported properties are:
- CHANGELOG_NAME, CHANGELOG_DIR, CHANGELOG_MAXAGE,
- CHANGELOG_MAXENTRIES, CHANGELOG_TRIM_INTERVAL,
- CHANGELOG_COMPACT_INTV, CHANGELOG_CONCURRENT_WRITES,
- CHANGELOG_ENCRYPT_ALG, CHANGELOG_SYM_KEY
- """
-
- if not changelogdn:
- raise InvalidArgumentError("changelog DN is missing")
-
- ents = self.conn.changelog.list(changelogdn=changelogdn)
- if len(ents) != 1:
- raise ValueError("Changelog entry not found: %s" % changelogdn)
-
- # check that the given properties are valid
- for prop in properties:
- # skip the prefix to add/del value
- if not inProperties(prop, CHANGELOG_PROPNAME_TO_ATTRNAME):
- raise ValueError("unknown property: %s" % prop)
-
- # build the MODS
- mods = []
- for prop in properties:
- # take the operation type from the property name
- val = rawProperty(prop)
- if str(prop).startswith('+'):
- op = ldap.MOD_ADD
- elif str(prop).startswith('-'):
- op = ldap.MOD_DELETE
- else:
- op = ldap.MOD_REPLACE
-
- mods.append((op, CHANGELOG_PROPNAME_TO_ATTRNAME[val],
- properties[prop]))
-
- # that is fine now to apply the MOD
- self.conn.modify_s(ents[0].dn, mods)
-
- def getProperties(self, changelogdn=None, properties=None):
- """Get a dictionary of the requested properties.
- If properties parameter is missing, it returns all the properties.
-
- NotImplemented
- """
-
- raise NotImplemented
diff --git a/src/lib389/lib389/cli_conf/replication.py b/src/lib389/lib389/cli_conf/replication.py
index b25eba679..3e147e973 100644
--- a/src/lib389/lib389/cli_conf/replication.py
+++ b/src/lib389/lib389/cli_conf/replication.py
@@ -6,13 +6,16 @@
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
+import logging
+import time
+import base64
+import os
import json
import ldap
from getpass import getpass
from lib389._constants import *
-from lib389.changelog import Changelog5
-from lib389.utils import is_a_dn
-from lib389.replica import Replicas, BootstrapReplicationManager
+from lib389.utils import is_a_dn, ensure_str
+from lib389.replica import Replicas, BootstrapReplicationManager, RUV, Changelog5, ChangelogLDIF
from lib389.tasks import CleanAllRUVTask, AbortCleanAllRUVTask
from lib389._mapped_object import DSLdapObjects
@@ -885,6 +888,25 @@ def list_abort_cleanallruv(inst, basedn, log, args):
log.info("No CleanAllRUV abort tasks found")
+def dump_cl(inst, basedn, log, args):
+ if args.output_file:
+ fh = logging.FileHandler(args.output_file, mode='w')
+ log.addHandler(fh)
+ replicas = Replicas(inst)
+ if not args.changelog_ldif:
+ replicas.process_and_dump_changelog(replica_roots=args.replica_roots, csn_only=args.csn_only)
+ else:
+ try:
+ assert os.path.exists(args.changelog_ldif)
+ except AssertionError:
+ raise FileNotFoundError(f"File {args.changelog_ldif} was not found")
+ cl_ldif = ChangelogLDIF(args.changelog_ldif, log)
+ if args.csn_only:
+ cl_ldif.grep_csn()
+ else:
+ cl_ldif.decode()
+
+
def create_parser(subparsers):
############################################
@@ -971,6 +993,18 @@ def create_parser(subparsers):
repl_get_cl = repl_subcommands.add_parser('get-changelog', help='Display replication changelog attributes.')
repl_get_cl.set_defaults(func=get_cl)
+ repl_set_cl = repl_subcommands.add_parser('dump-changelog', help='Decode Directory Server replication change log and dump it to an LDIF')
+ repl_set_cl.set_defaults(func=dump_cl)
+ repl_set_cl.add_argument('-c', '--csn-only', action='store_true',
+ help="Dump and interpret CSN only. This option can be used with or without -i option.")
+ repl_set_cl.add_argument('-i', '--changelog-ldif',
+ help="If you already have a ldif-like changelog, but the changes in that file are encoded,"
+ " you may use this option to decode that ldif-like changelog. It should be base64 encoded.")
+ repl_set_cl.add_argument('-o', '--output-file', help="Path name for the final result. Default to STDOUT if omitted.")
+ repl_set_cl.add_argument('-r', '--replica-roots', nargs="+",
+ help="Specify replica roots whose changelog you want to dump. The replica "
+ "roots may be seperated by comma. All the replica roots would be dumped if the option is omitted.")
+
repl_set_parser = repl_subcommands.add_parser('set', help='Set an attribute in the replication configuration')
repl_set_parser.set_defaults(func=set_repl_config)
repl_set_parser.add_argument('--suffix', required=True, help='The DN of the replication suffix')
@@ -1264,4 +1298,3 @@ def create_parser(subparsers):
task_abort_cleanallruv_list = task_subcommands.add_parser('list-abortruv-tasks', help='List all the running CleanAllRUV abort Tasks')
task_abort_cleanallruv_list.set_defaults(func=list_abort_cleanallruv)
task_abort_cleanallruv_list.add_argument('--suffix', help="List only tasks from for suffix")
-
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index ab207756a..a34865016 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -6,9 +6,12 @@
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
+import os
+import base64
import ldap
import decimal
import time
+import datetime
import logging
import uuid
import json
@@ -22,7 +25,6 @@ from lib389._mapped_object import DSLdapObjects, DSLdapObject
from lib389.passwd import password_generate
from lib389.mappingTree import MappingTrees
from lib389.agreement import Agreements
-from lib389.changelog import Changelog5
from lib389.tombstone import Tombstones
from lib389.idm.domain import Domain
@@ -815,15 +817,19 @@ class RUV(object):
:type logger: logging object
"""
- def __init__(self, ruvs, logger=None):
+ def __init__(self, ruvs=[], logger=None):
if logger is not None:
self._log = logger
else:
self._log = logging.getLogger(__name__)
self._rids = []
- self._rid_csn = {}
self._rid_url = {}
+ self._rid_rawruv = {}
+ self._rid_csn = {}
+ self._rid_maxcsn = {}
+ self._rid_modts = {}
self._data_generation = None
+ self._data_generation_csn = None
# Process the array of data
for r in ruvs:
pr = r.replace('{', '').replace('}', '').split(' ')
@@ -836,10 +842,66 @@ class RUV(object):
rid = pr[1]
self._rids.append(rid)
self._rid_url[rid] = pr[2]
+ self._rid_rawruv[rid] = r
try:
- self._rid_csn[rid] = pr[4]
+ self._rid_csn[rid] = pr[3]
except IndexError:
self._rid_csn[rid] = '00000000000000000000'
+ try:
+ self._rid_maxcsn[rid] = pr[4]
+ except IndexError:
+ self._rid_maxcsn[rid] = '00000000000000000000'
+ try:
+ self._rid_modts[rid] = pr[5]
+ except IndexError:
+ self._rid_modts[rid] = '00000000'
+
+ @staticmethod
+ def parse_csn(csn):
+ """Parse CSN into human readable format '1970-01-31 00:00:00'
+
+ :param csn: the CSN to format
+ :type csn: str
+ :returns: str
+ """
+ if len(csn) != 20 or len(csn) != 8 and not isinstance(csn, str):
+ ValueError("Wrong CSN value was supplied")
+
+ timestamp = int(csn[:8], 16)
+ time_str = datetime.datetime.utcfromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
+ # We are parsing shorter CSN which contains only timestamp
+ if len(csn) == 8:
+ return time_str
+ else:
+ seq = int(csn[8:12], 16)
+ subseq = int(csn[16:20], 16)
+ if seq != 0 or subseq != 0:
+ return f"{time_str} {str(seq)} {str(subseq)}"
+ else:
+ return f"{time_str}"
+
+ def format_ruv(self):
+ """Parse RUV into human readable format
+
+ :returns: dict
+ """
+ result = {}
+ if self._data_generation:
+ result["data_generation"] = {"name": self._data_generation,
+ "value": self._data_generation_csn}
+ else:
+ result["data_generation"] = None
+
+ ruvs = []
+ for rid in self._rids:
+ ruvs.append({"raw_ruv": self._rid_rawruv.get(rid),
+ "rid": rid,
+ "url": self._rid_url.get(rid),
+ "csn": parse_csn(self._rid_csn.get(rid, '00000000000000000000')),
+ "maxcsn": parse_csn(self._rid_maxcsn.get(rid, '00000000000000000000')),
+ "modts": parse_csn(self._rid_modts.get(rid, '00000000'))})
+ result["ruvs"] = ruvs
+ return result
def alloc_rid(self):
"""Based on the RUV, determine an available RID for the replication
@@ -880,6 +942,133 @@ class RUV(object):
return True
+class ChangelogLDIF(object):
+ def __init__(self, file_path, logger=None):
+ """A class for working with Changelog LDIF file
+
+ :param file_path: LDIF file path
+ :type file_path: str
+ :param logger: A logging object
+ :type logger: logging.Logger
+ """
+
+ if logger is not None:
+ self._log = logger
+ else:
+ self._log = logging.getLogger(__name__)
+ self.file_path = file_path
+
+ def grep_csn(self):
+ """Grep and interpret CSNs
+
+ :param file: LDIF file path
+ :type file: str
+ """
+
+ self._log.info(f"# LDIF File: {self.file_path}")
+ with open(self.file_path) as f:
+ for line in f.readlines():
+ if "ruv:" in line or "csn:" in line:
+ csn = ""
+ maxcsn = ""
+ modts = ""
+ line = line.split("\n")[0]
+ if "ruv:" in line:
+ ruv = RUV([line.split("ruv: ")[1]])
+ ruv_dict = ruv.parse_ruv()
+ csn = ruv_dict["csn"]
+ maxcsn = ruv_dict["maxcsn"]
+ modts = ruv_dict["modts"]
+ elif "csn:" in line:
+ csn = RUV().parse_csn(line.split("csn: ")[1])
+ if maxcsn or modts:
+ self._log.info(f'{line} ({csn}')
+ if maxcsn:
+ self._log.info(f"; {maxcsn}")
+ if modts:
+ self._log.info(f"; {modts}")
+ self._log.info(")")
+ else:
+ self._log.info(f"{line} ({csn})")
+
+ def decode(self):
+ """Decode the changelog
+
+ :param file: LDIF file path
+ :type file: str
+ """
+
+ self._log.info(f"# LDIF File: {self.file_path}")
+ with open(self.file_path) as f:
+ encoded_str = ""
+ for line in f.readlines():
+ if line.startswith("change::") or line.startswith("changes::"):
+ self._log.info("change::")
+ try:
+ encoded_str = line.split("change:: ")[1]
+ except IndexError:
+ encoded_str = line.split("changes:: ")[1]
+ continue
+ if not encoded_str:
+ self._log.info(line.split('\n')[0])
+ continue
+ if line == "\n":
+ decoded_str = ensure_str(base64.b64decode(encoded_str))
+ self._log.info(decoded_str)
+ encoded_str = ""
+ continue
+ encoded_str += line
+
+
+class Changelog5(DSLdapObject):
+ """Represents the Directory Server changelog. This is used for
+ replication. Only one changelog is needed for every server.
+
+ :param instance: An instance
+ :type instance: lib389.DirSrv
+ """
+
+ def __init__(self, instance, dn='cn=changelog5,cn=config'):
+ super(Changelog5, self).__init__(instance, dn)
+ self._rdn_attribute = 'cn'
+ self._must_attributes = ['cn', 'nsslapd-changelogdir']
+ self._create_objectclasses = [
+ 'top',
+ 'nsChangelogConfig',
+ ]
+ if ds_is_older('1.4.0'):
+ self._create_objectclasses = [
+ 'top',
+ 'extensibleobject',
+ ]
+ self._protected = False
+
+ def set_max_entries(self, value):
+ """Configure the max entries the changelog can hold.
+
+ :param value: the number of entries.
+ :type value: str
+ """
+ self.replace('nsslapd-changelogmaxentries', value)
+
+ def set_trim_interval(self, value):
+ """The time between changelog trims in seconds.
+
+ :param value: The time in seconds
+ :type value: str
+ """
+ self.replace('nsslapd-changelogtrim-interval', value)
+
+ def set_max_age(self, value):
+ """The maximum age of entries in the changelog.
+
+ :param value: The age with a time modifier of s, m, h, d, w.
+ :type value: str
+ """
+
+ self.replace('nsslapd-changelogmaxage', value)
+
+
class Replica(DSLdapObject):
"""Replica DSLdapObject with:
- must attributes = ['cn', 'nsDS5ReplicaType', 'nsDS5ReplicaRoot',
@@ -1307,6 +1496,55 @@ class Replicas(DSLdapObjects):
replica._populate_suffix()
return replica
+ def process_and_dump_changelog(self, replica_roots=[], csn_only=False):
+ """Dump and decode Directory Server replication change log
+
+ :param replica_roots: Replica suffixes that need to be processed
+ :type replica_roots: list of str
+ :param csn_only: Grep only the CSNs from the file
+ :type csn_only: bool
+ """
+
+ repl_roots = []
+ try:
+ cl = Changelog5(self._instance)
+ cl_dir = cl.get_attr_val_utf8_l("nsslapd-changelogdir")
+ except ldap.NO_SUCH_OBJECT:
+ raise ValueError("Changelog entry was not found. Probably, the replication is not enabled on this instance")
+
+ # Get all the replicas on the server if --replica-roots option is not specified
+ if not replica_roots:
+ for replica in self.list():
+ repl_roots.append(replica.get_attr_val_utf8("nsDS5ReplicaRoot"))
+ else:
+ for repl_root in replica_roots:
+ repl_roots.append(repl_root)
+
+ # Dump the changelog for the replica
+ for repl_root in repl_roots:
+ got_ldif = False
+ current_time = time.time()
+ replica = self.get(repl_root)
+ self._log.info(f"# Replica Root: {repl_root}")
+ replica.replace("nsDS5Task", 'CL2LDIF')
+
+ # Decode the dumped changelog
+ for file in [i for i in os.listdir(cl_dir) if i.endswith('.ldif')]:
+ file_path = os.path.join(cl_dir, file)
+ # Skip older ldif files
+ if os.path.getmtime(file_path) < current_time:
+ continue
+ got_ldif = True
+ cl_ldif = ChangelogLDIF(file_path, self._log)
+
+ if csn_only:
+ cl_ldif.grep_csn()
+ else:
+ cl_ldif.decode()
+ os.rename(file_path, f'{file_path}.done')
+ if not got_ldif:
+ self._log.info("LDIF file: Not found")
+
class BootstrapReplicationManager(DSLdapObject):
"""A Replication Manager credential for bootstrapping the repl process.
@@ -1989,5 +2227,3 @@ class ReplicationManager(object):
replicas = Replicas(instance)
replica = replicas.get(self._suffix)
return replica.get_rid()
-
-
| 0 |
f901190305cb01aa7a682a56ea0d212e6216049a
|
389ds/389-ds-base
|
Ticket 49856 - Remove backend option from bak2db
Description:
The server has not supported backup/restore of a single backend for a
long time now. All references to it should be remove from the CLI
and man pages.
https://pagure.io/389-ds-base/issue/49856
Reviewed by: tbordaz & spichugi(Thanks!!)
|
commit f901190305cb01aa7a682a56ea0d212e6216049a
Author: Mark Reynolds <[email protected]>
Date: Tue Oct 23 10:52:50 2018 -0400
Ticket 49856 - Remove backend option from bak2db
Description:
The server has not supported backup/restore of a single backend for a
long time now. All references to it should be remove from the CLI
and man pages.
https://pagure.io/389-ds-base/issue/49856
Reviewed by: tbordaz & spichugi(Thanks!!)
diff --git a/ldap/admin/src/scripts/bak2db.in b/ldap/admin/src/scripts/bak2db.in
index cb5ef14f2..5ab454648 100755
--- a/ldap/admin/src/scripts/bak2db.in
+++ b/ldap/admin/src/scripts/bak2db.in
@@ -13,10 +13,9 @@ export SHLIB_PATH
usage()
{
- echo "Usage: bak2db archivedir [-Z serverID] [-n backend] [-q] [-h]"
+ echo "Usage: bak2db archivedir [-Z serverID] [-q] [-h]"
echo "Options:"
echo " archivedir - Directory where the archived backup is located"
- echo " -n backend - Backend database name. Example: userRoot"
echo " -Z serverID - Server instance identifier"
echo " -q - Quiet mode - suppresses output"
echo " -h - Display usage"
@@ -44,7 +43,6 @@ do
h) usage
exit 0;;
Z) servid=$OPTARG;;
- n) args=$args" -n \"$OPTARG\"";;
q) args=$args" -q";;
d) args=$args" -d \"$OPTARG\"";;
v) args=$args" -v";;
diff --git a/ldap/admin/src/scripts/bak2db.pl.in b/ldap/admin/src/scripts/bak2db.pl.in
index bba8b930a..798775697 100644
--- a/ldap/admin/src/scripts/bak2db.pl.in
+++ b/ldap/admin/src/scripts/bak2db.pl.in
@@ -25,7 +25,7 @@ $i = 0;
sub usage {
print(STDERR "Usage: bak2db.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j filename } -a dirname [-t dbtype]\n");
- print(STDERR " [-n backendname] [-P protocol] [-h]\n");
+ print(STDERR " [-P protocol] [-h]\n");
print(STDERR "Options:\n");
print(STDERR " -D rootdn - Directory Manager\n");
print(STDERR " -w password - Directory Manager's password\n");
@@ -34,7 +34,6 @@ sub usage {
print(STDERR " -j filename - Read Directory Manager's password from file\n");
print(STDERR " -a dirname - Backup directory\n");
print(STDERR " -t dbtype - Database type (default: ldbm database)\n");
- print(STDERR " -n backend - Backend database name. Example: userRoot\n");
print(STDERR " -P protocol - STARTTLS, LDAPS, LDAPI, LDAP (default: uses most secure protocol available)\n");
print(STDERR " -h - Display usage\n");
}
@@ -50,8 +49,6 @@ while ($i <= $#ARGV) {
$i++; $passwdfile = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-t") { # database type
$i++; $dbtype = $ARGV[$i];
- } elsif ("$ARGV[$i]" eq "-n") { # backend instance name
- $i++; $instance = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-Z") { # server instance name
$i++; $servid = $ARGV[$i];
} elsif ("$ARGV[$i]" eq "-P") { # protocol preference
@@ -94,12 +91,9 @@ if (!$isabs) {
$dn = "dn: cn=$taskname, cn=restore, cn=tasks, cn=config\n";
$misc = "objectclass: top\nobjectclass: extensibleObject\n";
$cn = "cn: $taskname\n";
-if ($instance ne "") {
- $nsinstance = "nsInstance: ${instance}\n";
-}
$nsarchivedir = "nsArchiveDir: $archivedir\n";
$nsdbtype = "nsDatabaseType: $dbtype\n";
-$entry = "${dn}${misc}${cn}${nsinstance}${nsarchivedir}${nsdbtype}";
+$entry = "${dn}${misc}${cn}${nsarchivedir}${nsdbtype}";
$rc = DSUtil::ldapmod($entry, %info);
diff --git a/man/man8/bak2db.8 b/man/man8/bak2db.8
index 74e5e589e..49e034c6d 100644
--- a/man/man8/bak2db.8
+++ b/man/man8/bak2db.8
@@ -18,7 +18,7 @@
.SH NAME
bak2db - Directory Server script for restoring a backup
.SH SYNOPSIS
-bak2db archivedir [\-Z serverID] [\-n backendname] [\-q] [\-v] [\-h]
+bak2db archivedir [\-Z serverID] [\-q] [\-v] [\-h]
.SH DESCRIPTION
Restores the database from a archived backup. The Directory Server must be stopped prior to running this script.
.SH OPTIONS
@@ -31,9 +31,6 @@ The directory of the archived database.
The server ID of the Directory Server instance. If there is only
one instance on the system, this option can be skipped.
.TP
-.B \fB\-n\fR \fIBackend Name\fR
-The name of the LDBM database to restore. Example: userRoot
-.TP
.B \fB\-q\fR
.br
Quiet mode. Reduces output of task.
diff --git a/src/lib389/doc/source/task.rst b/src/lib389/doc/source/task.rst
index 9adf96ccf..614b16973 100644
--- a/src/lib389/doc/source/task.rst
+++ b/src/lib389/doc/source/task.rst
@@ -31,7 +31,7 @@ Usage example
standalone.tasks.importLDIF(DEFAULT_SUFFIX, path_ro_ldif, args)
standalone.tasks.exportLDIF(DEFAULT_SUFFIX, benamebase=None, output_file=path_to_ldif, args)
standalone.tasks.db2bak(backup_dir, args)
- standalone.tasks.bak2db(bename=None, backup_dir, args)
+ standalone.tasks.bak2db(backup_dir, args)
standalone.tasks.reindex(suffix=None, benamebase=None, attrname=None, args)
standalone.tasks.fixupMemberOf(suffix=None, benamebase=None, filt=None, args)
standalone.tasks.fixupTombstones(bename=None, args)
diff --git a/src/lib389/doc/source/utils.rst b/src/lib389/doc/source/utils.rst
index 9e7865ff8..e0ee462be 100644
--- a/src/lib389/doc/source/utils.rst
+++ b/src/lib389/doc/source/utils.rst
@@ -7,7 +7,7 @@ Usage example
standalone.ldif2db(bename, suffixes, excludeSuffixes, encrypt, import_file)
standalone.db2ldif(bename, suffixes, excludeSuffixes, encrypt, repl_data, outputfile)
- standalone.bak2db(archive_dir,bename=None)
+ standalone.bak2db(archive_dir)
standalone.db2bak(archive_dir)
standalone.db2index(bename=None, suffixes=None, attrs=None, vlvTag=None)
standalone.dbscan(bename=None, index=None, key=None, width=None, isRaw=False)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 151e68c9d..9c1089c4b 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -2867,7 +2867,7 @@ class DirSrv(SimpleLDAPObject, object):
return True
- def bak2db(self, archive_dir, bename=None):
+ def bak2db(self, archive_dir):
"""
@param archive_dir - The directory containing the backup
@param bename - The backend name to restore
diff --git a/src/lib389/lib389/tasks.py b/src/lib389/lib389/tasks.py
index a06807587..6726c74e9 100644
--- a/src/lib389/lib389/tasks.py
+++ b/src/lib389/lib389/tasks.py
@@ -522,7 +522,7 @@ class Tasks(object):
return exitCode
- def bak2db(self, bename=None, backup_dir=None, args=None):
+ def bak2db(self, backup_dir=None, args=None):
'''
Restore a backup by creating a bak2db task
@@ -543,12 +543,6 @@ class Tasks(object):
if not os.path.exists(backup_dir):
raise ValueError("Backup file (%s) does not exist" % backup_dir)
- # If a backend name was provided then verify it
- if bename:
- ents = self.conn.mappingtree.list(bename=bename)
- if len(ents) != 1:
- raise ValueError("invalid backend name: %s" % bename)
-
# build the task entry
cn = "restore_" + time.strftime("%m%d%Y_%H%M%S", time.localtime())
dn = "cn=%s,%s" % (cn, DN_RESTORE_TASK)
@@ -559,8 +553,6 @@ class Tasks(object):
'nsArchiveDir': backup_dir,
'nsDatabaseType': 'ldbm database'
})
- if bename:
- entry.update({'nsInstance': bename})
# start the task and possibly wait for task completion
try:
| 0 |
afd830866ca4f393d5579fa4124eafd85062a133
|
389ds/389-ds-base
|
Ticket 46918 - Fix compiler warnings on arm
Description: There were still a few lingering compiler errors
https://pagure.io/389-ds-base/issue/46918
Reviewed by: mreynolds(one line commit rule)
|
commit afd830866ca4f393d5579fa4124eafd85062a133
Author: Mark Reynolds <[email protected]>
Date: Fri Jun 8 19:16:29 2018 -0400
Ticket 46918 - Fix compiler warnings on arm
Description: There were still a few lingering compiler errors
https://pagure.io/389-ds-base/issue/46918
Reviewed by: mreynolds(one line commit rule)
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index 827cd9111..a27505c4b 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -731,10 +731,10 @@ cache_set_max_entries(struct cache *cache, int64_t entries)
}
}
-size_t
+uint64_t
cache_get_max_size(struct cache *cache)
{
- size_t n = 0;
+ uint64_t n = 0;
cache_lock(cache);
n = cache->c_maxsize;
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 793150bee..6d772cd6b 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -36,9 +36,9 @@ int cache_init(struct cache *cache, uint64_t maxsize, int64_t maxentries, int ty
void cache_clear(struct cache *cache, int type);
void cache_destroy_please(struct cache *cache, int type);
void cache_set_max_size(struct cache *cache, uint64_t bytes, int type);
-void cache_set_max_entries(struct cache *cache, long entries);
-size_t cache_get_max_size(struct cache *cache);
-long cache_get_max_entries(struct cache *cache);
+void cache_set_max_entries(struct cache *cache, int64_t entries);
+uint64_t cache_get_max_size(struct cache *cache);
+int64_t cache_get_max_entries(struct cache *cache);
void cache_get_stats(struct cache *cache, uint64_t *hits, uint64_t *tries, uint64_t *entries, int64_t *maxentries, uint64_t *size, uint64_t *maxsize);
void cache_debug_hash(struct cache *cache, char **out);
int cache_remove(struct cache *cache, void *e);
| 0 |
57cf1cd2cff97707fe5e5052e3e17efc7bc2fe30
|
389ds/389-ds-base
|
Issue 49156 - Add more IDs and fix docstrings
Description: Add IDs and fix docstrings in page_results test suite.
https://pagure.io/389-ds-base/issue/49156
Reviewed by: vashirov (Thanks!)
|
commit 57cf1cd2cff97707fe5e5052e3e17efc7bc2fe30
Author: Simon Pichugin <[email protected]>
Date: Thu Mar 9 16:47:42 2017 +0100
Issue 49156 - Add more IDs and fix docstrings
Description: Add IDs and fix docstrings in page_results test suite.
https://pagure.io/389-ds-base/issue/49156
Reviewed by: vashirov (Thanks!)
diff --git a/dirsrvtests/tests/suites/paged_results/paged_results_test.py b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
index e54e293e8..96626aa41 100644
--- a/dirsrvtests/tests/suites/paged_results/paged_results_test.py
+++ b/dirsrvtests/tests/suites/paged_results/paged_results_test.py
@@ -247,14 +247,12 @@ def test_search_success(topology_st, test_user, page_size, users_num):
"""Verify that search with a simple paged results control
returns all entries it should without errors.
- :feature: Simple paged results
-
+ :id: ddd15b70-64f1-4a85-a793-b24761e50354
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Search through added users with a simple paged control
-
:assert: All users should be found
"""
@@ -296,16 +294,14 @@ def test_search_limits_fail(topology_st, test_user, page_size, users_num,
throws expected exceptoins when corresponding limits are
exceeded.
- :feature: Simple paged results
-
+ :id: e3067107-bd6d-493d-9989-3e641a9337b0
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Set limit attribute to the value that will cause
an expected exception
3. Search through added users with a simple paged control
-
:assert: Should fail with appropriate exception
"""
@@ -381,15 +377,13 @@ def test_search_sort_success(topology_st, test_user):
and a server side sort control returns all entries
it should without errors.
- :feature: Simple paged results
-
+ :id: 17d8b150-ed43-41e1-b80f-ee9b4ce45155
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Search through added users with a simple paged control
and a server side sort control
-
:assert: All users should be found and sorted
"""
@@ -427,15 +421,13 @@ def test_search_abandon(topology_st, test_user):
"""Verify that search with simple paged results control
can be abandon
- :feature: Simple paged results
-
+ :id: 0008538b-7585-4356-839f-268828066978
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Search through added users with a simple paged control
3. Abandon the search
-
:assert: It will throw an ldap.TIMEOUT exception, while trying
to get the rest of the search results
"""
@@ -477,17 +469,15 @@ def test_search_with_timelimit(topology_st, test_user):
to completion, each with a timelimit, it wouldn't fail, if we sleep
for a time more than the timelimit.
- :feature: Simple paged results
-
+ :id: 6cd7234b-136c-419f-bf3e-43aa73592cff
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Search through added users with a simple paged control
and timelimit set to 5
3. When the returned cookie is empty, wait 10 seconds
4. Perform steps 2 and 3 three times in a row
-
:assert: No error happens
"""
@@ -557,11 +547,10 @@ def test_search_dns_ip_aci(topology_st, test_user, aci_subject):
"""Verify that after performing multiple simple paged searches
to completion on the suffix with DNS or IP based ACI
- :feature: Simple paged results
-
+ :id: bbfddc46-a8c8-49ae-8c90-7265d05b22a9
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Back up and remove all previous ACI from suffix
2. Add an anonymous ACI for DNS check
3. Bind as test user
@@ -570,7 +559,6 @@ def test_search_dns_ip_aci(topology_st, test_user, aci_subject):
6. Return ACI to the initial state
7. Go through all steps onece again, but use IP subjectdn
insted of DNS
-
:assert: No error happens, all users should be found and sorted
"""
@@ -631,16 +619,14 @@ def test_search_multiple_paging(topology_st, test_user):
"""Verify that after performing multiple simple paged searches
on a single connection without a complition, it wouldn't fail.
- :feature: Simple paged results
-
+ :id: 628b29a6-2d47-4116-a88d-00b87405ef7f
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Initiate the search with a simple paged control
3. Acquire the returned cookie only one time
4. Perform steps 2 and 3 three times in a row
-
:assert: No error happens
"""
@@ -691,16 +677,14 @@ def test_search_invalid_cookie(topology_st, test_user, invalid_cookie):
search with the simple paged results control throws
a TypeError exception
- :feature: Simple paged results
-
+ :id: 107be12d-4fe4-47fe-ae86-f3e340a56f42
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Initiate the search with a simple paged control
3. Put an invalid cookie (-1, 1000) to the control
4. Continue the search
-
:assert: It will throw an TypeError exception
"""
@@ -744,15 +728,13 @@ def test_search_abandon_with_zero_size(topology_st, test_user):
"""Verify that search with simple paged results control
can be abandon using page_size = 0
- :feature: Simple paged results
-
+ :id: d2fd9a10-84e1-4b69-a8a7-36ca1427c171
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Bind as test user
2. Search through added users with a simple paged control
and page_size = 0
-
:assert: No cookie should be returned at all
"""
@@ -793,16 +775,14 @@ def test_search_pagedsizelimit_success(topology_st, test_user):
returns all entries it should without errors while
valid value set to nsslapd-pagedsizelimit.
- :feature: Simple paged results
-
+ :id: 88193f10-f6f0-42f5-ae9c-ff34b8f9ee8c
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
10 users for the search base
-
:steps: 1. Set nsslapd-pagedsizelimit: 20
2. Bind as test user
3. Search through added users with a simple paged control
using page_size = 10
-
:assert: All users should be found
"""
@@ -845,11 +825,10 @@ def test_search_nspagedsizelimit(topology_st, test_user,
nsslapd-pagedsizelimit while performing search with
the simple paged results control.
- :feature: Simple paged results
-
+ :id: b08c6ad2-ba28-447a-9f04-5377c3661d0d
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
10 users for the search base
-
:steps: 1. Set nsslapd-pagedsizelimit: 5
2. Set nsPagedSizeLimit: 15
3. Bind as test user
@@ -862,7 +841,6 @@ def test_search_nspagedsizelimit(topology_st, test_user,
9. Bind as test user
10. Search through added users with a simple paged control
using page_size = 10
-
:assert: After the steps 1-4, it should PASS.
After the steps 7-10, it should throw
SIZELIMIT_EXCEEDED exception
@@ -915,11 +893,10 @@ def test_search_paged_limits(topology_st, test_user, conf_attr_values, expected_
nsslapd-lookthroughlimit can limit the administrator
search abilities.
- :feature: Simple paged results
-
+ :id: e0f8b916-7276-4bd3-9e73-8696a4468811
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
10 users for the search base
-
:steps: 1. Set nsslapd-sizelimit and nsslapd-pagedsizelimit to 5000
2. Set nsslapd-idlistscanlimit: 120
3. Set nsslapd-lookthroughlimit: 122
@@ -932,7 +909,6 @@ def test_search_paged_limits(topology_st, test_user, conf_attr_values, expected_
9. Bind as test user
10. Search through added users with a simple paged control
using page_size = 10
-
:assert: After the steps 1-4, it should PASS.
After the steps 7-10, it should throw
ADMINLIMIT_EXCEEDED exception
@@ -992,11 +968,10 @@ def test_search_paged_user_limits(topology_st, test_user, conf_attr_values, expe
override nsslapd-idlistscanlimit and nsslapd-lookthroughlimit
while performing search with the simple paged results control.
- :feature: Simple paged results
-
+ :id: 69e393e9-1ab8-4f4e-b4a1-06ca63dc7b1b
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
10 users for the search base
-
:steps: 1. Set nsslapd-idlistscanlimit: 1000
2. Set nsslapd-lookthroughlimit: 1000
3. Set nsPagedIDListScanLimit: 120
@@ -1010,7 +985,6 @@ def test_search_paged_user_limits(topology_st, test_user, conf_attr_values, expe
10. Bind as test user
11. Search through added users with a simple paged control
using page_size = 10
-
:assert: After the steps 1-4, it should PASS.
After the steps 8-11, it should throw
ADMINLIMIT_EXCEEDED exception
@@ -1067,14 +1041,12 @@ def test_ger_basic(topology_st, test_user):
and get effective rights control returns all entries
it should without errors.
- :feature: Simple paged results
-
+ :id: 7b0bdfc7-a2f2-4c1a-bcab-f1eb8b330d45
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
variated number of users for the search base
-
:steps: 1. Search through added users with a simple paged control
and get effective rights control
-
:assert: All users should be found, every found entry should have
an 'attributeLevelRights' returned
"""
@@ -1107,18 +1079,16 @@ def test_multi_suffix_search(topology_st, test_user, new_suffixes):
"""Verify that page result search returns empty cookie
if there is no returned entry.
- :feature: Simple paged results
-
+ :id: 9712345b-9e38-4df6-8794-05f12c457d39
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
two suffixes with backends, one is inserted into another,
10 users for the search base within each suffix
-
:steps: 1. Bind as test user
2. Search through all 20 added users with a simple paged control
using page_size = 4
3. Wait some time logs to be updated
3. Check access log
-
:assert: All users should be found, the access log should contain
the pr_cookie for each page request and it should be equal 0,
except the last one should be equal -1
@@ -1167,16 +1137,14 @@ def test_multi_suffix_search(topology_st, test_user, new_suffixes):
def test_maxsimplepaged_per_conn_success(topology_st, test_user, conf_attr_value):
"""Verify that nsslapd-maxsimplepaged-per-conn acts according design
- :feature: Simple paged results
-
+ :id: 192e2f25-04ee-4ff9-9340-d875dcbe8011
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
20 users for the search base
-
:steps: 1. Set nsslapd-maxsimplepaged-per-conn in cn=config
to the next values: no value, -1, some positive
2. Search through the added users with a simple paged control
using page size = 4
-
:assert: If no value or value = -1 - all users should be found,
default behaviour;
If the value is positive, the value is the max simple paged
@@ -1216,18 +1184,16 @@ def test_maxsimplepaged_per_conn_success(topology_st, test_user, conf_attr_value
def test_maxsimplepaged_per_conn_failure(topology_st, test_user, conf_attr_value):
"""Verify that nsslapd-maxsimplepaged-per-conn acts according design
- :feature: Simple paged results
-
+ :id: eb609e63-2829-4331-8439-a35f99694efa
+ :feature: Simple paged results
:setup: Standalone instance, test user for binding,
20 users for the search base
-
:steps: 1. Set nsslapd-maxsimplepaged-per-conn = 0 in cn=config
2. Search through the added users with a simple paged control
using page size = 4
3. Set nsslapd-maxsimplepaged-per-conn = 1 in cn=config
4. Search through the added users with a simple paged control
using page size = 4 two times, but don't close the connections
-
:assert: During the searches UNWILLING_TO_PERFORM should be throwned
"""
| 0 |
f069f4bc18607ceef5d01e57b4102a0317819f8b
|
389ds/389-ds-base
|
Merge branch '718303'
|
commit f069f4bc18607ceef5d01e57b4102a0317819f8b (from b554264e6b6056414d17044991c3b5ec839d0981)
Merge: b554264e6 20c42018a
Author: Noriko Hosoi <[email protected]>
Date: Fri Jul 1 14:12:35 2011 -0700
Merge branch '718303'
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index dc759b47e..f2edf1e9a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -495,6 +495,11 @@ ldbm_back_delete( Slapi_PBlock *pb )
}
if (cache_add_tentative( &inst->inst_cache, tombstone, NULL) == 0) {
tombstone_in_cache = 1;
+ } else if (!(tombstone->ep_state & ENTRY_STATE_NOTINCACHE)) {
+ LDAPDebug1Arg(LDAP_DEBUG_CACHE,
+ "id2entry_add tombstone (%s) is in cache\n",
+ slapi_entry_get_dn(tombstone->ep_entry));
+ tombstone_in_cache = 1;
}
}
else
commit f069f4bc18607ceef5d01e57b4102a0317819f8b (from 20c42018a6cacde318c4213568ff4d31404af6e0)
Merge: b554264e6 20c42018a
Author: Noriko Hosoi <[email protected]>
Date: Fri Jul 1 14:12:35 2011 -0700
Merge branch '718303'
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index c8b3b7fe3..9255ddb2b 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -199,9 +199,14 @@ int instance_set_busy_and_readonly(ldbm_instance *inst)
} else {
inst->inst_flags &= ~INST_FLAG_READONLY;
}
+ /*
+ * Normally, acquire rlock on be_lock, then lock inst_config_mutex.
+ * instance_set_busy_and_readonly should release inst_config_mutex
+ * before acquiring wlock on be_lock in slapi_mtn_be_set_readonly.
+ */
+ PR_Unlock(inst->inst_config_mutex);
slapi_mtn_be_set_readonly(inst->inst_be, 1);
- PR_Unlock(inst->inst_config_mutex);
return 0;
}
| 0 |
9000a256dad532e9b63c9f51a102adcaea09a30d
|
389ds/389-ds-base
|
Issue 5554 - Add more tests to security_basic_test suite
Description:
Add test for TCP_ERROR maxbersize B2 scenario.
Relates: https://github.com/389ds/389-ds-base/issues/5554
Reviewed by: @droideck, @mreynolds389, @vashirov (Thanks!)
|
commit 9000a256dad532e9b63c9f51a102adcaea09a30d
Author: Barbora Simonova <[email protected]>
Date: Wed Mar 1 20:35:26 2023 +0100
Issue 5554 - Add more tests to security_basic_test suite
Description:
Add test for TCP_ERROR maxbersize B2 scenario.
Relates: https://github.com/389ds/389-ds-base/issues/5554
Reviewed by: @droideck, @mreynolds389, @vashirov (Thanks!)
diff --git a/dirsrvtests/testimony.yaml b/dirsrvtests/testimony.yaml
index fc9cf224e..38cc061a6 100644
--- a/dirsrvtests/testimony.yaml
+++ b/dirsrvtests/testimony.yaml
@@ -12,3 +12,11 @@ customerscenario:
required: False
parametrized:
required: False
+testype:
+ required: False
+subtype1:
+ required: False
+subtype2:
+ required: False
+subsystemteam:
+ required: False
diff --git a/dirsrvtests/tests/suites/logging/security_basic_test.py b/dirsrvtests/tests/suites/logging/security_basic_test.py
index 8c897e0ac..36cb03f24 100644
--- a/dirsrvtests/tests/suites/logging/security_basic_test.py
+++ b/dirsrvtests/tests/suites/logging/security_basic_test.py
@@ -92,6 +92,15 @@ def check_log(inst, event_id, msg, dn=None, bind_method=None):
assert False
[email protected](scope="module")
+def big_file():
+ TEMP_BIG_FILE = ''
+ for x in range(1048576):
+ TEMP_BIG_FILE += '+'
+
+ return TEMP_BIG_FILE
+
+
def test_invalid_binds(topo, setup_test):
"""Test the various bind scenarios that should be logged in the security log
@@ -168,7 +177,7 @@ def test_authorization(topo, setup_test):
"""
inst = topo.standalone
- # Delete the previous securty logs
+ # Delete the previous security logs
inst.deleteSecurityLogs()
# Bind as a user
@@ -185,7 +194,7 @@ def test_authorization(topo, setup_test):
def test_account_lockout(topo, setup_test):
- """Test that accound locked message is displayed correctly
+ """Test that account locked message is displayed correctly
:id: b70494f0-7d8e-4d90-8265-9d009bbb08b4
:setup: Standalone Instance
@@ -200,7 +209,7 @@ def test_account_lockout(topo, setup_test):
"""
inst = topo.standalone
- # Delete the previous securty logs
+ # Delete the previous security logs
inst.deleteSecurityLogs()
# Configure account lockout
@@ -222,7 +231,7 @@ def test_account_lockout(topo, setup_test):
def test_tcp_events(topo, setup_test):
- """Trigger a TCP_ERROR event event that should be logged in the security log
+ """Trigger a TCP_ERROR event that should be logged in the security log
:id: 2f653508-89ae-4325-9fed-a2c4ab304149
:setup: Standalone Instance
@@ -240,7 +249,7 @@ def test_tcp_events(topo, setup_test):
inst = topo.standalone
- # Delete the previous securty logs
+ # Delete the previous security logs
inst.deleteSecurityLogs()
# Start interactive ldapamodfy command
@@ -258,6 +267,48 @@ def test_tcp_events(topo, setup_test):
check_log(inst, "TCP_ERROR", "Bad Ber Tag or uncleanly closed connection - B1")
+def test_tcp_events_maxbersize(topo, setup_test, big_file):
+ """Trigger a TCP_ERROR event B2 that should be logged in the security log
+
+ :id: 85e5ac23-4288-4e55-b8c3-1f8f39e95c2b
+ :setup: Standalone Instance
+ :testype: Non-functional
+ :subtype1: Security
+ :subtype2: Penetration
+ :subsystemteam: sst_idm_ds
+ :steps:
+ 1. Create test user
+ 1. Set maxbersize attribute to a small value (20KiB)
+ 3. Add the big value to instance
+ 4. Check that a TCP_ERROR is in the security log
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ """
+
+ inst = topo.standalone
+ user_entry = UserAccount(inst, DN)
+
+ # Delete the previous security logs
+ inst.deleteSecurityLogs()
+
+ log.info("Set nsslapd-maxbersize to 20K")
+ inst.config.set('nsslapd-maxbersize', '20480')
+ inst.restart()
+
+ log.info('Try to add attribute with a big value to instance - expect to FAIL')
+ with pytest.raises(ldap.SERVER_DOWN):
+ user_entry.add('jpegphoto', big_file)
+
+ log.info('Check security log')
+ check_log(inst, "TCP_ERROR", "Ber Too Big (nsslapd-maxbersize) - B2")
+
+ # restart the instance so it won't break next tests
+ inst.restart()
+
+
def test_anonymous_bind(topo, setup_test):
"""Test that anonymous bind message is displayed correctly
| 0 |
e3ab42f91b630a333b671632599371aad82b2796
|
389ds/389-ds-base
|
Ticket 48029 - Add missing replication related functions
Description: There was either missing or not fully implemented functions
for disabling replication, deleting agreements, and deleting
the changelog.
Also added some helper functions to "grep" log files, or any file.
https://fedorahosted.org/389/ticket/48029
Reviewed by: tbordaz(Thanks!)
|
commit e3ab42f91b630a333b671632599371aad82b2796
Author: Mark Reynolds <[email protected]>
Date: Mon Feb 16 16:23:23 2015 -0500
Ticket 48029 - Add missing replication related functions
Description: There was either missing or not fully implemented functions
for disabling replication, deleting agreements, and deleting
the changelog.
Also added some helper functions to "grep" log files, or any file.
https://fedorahosted.org/389/ticket/48029
Reviewed by: tbordaz(Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 645e5dc47..e10990916 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -1770,14 +1770,16 @@ class DirSrv(SimpleLDAPObject):
@raise None
'''
- test_value = 'test replication - ' + str(int(time.time()))
+ test_value = ('test replication from ' + self.serverid + ' to ' +
+ replicas[0].serverid + ': ' + str(int(time.time())))
self.modify_s(suffix, [(ldap.MOD_REPLACE, 'description', test_value)])
for replica in replicas:
loop = 0
replicated = False
- while loop <= 10:
+ while loop <= 30:
try:
+
entry = replica.getEntry(suffix, ldap.SCOPE_BASE, "(objectclass=*)")
if entry.hasValue('description', test_value):
replicated = True
@@ -1787,7 +1789,7 @@ class DirSrv(SimpleLDAPObject):
% (suffix, e.message['desc']))
return False
loop += 1
- time.sleep(1)
+ time.sleep(2)
if not replicated:
log.fatal('Replication is not in sync with replica server (%s)' % replica.serverid)
return False
@@ -2239,3 +2241,15 @@ class DirSrv(SimpleLDAPObject):
self.start(timeout=10)
return result
+
+ def searchAccessLog(self, pattern):
+ return DirSrvTools.searchFile(self.accesslog, pattern)
+
+ def searchAuditLog(self, pattern):
+ return DirSrvTools.searchFile(self.auditlog, pattern)
+
+ def searchErrorsLog(self, pattern):
+ return DirSrvTools.searchFile(self.errlog, pattern)
+
+ def detectDisorderlyShutdown(self):
+ return DirSrvTools.searchFile(self.errlog, DISORDERLY_SHUTDOWN)
\ No newline at end of file
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index 5ba7fe755..2b4c6d5ec 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -19,8 +19,9 @@ REPLICA_RDONLY_TYPE = 2 # CONSUMER and HUB
REPLICA_WRONLY_TYPE = 1 # SINGLE and MULTI MASTER
REPLICA_RDWR_TYPE = REPLICA_RDONLY_TYPE | REPLICA_WRONLY_TYPE
-REPLICA_RUV_UUID = "ffffffff-ffffffff-ffffffff-ffffffff"
-REPLICA_OC_TOMBSTONE= "nsTombstone"
+REPLICA_RUV_UUID = "ffffffff-ffffffff-ffffffff-ffffffff"
+REPLICA_RUV_FILTER = '(&(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff)(objectclass=nstombstone))'
+REPLICA_OC_TOMBSTONE = "nsTombstone"
REPLICATION_BIND_DN = 'replication_bind_dn'
REPLICATION_BIND_PW = 'replication_bind_pw'
REPLICATION_BIND_METHOD = 'replication_bind_method'
@@ -119,6 +120,7 @@ RETROCL_SUFFIX = "cn=changelog"
###
##################################
+PLUGIN_7_BIT_CHECK = '7-bit check'
PLUGIN_ACCT_POLICY = 'Account Policy Plugin'
PLUGIN_ACCT_USABILITY = 'Account Usability Plugin'
PLUGIN_ACL = 'ACL Plugin'
@@ -152,13 +154,14 @@ PLUGIN_WHOAMI = 'whoami'
#
-# constants
+# Constants
#
DEFAULT_USER = "nobody"
DEFAULT_USERHOME = "/tmp/lib389_home"
DATA_DIR = "data"
TMP_DIR = "tmp"
VALGRIND_WRAPPER = "ns-slapd.valgrind"
+DISORDERLY_SHUTDOWN = 'Detected Disorderly Shutdown last time Directory Server was running, recovering database'
#
# LOG: see https://access.redhat.com/site/documentation/en-US/Red_Hat_Directory_Server/9.0/html/Administration_Guide/Configuring_Logs.html
diff --git a/src/lib389/lib389/agreement.py b/src/lib389/lib389/agreement.py
index 95cfea883..e94bbb2bb 100644
--- a/src/lib389/lib389/agreement.py
+++ b/src/lib389/lib389/agreement.py
@@ -108,7 +108,8 @@ class Agreement(object):
if ((hour < 0) or (hour > 23)):
raise ValueError("Bad schedule format %r: illegal hour %d" % (interval, hour))
if int(schedule[1]) > int(schedule[3]):
- raise ValueError("Bad schedule (start HOUR larger than end HOUR) %r: illegal hour %d" % (interval, int(schedule[1])))
+ raise ValueError("Bad schedule (start HOUR larger than end HOUR) %r: illegal hour %d" %
+ (interval, int(schedule[1])))
# check the minutes
minute = int(schedule[2])
@@ -362,11 +363,12 @@ class Agreement(object):
# Now returns the replica agreement for that suffix that replicates to
# consumer host/port
if consumer_host and consumer_port:
- filt = "(&(objectclass=%s)(%s=%s)(%s=%d))" % (RA_OBJECTCLASS_VALUE,
+ filt = "(&(|(objectclass=%s)(objectclass=%s))(%s=%s)(%s=%d))" % (RA_OBJECTCLASS_VALUE,
+ RA_WINDOWS_OBJECTCLASS_VALUE,
RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_HOST], consumer_host,
RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_PORT], consumer_port)
else:
- filt = "(objectclass=%s)" % RA_OBJECTCLASS_VALUE
+ filt = "(|(objectclass=%s)(objectclass=%s))" % (RA_OBJECTCLASS_VALUE, RA_WINDOWS_OBJECTCLASS_VALUE)
return self.conn.search_s(replica_entry.dn, ldap.SCOPE_ONELEVEL, filt)
def create(self, suffix=None, host=None, port=None, properties=None):
@@ -520,6 +522,39 @@ class Agreement(object):
return dn_agreement
+ def delete(self, suffix, replica):
+ '''
+ Delete a replication agreement
+
+ @param suffix - the suffix that the agreement is configured for
+ @replica - a DirSrv object of the server that the agreement points to
+ @raise ldap.LDAPError - for ldap operation failures
+ '''
+
+ if replica.sslport:
+ # We assume that if you are using SSL, you are using it with replication
+ port = replica.sslport
+ else:
+ port = replica.port
+
+ agmts = self.list(suffix=suffix, consumer_host=replica.host, consumer_port=port)
+ if agmts:
+ if len(agmts) > 1:
+ # Found too many agreements
+ self.log.error('Too many agreements found')
+ raise
+ else:
+ # delete the agreement
+ try:
+ self.conn.delete_s(agmts[0].dn)
+ except ldap.LDAPError, e:
+ self.log.error('Failed to delete agreement (%s), error: %s' %
+ (agmts[0].dn, e.message['desc']))
+ raise ldap.LDAPError
+ else:
+ # No agreements, error?
+ self.log.error('No agreements found')
+
def init(self, suffix=None, consumer_host=None, consumer_port=None):
"""Trigger a total update of the consumer replica
- self is the supplier,
@@ -547,7 +582,7 @@ class Agreement(object):
if not consumer_port:
self.log.fatal("initAgreement: port is missing")
raise InvalidArgumentError('port is mandatory argument')
- #
+ #
# check the replica agreement already exist
#
replica_entries = self.conn.replica.list(suffix)
@@ -557,10 +592,13 @@ class Agreement(object):
replica_entry = replica_entries[0]
self.log.debug("initAgreement: looking for replica agreements under %s" % replica_entry.dn)
try:
- filt = "(&(objectclass=nsds5replicationagreement)(nsds5replicahost=%s)(nsds5replicaport=%d)(nsds5replicaroot=%s))" % (consumer_host, consumer_port, nsuffix)
+ filt = ("(&(objectclass=nsds5replicationagreement)(nsds5replicahost=" +
+ "%s)(nsds5replicaport=%d)(nsds5replicaroot=%s))"
+ % (consumer_host, consumer_port, nsuffix))
entry = self.conn.getEntry(replica_entry.dn, ldap.SCOPE_ONELEVEL, filt)
except ldap.NO_SUCH_OBJECT:
- self.log.fatal("initAgreement: No replica agreement to %s:%d for suffix %s" % (consumer_host, consumer_port, nsuffix))
+ self.log.fatal("initAgreement: No replica agreement to %s:%d for suffix %s" %
+ (consumer_host, consumer_port, nsuffix))
raise
#
diff --git a/src/lib389/lib389/changelog.py b/src/lib389/lib389/changelog.py
index 53c5592d3..025e71efa 100644
--- a/src/lib389/lib389/changelog.py
+++ b/src/lib389/lib389/changelog.py
@@ -26,14 +26,14 @@ class Changelog(object):
def list(self, suffix=None, changelogdn=None):
if not changelogdn:
raise InvalidArgumentError("changelog DN is missing")
-
+
base = changelogdn
filtr = "(objectclass=extensibleobject)"
-
+
# now do the effective search
ents = self.conn.search_s(base, ldap.SCOPE_BASE, filtr)
return ents
-
+
def create(self, dbname=DEFAULT_CHANGELOG_DB):
"""Add and return the replication changelog entry.
@@ -56,24 +56,32 @@ class Changelog(object):
except ldap.ALREADY_EXISTS:
self.log.warn("entry %s already exists" % dn)
return(dn)
-
- def delete(self, changelogdn=None):
- raise NotImplemented
-
+
+ def delete(self):
+ '''
+ Delete the changelog entry
+ @raise LDAPError
+ '''
+ try:
+ self.conn.delete_s(DN_CHANGELOG)
+ except ldap.LDAPError, e:
+ self.log.error('Failed to delete the changelog: ' + e.message['desc'])
+ raise ldap.LDAPError
+
def setProperties(self, changelogdn=None, properties=None):
if not changelogdn:
raise InvalidArgumentError("changelog DN is missing")
-
+
ents = self.changelog.list(changelogdn=changelogdn)
if len(ents) != 1:
raise ValueError("Changelog entry not found: %s" % changelogdn)
-
+
# check that the given properties are valid
for prop in properties:
# skip the prefix to add/del value
if not inProperties(prop, CHANGELOG_PROPNAME_TO_ATTRNAME):
raise ValueError("unknown property: %s" % prop)
-
+
# build the MODS
mods = []
for prop in properties:
@@ -85,12 +93,12 @@ class Changelog(object):
op = ldap.MOD_DELETE
else:
op = ldap.MOD_REPLACE
-
+
mods.append((op, REPLICA_PROPNAME_TO_ATTRNAME[val], properties[prop]))
-
+
# that is fine now to apply the MOD
self.conn.modify_s(ents[0].dn, mods)
-
+
def getProperties(self, changelogdn=None, properties=None):
raise NotImplemented
\ No newline at end of file
diff --git a/src/lib389/lib389/properties.py b/src/lib389/lib389/properties.py
index ef3599a2c..bc0da7e3a 100644
--- a/src/lib389/lib389/properties.py
+++ b/src/lib389/lib389/properties.py
@@ -5,9 +5,9 @@ Created on Dec 5, 2013
'''
####################################
-#
+#
# Properties supported by the server
-#
+#
####################################
#
@@ -36,11 +36,11 @@ SER_BACKUP_INST_DIR ='inst-backupdir'
SER_CREATION_SUFFIX ='suffix'
####################################
-#
+#
# Properties supported by the Mapping Tree entries
#
####################################
-
+
# Properties name
MT_STATE = 'state'
MT_BACKEND = 'backend-name'
@@ -77,7 +77,7 @@ MT_PROPNAME_TO_ATTRNAME = {MT_STATE: 'nsslapd-state',
MT_CHAIN_UPDATE: 'nsslapd-distribution-root-update'}
####################################
-#
+#
# Properties supported by the backend
#
####################################
@@ -111,7 +111,7 @@ BACKEND_PROPNAME_TO_ATTRNAME = {BACKEND_SUFFIX: 'nsslapd-suffix',
BACKEND_CHAIN_URLS: 'nsfarmserverurl'}
####################################
-#
+#
# Properties of a replica
#
####################################
@@ -142,7 +142,7 @@ REPLICA_PROPNAME_TO_ATTRNAME = {
REPLICA_FLAGS: 'nsds5flags'}
####################################
-#
+#
# Properties of a changelog
#
####################################
@@ -161,7 +161,7 @@ CHANGELOG_PROPNAME_TO_ATTRNAME = {CHANGELOG_NAME: 'cn',
CHANGELOG_COMPACT_INTV: 'nsslapd-changelogcompactdb-interval',}
####################################
-#
+#
# Properties of an entry
#
####################################
@@ -178,7 +178,7 @@ ENTRY_TYPE_TO_OBJECTCLASS = {ENTRY_TYPE_PERSON: ["top", "person"],
ENTRY_TYPE_INETPERSON: ["top", "person", "inetOrgPerson"]}
####################################
-#
+#
# Properties supported by the replica agreement
#
####################################
@@ -201,6 +201,7 @@ RA_TIMEOUT = 'timeout'
RA_CHANGES = 'changes'
RA_OBJECTCLASS_VALUE = "nsds5replicationagreement"
+RA_WINDOWS_OBJECTCLASS_VALUE = "nsDSWindowsReplicationAgreement"
RA_PROPNAME_TO_ATTRNAME = {RA_NAME: 'cn',
RA_SUFFIX: 'nsds5replicaroot',
@@ -220,7 +221,7 @@ RA_PROPNAME_TO_ATTRNAME = {RA_NAME: 'cn',
RA_CHANGES: 'nsds5replicaChangesSentSinceStartup'}
####################################
-#
+#
# Properties supported by the plugins
#
####################################
@@ -232,13 +233,13 @@ PLUGIN_ENABLE = 'enable'
PLUGINS_OBJECTCLASS_VALUE = "nsSlapdPlugin"
PLUGINS_ENABLE_ON_VALUE = "on"
PLUGINS_ENABLE_OFF_VALUE = "off"
-
+
PLUGIN_PROPNAME_TO_ATTRNAME = {PLUGIN_NAME: 'cn',
PLUGIN_PATH: 'nsslapd-pluginPath',
PLUGIN_ENABLE: 'nsslapd-pluginEnabled'}
####################################
-#
+#
# Properties supported by the index
#
####################################
@@ -251,7 +252,7 @@ INDEX_PROPNAME_TO_ATTRNAME = {INDEX_TYPE: 'nsIndexType',
INDEX_MATCHING_RULE: 'nsMatchingRule'}
####################################
-#
+#
# Properties supported by the tasks
#
####################################
@@ -265,27 +266,27 @@ def rawProperty(prop):
'''
Return the string 'prop' without the heading '+'/'-'
@param prop - string of a property name
-
+
@return property name without heading '+'/'-'
-
+
@raise None
'''
if str(prop).startswith('+') or str(prop).startswith('-'):
return prop[1::]
else:
return prop
-
-
+
+
def inProperties(prop, properties):
'''
Return True if 'prop' is in the 'properties' dictionary
Properties in 'properties' does NOT contain a heading '+'/'-', but 'prop'
may contain heading '+'/'-'
@param prop - string of a property name
- @param properties - dictionary of properties.
-
+ @param properties - dictionary of properties.
+
@return True/False
-
+
@raise None
'''
if rawProperty(prop) in properties:
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index 5357207a8..f49cdc7ee 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -15,9 +15,6 @@ from lib389.properties import *
from lib389.utils import normalizeDN, escapeDNValue
-
-
-
class Replica(object):
proxied_methods = 'search_s getEntry'.split()
@@ -34,24 +31,24 @@ class Replica(object):
"""Return the replica dn of the given suffix."""
mtent = self.conn.mappingtree.list(suffix=suffix)
return ','.join(("cn=replica", mtent.dn))
-
+
@staticmethod
def _valid_role(role):
if role != REPLICAROLE_MASTER and role != REPLICAROLE_HUB and role != REPLICAROLE_CONSUMER:
return False
else:
return True
-
+
@staticmethod
def _valid_rid(role, rid=None):
if role == REPLICAROLE_MASTER:
- if not decimal.Decimal(rid) or (rid <= 0) or (rid >=CONSUMER_REPLICAID):
+ if not decimal.Decimal(rid) or (rid <= 0) or (rid >= CONSUMER_REPLICAID):
return False
else:
if rid and (rid != CONSUMER_REPLICAID):
return False
return True
-
+
@staticmethod
def _set_or_default(attribute, properties, default):
'''
@@ -64,19 +61,19 @@ class Replica(object):
if attribute in properties or add_attribute in properties or del_attribute in properties:
return
properties[attribute] = default
-
+
def create_repl_manager(self, repl_manager_dn=None, repl_manager_pw=None):
'''
Create an entry that will be used to bind as replica manager.
-
+
@param repl_manager_dn - DN of the bind entry. If not provided use the default one
@param repl_manager_pw - Password of the entry. If not provide use the default one
-
+
@return None
-
+
@raise - KeyError if can not find valid values of Bind DN and Pwd
'''
-
+
# check the DN and PW
try:
repl_manager_dn = repl_manager_dn or defaultProperties[REPLICATION_BIND_DN]
@@ -89,7 +86,7 @@ class Replica(object):
if not repl_manager_dn:
self.log.warning("replica_createReplMgr: bind DN not specified")
raise
-
+
# if the replication manager entry already exists, ust return
try:
entries = self.search_s(repl_manager_dn, ldap.SCOPE_BASE, "objectclass=*")
@@ -98,9 +95,9 @@ class Replica(object):
return
except ldap.NO_SUCH_OBJECT:
pass
-
+
# ok it does not exist, create it
- try:
+ try:
attrs = {
'nsIdleTimeout': '0',
'passwordExpirationTime': '20381010000000Z'
@@ -108,76 +105,74 @@ class Replica(object):
self.conn.setupBindDN(repl_manager_dn, repl_manager_pw, attrs)
except ldap.ALREADY_EXISTS:
self.log.warn("User already exists (weird we just checked: %s " % repl_manager_dn)
-
-
+
def list(self, suffix=None, replica_dn=None):
"""
- Return a list of replica entries.
- If 'replica_dn' is specified it returns the related entry.
+ Return a list of replica entries.
+ If 'replica_dn' is specified it returns the related entry.
If 'suffix' is specified it returns the replica that is configured for that 'suffix'.
If both 'replica_dn' and 'suffix' are specified it returns the 'replica_dn' entry.
If none of them are specified, it returns all the replicas
-
+
@param suffix - suffix of a replica
@param replica_dn - DN of a replica
-
+
@return replica entries
-
+
@raise search exceptions: ldap.NO_SUCH_OBJECT, ..
"""
# set base/filtr according to the arguments
if replica_dn:
- base = replica_dn
+ base = replica_dn
filtr = "(objectclass=%s)" % REPLICA_OBJECTCLASS_VALUE
elif suffix:
- base = DN_MAPPING_TREE
- filtr = "(&(objectclass=%s)(%s=%s))" % (REPLICA_OBJECTCLASS_VALUE,
+ base = DN_MAPPING_TREE
+ filtr = "(&(objectclass=%s)(%s=%s))" % (REPLICA_OBJECTCLASS_VALUE,
REPLICA_PROPNAME_TO_ATTRNAME[REPLICA_SUFFIX], suffix)
else:
- base = DN_MAPPING_TREE
+ base = DN_MAPPING_TREE
filtr = "(objectclass=%s)" % REPLICA_OBJECTCLASS_VALUE
-
+
# now do the effective search
ents = self.conn.search_s(base, ldap.SCOPE_SUBTREE, filtr)
return ents
-
def setProperties(self, suffix=None, replica_dn=None, replica_entry=None, properties=None):
'''
Set the properties of the replica. If an 'replica_entry' (Entry) is provided, it updates the entry, else
it updates the entry on the server. If the 'replica_dn' is provided it retrieves the entry using it, else
it retrieve the replica using the 'suffix'.
-
+
@param suffix : suffix stored in that replica (online update)
@param replica_dn: DN of the replica (online update)
@param replica_entry: Entry of a replica (offline update)
@param properties: dictionary of properties
Supported properties are:
REPLICA_SUFFIX
- REPLICA_ID
- REPLICA_TYPE
- REPLICA_LEGACY_CONS
- REPLICA_BINDDN
- REPLICA_PURGE_INTERVAL
+ REPLICA_ID
+ REPLICA_TYPE
+ REPLICA_LEGACY_CONS
+ REPLICA_BINDDN
+ REPLICA_PURGE_INTERVAL
REPLICA_PURGE_DELAY
REPLICA_PRECISE_PURGING
- REPLICA_REFERRAL
- REPLICA_FLAGS
-
+ REPLICA_REFERRAL
+ REPLICA_FLAGS
+
@return None
-
+
@raise ValueError: if unknown properties
ValueError: if invalid replica_entry
- ValueError: if replica_dn or suffix are not associated to a replica
+ ValueError: if replica_dn or suffix are not associated to a replica
InvalidArgumentError: If missing mandatory parameter
-
+
'''
# No properties provided
if len(properties) == 0:
return
-
+
# check that the given properties are valid
for prop in properties:
# skip the prefix to add/del value
@@ -185,16 +180,16 @@ class Replica(object):
raise ValueError("unknown property: %s" % prop)
else:
self.log.debug("setProperties: %s:%s" % (prop, properties[prop]))
-
+
# At least we need to have suffix/replica_dn/replica_entry
if not suffix and not replica_dn and not replica_entry:
raise InvalidArgumentError("suffix and replica_dn and replica_entry are missing")
-
+
# the caller provides a set of properties to set into a replica entry
if replica_entry:
if not isinstance(replica_entry, Entry):
raise ValueError("invalid instance of the replica_entry")
-
+
# that is fine, now set the values
for prop in properties:
val = rawProperty(prop)
@@ -203,8 +198,8 @@ class Replica(object):
replica_entry.update({REPLICA_PROPNAME_TO_ATTRNAME[val]: properties[prop]})
return
-
- # If it provides the suffix or the replicaDN, replica.list will
+
+ # If it provides the suffix or the replicaDN, replica.list will
# return the appropriate entry
ents = self.conn.replica.list(suffix=suffix, replica_dn=replica_dn)
if len(ents) != 1:
@@ -213,7 +208,6 @@ class Replica(object):
else:
raise ValueError("invalid suffix: %s" % suffix)
-
# build the MODS
mods = []
for prop in properties:
@@ -225,12 +219,11 @@ class Replica(object):
op = ldap.MOD_DELETE
else:
op = ldap.MOD_REPLACE
-
+
mods.append((op, REPLICA_PROPNAME_TO_ATTRNAME[val], properties[prop]))
-
+
# that is fine now to apply the MOD
self.conn.modify_s(ents[0].dn, mods)
-
def getProperties(self, suffix=None, replica_dn=None, replica_entry=None, properties=None):
raise NotImplementedError
@@ -238,28 +231,28 @@ class Replica(object):
def create(self, suffix=None, role=None, rid=None, args=None):
"""
Create a replica entry on an existing suffix.
-
+
@param suffix - dn of suffix
@param role - REPLICAROLE_MASTER, REPLICAROLE_HUB or REPLICAROLE_CONSUMER
- @param rid - number that identify the supplier replica (role=REPLICAROLE_MASTER) in the topology.
- For hub/consumer (role=REPLICAROLE_HUB or REPLICAROLE_CONSUMER), rid value is not used.
+ @param rid - number that identify the supplier replica (role=REPLICAROLE_MASTER) in the topology.
+ For hub/consumer (role=REPLICAROLE_HUB or REPLICAROLE_CONSUMER), rid value is not used.
This parameter is mandatory for supplier.
@param args - dictionnary of initial replica's properties
Supported properties are:
- REPLICA_SUFFIX
- REPLICA_ID
- REPLICA_TYPE
+ REPLICA_SUFFIX
+ REPLICA_ID
+ REPLICA_TYPE
REPLICA_LEGACY_CONS ['off']
REPLICA_BINDDN [defaultProperties[REPLICATION_BIND_DN]]
- REPLICA_PURGE_INTERVAL
+ REPLICA_PURGE_INTERVAL
REPLICA_PURGE_DELAY
REPLICA_PRECISE_PURGING
REPLICA_REFERRAL
REPLICA_FLAGS
@return replica DN
-
+
@raise InvalidArgumentError - if missing mandatory arguments
ValueError - argument with invalid value
@@ -272,31 +265,31 @@ class Replica(object):
if not Replica._valid_role(role):
self.log.fatal("enableReplication: replica role invalid (%s) " % role)
raise ValueError("invalid role: %s" % role)
-
+
# check the validity of 'rid'
if not Replica._valid_rid(role, rid=rid):
self.log.fatal("Replica.create: replica role is master but 'rid' is missing or invalid value")
raise InvalidArgumentError("rid missing or invalid value")
-
+
# check the validity of the suffix
if not suffix:
self.log.fatal("Replica.create: suffix is missing")
raise InvalidArgumentError("suffix missing")
else:
nsuffix = normalizeDN(suffix)
-
+
# role is fine, set the replica type
if role == REPLICAROLE_MASTER:
rtype = REPLICA_RDWR_TYPE
else:
rtype = REPLICA_RDONLY_TYPE
-
+
# Set the properties provided as mandatory parameter
# The attribute name is not prefixed '+'/'-' => ldap.MOD_REPLACE
properties = {REPLICA_SUFFIX: nsuffix,
REPLICA_ID: str(rid),
REPLICA_TYPE: str(rtype)}
-
+
# If the properties in args are valid
# add them to the 'properties' dictionary
# The attribute name may be prefixed '+'/'-' => keep MOD type as provided in args
@@ -305,15 +298,15 @@ class Replica(object):
if not inProperties(prop, REPLICA_PROPNAME_TO_ATTRNAME):
raise ValueError("unknown property: %s" % prop)
properties[prop] = args[prop]
-
+
# Now set default values of unset properties
Replica._set_or_default(REPLICA_LEGACY_CONS, properties, 'off')
- Replica._set_or_default(REPLICA_BINDDN, properties, [defaultProperties[REPLICATION_BIND_DN]])
+ Replica._set_or_default(REPLICA_BINDDN, properties, [defaultProperties[REPLICATION_BIND_DN]])
if role != REPLICAROLE_CONSUMER:
properties[REPLICA_FLAGS] = "1"
-
- # create replica entry in mapping-tree
+
+ # create replica entry in mapping-tree
mtents = self.conn.mappingtree.list(suffix=nsuffix)
mtent = mtents[0]
dn_replica = ','.join((RDN_REPLICA, mtent.dn))
@@ -325,7 +318,7 @@ class Replica(object):
return dn_replica
except ldap.NO_SUCH_OBJECT:
entry = None
-
+
#
# Now create the replica entry
#
@@ -339,85 +332,132 @@ class Replica(object):
self.conn.suffixes[nsuffix] = {'dn': dn_replica, 'type': rtype}
return dn_replica
-
- def delete(self, suffix=None):
+
+ def deleteAgreements(self, suffix=None):
+ '''
+ Delete all the agreements for the suffix
'''
- Delete a replica related to the provided suffix.
- If this replica role was REPLICAROLE_HUB or REPLICAROLE_MASTER, it also deletes the changelog
- associated to that replica.
+ # check the validity of the suffix
+ if not suffix:
+ self.log.fatal("disableReplication: suffix is missing")
+ raise InvalidArgumentError("suffix missing")
+ else:
+ nsuffix = normalizeDN(suffix)
+
+ # Build the replica config DN
+ mtents = self.conn.mappingtree.list(suffix=nsuffix)
+ mtent = mtents[0]
+ dn_replica = ','.join((RDN_REPLICA, mtent.dn))
+
+ # Delete the agreements
+ try:
+ agmts = self.conn.agreement.list(suffix=suffix)
+ for agmt in agmts:
+ try:
+ self.conn.delete_s(agmt.dn)
+ except ldap.LDAPError, e:
+ self.log.fatal('Failed to delete replica agreement (%s), error: %s' %
+ (admt.dn, e.message('desc')))
+ raise ldap.LDAPError
+ except ldap.LDAPError, e:
+ self.log.fatal('Failed to search for replication agreements under (%s), error: %s' %
+ (dn_replica, e.message('desc')))
+ raise ldap.LDAPError
+
+ def disableReplication(self, suffix=None):
+ '''
+ Delete a replica related to the provided suffix.
+ If this replica role was REPLICAROLE_HUB or REPLICAROLE_MASTER, it also deletes the changelog
+ associated to that replica.
If it exists some replication agreement below that replica, they are deleted.
-
- @param suffix - dn of suffix
+ @param suffix - dn of suffix
@return None
-
- @raise ldap.NO_SUCH_OBJECT - if the suffix has no replica
- InvalidArgumentError - if suffix is missing
+ @raise InvalidArgumentError - if suffix is missing
+ ldap.LDAPError - for all other update failures
'''
+
# check the validity of the suffix
if not suffix:
- self.log.fatal("Replica.delete: suffix is missing")
+ self.log.fatal("disableReplication: suffix is missing")
raise InvalidArgumentError("suffix missing")
else:
nsuffix = normalizeDN(suffix)
-
- # check the replica exists
+
+ # Build the replica config DN
mtents = self.conn.mappingtree.list(suffix=nsuffix)
mtent = mtents[0]
dn_replica = ','.join((RDN_REPLICA, mtent.dn))
+
+ # Delete the agreements
try:
- entry = self.conn.getEntry(dn_replica, ldap.SCOPE_BASE)
- except ldap.NO_SUCH_OBJECT:
- raise
-
- raise NotImplementedError()
-
+ self.deleteAgreements(nsuffix)
+ except ldap.LDAPError, e:
+ self.log.fatal('Failed to delete replica agreements!')
+ raise ldap.LDAPError
+
+ # Delete the replica
+ try:
+ self.conn.delete_s(dn_replica)
+ except ldap.LDAPError, e:
+ self.log.fatal('Failed to delete replica configuration (%s), error: %s' % (dn_replica, e.message('desc')))
+ raise ldap.LDAPError
+
+ # Delete the changelog
+ try:
+ self.conn.changelog.delete()
+ except ldap.LDAPError, e:
+ self.log.error('Failed to delete changelog: ' + e.message['desc'])
+ raise ldap.LDAPError
+
def enableReplication(self, suffix=None, role=None, replicaId=CONSUMER_REPLICAID, binddn=None):
if not suffix:
self.log.fatal("enableReplication: suffix not specified")
raise ValueError("suffix missing")
-
+
if not role:
self.log.fatal("enableReplication: replica role not specify (REPLICAROLE_*)")
raise ValueError("role missing")
-
- #
+
+ #
# Check the validity of the parameters
#
-
+
# First role and replicaID
if role != REPLICAROLE_MASTER and role != REPLICAROLE_HUB and role != REPLICAROLE_CONSUMER:
self.log.fatal("enableReplication: replica role invalid (%s) " % role)
raise ValueError("invalid role: %s" % role)
-
+
# master
replica_type = REPLICA_RDWR_TYPE
else:
# hub or consumer
replica_type = REPLICA_RDONLY_TYPE
-
+
if role == REPLICAROLE_MASTER:
# check the replicaId [1..CONSUMER_REPLICAID[
- if not decimal.Decimal(replicaId) or (replicaId <= 0) or (replicaId >=CONSUMER_REPLICAID):
+ if not decimal.Decimal(replicaId) or (replicaId <= 0) or (replicaId >= CONSUMER_REPLICAID):
self.log.fatal("enableReplication: invalid replicaId (%s) for a RW replica" % replicaId)
raise ValueError("invalid replicaId %d (expected [1..CONSUMER_REPLICAID[" % replicaId)
elif replicaId != CONSUMER_REPLICAID:
# check the replicaId is CONSUMER_REPLICAID
- self.log.fatal("enableReplication: invalid replicaId (%s) for a Read replica (expected %d)" % (replicaId, CONSUMER_REPLICAID))
+ self.log.fatal("enableReplication: invalid replicaId (%s) for a Read replica (expected %d)" %
+ (replicaId, CONSUMER_REPLICAID))
raise ValueError("invalid replicaId: %d for HUB/CONSUMER replicaId is CONSUMER_REPLICAID" % replicaId)
-
+
# Now check we have a suffix
entries_backend = self.conn.backend.list(suffix=suffix)
if not entries_backend:
self.log.fatal("enableReplication: enable to retrieve the backend for %s" % suffix)
raise ValueError("no backend for suffix %s" % suffix)
-
+
ent = entries_backend[0]
if normalizeDN(suffix) != normalizeDN(ent.getValue('nsslapd-suffix')):
- self.log.warning("enableReplication: suffix (%s) and backend suffix (%s) differs" % (suffix, entries_backend[0].nsslapd-suffix))
+ self.log.warning("enableReplication: suffix (%s) and backend suffix (%s) differs" %
+ (suffix, entries_backend[0].nsslapd - suffix))
pass
-
+
# Now prepare the bindDN property
if not binddn:
binddn = defaultProperties.get(REPLICATION_BIND_DN, None)
@@ -427,29 +467,22 @@ class Replica(object):
# property will be set
self.log.warning("enableReplication: binddn not provided and default value unavailable")
pass
-
+
# Now do the effectif job
# First add the changelog if master/hub
if (role == REPLICAROLE_MASTER) or (role == REPLICAROLE_HUB):
self.conn.changelog.create()
-
+
# Second create the default replica manager entry if it does not exist
# it should not be called from here but for the moment I am unsure when to create it elsewhere
self.conn.replica.create_repl_manager()
-
+
# then enable replication
properties = {REPLICA_BINDDN: [binddn]}
ret = self.conn.replica.create(suffix=suffix, role=role, rid=replicaId, args=properties)
-
+
return ret
-
- def disableReplication(self, suffix=None):
- if not suffix:
- self.log.fatal("enableReplication: suffix not specified")
- raise ValueError("suffix missing")
-
- raise NotImplementedError
-
+
def check_init(self, agmtdn):
"""returns tuple - first element is done/not done, 2nd is no error/has error
@param agmtdn - the agreement dn
@@ -517,10 +550,9 @@ class Replica(object):
mod = [(ldap.MOD_ADD, 'nsds5BeginReplicaRefresh', 'start')]
self.conn.modify_s(agmtdn, mod)
-
def keep_in_sync(self, agmtdn):
"""
- @param agmtdn -
+ @param agmtdn -
"""
self.log.info("Setting agreement for continuous replication")
raise NotImplementedError("Check nsds5replicaupdateschedule before writing!")
@@ -551,5 +583,5 @@ class Replica(object):
raise NoSuchEntryError("RUV not found: suffix: %r" % suffix)
-
+
diff --git a/src/lib389/lib389/tasks.py b/src/lib389/lib389/tasks.py
index a1ed3685e..0ec61ba34 100644
--- a/src/lib389/lib389/tasks.py
+++ b/src/lib389/lib389/tasks.py
@@ -776,25 +776,28 @@ class Tasks(object):
self.log.info("Sysconfig Reload task (%s) completed successfully" % (cn))
return exitCode
-
- def cleanAllRUV(self, replicaid=None, force=None, args=None):
+ def cleanAllRUV(self, suffix=None, replicaid=None, force=None, args=None):
'''
@param replicaid - The replica ID to remove/clean
@param force - True/False - Clean all the replicas, even if one is down
@param args - is a dictionary that contains modifier of the task
wait: True/[False] - If True, waits for the completion of the task before to return
- @return exit code
+ @return tuple (task dn, and the exit code)
@raise ValueError: If missing replicaid
'''
if not replicaid:
raise ValueError("Missing required paramter: replicaid")
+ if not suffix:
+ raise ValueError("Missing required paramter: suffix")
+
cn = 'task-' + time.strftime("%m%d%Y_%H%M%S", time.localtime())
dn = ('cn=%s,cn=cleanallruv,cn=tasks,cn=config' % cn)
entry = Entry(dn)
entry.setValues('objectclass', 'top', 'extensibleObject')
entry.setValues('cn', cn)
+ entry.setValues('replica-base-dn', suffix)
entry.setValues('replica-id', replicaid)
if force:
entry.setValues('replica-force-cleaning', 'yes')
@@ -803,7 +806,7 @@ class Tasks(object):
self.conn.add_s(entry)
except ldap.ALREADY_EXISTS:
self.log.error("Fail to add cleanAllRUV task")
- return -1
+ return (dn, -1)
exitCode = 0
if args and args.get(TASK_WAIT, False):
@@ -813,36 +816,41 @@ class Tasks(object):
self.log.error("Error: cleanAllRUV task (%s) exited with %d" % (cn, exitCode))
else:
self.log.info("cleanAllRUV task (%s) completed successfully" % (cn))
- return exitCode
+ return (dn, exitCode)
- def abortCleanAllRUV(self, replicaid=None, certify=None, args=None):
+ def abortCleanAllRUV(self, suffix=None, replicaid=None, certify=None, args=None):
'''
@param replicaid - The replica ID to remove/clean
@param certify - True/False - Certify the task was aborted on all the replicas
@param args - is a dictionary that contains modifier of the task
wait: True/[False] - If True, waits for the completion of the task before to return
- @return exit code
+ @return tuple (task dn, and the exit code)
@raise ValueError: If missing replicaid
'''
if not replicaid:
raise ValueError("Missing required paramter: replicaid")
+ if not suffix:
+ raise ValueError("Missing required paramter: suffix")
cn = 'task-' + time.strftime("%m%d%Y_%H%M%S", time.localtime())
dn = ('cn=%s,cn=abort cleanallruv,cn=tasks,cn=config' % cn)
entry = Entry(dn)
entry.setValues('objectclass', 'top', 'extensibleObject')
entry.setValues('cn', cn)
+ entry.setValues('replica-base-dn', suffix)
entry.setValues('replica-id', replicaid)
if certify:
- entry.setValues('replica-certifyall', 'yes')
+ entry.setValues('replica-certify-all', 'yes')
+ else:
+ entry.setValues('replica-certify-all', 'no')
# start the task and possibly wait for task completion
try:
self.conn.add_s(entry)
except ldap.ALREADY_EXISTS:
self.log.error("Fail to add Abort cleanAllRUV task")
- return -1
+ return (dn, -1)
exitCode = 0
if args and args.get(TASK_WAIT, False):
@@ -852,7 +860,7 @@ class Tasks(object):
self.log.error("Error: Abort cleanAllRUV task (%s) exited with %d" % (cn, exitCode))
else:
self.log.info("Abort cleanAllRUV task (%s) completed successfully" % (cn))
- return exitCode
+ return (dn, exitCode)
def upgradeDB(self, nsArchiveDir=None, nsDatabaseType=None, nsForceToReindex=None, args=None):
'''
diff --git a/src/lib389/lib389/tools.py b/src/lib389/lib389/tools.py
index c73dec460..738e4067e 100644
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -882,7 +882,8 @@ class DirSrvTools(object):
assert(words[1] == expectedHost)
done = True
except AssertionError:
- raise AssertionError("Error: /etc/hosts should contains 'localhost.localdomain' as first host for %s" % (expectedHost, loopbackIpPattern))
+ raise AssertionError("Error: /etc/hosts should contains 'localhost.localdomain' as first host for %s" %
+ (expectedHost, loopbackIpPattern))
@staticmethod
def runUpgrade(prefix, online=True):
@@ -951,6 +952,21 @@ class DirSrvTools(object):
log.fatal('runUpgrade failed!')
assert False
+ @staticmethod
+ def searchFile(filename, pattern):
+ # Open the file and read it line by line
+ found = False
+ try:
+ myfile = open(filename)
+ for line in myfile:
+ if re.search(pattern, line):
+ found = True
+ myfile.close()
+ except IOError as e:
+ log.error('Problem opening/searching file (%s): I/O error(%d): %s' % (filename, e.errno, e.strerror))
+
+ return found
+
class MockDirSrv(object):
host = 'localhost'
@@ -969,3 +985,5 @@ class MockDirSrv(object):
return 'ldaps://%s:%s' % (self.host, self.sslport)
else:
return 'ldap://%s:%s' % (self.host, self.port)
+
+
| 0 |
c860c5c441ca7f6c254faa99880cd6db5e1e4446
|
389ds/389-ds-base
|
Bug 711679 - unresponsive LDAP service when deleting vlv on replica
https://bugzilla.redhat.com/show_bug.cgi?id=711679
Resolves: bug 711679
Bug Description: unresponsive LDAP service when deleting vlv on replica
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: The original fix introduced a memory leak found by
Coverity. This fixes the leak.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit c860c5c441ca7f6c254faa99880cd6db5e1e4446
Author: Rich Megginson <[email protected]>
Date: Mon Jun 20 19:39:54 2011 -0600
Bug 711679 - unresponsive LDAP service when deleting vlv on replica
https://bugzilla.redhat.com/show_bug.cgi?id=711679
Resolves: bug 711679
Bug Description: unresponsive LDAP service when deleting vlv on replica
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: The original fix introduced a memory leak found by
Coverity. This fixes the leak.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
index 063b3a1a2..c9c300422 100644
--- a/ldap/servers/slapd/back-ldbm/vlv.c
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
@@ -116,6 +116,7 @@ int vlv_AddIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e
vlvIndex_init(newVlvIndex, be, parent, entryBefore);
vlvSearch_addIndex(parent, newVlvIndex);
}
+ slapi_ch_free_string(&name);
}
PR_RWLock_Unlock(be->vlvSearchList_lock);
slapi_sdn_done(&parentdn);
| 0 |
3276d926e61eac681c48172d1780a4650253254d
|
389ds/389-ds-base
|
Add additional standard syntaxes.
This adds support for the following standard syntaxes, complete
with validation functions:
Bit String
Delivery Method
Enhanced Guide
Facsimile Telephone Number
Fax
Guide
Name And Optional UID
Printable String
Teletex Terminal Identifier
Telex Number
This patch does not change the schema to use any of these syntaxes
yet. That will come when we update to the current versions of the
standard schema from the LDAP RFCs.
I also fixed an error in makefile.am where Setup.pm was listed
twice in perl_DATA.
|
commit 3276d926e61eac681c48172d1780a4650253254d
Author: Nathan Kinder <[email protected]>
Date: Tue Jul 14 14:25:05 2009 -0700
Add additional standard syntaxes.
This adds support for the following standard syntaxes, complete
with validation functions:
Bit String
Delivery Method
Enhanced Guide
Facsimile Telephone Number
Fax
Guide
Name And Optional UID
Printable String
Teletex Terminal Identifier
Telex Number
This patch does not change the schema to use any of these syntaxes
yet. That will come when we update to the current versions of the
standard schema from the LDAP RFCs.
I also fixed an error in makefile.am where Setup.pm was listed
twice in perl_DATA.
diff --git a/Makefile.am b/Makefile.am
index dd7965fcd..65977d9d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -277,7 +277,6 @@ perl_DATA = ldap/admin/src/scripts/SetupLog.pm \
ldap/admin/src/scripts/DialogManager.pm \
ldap/admin/src/scripts/Dialog.pm \
ldap/admin/src/scripts/DSDialogs.pm \
- ldap/admin/src/scripts/Setup.pm \
ldap/admin/src/scripts/Migration.pm \
ldap/admin/src/scripts/DSMigration.pm \
ldap/admin/src/scripts/FileConn.pm \
@@ -942,16 +941,23 @@ libstatechange_plugin_la_LDFLAGS = -avoid-version
# libsyntax-plugin
#------------------------
libsyntax_plugin_la_SOURCES = ldap/servers/plugins/syntaxes/bin.c \
+ ldap/servers/plugins/syntaxes/bitstring.c \
ldap/servers/plugins/syntaxes/ces.c \
ldap/servers/plugins/syntaxes/cis.c \
ldap/servers/plugins/syntaxes/debug.c \
ldap/servers/plugins/syntaxes/dn.c \
+ ldap/servers/plugins/syntaxes/deliverymethod.c \
+ ldap/servers/plugins/syntaxes/facsimile.c \
+ ldap/servers/plugins/syntaxes/guide.c \
ldap/servers/plugins/syntaxes/int.c \
+ ldap/servers/plugins/syntaxes/nameoptuid.c \
ldap/servers/plugins/syntaxes/numericstring.c \
ldap/servers/plugins/syntaxes/phonetic.c \
ldap/servers/plugins/syntaxes/sicis.c \
ldap/servers/plugins/syntaxes/string.c \
ldap/servers/plugins/syntaxes/tel.c \
+ ldap/servers/plugins/syntaxes/telex.c \
+ ldap/servers/plugins/syntaxes/teletex.c \
ldap/servers/plugins/syntaxes/validate.c \
ldap/servers/plugins/syntaxes/validate_task.c \
ldap/servers/plugins/syntaxes/value.c
diff --git a/Makefile.in b/Makefile.in
index c2a2ba557..00c5fae4e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -664,16 +664,23 @@ libstatechange_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
libsyntax_plugin_la_LIBADD =
am_libsyntax_plugin_la_OBJECTS = \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-cis.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-debug.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-phonetic.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-sicis.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-string.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo \
+ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate_task.lo \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-value.lo
@@ -1363,7 +1370,6 @@ perl_DATA = ldap/admin/src/scripts/SetupLog.pm \
ldap/admin/src/scripts/DialogManager.pm \
ldap/admin/src/scripts/Dialog.pm \
ldap/admin/src/scripts/DSDialogs.pm \
- ldap/admin/src/scripts/Setup.pm \
ldap/admin/src/scripts/Migration.pm \
ldap/admin/src/scripts/DSMigration.pm \
ldap/admin/src/scripts/FileConn.pm \
@@ -1967,16 +1973,23 @@ libstatechange_plugin_la_LDFLAGS = -avoid-version
# libsyntax-plugin
#------------------------
libsyntax_plugin_la_SOURCES = ldap/servers/plugins/syntaxes/bin.c \
+ ldap/servers/plugins/syntaxes/bitstring.c \
ldap/servers/plugins/syntaxes/ces.c \
ldap/servers/plugins/syntaxes/cis.c \
ldap/servers/plugins/syntaxes/debug.c \
ldap/servers/plugins/syntaxes/dn.c \
+ ldap/servers/plugins/syntaxes/deliverymethod.c \
+ ldap/servers/plugins/syntaxes/facsimile.c \
+ ldap/servers/plugins/syntaxes/guide.c \
ldap/servers/plugins/syntaxes/int.c \
+ ldap/servers/plugins/syntaxes/nameoptuid.c \
ldap/servers/plugins/syntaxes/numericstring.c \
ldap/servers/plugins/syntaxes/phonetic.c \
ldap/servers/plugins/syntaxes/sicis.c \
ldap/servers/plugins/syntaxes/string.c \
ldap/servers/plugins/syntaxes/tel.c \
+ ldap/servers/plugins/syntaxes/telex.c \
+ ldap/servers/plugins/syntaxes/teletex.c \
ldap/servers/plugins/syntaxes/validate.c \
ldap/servers/plugins/syntaxes/validate_task.c \
ldap/servers/plugins/syntaxes/value.c
@@ -3669,6 +3682,9 @@ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp):
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
@@ -3681,9 +3697,21 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-debug.lo: \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
@@ -3699,6 +3727,12 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-string.lo: \
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo: \
+ ldap/servers/plugins/syntaxes/$(am__dirstamp) \
+ ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo: \
ldap/servers/plugins/syntaxes/$(am__dirstamp) \
ldap/servers/plugins/syntaxes/$(DEPDIR)/$(am__dirstamp)
@@ -4403,16 +4437,26 @@ mostlyclean-compile:
-rm -f ldap/servers/plugins/statechange/libstatechange_plugin_la-statechange.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-cis.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-cis.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-debug.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-debug.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-phonetic.$(OBJEXT)
@@ -4423,6 +4467,10 @@ mostlyclean-compile:
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-string.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.$(OBJEXT)
+ -rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.$(OBJEXT)
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo
-rm -f ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate_task.$(OBJEXT)
@@ -5071,16 +5119,23 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/shared/$(DEPDIR)/libattr_unique_plugin_la-utils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/statechange/$(DEPDIR)/libstatechange_plugin_la-statechange.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bitstring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-ces.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-cis.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-deliverymethod.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-dn.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-facsimile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-guide.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-int.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-nameoptuid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-numericstring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-phonetic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-sicis.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-string.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-tel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-teletex.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-telex.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-validate.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-validate_task.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-value.Plo@am__quote@
@@ -7714,6 +7769,13 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.lo: ldap/servers/plugins/s
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bin.lo `test -f 'ldap/servers/plugins/syntaxes/bin.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/bin.c
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo: ldap/servers/plugins/syntaxes/bitstring.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bitstring.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo `test -f 'ldap/servers/plugins/syntaxes/bitstring.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/bitstring.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bitstring.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-bitstring.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/bitstring.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-bitstring.lo `test -f 'ldap/servers/plugins/syntaxes/bitstring.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/bitstring.c
+
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo: ldap/servers/plugins/syntaxes/ces.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-ces.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-ces.lo `test -f 'ldap/servers/plugins/syntaxes/ces.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/ces.c
@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-ces.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-ces.Plo
@@ -7742,6 +7804,27 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.lo: ldap/servers/plugins/sy
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-dn.lo `test -f 'ldap/servers/plugins/syntaxes/dn.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/dn.c
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo: ldap/servers/plugins/syntaxes/deliverymethod.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-deliverymethod.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo `test -f 'ldap/servers/plugins/syntaxes/deliverymethod.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/deliverymethod.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-deliverymethod.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-deliverymethod.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/deliverymethod.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-deliverymethod.lo `test -f 'ldap/servers/plugins/syntaxes/deliverymethod.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/deliverymethod.c
+
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo: ldap/servers/plugins/syntaxes/facsimile.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-facsimile.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo `test -f 'ldap/servers/plugins/syntaxes/facsimile.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/facsimile.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-facsimile.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-facsimile.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/facsimile.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-facsimile.lo `test -f 'ldap/servers/plugins/syntaxes/facsimile.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/facsimile.c
+
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo: ldap/servers/plugins/syntaxes/guide.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-guide.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo `test -f 'ldap/servers/plugins/syntaxes/guide.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/guide.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-guide.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-guide.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/guide.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-guide.lo `test -f 'ldap/servers/plugins/syntaxes/guide.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/guide.c
+
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo: ldap/servers/plugins/syntaxes/int.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-int.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo `test -f 'ldap/servers/plugins/syntaxes/int.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/int.c
@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-int.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-int.Plo
@@ -7749,6 +7832,13 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo: ldap/servers/plugins/s
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-int.lo `test -f 'ldap/servers/plugins/syntaxes/int.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/int.c
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo: ldap/servers/plugins/syntaxes/nameoptuid.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-nameoptuid.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo `test -f 'ldap/servers/plugins/syntaxes/nameoptuid.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/nameoptuid.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-nameoptuid.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-nameoptuid.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/nameoptuid.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-nameoptuid.lo `test -f 'ldap/servers/plugins/syntaxes/nameoptuid.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/nameoptuid.c
+
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo: ldap/servers/plugins/syntaxes/numericstring.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-numericstring.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-numericstring.lo `test -f 'ldap/servers/plugins/syntaxes/numericstring.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/numericstring.c
@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-numericstring.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-numericstring.Plo
@@ -7784,6 +7874,20 @@ ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.lo: ldap/servers/plugins/s
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-tel.lo `test -f 'ldap/servers/plugins/syntaxes/tel.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/tel.c
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo: ldap/servers/plugins/syntaxes/telex.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-telex.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo `test -f 'ldap/servers/plugins/syntaxes/telex.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/telex.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-telex.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-telex.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/telex.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-telex.lo `test -f 'ldap/servers/plugins/syntaxes/telex.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/telex.c
+
+ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo: ldap/servers/plugins/syntaxes/teletex.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-teletex.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo `test -f 'ldap/servers/plugins/syntaxes/teletex.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/teletex.c
+@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-teletex.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-teletex.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ldap/servers/plugins/syntaxes/teletex.c' object='ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-teletex.lo `test -f 'ldap/servers/plugins/syntaxes/teletex.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/teletex.c
+
ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo: ldap/servers/plugins/syntaxes/validate.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsyntax_plugin_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo -MD -MP -MF ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-validate.Tpo -c -o ldap/servers/plugins/syntaxes/libsyntax_plugin_la-validate.lo `test -f 'ldap/servers/plugins/syntaxes/validate.c' || echo '$(srcdir)/'`ldap/servers/plugins/syntaxes/validate.c
@am__fastdepCC_TRUE@ mv -f ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-validate.Tpo ldap/servers/plugins/syntaxes/$(DEPDIR)/libsyntax_plugin_la-validate.Plo
diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in
index 2694f0f10..d0e292784 100644
--- a/ldap/ldif/template-dse.ldif.in
+++ b/ldap/ldif/template-dse.ldif.in
@@ -244,6 +244,16 @@ nsslapd-plugininitfunc: bin_init
nsslapd-plugintype: syntax
nsslapd-pluginenabled: on
+dn: cn=Bit String Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Bit String
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: bitstring_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
dn: cn=Octet String Syntax,cn=plugins,cn=config
objectclass: top
objectclass: nsSlapdPlugin
@@ -284,6 +294,76 @@ nsslapd-plugininitfunc: tel_init
nsslapd-plugintype: syntax
nsslapd-pluginenabled: on
+dn: cn=Telex Number Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Telex Number Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: telex_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Teletex Terminal Identifier Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Teletex Terminal Identifier Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: teletex_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Enhanced Guide Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Enhanced Guide Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: enhancedguide_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Facsimile Telephone Number Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Facsimile Telephone Number Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: facsimile_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Fax Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Fax Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: fax_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Guide Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Guide Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: guide_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
+dn: cn=Delivery Method Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Delivery Method Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: delivery_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
dn: cn=Integer Syntax,cn=plugins,cn=config
objectclass: top
objectclass: nsSlapdPlugin
@@ -304,6 +384,16 @@ nsslapd-plugininitfunc: dn_init
nsslapd-plugintype: syntax
nsslapd-pluginenabled: on
+dn: cn=Name And Optional UID Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Name And Optional UID Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: nameoptuid_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
dn: cn=OID Syntax,cn=plugins,cn=config
objectclass: top
objectclass: nsSlapdPlugin
@@ -364,6 +454,16 @@ nsslapd-plugininitfunc: numstr_init
nsslapd-plugintype: syntax
nsslapd-pluginenabled: on
+dn: cn=Printable String Syntax,cn=plugins,cn=config
+objectclass: top
+objectclass: nsSlapdPlugin
+objectclass: extensibleObject
+cn: Printable String Syntax
+nsslapd-pluginpath: libsyntax-plugin
+nsslapd-plugininitfunc: printable_init
+nsslapd-plugintype: syntax
+nsslapd-pluginenabled: on
+
dn: cn=State Change Plugin,cn=plugins,cn=config
objectclass: top
objectclass: nsSlapdPlugin
diff --git a/ldap/servers/plugins/syntaxes/bin.c b/ldap/servers/plugins/syntaxes/bin.c
index 2d0b6f8aa..be4235822 100644
--- a/ldap/servers/plugins/syntaxes/bin.c
+++ b/ldap/servers/plugins/syntaxes/bin.c
@@ -43,7 +43,8 @@
/* bin.c - bin syntax routines */
/*
- * This file actually implements three syntax plugins: OctetString, JPEG, and Binary.
+ * This file actually implements four syntax plugins: OctetString, JPEG,
+ * Fax, and Binary.
*/
#include <stdio.h>
@@ -59,11 +60,11 @@ static int bin_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *bval,
Slapi_Value ***ivals, int ftype );
/*
- * Attribute syntaxes. We treat all of these the same for now, even though
- * the specifications (e.g., RFC 2252) impose various constraints on the
- * the format for each of these.
- *
- * Note: the first name is the official one from RFC 2252.
+ * Attribute syntaxes. We treat all of these the same since the
+ * LDAP-specific encoding for all of them are simply strings of octets
+ * with no real content restrictions (even though the content is supposed
+ * to represent something specific). For this reason, we do no
+ * validation of the values for these syntaxes.
*/
static char *bin_names[] = { "Binary", "bin", BINARY_SYNTAX_OID, 0 };
@@ -71,6 +72,8 @@ static char *octetstring_names[] = { "OctetString", OCTETSTRING_SYNTAX_OID, 0 };
static char *jpeg_names[] = { "JPEG", JPEG_SYNTAX_OID, 0 };
+static char *fax_names[] = { "FAX", FAX_SYNTAX_OID, 0 };
+
/* This syntax has "gone away" in RFC 4517, however we still use it for
* a number of attributes in our default schema. We should try to eliminate
@@ -90,6 +93,10 @@ static Slapi_PluginDesc jpeg_pdesc = {
"JPEG attribute syntax plugin"
};
+static Slapi_PluginDesc fax_pdesc = {
+ "fax-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Fax attribute syntax plugin"
+};
/*
* register_bin_like_plugin(): register all items for a bin-like plugin.
@@ -158,6 +165,19 @@ jpeg_init( Slapi_PBlock *pb )
}
+int
+fax_init( Slapi_PBlock *pb )
+{
+ int rc;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> fax_init\n", 0, 0, 0 );
+ rc = register_bin_like_plugin( pb, &fax_pdesc, fax_names,
+ FAX_SYNTAX_OID );
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= fax_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+
static int
bin_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
Slapi_Value **bvals, int ftype, Slapi_Value **retVal )
diff --git a/ldap/servers/plugins/syntaxes/bitstring.c b/ldap/servers/plugins/syntaxes/bitstring.c
new file mode 100644
index 000000000..91f88846d
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/bitstring.c
@@ -0,0 +1,195 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* bitstring.c - Bit String syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int bitstring_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int bitstring_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int bitstring_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int bitstring_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int bitstring_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int bitstring_compare(struct berval *v1, struct berval *v2);
+static int bitstring_validate(struct berval *val);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Bit String", "bitstring", BITSTRING_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "bitstring-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Bit String attribute syntax plugin" };
+
+int
+bitstring_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> bitstring_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) bitstring_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) bitstring_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) bitstring_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) bitstring_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) bitstring_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) BITSTRING_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) bitstring_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) bitstring_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= bitstring_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+bitstring_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CES,
+ ftype, retVal ) );
+}
+
+
+static int
+bitstring_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CES ) );
+}
+
+static int
+bitstring_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CES,
+ ftype ) );
+}
+
+static int
+bitstring_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CES, ftype ));
+}
+
+static int
+bitstring_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CES ) );
+}
+
+static int bitstring_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CES, 3 /* Normalise both values */);
+}
+
+static int
+bitstring_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ rc = bitstring_validate_internal(val->bv_val, &(val->bv_val[val->bv_len - 1]));
+
+exit:
+ return rc;
+}
+
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c
index 4f1d9d718..2af300baf 100644
--- a/ldap/servers/plugins/syntaxes/cis.c
+++ b/ldap/servers/plugins/syntaxes/cis.c
@@ -51,7 +51,7 @@
* GeneralizedTime
* OID
* PostalAddress
- *
+ * PrintableString
*/
#include <stdio.h>
@@ -76,6 +76,7 @@ static int time_validate(struct berval *val);
static int country_validate(struct berval *val);
static int postal_validate(struct berval *val);
static int oid_validate(struct berval *val);
+static int printable_validate(struct berval *val);
/*
* Attribute syntaxes. We treat all of these the same for now, even though
@@ -114,6 +115,9 @@ static char *postal_names[] = { "Postal Address",
static char *oid_names[] = { "OID",
OID_SYNTAX_OID, 0};
+static char *printable_names[] = { "Printable String",
+ PRINTABLESTRING_SYNTAX_OID, 0};
+
/*
TBD (XXX)
@@ -172,6 +176,10 @@ static Slapi_PluginDesc oid_pdesc = { "oid-syntax",
PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
"OID attribute syntax plugin" };
+static Slapi_PluginDesc printable_pdesc = { "printablestring-syntax",
+ PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Printable String attribtue syntax plugin" };
+
/*
* register_cis_like_plugin(): register all items for a cis-like plugin.
@@ -289,7 +297,17 @@ oid_init( Slapi_PBlock *pb )
return( rc );
}
+int
+printable_init( Slapi_PBlock *pb )
+{
+ int rc;
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> printable_init\n", 0, 0, 0 );
+ rc = register_cis_like_plugin( pb, &printable_pdesc, printable_names,
+ PRINTABLESTRING_SYNTAX_OID, printable_validate );
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= printable_init %d\n", rc, 0, 0 );
+ return( rc );
+}
static int
cis_filter_ava(
@@ -805,3 +823,29 @@ exit:
return( rc );
}
+static int printable_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ int i = 0;
+
+ /* Per RFC4517:
+ *
+ * PrintableString = 1*PrintableCharacter
+ */
+ if ((val != NULL) && (val->bv_len > 0)) {
+ /* Make sure all chars are a PrintableCharacter */
+ for (i=0; i < val->bv_len; i++) {
+ if (!IS_PRINTABLE(val->bv_val[i])) {
+ rc = 1;
+ goto exit;
+ }
+ }
+ } else {
+ rc = 1;
+ }
+
+exit:
+ return( rc );
+}
diff --git a/ldap/servers/plugins/syntaxes/deliverymethod.c b/ldap/servers/plugins/syntaxes/deliverymethod.c
new file mode 100644
index 000000000..0edb8ceba
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/deliverymethod.c
@@ -0,0 +1,318 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* deliverymethod.c - Delivery Method syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int delivery_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int delivery_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int delivery_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int delivery_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int delivery_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int delivery_compare(struct berval *v1, struct berval *v2);
+static int delivery_validate(struct berval *val);
+static int pdm_validate(const char *start, const char *end);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Delivery Method", "delivery", DELIVERYMETHOD_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "delivery-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Delivery Method attribute syntax plugin" };
+
+int
+delivery_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> delivery_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) delivery_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) delivery_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) delivery_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) delivery_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) delivery_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) DELIVERYMETHOD_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) delivery_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) delivery_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= delivery_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+delivery_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+delivery_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+delivery_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+delivery_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+delivery_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int delivery_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+delivery_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *start = NULL;
+ const char *end = NULL;
+ const char *p = NULL;
+
+ /* Per RFC4517:
+ *
+ * DeliveryMethod = pdm *( WSP DOLLAR WSP pdm )
+ * pdm = "any" / "mhs" / "physical" / "telex" / "teletex" /
+ * "g3fax" / "g4fax" / "ia5" / "videotex" / "telephone"
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Loop through each delivery method. */
+ for (p = start; p <= end; p++) {
+ if (p == end) {
+ /* Validate start through p */
+ rc = pdm_validate(start, p);
+ goto exit;
+ } else if (IS_SPACE(*p) || IS_DOLLAR(*p)) {
+ /* Validate start through p-1. Advance
+ * pointer to next start char. */
+ if ((rc = pdm_validate(start, p - 1)) != 0) {
+ goto exit;
+ } else {
+ int got_separator = 0;
+
+ /* Advance until we find the
+ * start of the next pdm. */
+ for (p++; p <= end; p++) {
+ /* If we hit the end before encountering
+ * another pdm, fail. We can do this check
+ * without looking at what the actual char
+ * is first since no single char is a valid
+ * pdm. */
+ if (p == end) {
+ rc = 1;
+ goto exit;
+ } else if (IS_DOLLAR(*p)) {
+ /* Only allow one '$' between pdm's. */
+ if (got_separator) {
+ rc = 1;
+ goto exit;
+ } else {
+ got_separator = 1;
+ }
+ } else if (!IS_SPACE(*p)) {
+ /* Set start to point to what
+ * should be the start of the
+ * next pdm. */
+ start = p;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+exit:
+ return rc;
+}
+
+/*
+ * pdm_validate()
+ *
+ * Returns 0 if the string from start to end is a valid
+ * pdm, otherwise returns 1.
+ */
+static int
+pdm_validate(const char *start, const char *end)
+{
+ int rc = 0; /* Assume string is valid */
+ size_t length = 0;
+ const char *p = NULL;
+
+ if ((start == NULL) || (end == NULL)) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Per RFC4517:
+ *
+ * DeliveryMethod = pdm *( WSP DOLLAR WSP pdm )
+ * pdm = "any" / "mhs" / "physical" / "telex" / "teletex" /
+ * "g3fax" / "g4fax" / "ia5" / "videotex" / "telephone"
+ */
+
+ /* Check length first for efficiency. */
+ length = end - start + 1;
+ switch (length) {
+ case 3:
+ if ((strncmp(start, "any", length) != 0) &&
+ (strncmp(start, "mhs", length) != 0) &&
+ (strncmp(start, "ia5", length) != 0)) {
+ rc = 1;
+ }
+ break;
+ case 5:
+ if ((strncmp(start, "telex", length) != 0) &&
+ (strncmp(start, "g3fax", length) != 0) &&
+ (strncmp(start, "g4fax", length) != 0)) {
+ rc = 1;
+ }
+ break;
+ case 7:
+ if (strncmp(start, "teletex", length) != 0) {
+ rc = 1;
+ }
+ break;
+ case 8:
+ if ((strncmp(start, "physical", length) != 0) &&
+ (strncmp(start, "videotex", length) != 0)) {
+ rc = 1;
+ }
+ break;
+ case 9:
+ if (strncmp(start, "telephone", length) != 0) {
+ rc = 1;
+ }
+ break;
+ default:
+ rc = 1;
+ break;
+ }
+
+exit:
+ return rc;
+}
diff --git a/ldap/servers/plugins/syntaxes/dn.c b/ldap/servers/plugins/syntaxes/dn.c
index ab6b254dc..fbfb49f3d 100644
--- a/ldap/servers/plugins/syntaxes/dn.c
+++ b/ldap/servers/plugins/syntaxes/dn.c
@@ -58,7 +58,6 @@ static int dn_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
static int dn_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
char *final, Slapi_Value ***ivals );
static int dn_validate( struct berval *val );
-static int rdn_validate( const char *begin, const char *end, const char **last );
/* the first name is the official one from RFC 2252 */
static char *names[] = { "DN", DN_SYNTAX_OID, 0 };
@@ -143,224 +142,13 @@ static int dn_validate( struct berval *val )
int rc = 0; /* Assume value is valid */
char *val_copy = NULL;
- if (val != NULL) {
- /* Per RFC 4514:
- *
- * distinguishedName = [ relativeDistinguishedName
- * *( COMMA relativeDistinguishedName ) ]
- * relativeDistinguishedName = attributeTypeAndValue
- * *( PLUS attributeTypeAndValue )
- * attributeTypeAndValue = attribyteType EQUALS attributeValue
- * attributeType = descr / numericoid
- * attributeValue = string / hexstring
- */
- if (val->bv_len > 0) {
- int strict = 0;
- const char *p = val->bv_val;
- const char *end = &(val->bv_val[val->bv_len - 1]);
- const char *last = NULL;
-
- /* Check if we should be performing strict validation. */
- strict = config_get_dn_validate_strict();
- if (!strict) {
- /* Create a normalized copy of the value to use
- * for validation. The original value will be
- * stored in the backend unmodified. */
- val_copy = PL_strndup(val->bv_val, val->bv_len);
- p = val_copy;
- end = slapi_dn_normalize_to_end(val_copy, NULL) - 1;
- }
-
- /* Validate one RDN at a time in a loop. */
- while (p <= end) {
- if ((rc = rdn_validate(p, end, &last)) != 0) {
- goto exit;
- }
- p = last + 1;
-
- /* p should be pointing at a comma, or one past
- * the end of the entire dn value. If we have
- * not reached the end, ensure that the next
- * character is a comma and that there is at
- * least another character after the comma. */
- if ((p <= end) && ((p == end) || (*p != ','))) {
- rc = 1;
- goto exit;
- }
-
- /* Advance the pointer past the comma so it
- * points at the beginning of the next RDN
- * (if there is one). */
- p++;
- }
- }
- } else {
- rc = 1;
- goto exit;
- }
-exit:
- if (val_copy) {
- slapi_ch_free_string(&val_copy);
- }
- return rc;
-}
-
-/*
- * Helper function for validating a DN. This function will validate
- * a single RDN. If the RDN is valid, 0 will be returned, otherwise
- * non-zero will be returned. A pointer to the last character processed
- * will be set in the "last parameter. This will be the end of the RDN
- * in the valid case, and the illegal character in the invalid case.
- */
-static int rdn_validate( const char *begin, const char *end, const char **last )
-{
- int rc = 0; /* Assume RDN is valid */
- int numericform = 0;
- char *separator = NULL;
- const char *p = begin;
-
- /* Find the '=', then use the helpers for descr and numericoid */
- if ((separator = PL_strnchr(p, '=', end - begin + 1)) == NULL) {
- rc = 1;
- goto exit;
- }
-
- /* Process an attribute type. The 'descr'
- * form must start with a 'leadkeychar'. */
- if (IS_LEADKEYCHAR(*p)) {
- if ((rc = keystring_validate(p, separator - 1))) {
- goto exit;
- }
- /* See if the 'numericoid' form is being used */
- } else if (isdigit(*p)) {
- numericform = 1;
- if ((rc = numericoid_validate(p, separator - 1))) {
- goto exit;
- }
- } else {
- rc = 1;
- goto exit;
- }
-
- /* Advance the pointer past the '=' and make sure
- * we're not past the end of the string. */
- p = separator + 1;
- if (p > end) {
+ /* A 0 length value is valid for the DN syntax. */
+ if (val == NULL) {
rc = 1;
- goto exit;
- }
-
- /* The value must be a 'hexstring' if the 'numericoid'
- * form of 'attributeType' is used. Per RFC 4514:
- *
- * hexstring = SHARP 1*hexpair
- * hexpair = HEX HEX
- */
- if (numericform) {
- if ((p == end) || !IS_SHARP(*p)) {
- rc = 1;
- goto exit;
- }
- p++;
- /* The value must be a 'string' when the 'descr' form
- * of 'attributeType' is used. Per RFC 4514:
- *
- * string = [ ( leadchar / pair ) [ *( stringchar / pair )
- * ( trailchar / pair ) ] ]
- *
- * leadchar = LUTF1 / UTFMB
- * trailchar = TUTF1 / UTFMB
- * stringchar = SUTF1 / UTFMB
- *
- * pair = ESC (ESC / special / hexpair )
- * special = escaped / SPACE / SHARP / EQUALS
- * escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
- * hexpair = HEX HEX
- */
- } else {
- /* Check the leadchar to see if anything illegal
- * is there. We need to allow a 'pair' to get
- * through, so we'll assume that a '\' is the
- * start of a 'pair' for now. */
- if (IS_UTF1(*p) && !IS_ESC(*p) && !IS_LUTF1(*p)) {
- rc = 1;
- goto exit;
- }
- }
-
- /* Loop through string until we find the ',' separator, a '+'
- * char indicating a multi-value RDN, or we reach the end. */
- while ((p <= end) && (*p != ',') && (*p != '+')) {
- if (numericform) {
- /* Process a single 'hexpair' */
- if ((p == end) || !isxdigit(*p) || !isxdigit(*p + 1)) {
- rc = 1;
- goto exit;
- }
- p = p + 2;
- } else {
- /* Check for a valid 'stringchar'. We handle
- * multi-byte characters separately. */
- if (IS_UTF1(*p)) {
- /* If we're at the end, check if we have
- * a valid 'trailchar'. */
- if ((p == end) && !IS_TUTF1(*p)) {
- rc = 1;
- goto exit;
- /* Check for a 'pair'. */
- } else if (IS_ESC(*p)) {
- /* We're guaranteed to still have at
- * least one more character, so lets
- * take a look at it. */
- p++;
- if (!IS_ESC(*p) && !IS_SPECIAL(*p)) {
- /* The only thing valid now
- * is a 'hexpair'. */
- if ((p == end) || !isxdigit(*p) ||!isxdigit(*p + 1)) {
- rc = 1;
- goto exit;
- }
- p++;
- }
- p++;
- /* Only allow 'SUTF1' chars now. */
- } else if (!IS_SUTF1(*p)) {
- rc = 1;
- goto exit;
- }
-
- p++;
- } else {
- /* Validate a single 'UTFMB' (multi-byte) character. */
- if (utf8char_validate(p, end, &p ) != 0) {
- rc = 1;
- goto exit;
- }
-
- /* Advance the pointer past the multi-byte char. */
- p++;
- }
- }
+ } else if (val->bv_len > 0) {
+ rc = distinguishedname_validate(val->bv_val, &(val->bv_val[val->bv_len - 1]));
}
- /* We'll end up either at the comma, a '+', or one past end.
- * If we are processing a multi-valued RDN, we recurse to
- * process the next 'attributeTypeAndValue'. */
- if ((p <= end) && (*p == '+')) {
- /* Make sure that there is something after the '+'. */
- if (p == end) {
- rc = 1;
- goto exit;
- }
- p++;
-
- /* Recurse to process the next value. We need to reset p to
- * ensure that last is set correctly for the original caller. */
- rc = rdn_validate( p, end, last );
- p = *last + 1;
- }
-
-exit:
- *last = p - 1;
return rc;
}
+
diff --git a/ldap/servers/plugins/syntaxes/facsimile.c b/ldap/servers/plugins/syntaxes/facsimile.c
new file mode 100644
index 000000000..c37a36042
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/facsimile.c
@@ -0,0 +1,324 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* facsimile.c - Facsimile Telephone Number syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int facsimile_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int facsimile_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int facsimile_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int facsimile_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int facsimile_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int facsimile_compare(struct berval *v1, struct berval *v2);
+static int facsimile_validate(struct berval *val);
+static int fax_parameter_validate(const char *start, const char *end);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Facsimile Telephone Number", "facsimile", FACSIMILE_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "facsimile-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Facsimile Telephone Number attribute syntax plugin" };
+
+int
+facsimile_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> facsimile_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) facsimile_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) facsimile_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) facsimile_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) facsimile_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) facsimile_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) FACSIMILE_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) facsimile_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) facsimile_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= facsimile_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+facsimile_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+facsimile_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+facsimile_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+facsimile_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+facsimile_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int facsimile_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+facsimile_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ int i = 0;
+
+ /* Per RFC4517:
+ *
+ * fax-number = telephone-number *( DOLLAR fax-parameter )
+ * telephone-number = PrintableString
+ * fax-parameter = "twoDimensional" /
+ * "fineResolution" /
+ * "unlimitedLength" /
+ * "b4Length" /
+ * "a3Width" /
+ * "b4Width" /
+ * "uncompressed"
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Make sure all chars are a PrintableCharacter */
+ for (i=0; i < val->bv_len; i++) {
+ if (!IS_PRINTABLE(val->bv_val[i])) {
+ if (!IS_DOLLAR(val->bv_val[i])) {
+ rc = 1;
+ goto exit;
+ } else {
+ /* Process the fax-parameters */
+ const char *start = NULL;
+ const char *end = &(val->bv_val[val->bv_len - 1]);
+ const char *p = &(val->bv_val[i]);
+
+ /* The value must have a printable string first,
+ * so we can't allow it to start with a '$'. We
+ * also need to ensure that the string does not
+ * end with this '$'. */
+ if ((i == 0) || (p == end)) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* We're guaranteed to have at least one character
+ * past p. This is where the fax-paramter should
+ * start. */
+ start = p + 1;
+
+ for (p = start; p <= end; p++) {
+ if (p == end) {
+ /* Ensure start to p is a valid fax-parameter, then
+ * exit since we're at the end. */
+ rc = fax_parameter_validate(start, p);
+ goto exit;
+ } else if (*p == '$') {
+ /* Ensure start to p-1 is a valid fax-parameter */
+ if ((rc = fax_parameter_validate(start, p - 1)) != 0) {
+ goto exit;
+ }
+
+ /* We're guaranteed to have another character, which
+ * should be the beginning of the next fax-paramter.
+ * Adjust the start pointer to point to the beginning
+ * of this fax-paramter. */
+ start = p + 1;
+ }
+ }
+ }
+ }
+ }
+
+exit:
+ return rc;
+}
+
+/*
+ * fax_parameter_validate()
+ *
+ * Returns 0 if the string from start to end is a valid
+ * fax-parameter, otherwise returns 1.
+ */
+static int
+fax_parameter_validate(const char *start, const char *end)
+{
+ int rc = 0; /* Assume string is valid */
+ size_t length = 0;
+ const char *p = NULL;
+
+ if ((start == NULL) || (end == NULL)) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Per RFC4517:
+ *
+ * fax-parameter = "twoDimensional" /
+ * "fineResolution" /
+ * "unlimitedLength" /
+ * "b4Length" /
+ * "a3Width" /
+ * "b4Width" /
+ * "uncompressed"
+ */
+
+ /* Check length first for efficiency. */
+ length = end - start + 1;
+ switch (length) {
+ case 7:
+ if ((strncmp(start, "a3Width", length) != 0) &&
+ (strncmp(start, "b4Width", length) != 0)) {
+ rc = 1;
+ }
+ break;
+ case 8:
+ if (strncmp(start, "b4Length", length) != 0) {
+ rc = 1;
+ }
+ break;
+ case 12:
+ if (strncmp(start, "uncompressed", length) != 0) {
+ rc = 1;
+ }
+ break;
+ case 14:
+ if ((strncmp(start, "twoDimensional", length) != 0) &&
+ (strncmp(start, "fineResolution", length) != 0)) {
+ rc = 1;
+ }
+ break;
+ case 15:
+ if (strncmp(start, "unlimitedLength", length) != 0) {
+ rc = 1;
+ }
+ break;
+ default:
+ rc = 1;
+ break;
+ }
+
+exit:
+ return rc;
+}
diff --git a/ldap/servers/plugins/syntaxes/guide.c b/ldap/servers/plugins/syntaxes/guide.c
new file mode 100644
index 000000000..90dd27a44
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/guide.c
@@ -0,0 +1,734 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* guide.c - Guide and Enhanced Guide syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int guide_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int guide_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int guide_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int guide_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int guide_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int guide_compare(struct berval *v1, struct berval *v2);
+static int enhancedguide_validate(struct berval *val);
+static int guide_validate(struct berval *val);
+static int criteria_validate(const char *start, const char *end);
+static int andterm_validate(const char *start, const char *end, const char **last);
+static int term_validate(const char *start, const char *end, const char **last);
+
+/* the first name is the official one from RFC 4517 */
+static char *guide_names[] = { "Guide", "guide", GUIDE_SYNTAX_OID, 0 };
+
+static char *enhancedguide_names[] = { "Enhanced Guide", "enhancedguide",
+ ENHANCEDGUIDE_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc guide_pdesc = { "guide-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Guide attribute syntax plugin" };
+
+static Slapi_PluginDesc enhancedguide_pdesc = { "enhancedguide-syntax",
+ PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Enhanced Guide attribute syntax plugin" };
+
+int
+guide_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> guide_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&guide_pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) guide_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) guide_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) guide_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) guide_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) guide_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) guide_names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) GUIDE_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) guide_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) guide_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= guide_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+int
+enhancedguide_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> guide_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&enhancedguide_pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) guide_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) guide_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) guide_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) guide_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) guide_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) enhancedguide_names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) ENHANCEDGUIDE_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) guide_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) enhancedguide_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= guide_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+guide_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+guide_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+guide_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+guide_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+guide_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int guide_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+enhancedguide_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *start = NULL;
+ const char *end = NULL;
+ const char *p = NULL;
+ const char *sharp = NULL;
+
+ /* Per RFC4517:
+ *
+ * EnhancedGuide = object-class SHARP WSP criteria WSP
+ * SHARP WSP subset
+ * subset = "baseobject" / "oneLevel" / "wholeSubtree"
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Find the first SHARP. */
+ for (p = start; p <= end; p++) {
+ if (IS_SHARP(*p)) {
+ sharp = p;
+ break;
+ }
+ }
+
+ /* Fail if we didn't find a SHARP, or if SHARP
+ * is at the start or end of the value. */
+ if ((sharp == NULL) || (sharp == start) || (sharp == end)){
+ rc = 1;
+ goto exit;
+ }
+
+ /* Reset p and end to validate the object-class. */
+ p = start;
+ end = sharp - 1;
+
+ /* Skip any leading spaces. */
+ while ((p < sharp) && IS_SPACE(*p)) {
+ p++;
+ }
+
+ /* Skip any trailing spaces. */
+ while ((end > p) && IS_SPACE(*end)) {
+ end--;
+ }
+
+ /* See if we only found spaces before the SHARP. */
+ if (end < p) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Validate p to end as object-class. This is the same
+ * as an oid, which is either a keystring or a numericoid. */
+ if (IS_LEADKEYCHAR(*p)) {
+ rc = keystring_validate(p, end);
+ /* check if the value matches the numericoid form */
+ } else if (isdigit(*p)) {
+ rc = numericoid_validate(p, end);
+ } else {
+ rc = 1;
+ }
+
+ /* We're done if the object-class failed to validate. */
+ if (rc != 0) {
+ goto exit;
+ }
+
+ /* Reset start and end to validate the criteria. */
+ start = sharp + 1;
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Find the next SHARP. */
+ for (p = start; p <= end; p++) {
+ if (IS_SHARP(*p)) {
+ sharp = p;
+ break;
+ }
+ }
+
+ /* Fail if we didn't find a SHARP, or if SHARP
+ * is at the start or end of the value. */
+ if ((sharp == NULL) || (sharp == start) || (sharp == end)){
+ rc = 1;
+ goto exit;
+ }
+
+ /* Reset p and end to validate the criteria. */
+ p = start;
+ end = sharp - 1;
+
+ /* Skip any leading spaces. */
+ while ((p < sharp) && IS_SPACE(*p)) {
+ p++;
+ }
+
+ /* Skip any trailing spaces. */
+ while ((end > p) && IS_SPACE(*end)) {
+ end--;
+ }
+
+ /* See if we only found spaces before the SHARP. */
+ if (end < p) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Validate p to end as criteria. */
+ if ((rc = criteria_validate(p, end)) != 0) {
+ goto exit;
+ }
+
+ /* Reset start and end to validate the subset. We're
+ * guaranteed to have a character after sharp. */
+ p = start = sharp + 1;
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Skip any leading spaces. */
+ while ((p < end) && IS_SPACE(*p)) {
+ p ++;
+ }
+
+ /* Validate the subset. */
+ switch (end - p + 1) {
+ case 8:
+ if (strncmp(p, "oneLevel", 8) != 0) {
+ rc = 1;
+ }
+ break;
+ case 10:
+ if (strncmp(p, "baseobject", 10) != 0) {
+ rc = 1;
+ }
+ break;
+ case 12:
+ if (strncmp(p, "wholeSubtree", 12) != 0) {
+ rc = 1;
+ }
+ break;
+ default:
+ rc = 1;
+ }
+
+exit:
+ return rc;
+}
+
+static int
+guide_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *start = NULL;
+ const char *end = NULL;
+ const char *p = NULL;
+ const char *sharp = NULL;
+
+ /* Per RFC4517:
+ *
+ * Guide = [ object-class SHARP ] criteria
+ * object-class = WSP oid WSP
+ * criteria = and-term *( BAR and-term )
+ * and-term = term *( AMPERSAND term )
+ * term = EXCLAIM term /
+ * attributetype DOLLAR match-type /
+ * LPAREN criteria RPAREN /
+ * true /
+ * false
+ * match-type = "EQ" / "SUBSTR" / "GE" / "LE" / "APPROX"
+ * true = "?true"
+ * false = "?false"
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Look for a SHARP. If we have one, the value should
+ * begin with the optional object-class. */
+ for (p = start; p <= end; p++) {
+ if (IS_SHARP(*p)) {
+ sharp = p;
+ break;
+ }
+ }
+
+ if (sharp) {
+ /* "criteria" must exist, so the SHARP
+ * can't be at the end of the value. */
+ if (sharp == end) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* An optional object-class should be present. Reset
+ * p to the beginning of the value and end to just
+ * before the SHARP to validate the object-class.
+ * We'll reset end later. */
+ p = start;
+ end = sharp - 1;
+
+ /* This can happen if the value begins with SHARP. */
+ if (end < start) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Skip any leading spaces. */
+ while ((p < sharp) && IS_SPACE(*p)) {
+ p++;
+ }
+
+ /* Skip any trailing spaces. */
+ while ((end > p) && IS_SPACE(*end)) {
+ end--;
+ }
+
+ /* See if we only found spaces before the SHARP. */
+ if (end < p) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Validate p to end as object-class. This is the same
+ * as an oid, which is either a keystring or a numericoid. */
+ if (IS_LEADKEYCHAR(*p)) {
+ rc = keystring_validate(p, end);
+ /* check if the value matches the numericoid form */
+ } else if (isdigit(*p)) {
+ rc = numericoid_validate(p, end);
+ } else {
+ rc = 1;
+ }
+
+ /* If the object-class failed to validate, we're done. */
+ if (rc != 0) {
+ goto exit;
+ }
+
+ /* Reset p and end to point to the criteria. */
+ p = sharp + 1;
+ end = &(val->bv_val[val->bv_len - 1]);
+ } else {
+ /* Reset p. */
+ p = start;
+ }
+
+ /* Validate the criteria. */
+ rc = criteria_validate(p, end);
+
+exit:
+ return rc;
+}
+
+/* criteria_validate()
+ *
+ * Helper to validate criteria element.
+ */
+static int
+criteria_validate(const char *start, const char *end)
+{
+ const char *p = start;
+ const char *last = NULL;
+ int rc = 0;
+
+ /* Validate the criteria, which is just made up of a number
+ * of and-term elements. Validate one and-term at a time. */
+ while (p <= end) {
+ if ((rc = andterm_validate(p, end, &last)) != 0) {
+ goto exit;
+ }
+ p = last + 1;
+
+ /* p should be pointing at a BAR, or one past
+ * the end of the entire value. If we have
+ * not reached the end, ensure that the next
+ * character is a BAR and that there is at
+ * least another character after the BAR. */
+ if ((p <= end) && ((p == end) || (*p != '|'))) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Advance the pointer past the BAR so
+ * it points at the beginning of the
+ * next and-term (if there is one). */
+ p++;
+ }
+
+exit:
+ return rc;
+}
+
+/*
+ * andterm_validate()
+ *
+ * This function will validate a single and-term. If the and-term
+ * is valid, 0 will be returned, otherwise non-zero will be returned.
+ * A pointer to the last character of the and-term will be set in the
+ * "last" parameter in the valid case.
+ */
+static int
+andterm_validate(const char *start, const char *end, const char **last)
+{
+ const char *p = start;
+ int rc = 0;
+
+ if ((start == NULL) || (end == NULL)) {
+ rc = 1;
+ goto exit;
+ }
+
+ while (p <= end) {
+ if ((rc = term_validate(p, end, last)) != 0) {
+ goto exit;
+ }
+ p = *last + 1;
+
+ /* p should be pointing at an ampersand, a bar, or
+ * one past the end of the entire value. If we have
+ * not reached the end, ensure that the next
+ * character is an ampersand or a bar and that
+ * there is at least another character afterwards. */
+ if ((p <= end) && ((p == end) || ((*p != '&') && (*p != '|')))) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* If p is a bar, we're done. */
+ if (*p == '|') {
+ break;
+ }
+
+ /* Advance the pointer past the ampersand
+ * or bar so it points at the beginning of
+ * the next term or and-term (if there is
+ * one). */
+ p++;
+ }
+
+exit:
+ return rc;
+}
+
+static int
+term_validate(const char *start, const char *end, const char **last)
+{
+ int rc = 0;
+ const char *p = start;
+
+ /* Per RFC 4517:
+ *
+ * term = EXCLAIM term /
+ * attributetype DOLLAR match-type /
+ * LPAREN criteria RPAREN /
+ * true /
+ * false
+ * match-type = "EQ" / "SUBSTR" / "GE" / "LE" / "APPROX"
+ * true = "?true"
+ * false = "?false"
+ */
+
+ /* See if the term is prefixed by an EXCLAIM. */
+ if (*p == '!') {
+ p++;
+ /* Ensure the value doesn't end with an EXCLAIM. */
+ if (p > end) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+ /* Check for valid terms. */
+ switch (*p) {
+ case '?':
+ {
+ /* true or false */
+ int length = 0;
+
+ p++;
+ length = end - p + 1;
+
+ if ((length >= 5) && (strncmp(p, "false", 5) == 0)) {
+ /* Found false. We're done. */
+ *last = p + 4;
+ goto exit;
+ }
+
+ if ((length >= 4) && (strncmp(p, "true", 4) == 0)) {
+ /* Found true. We're done. */
+ *last = p + 3;
+ goto exit;
+ }
+
+ /* We didn't find true or false. Fail. */
+ rc = 1;
+ goto exit;
+ }
+ case '(':
+ {
+ /* LPAREN criteria RPAREN */
+ const char *lparen = p;
+
+ while ((p <= end) && !IS_RPAREN(*p)) {
+ p++;
+ }
+
+ if (p > end) {
+ /* We didn't find a RPAREN. Fail. */
+ rc = 1;
+ goto exit;
+ } else {
+ /* p is pointing at the RPAREN. Validate
+ * everything between the parens as criteria. */
+ rc = criteria_validate(lparen + 1, p - 1);
+ *last = p;
+ }
+ break;
+ }
+ default:
+ {
+ /* attributetype DOLLAR match-type */
+ const char *attrtype = p;
+
+ while ((p <= end) && !IS_DOLLAR(*p)) {
+ p++;
+ }
+
+ if (p > end) {
+ /* We didn't find a DOLLAR. Fail. */
+ rc = 1;
+ goto exit;
+ } else {
+ /* p is pointing at the DOLLAR. Validate
+ * the attributetype before the DOLLAR. */
+ if (IS_LEADKEYCHAR(*attrtype)) {
+ rc = keystring_validate(attrtype, p - 1);
+ /* check if the value matches the numericoid form */
+ } else if (isdigit(*attrtype)) {
+ rc = numericoid_validate(attrtype, p - 1);
+ } else {
+ rc = 1;
+ }
+
+ /* If the attributetype was invalid, we're done. */
+ if (rc != 0) {
+ goto exit;
+ }
+
+ /* Validate that a valid match-type
+ * is after the DOLLAR. */
+ if (p == end) {
+ rc = 1;
+ goto exit;
+ } else {
+ int length = 0;
+
+ p++;
+ length = end - p + 1;
+
+ if (length >= 6) {
+ /* APPROX, SUBSTR */
+ if ((strncmp(p, "APPROX", 6) == 0) ||
+ (strncmp(p, "SUBSTR", 6) == 0)) {
+ /* We found a valid match-type.
+ * We're done. */
+ *last = p + 5;
+ goto exit;
+ }
+ }
+
+ if (length >= 2) {
+ /* EQ, GE, LE */
+ if ((strncmp(p, "EQ", 2) == 0) ||
+ (strncmp(p, "GE", 2) == 0) ||
+ (strncmp(p, "LE", 2) == 0)) {
+ /* We found a valid match-type.
+ * We're done. */
+ *last = p + 1;
+ goto exit;
+ }
+ }
+
+ /* We failed to find a valid match-type. */
+ rc = 1;
+ goto exit;
+ }
+ }
+ }
+ }
+
+exit:
+ return rc;
+}
diff --git a/ldap/servers/plugins/syntaxes/nameoptuid.c b/ldap/servers/plugins/syntaxes/nameoptuid.c
new file mode 100644
index 000000000..70b760ab5
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/nameoptuid.c
@@ -0,0 +1,232 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* nameoptuid.c - Name And Optional UID syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int nameoptuid_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int nameoptuid_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int nameoptuid_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int nameoptuid_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int nameoptuid_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int nameoptuid_compare(struct berval *v1, struct berval *v2);
+static int nameoptuid_validate(struct berval *val);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Name And Optional UID", "nameoptuid", NAMEANDOPTIONALUID_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "nameoptuid-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Name And Optional UID attribute syntax plugin" };
+
+int
+nameoptuid_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> nameoptuid_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) nameoptuid_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) nameoptuid_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) nameoptuid_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) nameoptuid_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) nameoptuid_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) NAMEANDOPTIONALUID_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) nameoptuid_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) nameoptuid_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= nameoptuid_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+nameoptuid_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+nameoptuid_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+nameoptuid_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+nameoptuid_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+nameoptuid_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int nameoptuid_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+nameoptuid_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ int got_sharp = 0;
+ const char *p = NULL;
+ const char *start = NULL;
+ const char *end = NULL;
+
+ /* Per RFC4517:
+ *
+ * NameAndOptionalUID = distinguishedName [ SHARP BitString ]
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Find the last SHARP in the value that may be separating
+ * the distinguishedName from the optional BitString. */
+ for (p = end; p >= start + 1; p--) {
+ if (IS_SHARP(*p)) {
+ got_sharp = 1;
+ break;
+ }
+ }
+
+ if (got_sharp) {
+ /* Try to validate everything after the sharp as
+ * a BitString. If this fails, we may still have
+ * a valid value since a sharp is allowed in a
+ * distinguishedName. If we don't find a valid
+ * BitString, just validate the entire value as
+ * a distinguishedName. */
+ if ((rc = bitstring_validate_internal(p + 1, end)) != 0) {
+ rc = distinguishedname_validate(start, end);
+ } else {
+ rc = distinguishedname_validate(start, p - 1);
+ }
+ } else {
+ /* No optional BitString is present, so validate
+ * the entire value as a distinguishedName. */
+ rc = distinguishedname_validate(start, end);
+ }
+
+exit:
+ return rc;
+}
+
diff --git a/ldap/servers/plugins/syntaxes/syntax.h b/ldap/servers/plugins/syntaxes/syntax.h
index e673718f2..865fc8b7a 100644
--- a/ldap/servers/plugins/syntaxes/syntax.h
+++ b/ldap/servers/plugins/syntaxes/syntax.h
@@ -74,7 +74,12 @@
#define IS_SPACE(c) ( (c == ' ') )
#define IS_LDIGIT(c) ( (c != '0') && isdigit(c) )
#define IS_SHARP(c) ( (c == '#') )
+#define IS_DOLLAR(c) ( (c == '$') )
+#define IS_SQUOTE(c) ( (c == '\'') )
#define IS_ESC(c) ( (c == '\\') )
+#define IS_LPAREN(c) ( (c == '(') )
+#define IS_RPAREN(c) ( (c == ')') )
+#define IS_COLON(c) ( (c == ':') )
#define IS_UTF0(c) ( ((unsigned char)(c) >= (unsigned char)'\x80') && ((unsigned char)(c) <= (unsigned char)'\xBF') )
#define IS_UTF1(c) ( !((unsigned char)(c) & 128) )
/* These are only checking the first byte of the multibyte character. They
@@ -102,8 +107,8 @@
* PLUS / COMMA / HYPHEN / DOT / EQUALS /
* SLASH / COLON / QUESTION / SPACE
*/
-#define IS_PRINTABLE(c) ( isalnum(c) || (c == '\'') || (c == '(') || \
- (c == ')') || (c == '+') || (c == ',') || (c == '-') || (c == '.') || \
+#define IS_PRINTABLE(c) ( isalnum(c) || (c == '\'') || IS_LPAREN(c) || \
+ IS_RPAREN(c) || (c == '+') || (c == ',') || (c == '-') || (c == '.') || \
(c == '=') || (c == '/') || (c == ':') || (c == '?') || IS_SPACE(c) )
int string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,Slapi_Value **bvals, int syntax );
@@ -123,5 +128,8 @@ int keystring_validate( const char *begin, const char *end );
int numericoid_validate( const char *begin, const char *end );
int utf8char_validate( const char *begin, const char *end, const char **last );
int utf8string_validate( const char *begin, const char *end, const char **last );
+int distinguishedname_validate( const char *begin, const char *end );
+int rdn_validate( const char *begin, const char *end, const char **last );
+int bitstring_validate_internal(const char *begin, const char *end);
#endif
diff --git a/ldap/servers/plugins/syntaxes/teletex.c b/ldap/servers/plugins/syntaxes/teletex.c
new file mode 100644
index 000000000..da9e7fe2f
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/teletex.c
@@ -0,0 +1,342 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* teletex.c - Teletex Terminal Identifier syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int teletex_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int teletex_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int teletex_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int teletex_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int teletex_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int teletex_compare(struct berval *v1, struct berval *v2);
+static int teletex_validate(struct berval *val);
+static int ttx_param_validate(const char *start, const char *end);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Teletex Terminal Identifier", "teletextermid", TELETEXTERMID_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "teletextermid-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Teletex Terminal Identifier attribute syntax plugin" };
+
+int
+teletex_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> teletex_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) teletex_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) teletex_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) teletex_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) teletex_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) teletex_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) TELETEXTERMID_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) teletex_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) teletex_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= teletex_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+teletex_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+teletex_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+teletex_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+teletex_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+teletex_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int teletex_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+teletex_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *start = NULL;
+ const char *end = NULL;
+ const char *p = NULL;
+ int got_ttx_term = 0;
+
+ /* Per RFC4517:
+ *
+ * teletex-id = ttx-term *(DOLLAR ttx-param)
+ * ttx-term = PrintableString
+ * ttx-param = ttx-key COLON ttx-value
+ * tty-key = "graphic" / "control" / "misc" / "page" / "private"
+ * ttx-value = *ttx-value-octet
+ *
+ * ttx-value-octet = %x00-23
+ * / (%x5C "24") ; escaped "$"
+ * / %x25-5B
+ * / (%x5C "5C") ; escaped "\"
+ * / %x5D-FF
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Look for a DOLLAR separator. */
+ for (p = start; p <= end; p++) {
+ if (IS_DOLLAR(*p)) {
+ /* Ensure we don't have an empty element. */
+ if ((p == start) || (p == end)) {
+ rc = 1;
+ goto exit;
+ }
+
+ if (!got_ttx_term) {
+ /* Validate the ttx-term. */
+ while (start < p) {
+ if (!IS_PRINTABLE(*start)) {
+ rc = 1;
+ goto exit;
+ }
+ start++;
+ }
+
+ got_ttx_term = 1;
+ } else {
+ /* Validate the ttx-param. */
+ if ((rc = ttx_param_validate(start, p - 1)) != 0) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+ /* Reset start to point at the
+ * next ttx-param. We're
+ * guaranteed to have at least
+ * one more char after p. */
+ start = p + 1;
+ }
+ }
+
+ /* If we didn't find the ttx-term, validate
+ * the whole value as the ttx-term. */
+ if (!got_ttx_term) {
+ for (p = start; p <= end; p++) {
+ if (!IS_PRINTABLE(*p)) {
+ rc = 1;
+ goto exit;
+ }
+ }
+ } else {
+ /* Validate the final ttx-param. */
+ rc = ttx_param_validate(start, end);
+ }
+
+exit:
+ return rc;
+}
+
+static int
+ttx_param_validate(
+ const char *start,
+ const char *end)
+{
+ int rc = 0;
+ const char *p = NULL;
+ int found_colon = 0;
+
+ for (p = start; p <= end; p++) {
+ if (IS_COLON(*p)) {
+ found_colon = 1;
+
+ /* Validate the ttx-key before the COLON. */
+ switch (p - start) {
+ case 4:
+ /* "misc" / "page" */
+ if ((strncmp(start, "misc", 4) != 0) &&
+ (strncmp(start, "page", 4) != 0)) {
+ rc = 1;
+ goto exit;
+ }
+ break;
+ case 7:
+ /* "graphic" / "control" / "private" */
+ if ((strncmp(start, "graphic", 7) != 0) &&
+ (strncmp(start, "control", 7) != 0) &&
+ (strncmp(start, "private", 7) != 0)) {
+ rc = 1;
+ goto exit;
+ }
+ break;
+ default:
+ rc = 1;
+ goto exit;
+ }
+
+ /* Validate the ttx-value after the COLON.
+ * It is allowed to be 0 length. */
+ if (p != end) {
+ for (++p; p <= end; p++) {
+ /* Ensure that '\' is only used
+ * to escape a '$' or a '\'. */
+ if (*p == '\\') {
+ p++;
+ /* Ensure that we're not at the end of the value */
+ if ((p > end) || ((strncmp(p, "24", 2) != 0)
+ && (strncasecmp(p, "5C", 2) != 0))) {
+ rc = 1;
+ goto exit;
+ } else {
+ /* advance the pointer to point to the end
+ * of the hex code for the escaped character */
+ p++;
+ }
+ } else if (*p == '$') {
+ /* This should be escaped. Fail. */
+ rc = 1;
+ goto exit;
+ }
+ }
+ }
+
+ /* We're done. */
+ break;
+ }
+ }
+
+ /* If we didn't find a COLON, fail. */
+ if (!found_colon) {
+ rc = 1;
+ }
+
+exit:
+ return rc;
+}
diff --git a/ldap/servers/plugins/syntaxes/telex.c b/ldap/servers/plugins/syntaxes/telex.c
new file mode 100644
index 000000000..e51f2f731
--- /dev/null
+++ b/ldap/servers/plugins/syntaxes/telex.c
@@ -0,0 +1,257 @@
+/** BEGIN COPYRIGHT BLOCK
+ * This Program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; version 2 of the License.
+ *
+ * This Program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * In addition, as a special exception, Red Hat, Inc. gives You the additional
+ * right to link the code of this Program with code not covered under the GNU
+ * General Public License ("Non-GPL Code") and to distribute linked combinations
+ * including the two, subject to the limitations in this paragraph. Non-GPL Code
+ * permitted under this exception must only link to the code of this Program
+ * through those well defined interfaces identified in the file named EXCEPTION
+ * found in the source code files (the "Approved Interfaces"). The files of
+ * Non-GPL Code may instantiate templates or use macros or inline functions from
+ * the Approved Interfaces without causing the resulting work to be covered by
+ * the GNU General Public License. Only Red Hat, Inc. may make changes or
+ * additions to the list of Approved Interfaces. You must obey the GNU General
+ * Public License in all respects for all of the Program code and other code used
+ * in conjunction with the Program except the Non-GPL Code covered by this
+ * exception. If you modify this file, you may extend this exception to your
+ * version of the file, but you are not obligated to do so. If you do not wish to
+ * provide this exception without modification, you must delete this exception
+ * statement from your version and license this file solely under the GPL without
+ * exception.
+ *
+ *
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2009 Red Hat, Inc.
+ * All rights reserved.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* telex.c - Telex Number syntax routines */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include "syntax.h"
+
+static int telex_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
+ Slapi_Value **bvals, int ftype, Slapi_Value **retVal );
+static int telex_filter_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value **bvals );
+static int telex_values2keys( Slapi_PBlock *pb, Slapi_Value **val,
+ Slapi_Value ***ivals, int ftype );
+static int telex_assertion2keys_ava( Slapi_PBlock *pb, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+static int telex_assertion2keys_sub( Slapi_PBlock *pb, char *initial, char **any,
+ char *final, Slapi_Value ***ivals );
+static int telex_compare(struct berval *v1, struct berval *v2);
+static int telex_validate(struct berval *val);
+
+/* the first name is the official one from RFC 4517 */
+static char *names[] = { "Telex Number", "telexnumber", TELEXNUMBER_SYNTAX_OID, 0 };
+
+static Slapi_PluginDesc pdesc = { "telex-syntax", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "Telex Number attribute syntax plugin" };
+
+int
+telex_init( Slapi_PBlock *pb )
+{
+ int rc, flags;
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "=> telex_init\n", 0, 0, 0 );
+
+ rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *) SLAPI_PLUGIN_VERSION_01 );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
+ (void *) telex_filter_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_SUB,
+ (void *) telex_filter_sub );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
+ (void *) telex_values2keys );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
+ (void *) telex_assertion2keys_ava );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB,
+ (void *) telex_assertion2keys_sub );
+ flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
+ (void *) &flags );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
+ (void *) names );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
+ (void *) TELEXNUMBER_SYNTAX_OID );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
+ (void *) telex_compare );
+ rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
+ (void *) telex_validate );
+
+ LDAPDebug( LDAP_DEBUG_PLUGIN, "<= telex_init %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+static int
+telex_filter_ava(
+ Slapi_PBlock *pb,
+ struct berval *bvfilter,
+ Slapi_Value **bvals,
+ int ftype,
+ Slapi_Value **retVal
+)
+{
+ return( string_filter_ava( bvfilter, bvals, SYNTAX_CIS,
+ ftype, retVal ) );
+}
+
+
+static int
+telex_filter_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value **bvals
+)
+{
+ return( string_filter_sub( pb, initial, any, final, bvals, SYNTAX_CIS ) );
+}
+
+static int
+telex_values2keys(
+ Slapi_PBlock *pb,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return( string_values2keys( pb, vals, ivals, SYNTAX_CIS,
+ ftype ) );
+}
+
+static int
+telex_assertion2keys_ava(
+ Slapi_PBlock *pb,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ return(string_assertion2keys_ava( pb, val, ivals,
+ SYNTAX_CIS, ftype ));
+}
+
+static int
+telex_assertion2keys_sub(
+ Slapi_PBlock *pb,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ return( string_assertion2keys_sub( pb, initial, any, final, ivals,
+ SYNTAX_CIS ) );
+}
+
+static int telex_compare(
+ struct berval *v1,
+ struct berval *v2
+)
+{
+ return value_cmp(v1, v2, SYNTAX_CIS, 3 /* Normalise both values */);
+}
+
+static int
+telex_validate(
+ struct berval *val
+)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *start = NULL;
+ const char *end = NULL;
+ const char *p = NULL;
+ const char *p2 = NULL;
+ int num_dollars = 0;
+
+ /* Per RFC4517:
+ *
+ * telex-number = actual-number DOLLAR country-code
+ * DOLLAR answerback
+ * actual-number = PrintableString
+ * country-code = PrintableString
+ * answerback = PrintableString
+ */
+
+ /* Don't allow a 0 length string */
+ if ((val == NULL) || (val->bv_len == 0)) {
+ rc = 1;
+ goto exit;
+ }
+
+ start = &(val->bv_val[0]);
+ end = &(val->bv_val[val->bv_len - 1]);
+
+ /* Look for the DOLLAR separators. */
+ for (p = start; p <= end; p++) {
+ if (IS_DOLLAR(*p)) {
+ num_dollars++;
+
+ /* Ensure we don't have an empty element. */
+ if ((p == start) || (p == end)) {
+ rc = 1;
+ goto exit;
+ }
+
+ for (p2 = start; p2 < p; p2++) {
+ if (!IS_PRINTABLE(*p2)) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+ /* Reset start to the beginning
+ * of the next element. We're
+ * guaranteed to have another
+ * char after p. */
+ start = p + 1;
+
+ if (num_dollars == 2) {
+ /* Validate the answerback element
+ * and exit. */
+ for (p2 = start; p2 <= end; p2++) {
+ if (!IS_PRINTABLE(*p2)) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+ /* We've hit the end and it's
+ * all valid. We're done. */
+ goto exit;
+ }
+ }
+ }
+
+ /* Make sure we found all three elements. */
+ if (num_dollars != 2) {
+ rc = 1;
+ goto exit;
+ }
+
+exit:
+ return rc;
+}
+
diff --git a/ldap/servers/plugins/syntaxes/validate.c b/ldap/servers/plugins/syntaxes/validate.c
index a34830cd0..d0da4be06 100644
--- a/ldap/servers/plugins/syntaxes/validate.c
+++ b/ldap/servers/plugins/syntaxes/validate.c
@@ -350,3 +350,262 @@ exit:
return(rc);
}
+/*
+ * Validates a distinguishedName as degined in RFC 4514. Returns
+ * 0 if the value from begin to end is a valid distinguishedName.
+ * Returns 1 otherwise.
+ */
+int distinguishedname_validate(
+ const char *begin,
+ const char *end
+)
+{
+ int rc = 0; /* Assume value is valid */
+ char *val_copy = NULL;
+ int strict = 0;
+ const char *p = begin;
+ const char *last = NULL;
+
+ /* Per RFC 4514:
+ *
+ * distinguishedName = [ relativeDistinguishedName
+ * *( COMMA relativeDistinguishedName ) ]
+ * relativeDistinguishedName = attributeTypeAndValue
+ * *( PLUS attributeTypeAndValue )
+ * attributeTypeAndValue = attribyteType EQUALS attributeValue
+ * attributeType = descr / numericoid
+ * attributeValue = string / hexstring
+ */
+
+ /* Check if we should be performing strict validation. */
+ strict = config_get_dn_validate_strict();
+ if (!strict) {
+ /* Create a normalized copy of the value to use
+ * for validation. The original value will be
+ * stored in the backend unmodified. */
+ val_copy = PL_strndup(begin, end - begin + 1);
+ p = val_copy;
+ end = slapi_dn_normalize_to_end(val_copy, NULL) - 1;
+ }
+
+ /* Validate one RDN at a time in a loop. */
+ while (p <= end) {
+ if ((rc = rdn_validate(p, end, &last)) != 0) {
+ goto exit;
+ }
+ p = last + 1;
+
+ /* p should be pointing at a comma, or one past
+ * the end of the entire dn value. If we have
+ * not reached the end, ensure that the next
+ * character is a comma and that there is at
+ * least another character after the comma. */
+ if ((p <= end) && ((p == end) || (*p != ','))) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Advance the pointer past the comma so it
+ * points at the beginning of the next RDN
+ * (if there is one). */
+ p++;
+ }
+
+exit:
+ if (val_copy) {
+ slapi_ch_free_string(&val_copy);
+ }
+ return rc;
+}
+
+/*
+ * Helper function for validating a DN. This function will validate
+ * a single RDN. If the RDN is valid, 0 will be returned, otherwise
+ * non-zero will be returned. A pointer to the last character processed
+ * will be set in the "last parameter. This will be the end of the RDN
+ * in the valid case, and the illegal character in the invalid case.
+ */
+int rdn_validate( const char *begin, const char *end, const char **last )
+{
+ int rc = 0; /* Assume RDN is valid */
+ int numericform = 0;
+ char *separator = NULL;
+ const char *p = begin;
+
+ /* Find the '=', then use the helpers for descr and numericoid */
+ if ((separator = PL_strnchr(p, '=', end - begin + 1)) == NULL) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Process an attribute type. The 'descr'
+ * form must start with a 'leadkeychar'. */
+ if (IS_LEADKEYCHAR(*p)) {
+ if ((rc = keystring_validate(p, separator - 1))) {
+ goto exit;
+ }
+ /* See if the 'numericoid' form is being used */
+ } else if (isdigit(*p)) {
+ numericform = 1;
+ if ((rc = numericoid_validate(p, separator - 1))) {
+ goto exit;
+ }
+ } else {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Advance the pointer past the '=' and make sure
+ * we're not past the end of the string. */
+ p = separator + 1;
+ if (p > end) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* The value must be a 'hexstring' if the 'numericoid'
+ * form of 'attributeType' is used. Per RFC 4514:
+ *
+ * hexstring = SHARP 1*hexpair
+ * hexpair = HEX HEX
+ */
+ if (numericform) {
+ if ((p == end) || !IS_SHARP(*p)) {
+ rc = 1;
+ goto exit;
+ }
+ p++;
+ /* The value must be a 'string' when the 'descr' form
+ * of 'attributeType' is used. Per RFC 4514:
+ *
+ * string = [ ( leadchar / pair ) [ *( stringchar / pair )
+ * ( trailchar / pair ) ] ]
+ *
+ * leadchar = LUTF1 / UTFMB
+ * trailchar = TUTF1 / UTFMB
+ * stringchar = SUTF1 / UTFMB
+ *
+ * pair = ESC (ESC / special / hexpair )
+ * special = escaped / SPACE / SHARP / EQUALS
+ * escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
+ * hexpair = HEX HEX
+ */
+ } else {
+ /* Check the leadchar to see if anything illegal
+ * is there. We need to allow a 'pair' to get
+ * through, so we'll assume that a '\' is the
+ * start of a 'pair' for now. */
+ if (IS_UTF1(*p) && !IS_ESC(*p) && !IS_LUTF1(*p)) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+ /* Loop through string until we find the ',' separator, a '+'
+ * char indicating a multi-value RDN, or we reach the end. */
+ while ((p <= end) && (*p != ',') && (*p != '+')) {
+ if (numericform) {
+ /* Process a single 'hexpair' */
+ if ((p == end) || !isxdigit(*p) || !isxdigit(*p + 1)) {
+ rc = 1;
+ goto exit;
+ }
+ p = p + 2;
+ } else {
+ /* Check for a valid 'stringchar'. We handle
+ * multi-byte characters separately. */
+ if (IS_UTF1(*p)) {
+ /* If we're at the end, check if we have
+ * a valid 'trailchar'. */
+ if ((p == end) && !IS_TUTF1(*p)) {
+ rc = 1;
+ goto exit;
+ /* Check for a 'pair'. */
+ } else if (IS_ESC(*p)) {
+ /* We're guaranteed to still have at
+ * least one more character, so lets
+ * take a look at it. */
+ p++;
+ if (!IS_ESC(*p) && !IS_SPECIAL(*p)) {
+ /* The only thing valid now
+ * is a 'hexpair'. */
+ if ((p == end) || !isxdigit(*p) ||!isxdigit(*p + 1)) {
+ rc = 1;
+ goto exit;
+ }
+ p++;
+ }
+ p++;
+ /* Only allow 'SUTF1' chars now. */
+ } else if (!IS_SUTF1(*p)) {
+ rc = 1;
+ goto exit;
+ }
+
+ p++;
+ } else {
+ /* Validate a single 'UTFMB' (multi-byte) character. */
+ if (utf8char_validate(p, end, &p ) != 0) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Advance the pointer past the multi-byte char. */
+ p++;
+ }
+ }
+ }
+
+ /* We'll end up either at the comma, a '+', or one past end.
+ * If we are processing a multi-valued RDN, we recurse to
+ * process the next 'attributeTypeAndValue'. */
+ if ((p <= end) && (*p == '+')) {
+ /* Make sure that there is something after the '+'. */
+ if (p == end) {
+ rc = 1;
+ goto exit;
+ }
+ p++;
+
+ /* Recurse to process the next value. We need to reset p to
+ * ensure that last is set correctly for the original caller. */
+ rc = rdn_validate( p, end, last );
+ p = *last + 1;
+ }
+
+exit:
+ *last = p - 1;
+ return rc;
+}
+
+int
+bitstring_validate_internal(const char *begin, const char *end)
+{
+ int rc = 0; /* assume the value is valid */
+ const char *p = NULL;
+
+ /* Per RFC4517:
+ *
+ * BitString = SQUOTE *binary-digit SQUOTE "B"
+ * binary-digit = "0" / "1"
+ */
+
+ /* Check that the value starts with a SQUOTE and
+ * ends with SQUOTE "B". */
+ if (!IS_SQUOTE(*begin) || (*end != 'B') ||
+ !IS_SQUOTE(*(end - 1))) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* Ensure that only '0' and '1' are between the SQUOTE chars. */
+ for (p = begin + 1; p <= end - 2; p++) {
+ if ((*p != '0') && (*p != '1')) {
+ rc = 1;
+ goto exit;
+ }
+ }
+
+exit:
+ return rc;
+}
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 696d81037..b4eb0c03d 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -507,19 +507,29 @@ typedef int (*SyntaxEnumFunc)(char **names, Slapi_PluginDesc *plugindesc,
/* OIDs for some commonly used syntaxes */
#define BINARY_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.5"
+#define BITSTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.6"
#define BOOLEAN_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.7"
#define COUNTRYSTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.11"
#define DN_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.12"
+#define DELIVERYMETHOD_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.14"
#define DIRSTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.15"
+#define ENHANCEDGUIDE_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.21"
+#define FACSIMILE_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.22"
+#define FAX_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.23"
#define GENERALIZEDTIME_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.24"
+#define GUIDE_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.25"
#define IA5STRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.26"
#define INTEGER_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.27"
#define JPEG_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.28"
+#define NAMEANDOPTIONALUID_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.34"
#define NUMERICSTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.36"
#define OID_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.38"
#define OCTETSTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.40"
#define POSTALADDRESS_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.41"
+#define PRINTABLESTRING_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.44"
#define TELEPHONE_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.50"
+#define TELETEXTERMID_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.51"
+#define TELEXNUMBER_SYNTAX_OID "1.3.6.1.4.1.1466.115.121.1.52"
#define SPACE_INSENSITIVE_STRING_SYNTAX_OID "2.16.840.1.113730.3.7.1"
/* OIDs for some commonly used matching rules */
| 0 |
8a943175138bbfec0b398ea4ffd24f3047df3951
|
389ds/389-ds-base
|
implement slapi_ldap_explode_dn and slapi_ldap_explode_rdn
The DS has some problems with the openldap versions of these functions:
1) They are deprecated - should use the str2[r]dn and [r]dn2str and the
bv versions of those functions instead
2) They escape utf-8 and other values in the strings - the mozldap functions
do not do this
3) They handle double quoted strings, but they remove the quotes - our
code expects the quotes to be left in place
Until we fix our DN handling, and get rid of the double quoted DNs, we just
use the mozldap versions of these functions.
|
commit 8a943175138bbfec0b398ea4ffd24f3047df3951
Author: Rich Megginson <[email protected]>
Date: Fri Aug 27 11:55:29 2010 -0600
implement slapi_ldap_explode_dn and slapi_ldap_explode_rdn
The DS has some problems with the openldap versions of these functions:
1) They are deprecated - should use the str2[r]dn and [r]dn2str and the
bv versions of those functions instead
2) They escape utf-8 and other values in the strings - the mozldap functions
do not do this
3) They handle double quoted strings, but they remove the quotes - our
code expects the quotes to be left in place
Until we fix our DN handling, and get rid of the double quoted DNs, we just
use the mozldap versions of these functions.
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index cb20dbeb0..4fcdf744a 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -172,9 +172,9 @@ static int check_rdn_access( Slapi_PBlock *pb, Slapi_Entry *e, char *dn,
int retCode = LDAP_INSUFFICIENT_ACCESS;
int i;
- if ( (dns = ldap_explode_dn( dn, 0 )) != NULL ) {
+ if ( (dns = slapi_ldap_explode_dn( dn, 0 )) != NULL ) {
- if ( (rdns = ldap_explode_rdn( dns[0], 0 )) != NULL ) {
+ if ( (rdns = slapi_ldap_explode_rdn( dns[0], 0 )) != NULL ) {
for ( i = 0; rdns[i] != NULL; i++ ) {
char *type;
diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c
index e1eb0ab14..d57291100 100644
--- a/ldap/servers/plugins/acl/aclutil.c
+++ b/ldap/servers/plugins/acl/aclutil.c
@@ -556,8 +556,8 @@ aclutil_expand_paramString ( char *str, Slapi_Entry *e )
char *buf = NULL;
- e_dns = ldap_explode_dn ( slapi_entry_get_ndn ( e ), 0 );
- a_dns = ldap_explode_dn ( str, 0 );
+ e_dns = slapi_ldap_explode_dn ( slapi_entry_get_ndn ( e ), 0 );
+ a_dns = slapi_ldap_explode_dn ( str, 0 );
i = 0;
ncomponents = 0;
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
index 454c51627..3207e5b35 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -375,7 +375,7 @@ _update_one_per_mod(const char *entryDN, /* DN of the searched entry */
Slapi_Value *v = NULL;
/* need to put together rdn into a dn */
- dnParts = ldap_explode_dn( origDN, 0 );
+ dnParts = slapi_ldap_explode_dn( origDN, 0 );
if (NULL == newRDN) {
newRDN = dnParts[0];
}
@@ -553,7 +553,7 @@ _update_all_per_mod(const char *entryDN, /* DN of the searched entry */
Slapi_Value *v = NULL;
/* need to put together rdn into a dn */
- dnParts = ldap_explode_dn( origDN, 0 );
+ dnParts = slapi_ldap_explode_dn( origDN, 0 );
if (NULL == newRDN) {
newRDN = dnParts[0];
}
diff --git a/ldap/servers/plugins/replication/winsync-plugin.h b/ldap/servers/plugins/replication/winsync-plugin.h
index 5a0f65d58..e70c4a943 100644
--- a/ldap/servers/plugins/replication/winsync-plugin.h
+++ b/ldap/servers/plugins/replication/winsync-plugin.h
@@ -371,7 +371,7 @@ test_winsync_get_new_ds_user_dn_cb(void *cbdata, const Slapi_Entry *rawentry,
"--> test_winsync_get_new_ds_user_dn_cb -- old dn [%s] -- begin\n",
*new_dn_string);
- rdns = ldap_explode_dn(*new_dn_string, 0);
+ rdns = slapi_ldap_explode_dn(*new_dn_string, 0);
if (!rdns || !rdns[0]) {
ldap_value_free(rdns);
return;
diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c
index 1337e0373..43a30b8e3 100644
--- a/ldap/servers/slapd/back-ldbm/ancestorid.c
+++ b/ldap/servers/slapd/back-ldbm/ancestorid.c
@@ -867,8 +867,8 @@ int slapi_sdn_suffix_cmp(
size_t len = 0;
char *p, *ndnstr;
- rdns1 = ldap_explode_dn(slapi_sdn_get_ndn(left), 0);
- rdns2 = ldap_explode_dn(slapi_sdn_get_ndn(right), 0);
+ rdns1 = slapi_ldap_explode_dn(slapi_sdn_get_ndn(left), 0);
+ rdns2 = slapi_ldap_explode_dn(slapi_sdn_get_ndn(right), 0);
for(count1 = 0; rdns1[count1]!=NULL; count1++){
}
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 73b40ec00..60a92b380 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -1497,7 +1497,7 @@ upgradedn_producer(void *param)
workdn = slapi_ch_strdup(slapi_sdn_get_dn(sdn));
isentrydn = 1;
}
- rdns = ldap_explode_dn(workdn, 0);
+ rdns = slapi_ldap_explode_dn(workdn, 0);
skipit = 0;
for (rdnsp = rdns; rdnsp && *rdnsp; rdnsp++) {
valueptr = PL_strchr(*rdnsp, '=');
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 4848c83e6..70fdecab7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -701,7 +701,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
{
char **rdns;
int i;
- if ( (rdns = ldap_explode_rdn( slapi_sdn_get_dn(&dn_newrdn), 0 )) != NULL )
+ if ( (rdns = slapi_ldap_explode_rdn( slapi_sdn_get_dn(&dn_newrdn), 0 )) != NULL )
{
for ( i = 0; rdns[i] != NULL; i++ )
{
@@ -1202,10 +1202,10 @@ moddn_newrdn_mods(Slapi_PBlock *pb, const char *olddn, struct backentry *ec, Sla
int baddn = 0; /* set to true if could not parse dn */
int badrdn = 0; /* set to true if could not parse rdn */
dn = slapi_ch_strdup(olddn);
- dns = ldap_explode_dn( dn, 0 );
+ dns = slapi_ldap_explode_dn( dn, 0 );
if ( dns != NULL )
{
- rdns = ldap_explode_rdn( dns[0], 0 );
+ rdns = slapi_ldap_explode_rdn( dns[0], 0 );
if ( rdns != NULL )
{
for ( i = 0; rdns[i] != NULL; i++ )
@@ -1254,7 +1254,7 @@ moddn_newrdn_mods(Slapi_PBlock *pb, const char *olddn, struct backentry *ec, Sla
/*
* add new RDN values to the entry (non-normalized)
*/
- rdns = ldap_explode_rdn( newrdn, 0 );
+ rdns = slapi_ldap_explode_rdn( newrdn, 0 );
if ( rdns != NULL )
{
for ( i = 0; rdns[i] != NULL; i++ )
@@ -1434,7 +1434,7 @@ moddn_rename_child_entry(
* excluding the old parent entry DN, and adding the new
* superior entry DN.
*
- * ldap_explode_dn is probably a bit slow, but it knows about
+ * slapi_ldap_explode_dn is probably a bit slow, but it knows about
* DN escaping which is pretty complicated, and we wouldn't
* want to reimplement that here.
*
@@ -1449,7 +1449,7 @@ moddn_rename_child_entry(
int i;
olddn = slapi_entry_get_dn(ec->ep_entry);
- olddns = ldap_explode_dn( olddn, 0 );
+ olddns = slapi_ldap_explode_dn( olddn, 0 );
for(;olddns[olddncomps]!=NULL;olddncomps++);
for(i=0;i<olddncomps-parentdncomps;i++)
{
@@ -1540,7 +1540,7 @@ moddn_rename_children(
* Break down the parent entry dn into its components.
*/
{
- char **parentdns = ldap_explode_dn( slapi_sdn_get_dn(dn_parentdn), 0 );
+ char **parentdns = slapi_ldap_explode_dn( slapi_sdn_get_dn(dn_parentdn), 0 );
if (parentdns)
{
for(;parentdns[parentdncomps]!=NULL;parentdncomps++);
@@ -1555,7 +1555,7 @@ moddn_rename_children(
/*
* Break down the new superior entry dn into its components.
*/
- newsuperiordns = ldap_explode_dn( slapi_sdn_get_dn(dn_newsuperiordn), 0 );
+ newsuperiordns = slapi_ldap_explode_dn( slapi_sdn_get_dn(dn_newsuperiordn), 0 );
if (newsuperiordns)
{
for(;newsuperiordns[newsuperiordncomps]!=NULL;newsuperiordncomps++);
diff --git a/ldap/servers/slapd/back-ldif/modrdn.c b/ldap/servers/slapd/back-ldif/modrdn.c
index 2ad4e430d..54b009ca9 100644
--- a/ldap/servers/slapd/back-ldif/modrdn.c
+++ b/ldap/servers/slapd/back-ldif/modrdn.c
@@ -170,8 +170,8 @@ ldif_back_modrdn( Slapi_PBlock *pb )
mods = NULL;
bvps[0] = &bv;
bvps[1] = NULL;
- if ( (dns = ldap_explode_dn( dn, 0 )) != NULL ) {
- if ( (rdns = ldap_explode_rdn( dns[0], 0 )) != NULL ) {
+ if ( (dns = slapi_ldap_explode_dn( dn, 0 )) != NULL ) {
+ if ( (rdns = slapi_ldap_explode_rdn( dns[0], 0 )) != NULL ) {
for ( i = 0; rdns[i] != NULL; i++ ) {
/* Delete from entry attributes */
@@ -179,23 +179,23 @@ ldif_back_modrdn( Slapi_PBlock *pb )
ldif_add_mod( &mods, LDAP_MOD_DELETE, type, bvps );
}
}
- ldap_value_free( rdns );
+ slapi_ldap_value_free( rdns );
}
- ldap_value_free( dns );
+ slapi_ldap_value_free( dns );
}
if ( dns == NULL || rdns == NULL ) {
slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL );
goto error_return;
}
/* Add new rdn values to the entry */
- if ( (rdns = ldap_explode_rdn( newrdn, 0 )) != NULL ) {
+ if ( (rdns = slapi_ldap_explode_rdn( newrdn, 0 )) != NULL ) {
for ( i = 0; rdns[i] != NULL; i++ ) {
/* Add to entry */
if ( rdn2typval( rdns[i], &type, &bv ) == 0 ) {
ldif_add_mod( &mods, LDAP_MOD_ADD, type, bvps );
}
}
- ldap_value_free( rdns );
+ slapi_ldap_value_free( rdns );
} else {
slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL );
goto error_return;
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index c6bffdd47..c270892b4 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -1184,8 +1184,8 @@ entry_dn_cmp( caddr_t d1, caddr_t d2 )
{
/* put fewer rdns before more rdns */
int rc = 0;
- char **dnlist1 = ldap_explode_dn(slapi_sdn_get_ndn(dn1), 0);
- char **dnlist2 = ldap_explode_dn(slapi_sdn_get_ndn(dn2), 0);
+ char **dnlist1 = slapi_ldap_explode_dn(slapi_sdn_get_ndn(dn1), 0);
+ char **dnlist2 = slapi_ldap_explode_dn(slapi_sdn_get_ndn(dn2), 0);
int len1 = 0;
int len2 = 0;
if (dnlist1)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 3f956bc62..aa83c96fb 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2873,9 +2873,9 @@ slapi_entry_rdn_values_present( const Slapi_Entry *e )
/* JCM Use the Slapi_RDN code */
rc = 1;
- if ( (dns = ldap_explode_dn( slapi_entry_get_dn_const(e), 0 )) != NULL )
+ if ( (dns = slapi_ldap_explode_dn( slapi_entry_get_dn_const(e), 0 )) != NULL )
{
- if ( (rdns = ldap_explode_rdn( dns[0], 0 )) != NULL )
+ if ( (rdns = slapi_ldap_explode_rdn( dns[0], 0 )) != NULL )
{
for ( i = 0; rdns[i] != NULL; i++ )
{
@@ -2934,10 +2934,10 @@ slapi_entry_add_rdn_values( Slapi_Entry *e )
/* JCM Use the Slapi_RDN code */
/* make sure RDN values are also in the entry */
- if ( (dns = ldap_explode_dn( dn, 0 )) == NULL ) {
+ if ( (dns = slapi_ldap_explode_dn( dn, 0 )) == NULL ) {
return( LDAP_INVALID_DN_SYNTAX );
}
- if ( (rdns = ldap_explode_rdn( dns[0], 0 )) == NULL ) {
+ if ( (rdns = slapi_ldap_explode_rdn( dns[0], 0 )) == NULL ) {
slapi_ldap_value_free( dns );
return( LDAP_INVALID_DN_SYNTAX );
}
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index d2c977e79..f2171282a 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -415,13 +415,13 @@ dn2attrs(const char *dn)
{
int rc= 0;
Slapi_Attr* dnAttrs = NULL;
- char** rdns = ldap_explode_dn (dn, 0);
+ char** rdns = slapi_ldap_explode_dn (dn, 0);
if (rdns)
{
char** rdn = rdns;
for (; !rc && *rdn; ++rdn)
{
- char** avas = ldap_explode_rdn (*rdn, 0);
+ char** avas = slapi_ldap_explode_rdn (*rdn, 0);
if (avas)
{
char** ava = avas;
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 0aab901cf..8cf988969 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -34,6 +34,47 @@
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* All rights reserved.
+ *
+ * mozldap_ldap_explode, mozldap_ldap_explode_dn, mozldap_ldap_explode_rdn
+ * are from the file ldap/libraries/libldap/getdn.c in the Mozilla LDAP C SDK
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Communicator client code, released
+ * March 31, 1998.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998-1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * Copyright (c) 1994 Regents of the University of Michigan.
+ * All rights reserved.
+ *
* END COPYRIGHT BLOCK **/
#ifdef HAVE_CONFIG_H
@@ -60,6 +101,15 @@
#include <ldappr.h>
#endif
+#if defined(USE_OPENLDAP)
+/* the server depends on the old, deprecated ldap_explode behavior which openldap
+ does not support - the use of the mozldap code should be seen as a temporary
+ measure which we should remove as we improve our internal DN handling */
+static char **mozldap_ldap_explode( const char *dn, const int notypes, const int nametype );
+static char **mozldap_ldap_explode_dn( const char *dn, const int notypes );
+static char **mozldap_ldap_explode_rdn( const char *rdn, const int notypes );
+#endif
+
#ifdef MEMPOOL_EXPERIMENTAL
void _free_wrapper(void *ptr)
{
@@ -79,6 +129,7 @@ slapi_ldap_unbind( LDAP *ld )
}
}
+#if defined(USE_OPENLDAP)
/* mozldap ldap_init and ldap_url_parse accept a hostname in the form
host1[:port1]SPACEhost2[:port2]SPACEhostN[:portN]
where SPACE is a single space (0x20) character
@@ -151,6 +202,7 @@ end:
slapi_ch_free_string(&my_copy);
return retstr;
}
+#endif /* USE_OPENLDAP */
const char *
slapi_urlparse_err2string( int err )
@@ -1034,6 +1086,26 @@ done:
return rc;
}
+char **
+slapi_ldap_explode_rdn(const char *rdn, int notypes)
+{
+#if defined(USE_OPENLDAP)
+ return mozldap_ldap_explode_rdn(rdn, notypes);
+#else
+ return ldap_explode_dn(rdn, notypes);
+#endif
+}
+
+char **
+slapi_ldap_explode_dn(const char *dn, int notypes)
+{
+#if defined(USE_OPENLDAP)
+ return mozldap_ldap_explode_dn(dn, notypes);
+#else
+ return ldap_explode_dn(dn, notypes);
+#endif
+}
+
void
slapi_add_auth_response_control( Slapi_PBlock *pb, const char *binddn )
{
@@ -1871,3 +1943,161 @@ cleanup:
}
#endif /* HAVE_KRB5 */
+
+#if defined(USE_OPENLDAP)
+
+#define LDAP_DN 1
+#define LDAP_RDN 2
+
+#define INQUOTE 1
+#define OUTQUOTE 2
+
+static char **
+mozldap_ldap_explode( const char *dn, const int notypes, const int nametype )
+{
+ char *p, *q, *rdnstart, **rdns = NULL;
+ size_t plen = 0;
+ int state = 0;
+ int count = 0;
+ int startquote = 0;
+ int endquote = 0;
+ int len = 0;
+ int goteq = 0;
+
+ if ( dn == NULL ) {
+ dn = "";
+ }
+
+ while ( ldap_utf8isspace( (char *)dn )) { /* ignore leading spaces */
+ ++dn;
+ }
+
+ p = rdnstart = (char *) dn;
+ state = OUTQUOTE;
+
+ do {
+ p += plen;
+ plen = 1;
+ switch ( *p ) {
+ case '\\':
+ if ( *++p == '\0' )
+ p--;
+ else
+ plen = LDAP_UTF8LEN(p);
+ break;
+ case '"':
+ if ( state == INQUOTE )
+ state = OUTQUOTE;
+ else
+ state = INQUOTE;
+ break;
+ case '+': if ( nametype != LDAP_RDN ) break;
+ case ';':
+ case ',':
+ case '\0':
+ if ( state == OUTQUOTE ) {
+ /*
+ * semicolon and comma are not valid RDN
+ * separators.
+ */
+ if ( nametype == LDAP_RDN &&
+ ( *p == ';' || *p == ',' || !goteq)) {
+ charray_free( rdns );
+ return NULL;
+ }
+ if ( (*p == ',' || *p == ';') && !goteq ) {
+ /* If we get here, we have a case similar
+ * to <attr>=<value>,<string>,<attr>=<value>
+ * This is not a valid dn */
+ charray_free( rdns );
+ return NULL;
+ }
+ goteq = 0;
+ ++count;
+ if ( rdns == NULL ) {
+ if (( rdns = (char **)slapi_ch_malloc( 8
+ * sizeof( char *))) == NULL )
+ return( NULL );
+ } else if ( count >= 8 ) {
+ if (( rdns = (char **)slapi_ch_realloc(
+ rdns, (count+1) *
+ sizeof( char *))) == NULL )
+ return( NULL );
+ }
+ rdns[ count ] = NULL;
+ endquote = 0;
+ if ( notypes ) {
+ for ( q = rdnstart;
+ q < p && *q != '='; ++q ) {
+ ;
+ }
+ if ( q < p ) { /* *q == '=' */
+ rdnstart = ++q;
+ }
+ if ( *rdnstart == '"' ) {
+ startquote = 1;
+ ++rdnstart;
+ }
+
+ if ( (*(p-1) == '"') && startquote ) {
+ endquote = 1;
+ --p;
+ }
+ }
+
+ len = p - rdnstart;
+ if (( rdns[ count-1 ] = (char *)slapi_ch_calloc(
+ 1, len + 1 )) != NULL ) {
+ memcpy( rdns[ count-1 ], rdnstart,
+ len );
+ if ( !endquote ) {
+ /* trim trailing spaces */
+ while ( len > 0 &&
+ ldap_utf8isspace(
+ &rdns[count-1][len-1] )) {
+ --len;
+ }
+ }
+ rdns[ count-1 ][ len ] = '\0';
+ }
+
+ /*
+ * Don't forget to increment 'p' back to where
+ * it should be. If we don't, then we will
+ * never get past an "end quote."
+ */
+ if ( endquote == 1 )
+ p++;
+
+ rdnstart = *p ? p + 1 : p;
+ while ( ldap_utf8isspace( rdnstart ))
+ ++rdnstart;
+ }
+ break;
+ case '=':
+ if ( state == OUTQUOTE ) {
+ goteq = 1;
+ }
+ /* FALL */
+ default:
+ plen = LDAP_UTF8LEN(p);
+ break;
+ }
+ } while ( *p );
+
+ return( rdns );
+}
+
+static char **
+mozldap_ldap_explode_dn( const char *dn, const int notypes )
+{
+ return( mozldap_ldap_explode( dn, notypes, LDAP_DN ) );
+}
+
+static char **
+mozldap_ldap_explode_rdn( const char *rdn, const int notypes )
+{
+ return( mozldap_ldap_explode( rdn, notypes, LDAP_RDN ) );
+}
+
+#endif /* USE_OPENLDAP */
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index b721fc79d..4cca3c978 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -465,7 +465,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
}
/* check that the rdn is formatted correctly */
- if ((rdns = ldap_explode_rdn(newrdn, 0)) == NULL)
+ if ((rdns = slapi_ldap_explode_rdn(newrdn, 0)) == NULL)
{
if ( !internal_op ) {
slapi_log_error(SLAPI_LOG_ARGS, NULL,
diff --git a/ldap/servers/slapd/rdn.c b/ldap/servers/slapd/rdn.c
index 1ef2b836d..39b40bd2b 100644
--- a/ldap/servers/slapd/rdn.c
+++ b/ldap/servers/slapd/rdn.c
@@ -101,7 +101,7 @@ slapi_rdn_init_dn(Slapi_RDN *rdn,const char *dn)
slapi_rdn_init(rdn);
if(dn!=NULL)
{
- char **dns= ldap_explode_dn(dn, 0);
+ char **dns= slapi_ldap_explode_dn(dn, 0);
if(dns!=NULL)
{
rdn->rdn= slapi_ch_strdup(dns[0]);
@@ -174,9 +174,9 @@ _slapi_rdn_init_all_dn_ext(Slapi_RDN *rdn, const Slapi_DN *sdn)
if (q) {
char bakup = *q;
*q = '\0';
- dns = ldap_explode_dn(dn, 0);
+ dns = slapi_ldap_explode_dn(dn, 0);
if (NULL == dns) { /* if dn contains NULL RDN (e.g., ",,"),
- ldap_explode_dn returns NULL */
+ slapi_ldap_explode_dn returns NULL */
*q = bakup;
return -1;
}
@@ -187,16 +187,16 @@ _slapi_rdn_init_all_dn_ext(Slapi_RDN *rdn, const Slapi_DN *sdn)
rc = 0; /* success */
} else {
/* Given dn does not belong to this server. Just set it. */
- dns = ldap_explode_dn(dn, 0);
+ dns = slapi_ldap_explode_dn(dn, 0);
}
}
} else {
/* Given dn does not belong to this server. Just set it. */
- dns = ldap_explode_dn(dn, 0);
+ dns = slapi_ldap_explode_dn(dn, 0);
}
} else {
/* Given dn does not belong to this server. Just set it. */
- dns = ldap_explode_dn(dn, 0);
+ dns = slapi_ldap_explode_dn(dn, 0);
}
/* Get the last matched position */
@@ -329,7 +329,7 @@ slapi_rdn_get_rdns(Slapi_RDN *rdn)
}
if(rdn->rdn!=NULL)
{
- rdn->rdns = ldap_explode_rdn( rdn->rdn, 0 );
+ rdn->rdns = slapi_ldap_explode_rdn( rdn->rdn, 0 );
rdns= rdn->rdns;
}
slapi_setbit_uchar(rdn->flag,FLAG_RDNS);
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 948fe1c12..0aab49cab 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5170,6 +5170,40 @@ int slapi_ldif_parse_line(
int *freeval /* values will usually be returned in place as pointers into line - if the value is a url, the value will be malloced and must be freed by the caller */
);
+/**
+ * Parse an LDAP DN string. Return an array of RDN strings, terminated by a NULL. This
+ * function differs from the standard openldap ldap_explode_dn, which will escape utf-8
+ * characters. In the directory server, we do not want to escape them. The caller
+ * should use slapi_ldap_value_free to free the returned memory when finished.
+ *
+ * \param dn The LDAP DN
+ * \param notypes set to true (1) to return only the attribute values with no attribute types
+ * \return \c An array of RDN strings - use slapi_ch_array_free to free
+ *
+ * \see slapi_ldap_value_free()
+ */
+char **slapi_ldap_explode_dn(
+ const char *dn, /* dn to explode */
+ int notypes /* set to true to return only the values with no types */
+);
+
+/**
+ * Parse an LDAP RDN string. Return an array of AVA strings, terminated by a NULL. This
+ * function differs from the standard openldap ldap_explode_rdn, which will escape utf-8
+ * characters. In the directory server, we do not want to escape them. The caller
+ * should use slapi_ldap_value_free to free the returned memory when finished.
+ *
+ * \param dn The LDAP RDN
+ * \param notypes set to true (1) to return only the attribute values with no attribute types
+ * \return \c An array of AVA strings - use slapi_ch_array_free to free
+ *
+ * \see slapi_ldap_value_free()
+ */
+char **slapi_ldap_explode_rdn(
+ const char *rdn, /* rdn to explode */
+ int notypes /* set to true to return only the values with no types */
+);
+
/*
* computed attributes
*/
diff --git a/lib/ldaputil/cert.c b/lib/ldaputil/cert.c
index 30fd0f4be..c26ff41f2 100644
--- a/lib/ldaputil/cert.c
+++ b/lib/ldaputil/cert.c
@@ -221,12 +221,12 @@ _explode_dn (const char* dn)
{
auto char*** exp = NULL;
if (dn && *dn) {
- auto char** rdns = ldap_explode_dn (dn, 0);
+ auto char** rdns = slapi_ldap_explode_dn (dn, 0);
if (rdns) {
auto size_t expLen = 0;
auto char** rdn;
for (rdn = rdns; *rdn; ++rdn) {
- auto char** avas = ldap_explode_rdn (*rdn, 0);
+ auto char** avas = slapi_ldap_explode_rdn (*rdn, 0);
if (avas && *avas) {
exp = (char***) ldapu_realloc (exp, sizeof(char**) * (expLen + 2));
if (exp) {
| 0 |
84d2f261bf2b5a58c3b2f6bc1a1346eb1a4a6bc4
|
389ds/389-ds-base
|
Resolves: #430172
Summary: memory leaks after db "get" deadlocks, e.g. in CL5 trim
Description: Even if cursor->c_get returns non SUCCESS(==0), there is an
occasion that DBT data holds memory which is allocated in libdb. To release
the memory, put
slapi_ch_free ((void **)&key.data);
slapi_ch_free ((void **)&data.data);
just after the while loop, where we come to the point when cursor->c_get fails.
|
commit 84d2f261bf2b5a58c3b2f6bc1a1346eb1a4a6bc4
Author: Noriko Hosoi <[email protected]>
Date: Wed Nov 26 00:13:42 2008 +0000
Resolves: #430172
Summary: memory leaks after db "get" deadlocks, e.g. in CL5 trim
Description: Even if cursor->c_get returns non SUCCESS(==0), there is an
occasion that DBT data holds memory which is allocated in libdb. To release
the memory, put
slapi_ch_free ((void **)&key.data);
slapi_ch_free ((void **)&data.data);
just after the while loop, where we come to the point when cursor->c_get fails.
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 11ad776aa..a0859b400 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -5387,6 +5387,21 @@ static int _cl5GetFirstEntry (Object *obj, CL5Entry *entry, void **iterator, DB_
return CL5_SUCCESS;
}
+ /*
+ * Bug 430172 - memory leaks after db "get" deadlocks, e.g. in CL5 trim
+ * Even when db->c_get() does not return success, memory may have been
+ * allocated in the DBT. This seems to happen when DB_DBT_MALLOC was set,
+ * the data being retrieved is larger than the page size, and we got
+ * DB_LOCK_DEADLOCK. libdb allocates the memory and then finds itself
+ * deadlocked trying to go through the overflow page list. It returns
+ * DB_LOCK_DEADLOCK which we've assumed meant that no memory was allocated
+ * for the DBT.
+ *
+ * The following slapi_ch_free frees the memory only when the value is
+ * non NULL, which is true if the situation described above occurs.
+ */
+ slapi_ch_free ((void **)&key.data);
+ slapi_ch_free ((void **)&data.data);
/* walked of the end of the file */
if (rc == DB_NOTFOUND)
@@ -5456,6 +5471,21 @@ static int _cl5GetNextEntry (CL5Entry *entry, void *iterator)
return rc;
}
+ /*
+ * Bug 430172 - memory leaks after db "get" deadlocks, e.g. in CL5 trim
+ * Even when db->c_get() does not return success, memory may have been
+ * allocated in the DBT. This seems to happen when DB_DBT_MALLOC was set,
+ * the data being retrieved is larger than the page size, and we got
+ * DB_LOCK_DEADLOCK. libdb allocates the memory and then finds itself
+ * deadlocked trying to go through the overflow page list. It returns
+ * DB_LOCK_DEADLOCK which we've assumed meant that no memory was allocated
+ * for the DBT.
+ *
+ * The following slapi_ch_free frees the memory only when the value is
+ * non NULL, which is true if the situation described above occurs.
+ */
+ slapi_ch_free ((void **)&key.data);
+ slapi_ch_free ((void **)&data.data);
/* walked of the end of the file or entry is out of range */
if (rc == 0 || rc == DB_NOTFOUND)
| 0 |
77f5376a533c01545ddb3fefacd35665b1530600
|
389ds/389-ds-base
|
Ticket 49054 - Fix sasl_map unused paramater compiler warnings.
Bug Description: sasl_map reports unused parameter warnings, but because it's
a call back the parameters are needed.
Fix Description: Add the gcc attributes to mask the warnings.
https://fedorahosted.org/389/ticket/49054
Author: wibrown
Review by: mreynolds (Thanks)
|
commit 77f5376a533c01545ddb3fefacd35665b1530600
Author: William Brown <[email protected]>
Date: Fri Nov 25 10:50:14 2016 +1000
Ticket 49054 - Fix sasl_map unused paramater compiler warnings.
Bug Description: sasl_map reports unused parameter warnings, but because it's
a call back the parameters are needed.
Fix Description: Add the gcc attributes to mask the warnings.
https://fedorahosted.org/389/ticket/49054
Author: wibrown
Review by: mreynolds (Thanks)
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index 1b28e4c26..84f845d36 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -434,7 +434,7 @@ sasl_map_read_config_startup(sasl_map_private *priv)
}
int
-sasl_map_config_add(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg)
+sasl_map_config_add(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext __attribute__((unused)) , void *arg)
{
int ret = 0;
sasl_map_data *dp = NULL;
@@ -485,7 +485,7 @@ sasl_map_config_modify(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
}
int
-sasl_map_config_delete(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg)
+sasl_map_config_delete(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext __attribute__((unused)), void *arg)
{
int ret = 0;
sasl_map_private *priv = sasl_map_get_global_priv();
| 0 |
ca1bfa7b34dd88249598ccd9c4ec47da526cf431
|
389ds/389-ds-base
|
minor edits to remove references to cos in the example
|
commit ca1bfa7b34dd88249598ccd9c4ec47da526cf431
Author: Pete Rowley <[email protected]>
Date: Wed Jan 31 22:36:10 2007 +0000
minor edits to remove references to cos in the example
diff --git a/ldap/servers/plugins/vattrsp_template/vattrsp.c b/ldap/servers/plugins/vattrsp_template/vattrsp.c
index b58e4e040..5a7afe169 100644
--- a/ldap/servers/plugins/vattrsp_template/vattrsp.c
+++ b/ldap/servers/plugins/vattrsp_template/vattrsp.c
@@ -95,8 +95,8 @@ static int vattrsp_vattr_types(
);
-static Slapi_PluginDesc pdesc = { "vattrsp", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
- "class of service plugin" };
+static Slapi_PluginDesc pdesc = { "vattrexamplesp", PLUGIN_MAGIC_VENDOR_STR, PRODUCTTEXT,
+ "vattr service provider example plugin" };
static void * vattrsp_plugin_identity = NULL;
| 0 |
3cdf0eb571d120573f2cda2c140fd2b4215c94fa
|
389ds/389-ds-base
|
Ticket 47937 - Crash in entry_add_present_values_wsi_multi_valued
Bug Description: If the DNA plugin uses an invlid attribute for "dnaType"
this can lead to crash when DNA attempts to update this
attribute.
Fix Description: In the DNA plugin, verify that the attribute exists.
Also in entrywsi.c, pass in the type from the attribute
struct(which does do some basic normalization).
https://fedorahosted.org/389/ticket/47937
Reviewed by: nhosoi(Thanks!)
|
commit 3cdf0eb571d120573f2cda2c140fd2b4215c94fa
Author: Mark Reynolds <[email protected]>
Date: Fri Oct 24 14:14:25 2014 -0400
Ticket 47937 - Crash in entry_add_present_values_wsi_multi_valued
Bug Description: If the DNA plugin uses an invlid attribute for "dnaType"
this can lead to crash when DNA attempts to update this
attribute.
Fix Description: In the DNA plugin, verify that the attribute exists.
Also in entrywsi.c, pass in the type from the attribute
struct(which does do some basic normalization).
https://fedorahosted.org/389/ticket/47937
Reviewed by: nhosoi(Thanks!)
diff --git a/dirsrvtests/tickets/ticket47937_test.py b/dirsrvtests/tickets/ticket47937_test.py
new file mode 100644
index 000000000..09ee71422
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47937_test.py
@@ -0,0 +1,237 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import pytest
+from lib389 import DirSrv, Entry, tools
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from constants import *
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the backups
+ backup_standalone = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ standalone.start(timeout=10)
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # Remove the backup. So even if we have a specific backup file
+ # (e.g backup_standalone) we clear backup that an instance may have created
+ if backup_standalone:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+
+def test_ticket47937(topology):
+ """
+ Test that DNA plugin only accepts valid attributes for "dnaType"
+ """
+
+ log.info("Creating \"ou=people\"...")
+ try:
+ topology.standalone.add_s(Entry(('ou=people,' + SUFFIX, {
+ 'objectclass': 'top organizationalunit'.split(),
+ 'ou': 'people'
+ })))
+
+ except ldap.ALREADY_EXISTS:
+ pass
+ except ldap.LDAPError, e:
+ log.error('Failed to add ou=people org unit: error ' + e.message['desc'])
+ assert False
+
+ log.info("Creating \"ou=ranges\"...")
+ try:
+ topology.standalone.add_s(Entry(('ou=ranges,' + SUFFIX, {
+ 'objectclass': 'top organizationalunit'.split(),
+ 'ou': 'ranges'
+ })))
+
+ except ldap.LDAPError, e:
+ log.error('Failed to add ou=ranges org unit: error ' + e.message['desc'])
+ assert False
+
+ log.info("Creating \"cn=entry\"...")
+ try:
+ topology.standalone.add_s(Entry(('cn=entry,ou=people,' + SUFFIX, {
+ 'objectclass': 'top groupofuniquenames'.split(),
+ 'cn': 'entry'
+ })))
+
+ except ldap.LDAPError, e:
+ log.error('Failed to add test entry: error ' + e.message['desc'])
+ assert False
+
+ log.info("Creating DNA shared config entry...")
+ try:
+ topology.standalone.add_s(Entry(('dnaHostname=localhost.localdomain+dnaPortNum=389,ou=ranges,%s' % SUFFIX, {
+ 'objectclass': 'top dnaSharedConfig'.split(),
+ 'dnaHostname': 'localhost.localdomain',
+ 'dnaPortNum': '389',
+ 'dnaSecurePortNum': '636',
+ 'dnaRemainingValues': '9501'
+ })))
+
+ except ldap.LDAPError, e:
+ log.error('Failed to add shared config entry: error ' + e.message['desc'])
+ assert False
+
+ log.info("Add dna plugin config entry...")
+ try:
+ topology.standalone.add_s(Entry(('cn=dna config,cn=Distributed Numeric Assignment Plugin,cn=plugins,cn=config', {
+ 'objectclass': 'top dnaPluginConfig'.split(),
+ 'dnaType': 'description',
+ 'dnaMaxValue': '10000',
+ 'dnaMagicRegen': '0',
+ 'dnaFilter': '(objectclass=top)',
+ 'dnaScope': 'ou=people,%s' % SUFFIX,
+ 'dnaNextValue': '500',
+ 'dnaSharedCfgDN': 'ou=ranges,%s' % SUFFIX
+ })))
+
+ except ldap.LDAPError, e:
+ log.error('Failed to add DNA config entry: error ' + e.message['desc'])
+ assert False
+
+ log.info("Enable the DNA plugin...")
+ try:
+ topology.standalone.plugins.enable(name=PLUGIN_DNA)
+ except e:
+ log.error("Failed to enable DNA Plugin: error " + e.message['desc'])
+ assert False
+
+ log.info("Restarting the server...")
+ topology.standalone.stop(timeout=120)
+ time.sleep(1)
+ topology.standalone.start(timeout=120)
+ time.sleep(3)
+
+ log.info("Apply an invalid attribute to the DNA config(dnaType: foo)...")
+
+ try:
+ topology.standalone.modify_s('cn=dna config,cn=Distributed Numeric Assignment Plugin,cn=plugins,cn=config',
+ [(ldap.MOD_REPLACE, 'dnaType', 'foo')])
+ except ldap.LDAPError, e:
+ log.info('Operation failed as expected (error: %s)' % e.message['desc'])
+ else:
+ log.error('Operation incorectly succeeded! Test Failed!')
+ assert False
+
+ topology.standalone.log.info('Test 47937 Passed.')
+
+
+def test_ticket47937_final(topology):
+ topology.standalone.stop(timeout=10)
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47937(topo)
+
+if __name__ == '__main__':
+ run_isolated()
\ No newline at end of file
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index bc280a46b..75edca820 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -936,6 +936,14 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
}
for (i = 0; entry->types && entry->types[i]; i++) {
+ if (!slapi_attr_syntax_exists(entry->types[i])){
+ slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
+ "dna_parse_config_entry: dnaType (%s) does "
+ "not exist.\n",
+ entry->types[i]);
+ ret = DNA_FAILURE;
+ goto bail;
+ }
slapi_log_error(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
"----------> %s [%s]\n", DNA_TYPE, entry->types[i]);
}
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 7039bfc8a..41afe1a40 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -423,6 +423,7 @@ static void resolve_attribute_state_present_to_deleted(Slapi_Entry *e, Slapi_Att
static void resolve_attribute_state_to_present_or_deleted(Slapi_Entry *e, Slapi_Attr *a, Slapi_Value **valuestoupdate, int attribute_state);
static int entry_add_present_values_wsi_single_valued(Slapi_Entry *e, const char *type, struct berval **bervals, const CSN *csn, int urp, long flags);
static int entry_add_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, struct berval **bervals, const CSN *csn, int urp, long flags);
+
static int
entry_add_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **bervals, const CSN *csn, int urp, long flags)
{
@@ -439,11 +440,11 @@ entry_add_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **b
if(slapi_attr_flag_is_set(a,SLAPI_ATTR_FLAG_SINGLE))
{
- retVal = entry_add_present_values_wsi_single_valued( e, type, bervals, csn, urp, 0 );
+ retVal = entry_add_present_values_wsi_single_valued( e, a->a_type, bervals, csn, urp, 0 );
}
else
{
- retVal = entry_add_present_values_wsi_multi_valued( e, type, bervals, csn, urp, 0 );
+ retVal = entry_add_present_values_wsi_multi_valued( e, a->a_type, bervals, csn, urp, 0 );
}
return retVal;
}
| 0 |
b3b0217acd2cffbf914fb1d0e61a73eb5b4e688c
|
389ds/389-ds-base
|
Bug 588791 - Allow anonymous rootDSE access only
This patch changes the nsslapd-allow-anonymous-access config
setting to allow a third value that gives anonymous access to
search the rootDSE. If you set this attribute to "rootdse", an
anonymous bind identity is only allowed to do a rootDSE search
or prove that it is someone other than anonymous. This also
required allowing explicit anonymous BIND operations through since
ldapsearch performs an explicit bind before searching. The old
behavior with the "on" and "off" settings remains unchanged.
|
commit b3b0217acd2cffbf914fb1d0e61a73eb5b4e688c
Author: Nathan Kinder <[email protected]>
Date: Fri Dec 10 13:05:59 2010 -0800
Bug 588791 - Allow anonymous rootDSE access only
This patch changes the nsslapd-allow-anonymous-access config
setting to allow a third value that gives anonymous access to
search the rootDSE. If you set this attribute to "rootdse", an
anonymous bind identity is only allowed to do a rootDSE search
or prove that it is someone other than anonymous. This also
required allowing explicit anonymous BIND operations through since
ldapsearch performs an explicit bind before searching. The old
behavior with the "on" and "off" settings remains unchanged.
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 5f4ab03f2..8b666f1f7 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -514,8 +514,9 @@ do_bind( Slapi_PBlock *pb )
that counter */
slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
- /* Refuse the operation if anonymous access is disabled. */
- if (!config_get_anon_access_switch()) {
+ /* Refuse the operation if anonymous access is disabled. We need to allow
+ * an anonymous bind through if only root DSE anonymous access is set too. */
+ if (config_get_anon_access_switch() == SLAPD_ANON_ACCESS_OFF) {
send_ldap_result(pb, LDAP_INAPPROPRIATE_AUTH, NULL,
"Anonymous access is not allowed", 0, NULL);
/* increment BindSecurityErrorcount */
@@ -544,7 +545,7 @@ do_bind( Slapi_PBlock *pb )
slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
/* Refuse the operation if anonymous access is disabled. */
- if (!config_get_anon_access_switch()) {
+ if (config_get_anon_access_switch() != SLAPD_ANON_ACCESS_ON) {
send_ldap_result(pb, LDAP_INAPPROPRIATE_AUTH, NULL,
"Anonymous access is not allowed", 0, NULL);
/* increment BindSecurityErrorcount */
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 75d958456..d3b3286d8 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -522,10 +522,20 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
* not authenticated, only allow bind and extended operations.
* We allow extended operations so one can do a startTLS prior
* to binding to protect their credentials in transit.
- * We also allow UNBIND and ABANDON. */
- if (!config_get_anon_access_switch() && (op->o_tag != LDAP_REQ_BIND) &&
- (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) &&
- (op->o_tag != LDAP_REQ_ABANDON) && (slapi_sdn_get_dn(&(op->o_sdn)) == NULL )) {
+ * We also allow UNBIND and ABANDON.
+ *
+ * If anonymous access is only allowed for root DSE searches,
+ * we let SEARCH operations through as well. The search code
+ * is responsible for checking if the operation is a root DSE
+ * search. */
+ if ((slapi_sdn_get_dn(&(op->o_sdn)) == NULL ) &&
+ /* anon access off and something other than BIND, EXTOP, UNBIND or ABANDON */
+ (((config_get_anon_access_switch() == SLAPD_ANON_ACCESS_OFF) && (op->o_tag != LDAP_REQ_BIND) &&
+ (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) && (op->o_tag != LDAP_REQ_ABANDON)) ||
+ /* root DSE access only and something other than BIND, EXTOP, UNBIND, ABANDON, or SEARCH */
+ ((config_get_anon_access_switch() == SLAPD_ANON_ACCESS_ROOTDSE) && (op->o_tag != LDAP_REQ_BIND) &&
+ (op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) &&
+ (op->o_tag != LDAP_REQ_ABANDON) && (op->o_tag != LDAP_REQ_SEARCH)))) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
" - Anonymous access not allowed\n",
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index a521cb7bb..f7e6ebe31 100644
--- a/ldap/servers/slapd/extendop.c
+++ b/ldap/servers/slapd/extendop.c
@@ -327,7 +327,7 @@ do_extended( Slapi_PBlock *pb )
/* If anonymous access is disabled and we haven't
* authenticated yet, only allow startTLS. */
- if (!config_get_anon_access_switch() && ((pb->pb_op->o_authtype == NULL) ||
+ if ((config_get_anon_access_switch() != SLAPD_ANON_ACCESS_ON) && ((pb->pb_op->o_authtype == NULL) ||
(strcasecmp(pb->pb_op->o_authtype, SLAPD_AUTH_NONE) == 0))) {
send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
"Anonymous access is not allowed.", 0, NULL );
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index a7cc1bc28..e1fb7ddf8 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -115,7 +115,8 @@ typedef enum {
CONFIG_SPECIAL_REFERRALLIST, /* this is a berval list */
CONFIG_SPECIAL_SSLCLIENTAUTH, /* maps strings to an enumeration */
CONFIG_SPECIAL_ERRORLOGLEVEL, /* requires & with LDAP_DEBUG_ANY */
- CONFIG_STRING_OR_EMPTY /* use an empty string */
+ CONFIG_STRING_OR_EMPTY, /* use an empty string */
+ CONFIG_SPECIAL_ANON_ACCESS_SWITCH /* maps strings to an enumeration */
} ConfigVarType;
static int config_set_onoff( const char *attrname, char *value,
@@ -616,7 +617,7 @@ static struct config_get_and_set {
(ConfigGetFunc)config_get_require_secure_binds},
{CONFIG_ANON_ACCESS_ATTRIBUTE, config_set_anon_access_switch,
NULL, 0,
- (void**)&global_slapdFrontendConfig.allow_anon_access, CONFIG_ON_OFF,
+ (void**)&global_slapdFrontendConfig.allow_anon_access, CONFIG_SPECIAL_ANON_ACCESS_SWITCH,
(ConfigGetFunc)config_get_anon_access_switch},
{CONFIG_MINSSF_ATTRIBUTE, config_set_minssf,
NULL, 0,
@@ -885,7 +886,7 @@ FrontendConfig_init () {
#endif
cfg->allow_unauth_binds = LDAP_OFF;
cfg->require_secure_binds = LDAP_OFF;
- cfg->allow_anon_access = LDAP_ON;
+ cfg->allow_anon_access = SLAPD_ANON_ACCESS_ON;
cfg->slapi_counters = LDAP_ON;
cfg->threadnumber = SLAPD_DEFAULT_MAX_THREADS;
cfg->maxthreadsperconn = SLAPD_DEFAULT_MAX_THREADS_PER_CONN;
@@ -4628,12 +4629,11 @@ config_get_require_secure_binds(void)
int
config_get_anon_access_switch(void)
{
- int retVal;
+ char *retVal = NULL;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
CFG_LOCK_READ(slapdFrontendConfig);
- retVal = slapdFrontendConfig->allow_anon_access;
+ retVal = slapdFrontendConfig->allow_anon_access;
CFG_UNLOCK_READ(slapdFrontendConfig);
-
return retVal;
}
@@ -5503,12 +5503,34 @@ config_set_anon_access_switch( const char *attrname, char *value,
int retVal = LDAP_SUCCESS;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- retVal = config_set_onoff(attrname,
- value,
- &(slapdFrontendConfig->allow_anon_access),
- errorbuf,
- apply);
+ if (config_value_is_null(attrname, value, errorbuf, 0)) {
+ return LDAP_OPERATIONS_ERROR;
+ }
+
+ if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
+ (strcasecmp(value, "rootdse") != 0)) {
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: invalid value \"%s\". Valid values are \"on\", "
+ "\"off\", or \"rootdse\".", attrname, value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ }
+
+ if (!apply) {
+ /* we can return now if we aren't applying the changes */
+ return retVal;
+ }
+ CFG_LOCK_WRITE(slapdFrontendConfig);
+
+ if (strcasecmp(value, "on") == 0 ) {
+ slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_ON;
+ } else if (strcasecmp(value, "off") == 0 ) {
+ slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_OFF;
+ } else if (strcasecmp(value, "rootdse") == 0) {
+ slapdFrontendConfig->allow_anon_access = SLAPD_ANON_ACCESS_ROOTDSE;
+ }
+
+ CFG_UNLOCK_WRITE(slapdFrontendConfig);
return retVal;
}
@@ -5776,6 +5798,22 @@ config_set_value(
slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
break;
+ case CONFIG_SPECIAL_ANON_ACCESS_SWITCH:
+ if (!value) {
+ slapi_entry_attr_set_charptr(e, cgas->attr_name, "off");
+ break;
+ }
+
+ if (*((int *)value) == SLAPD_ANON_ACCESS_ON) {
+ sval = "on";
+ } else if (*((int *)value) == SLAPD_ANON_ACCESS_ROOTDSE) {
+ sval = "rootdse";
+ } else {
+ sval = "off";
+ }
+ slapi_entry_attr_set_charptr(e, cgas->attr_name, sval);
+ break;
+
default:
PR_ASSERT(0); /* something went horribly wrong . . . */
break;
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 0a195dee8..401a82f35 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -663,7 +663,7 @@ void ids_sasl_server_new(Connection *conn)
secprops.max_ssf = 0xffffffff;
secprops.min_ssf = config_get_minssf();
/* If anonymous access is disabled, set the appropriate flag */
- if (!config_get_anon_access_switch()) {
+ if (config_get_anon_access_switch() != SLAPD_ANON_ACCESS_ON) {
secprops.security_flags = SASL_SEC_NOANONYMOUS;
}
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index 2909a1702..ff4de1764 100644
--- a/ldap/servers/slapd/search.c
+++ b/ldap/servers/slapd/search.c
@@ -152,6 +152,18 @@ do_search( Slapi_PBlock *pb )
*(base + baselen) = '\0';
}
+ /* If anonymous access is only allowed for searching the root DSE,
+ * we need to reject any other anonymous search attempts. */
+ if ((slapi_sdn_get_dn(&(operation->o_sdn)) == NULL) && ((baselen != 0) || (scope != LDAP_SCOPE_BASE))
+ && (config_get_anon_access_switch() == SLAPD_ANON_ACCESS_ROOTDSE)) {
+ op_shared_log_error_access(pb, "SRCH", base?base:"", "anonymous search not allowed");
+
+ send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
+ "Anonymous access is not allowed.", 0, NULL );
+
+ goto free_and_return;
+ }
+
/*
* ignore negative time and size limits since they make no sense
*/
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index d71367fd7..1cb52126c 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -328,6 +328,11 @@ typedef void (*VFP0)(void);
#define SLAPD_LDAPI_DEFAULT_FILENAME "/var/run/ldapi"
#define SLAPD_LDAPI_DEFAULT_STATUS "off"
+/* Anonymous access */
+#define SLAPD_ANON_ACCESS_OFF 0
+#define SLAPD_ANON_ACCESS_ON 1
+#define SLAPD_ANON_ACCESS_ROOTDSE 2
+
struct subfilt {
char *sf_type;
char *sf_initial;
| 0 |
01857c348ee8c179a0a76dd3683c2b7438cb7de2
|
389ds/389-ds-base
|
Issue 5175 - Remove stale zlib-devel dependency declaration (#5173)
Relates: https://github.com/389ds/389-ds-base/issues/5175
Reviewed by: Mark Reynolds <[email protected]>
Reviewed by: William Brown <[email protected]>
|
commit 01857c348ee8c179a0a76dd3683c2b7438cb7de2
Author: Florian Schmaus <[email protected]>
Date: Mon May 16 13:42:32 2022 +0200
Issue 5175 - Remove stale zlib-devel dependency declaration (#5173)
Relates: https://github.com/389ds/389-ds-base/issues/5175
Reviewed by: Mark Reynolds <[email protected]>
Reviewed by: William Brown <[email protected]>
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 1209c9ed2..7e91854b5 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -106,7 +106,6 @@ BuildRequires: libubsan
# The following are needed to build the snmp ldap-agent
BuildRequires: net-snmp-devel
BuildRequires: bzip2-devel
-BuildRequires: zlib-devel
BuildRequires: openssl-devel
# the following is for the pam passthru auth plug-in
BuildRequires: pam-devel
| 0 |
fa620fc7911d824048909b83125259743378f6a6
|
389ds/389-ds-base
|
Ticket #48800 - Cleaning up error buffers
Description: The changes in this patch is mainly one of these,
1. unifying error buffer size to SLAPI_DSE_RETURNTEXT_SIZE.
An error buf is filled either in config, mapping-tree, log, pass-
word code, where the size SLAPI_DSE_RETURNTEXT_SIZE is expected,
while some callers declare BUFSIZ array and pass it.
Note: SLAPI_DSE_RETURNTEXT_SIZE is defined as 512 in slapi-plugin.h.
2. replacing PR_snprintf with slapi_create_errormsg.
slapi_create_errormsg is almost the same as PR_snprintf except
2-1 the former does not do anything if the place to write the error
message is NULL. With this change, we can skip returning an
error message if it is not needed.
2-2 If buffer size 0 is given, sizeof(buffer) is used as the size
of buffer. The strict size is supposed to be passed only when
the error buffer is allocated on the heap.
3. Avoiding unnecessary array.
Caller sometimes declares an error buffer even though it does not
use it. This patch removed such error buffer declaration or moved
it in the local block where it is being used.
https://fedorahosted.org/389/ticket/48800
Reviewed by [email protected] (Thank you, William!!)
|
commit fa620fc7911d824048909b83125259743378f6a6
Author: Noriko Hosoi <[email protected]>
Date: Wed Apr 20 17:21:20 2016 -0700
Ticket #48800 - Cleaning up error buffers
Description: The changes in this patch is mainly one of these,
1. unifying error buffer size to SLAPI_DSE_RETURNTEXT_SIZE.
An error buf is filled either in config, mapping-tree, log, pass-
word code, where the size SLAPI_DSE_RETURNTEXT_SIZE is expected,
while some callers declare BUFSIZ array and pass it.
Note: SLAPI_DSE_RETURNTEXT_SIZE is defined as 512 in slapi-plugin.h.
2. replacing PR_snprintf with slapi_create_errormsg.
slapi_create_errormsg is almost the same as PR_snprintf except
2-1 the former does not do anything if the place to write the error
message is NULL. With this change, we can skip returning an
error message if it is not needed.
2-2 If buffer size 0 is given, sizeof(buffer) is used as the size
of buffer. The strict size is supposed to be passed only when
the error buffer is allocated on the heap.
3. Avoiding unnecessary array.
Caller sometimes declares an error buffer even though it does not
use it. This patch removed such error buffer declaration or moved
it in the local block where it is being used.
https://fedorahosted.org/389/ticket/48800
Reviewed by [email protected] (Thank you, William!!)
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index 8ab6f5882..ff9b4500c 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -1306,9 +1306,7 @@ DS_LASUserDnAttrEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator,
/* Wow it matches */
slapi_log_error( SLAPI_LOG_ACL, plugin_name,
"%s matches(%s, %s) level (%d)\n", attr_name,
- val,
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo.clientDn, ebuf),
- 0);
+ val, ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo.clientDn, ebuf), 0);
matched = ACL_TRUE;
slapi_ch_free ( (void **) &val);
break;
@@ -2844,7 +2842,6 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
char *str, *s_str, *base, *groupattr = NULL;
int i,j,k,matched, enumerate_groups;
aclUserGroup *u_group;
- char ebuf [ BUFSIZ ];
Slapi_Value *sval=NULL;
const struct berval *attrVal;
@@ -2967,14 +2964,18 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
slapi_ch_free_string(&filter_str_ptr);
- if (tt == info.lu_idx) {
- slapi_log_error( SLAPI_LOG_ACL, plugin_name, "currDn:(%s) \n\tNO MEMBER ADDED\n",
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf));
- } else {
- for (i=tt; i < info.lu_idx; i++)
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "currDn:(%s) \n\tADDED MEMBER[%d]=%s\n",
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf), i, info.member[i]);
+ if (slapi_is_loglevel_set(SLAPI_LOG_ACL)) {
+ char ebuf[BUFSIZ];
+ if (tt == info.lu_idx) {
+ slapi_log_error(SLAPI_LOG_ACL, plugin_name, "currDn:(%s) \n\tNO MEMBER ADDED\n",
+ ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf));
+ } else {
+ for (i=tt; i < info.lu_idx; i++) {
+ slapi_log_error(SLAPI_LOG_ACL, plugin_name,
+ "currDn:(%s) \n\tADDED MEMBER[%d]=%s\n",
+ ACL_ESCAPE_STRING_WITH_PUNCTUATION (curMemberDn, ebuf), i, info.member[i]);
+ }
+ }
}
if (info.c_idx >= info.lu_idx) {
@@ -3019,10 +3020,14 @@ acllas__eval_memberGroupDnAttr (char *attrName, Slapi_Entry *e,
}
}
- for (j=0; j < u_group->aclug_numof_member_group; j++)
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "acllas__eval_memberGroupDnAttr:GROUP[%d] IN CACHE:%s\n",
- j, ACL_ESCAPE_STRING_WITH_PUNCTUATION (u_group->aclug_member_groups[j], ebuf));
+ if (slapi_is_loglevel_set(SLAPI_LOG_ACL)) {
+ char ebuf[BUFSIZ];
+ for (j = 0; j < u_group->aclug_numof_member_group; j++) {
+ slapi_log_error(SLAPI_LOG_ACL, plugin_name,
+ "acllas__eval_memberGroupDnAttr:GROUP[%d] IN CACHE:%s\n",
+ j, ACL_ESCAPE_STRING_WITH_PUNCTUATION (u_group->aclug_member_groups[j], ebuf));
+ }
+ }
matched = ACL_FALSE;
slapi_entry_attr_find( e, groupattr, &attr);
@@ -4467,7 +4472,6 @@ acllas_eval_one_role(char *role, lasInfo *lasinfo) {
Slapi_DN *roleDN = NULL;
int rc = ACL_FALSE;
- char ebuf [ BUFSIZ ];
/*
* See if lasinfo.clientDn has role rolebuf.
@@ -4478,26 +4482,24 @@ acllas_eval_one_role(char *role, lasInfo *lasinfo) {
roleDN = slapi_sdn_new_dn_byval(role);
if (role) {
- rc = acllas__user_has_role(
- lasinfo->aclpb,
- roleDN,
- lasinfo->aclpb->aclpb_authorization_sdn);
+ rc = acllas__user_has_role(lasinfo->aclpb, roleDN, lasinfo->aclpb->aclpb_authorization_sdn);
} else { /* The user does not have the empty role */
rc = ACL_FALSE;
}
slapi_sdn_free(&roleDN );
/* Some useful logging */
- if (rc == ACL_TRUE ) {
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "role evaluation: user '%s' does have role '%s'\n",
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo->clientDn, ebuf),
- role);
- } else {
- slapi_log_error( SLAPI_LOG_ACL, plugin_name,
- "role evaluation: user '%s' does NOT have role '%s'\n",
- ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo->clientDn, ebuf),
- role);
+ if (slapi_is_loglevel_set(SLAPI_LOG_ACL)) {
+ char ebuf[BUFSIZ];
+ if (rc == ACL_TRUE ) {
+ slapi_log_error(SLAPI_LOG_ACL, plugin_name,
+ "role evaluation: user '%s' does have role '%s'\n",
+ ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo->clientDn, ebuf), role);
+ } else {
+ slapi_log_error(SLAPI_LOG_ACL, plugin_name,
+ "role evaluation: user '%s' does NOT have role '%s'\n",
+ ACL_ESCAPE_STRING_WITH_PUNCTUATION (lasinfo->clientDn, ebuf), role);
+ }
}
return(rc);
}
diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c
index 308cf8bf4..b0e9d715c 100644
--- a/ldap/servers/plugins/acl/aclutil.c
+++ b/ldap/servers/plugins/acl/aclutil.c
@@ -165,14 +165,13 @@ void
aclutil_print_err (int rv , const Slapi_DN *sdn, const struct berval* val,
char **errbuf)
{
- char ebuf [BUFSIZ];
+ char ebuf[BUFSIZ];
/*
* The maximum size of line is ebuf_size + the log message
* itself (less than 200 characters for all but potentially ACL_INVALID_TARGET)
*/
- char line [BUFSIZ + 200];
- char str [1024];
- const char *dn;
+ char line[BUFSIZ + 200];
+ char str[1024];
char *lineptr = line;
char *newline = NULL;
@@ -185,68 +184,71 @@ aclutil_print_err (int rv , const Slapi_DN *sdn, const struct berval* val,
str[0] = '\0';
}
- dn = slapi_sdn_get_dn ( sdn );
- if (dn && (rv == ACL_INVALID_TARGET) && ((strlen(dn) + strlen(str)) > BUFSIZ)) {
- /*
- * if (str_length + dn_length + 200 char message) > (BUFSIZ + 200) line
- * we have to make space for a bigger line...
- */
- newline = slapi_ch_malloc(strlen(dn) + strlen(str) + 200);
- lineptr = newline;
- }
-
switch (rv) {
case ACL_TARGET_FILTER_ERR:
- sprintf (line, "ACL Internal Error(%d): "
+ sprintf (lineptr, "ACL Internal Error(%d): "
"Error in generating the target filter for the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_TARGETATTR_FILTER_ERR:
- sprintf (line, "ACL Internal Error(%d): "
+ sprintf (lineptr, "ACL Internal Error(%d): "
"Error in generating the targetattr filter for the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_TARGETFILTER_ERR:
- sprintf (line, "ACL Internal Error(%d): "
+ sprintf (lineptr, "ACL Internal Error(%d): "
"Error in generating the targetfilter filter for the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_SYNTAX_ERR:
- sprintf (line, "ACL Syntax Error(%d):%s\n",
+ sprintf (lineptr, "ACL Syntax Error(%d):%s\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_ONEACL_TEXT_ERR:
- sprintf (line, "ACL Syntax Error in the Bind Rules(%d):%s\n",
+ sprintf (lineptr, "ACL Syntax Error in the Bind Rules(%d):%s\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_ERR_CONCAT_HANDLES:
- sprintf (line, "ACL Internal Error(%d): "
+ sprintf (lineptr, "ACL Internal Error(%d): "
"Error in Concatenating List handles\n",
rv);
break;
case ACL_INVALID_TARGET:
+ {
+ size_t newsize;
+ const char *dn = slapi_sdn_get_dn(sdn);
+ newsize = strlen(dn) + strlen(str) + 200;
+ if (dn && (newsize > sizeof(line))) {
+ /*
+ * if (str_length + dn_length + 200 char message) > (BUFSIZ + 200) line
+ * we have to make space for a bigger line...
+ */
+ newline = slapi_ch_malloc(newsize);
+ lineptr = newline;
+ }
sprintf (lineptr, "ACL Invalid Target Error(%d): "
"Target is beyond the scope of the ACL(SCOPE:%s)",
rv, dn ? escape_string_with_punctuation (dn, ebuf) : "NULL");
sprintf (lineptr + strlen(lineptr), " %s\n", escape_string_with_punctuation (str, ebuf));
break;
+ }
case ACL_INVALID_AUTHMETHOD:
- sprintf (line, "ACL Multiple auth method Error(%d):"
+ sprintf (lineptr, "ACL Multiple auth method Error(%d):"
"Multiple Authentication Metod in the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_INVALID_AUTHORIZATION:
- sprintf (line, "ACL Syntax Error(%d):"
+ sprintf (lineptr, "ACL Syntax Error(%d):"
"Invalid Authorization statement in the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
case ACL_INCORRECT_ACI_VERSION:
- sprintf (line, "ACL Syntax Error(%d):"
+ sprintf (lineptr, "ACL Syntax Error(%d):"
"Incorrect version Number in the ACL(%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
default:
- sprintf (line, "ACL Internal Error(%d):"
+ sprintf (lineptr, "ACL Internal Error(%d):"
"ACL generic error (%s)\n",
rv, escape_string_with_punctuation (str, ebuf));
break;
@@ -254,7 +256,7 @@ aclutil_print_err (int rv , const Slapi_DN *sdn, const struct berval* val,
if (errbuf) {
/* If a buffer is provided, then copy the error */
- aclutil_str_append(errbuf, lineptr );
+ aclutil_str_append(errbuf, lineptr);
}
slapi_log_error( SLAPI_LOG_FATAL, plugin_name, "%s", lineptr);
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index 88f2a1db2..1a491efb2 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -2190,7 +2190,6 @@ static void
repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
{
char buf[20];
- char msg[SLAPI_DSE_RETURNTEXT_SIZE];
if (eqctx && !*setlevel) {
(void)slapi_eq_cancel(eqctx);
@@ -2199,7 +2198,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
if (s_debug_timeout && s_debug_level && *setlevel) {
void config_set_errorlog_level(const char *type, char *buf, char *msg, int apply);
sprintf(buf, "%d", 0);
- config_set_errorlog_level("nsslapd-errorlog-level", buf, msg, 1);
+ config_set_errorlog_level("nsslapd-errorlog-level", buf, NULL, 1);
}
}
@@ -2209,11 +2208,10 @@ repl5_debug_timeout_callback(time_t when, void *arg)
int *setlevel = (int *)arg;
void config_set_errorlog_level(const char *type, char *buf, char *msg, int apply);
char buf[20];
- char msg[SLAPI_DSE_RETURNTEXT_SIZE];
*setlevel = 1;
sprintf(buf, "%d", s_debug_level);
- config_set_errorlog_level("nsslapd-errorlog-level", buf, msg, 1);
+ config_set_errorlog_level("nsslapd-errorlog-level", buf, NULL, 1);
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"repl5_debug_timeout_callback: set debug level to %d at %ld\n",
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index cab371526..1ac753df0 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -2029,7 +2029,6 @@ static void
repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
{
char buf[20];
- char msg[SLAPI_DSE_RETURNTEXT_SIZE];
LDAPDebug( LDAP_DEBUG_TRACE, "=> repl5_stop_debug_timeout\n", 0, 0, 0 );
@@ -2040,7 +2039,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
if (s_debug_timeout && s_debug_level && *setlevel) {
/* No longer needed as we are including the one in slap.h */
sprintf(buf, "%d", 0);
- config_set_errorlog_level("nsslapd-errorlog-level", buf, msg, 1);
+ config_set_errorlog_level("nsslapd-errorlog-level", buf, NULL, 1);
}
LDAPDebug( LDAP_DEBUG_TRACE, "<= repl5_stop_debug_timeout\n", 0, 0, 0 );
@@ -2052,13 +2051,12 @@ repl5_debug_timeout_callback(time_t when, void *arg)
int *setlevel = (int *)arg;
/* No longer needed as we are including the one in slap.h */
char buf[20];
- char msg[SLAPI_DSE_RETURNTEXT_SIZE];
LDAPDebug( LDAP_DEBUG_TRACE, "=> repl5_debug_timeout_callback\n", 0, 0, 0 );
*setlevel = 1;
sprintf(buf, "%d", s_debug_level);
- config_set_errorlog_level("nsslapd-errorlog-level", buf, msg, 1);
+ config_set_errorlog_level("nsslapd-errorlog-level", buf, NULL, 1);
slapi_log_error(SLAPI_LOG_FATAL, windows_repl_plugin_name,
"repl5_debug_timeout_callback: set debug level to %d at %ld\n",
diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c
index 4bcbb384d..427448ae6 100644
--- a/ldap/servers/plugins/retrocl/retrocl.c
+++ b/ldap/servers/plugins/retrocl/retrocl.c
@@ -189,7 +189,7 @@ static int retrocl_select_backend(void)
Slapi_Backend *be = NULL;
Slapi_Entry *referral = NULL;
Slapi_Operation *op = NULL;
- char errbuf[BUFSIZ];
+ char errbuf[SLAPI_DSE_RETURNTEXT_SIZE];
pb = slapi_pblock_new();
@@ -204,19 +204,19 @@ static int retrocl_select_backend(void)
slapi_pblock_set(pb,SLAPI_OPERATION, op);
err = slapi_mapping_tree_select(pb,&be,&referral,errbuf);
- slapi_entry_free(referral);
+ slapi_entry_free(referral);
if (err != LDAP_SUCCESS || be == NULL || be == defbackend_get_backend()) {
- LDAPDebug2Args(LDAP_DEBUG_TRACE,"Mapping tree select failed (%d) %s.\n",
- err,errbuf);
-
- /* could not find the backend for cn=changelog, either because
- * it doesn't exist
- * mapping tree not registered.
- */
- err = retrocl_create_config();
+ slapi_log_error(SLAPI_LOG_FATAL, RETROCL_PLUGIN_NAME,
+ "Mapping tree select failed (%d) %s.\n", err, errbuf);
+
+ /* could not find the backend for cn=changelog, either because
+ * it doesn't exist
+ * mapping tree not registered.
+ */
+ err = retrocl_create_config();
- if (err != LDAP_SUCCESS) return err;
+ if (err != LDAP_SUCCESS) return err;
} else {
retrocl_be_changelog = be;
}
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index 666016f5a..149663b34 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -196,7 +196,6 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
size_t tmpbufsize;
char pat[BUFSIZ];
char buf[BUFSIZ];
- char ebuf[BUFSIZ];
time_t curtime = 0;
time_t time_up = 0;
time_t optime = 0; /* time op was initiated */
@@ -327,9 +326,9 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
pat, p, re_result?re_result:"unknown" );
rc = LDAP_OPERATIONS_ERROR;
goto bailout;
- } else {
- LDAPDebug( LDAP_DEBUG_TRACE, "re_comp (%s)\n",
- escape_string( p, ebuf ), 0, 0 );
+ } else if (slapi_is_loglevel_set(SLAPI_LOG_TRACE)) {
+ char ebuf[BUFSIZ];
+ LDAPDebug(LDAP_DEBUG_TRACE, "re_comp (%s)\n", escape_string(p, ebuf), 0, 0);
}
}
@@ -375,8 +374,10 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
tmprc = slapi_re_exec( re, realval, time_up );
}
- LDAPDebug( LDAP_DEBUG_TRACE, "re_exec (%s) %i\n",
- escape_string( realval, ebuf ), tmprc, 0 );
+ if (slapi_is_loglevel_set(SLAPI_LOG_TRACE)) {
+ char ebuf[BUFSIZ];
+ LDAPDebug(LDAP_DEBUG_TRACE, "re_exec (%s) %i\n", escape_string(realval, ebuf), tmprc, 0);
+ }
if ( tmprc == 1 ) {
rc = 0;
break;
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 5e5002582..1d34d95c8 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -150,9 +150,9 @@ do_add( Slapi_PBlock *pb )
normtype = slapi_attr_syntax_normalize(type);
if ( !normtype || !*normtype ) {
- char ebuf[ BUFSIZ ];
+ char ebuf[SLAPI_DSE_RETURNTEXT_SIZE];
rc = LDAP_INVALID_SYNTAX;
- PR_snprintf (ebuf, BUFSIZ, "invalid type '%s'", type);
+ slapi_create_errormsg(ebuf, 0, "invalid type '%s'", type);
op_shared_log_error_access (pb, "ADD", slapi_sdn_get_dn (slapi_entry_get_sdn_const(e)), ebuf);
send_ldap_result( pb, rc, NULL, ebuf, 0, NULL );
slapi_ch_free_string(&type);
@@ -423,7 +423,7 @@ static void op_shared_add (Slapi_PBlock *pb)
char *pwdtype = NULL;
Slapi_Attr *attr = NULL;
Slapi_Entry *referral;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
struct slapdplugin *p = NULL;
char *proxydn = NULL;
char *proxystr = NULL;
diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c
index 2b319f005..06fa6a437 100644
--- a/ldap/servers/slapd/attr.c
+++ b/ldap/servers/slapd/attr.c
@@ -942,14 +942,13 @@ attr_check_onoff ( const char *attr_name, char *value, long minval, long maxval,
{
int retVal = LDAP_SUCCESS;
- if ( strcasecmp ( value, "on" ) != 0 &&
- strcasecmp ( value, "off") != 0 &&
- strcasecmp ( value, "1" ) != 0 &&
- strcasecmp ( value, "0" ) != 0 &&
- strcasecmp ( value, "true" ) != 0 &&
- strcasecmp ( value, "false" ) != 0 ) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "%s: invalid value \"%s\".", attr_name, value );
+ if (strcasecmp ( value, "on" ) != 0 &&
+ strcasecmp ( value, "off") != 0 &&
+ strcasecmp ( value, "1" ) != 0 &&
+ strcasecmp ( value, "0" ) != 0 &&
+ strcasecmp ( value, "true" ) != 0 &&
+ strcasecmp ( value, "false" ) != 0 ) {
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid value \"%s\".", attr_name, value);
retVal = LDAP_CONSTRAINT_VIOLATION;
}
@@ -965,9 +964,7 @@ attr_check_minmax ( const char *attr_name, char *value, long minval, long maxval
val = strtol(value, NULL, 0);
if ( (minval != -1 ? (val < minval ? 1 : 0) : 0) ||
(maxval != -1 ? (val > maxval ? 1 : 0) : 0) ) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "%s: invalid value \"%s\".",
- attr_name, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid value \"%s\".", attr_name, value);
retVal = LDAP_CONSTRAINT_VIOLATION;
}
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index ae603bc12..d27905612 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -1761,7 +1761,7 @@ upgradedn_producer(void *param)
if (NULL == dn_norm_sp_conflicts) {
char buf[BUFSIZ];
int my_max = 8;
- while (fgets(buf, BUFSIZ-1, job->upgradefd)) {
+ while (fgets(buf, sizeof(buf)-1, job->upgradefd)) {
/* search "OID0: OID1 OID2 ... */
if (!isdigit(*buf) || (NULL == PL_strchr(buf, ':'))) {
continue;
@@ -3535,7 +3535,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
LDAPDebug(LDAP_DEBUG_TRACE, "\ndn: %s\n",
slapi_entry_get_dn_const(*ep), 0, 0);
- if (l <= BUFSIZ)
+ if (l <= sizeof(tmpbuf))
tp = tmpbuf;
else
tp = (char *)slapi_ch_malloc(l); /* should be very rare ... */
@@ -3547,11 +3547,11 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
"dse_conf_backup(%s): write %s failed: %d (%s)\n",
filter, PR_GetError(), slapd_pr_strerror(PR_GetError()));
rval = -1;
- if (l > BUFSIZ)
+ if (l > sizeof(tmpbuf))
slapi_ch_free_string(&tp);
goto out;
}
- if (l > BUFSIZ)
+ if (l > sizeof(tmpbuf))
slapi_ch_free_string(&tp);
for (slapi_entry_first_attr(*ep, &attr); attr;
@@ -3574,7 +3574,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
l = strlen(attr_val->bv_val) + attr_name_len + 3; /* : \n" */
LDAPDebug(LDAP_DEBUG_TRACE, "%s: %s\n", attr_name,
attr_val->bv_val, 0);
- if (l <= BUFSIZ)
+ if (l <= sizeof(tmpbuf))
tp = tmpbuf;
else
tp = (char *)slapi_ch_malloc(l);
@@ -3586,11 +3586,11 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
"dse_conf_backup(%s): write %s failed: %d (%s)\n",
filter, PR_GetError(), slapd_pr_strerror(PR_GetError()));
rval = -1;
- if (l > BUFSIZ)
+ if (l > sizeof(tmpbuf))
slapi_ch_free_string(&tp);
goto out;
}
- if (l > BUFSIZ)
+ if (l > sizeof(tmpbuf))
slapi_ch_free_string(&tp);
}
}
@@ -3980,19 +3980,18 @@ _get_import_entryusn(ImportJob *job, Slapi_Value **usn_value)
/* import_init value is not digit.
* Use the counter which stores the old DB's
* next entryusn. */
- PR_snprintf(counter_buf, USN_COUNTER_BUF_LEN,
- "%" NSPRIu64,
- slapi_counter_get_value(be->be_usn_counter));
+ PR_snprintf(counter_buf, sizeof(counter_buf),
+ "%" NSPRIu64, slapi_counter_get_value(be->be_usn_counter));
} else {
/* import_init value is digit.
* Initialize the entryusn values with the digit */
- PR_snprintf(counter_buf, USN_COUNTER_BUF_LEN, "%s", usn_init_str);
+ PR_snprintf(counter_buf, sizeof(counter_buf), "%s", usn_init_str);
}
slapi_ch_free_string(&usn_init_str);
} else {
/* nsslapd-entryusn-import-init is not defined */
/* Initialize to 0 by default */
- PR_snprintf(counter_buf, USN_COUNTER_BUF_LEN, "0");
+ PR_snprintf(counter_buf, sizeof(counter_buf), "0");
}
usn_berval.bv_val = counter_buf;
usn_berval.bv_len = strlen(usn_berval.bv_val);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 341fdff41..58ab9a0c7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -73,11 +73,9 @@ int ldbm_config_add_dse_entries(struct ldbminfo *li, char **entries, char *strin
rc = slapi_add_internal_pb(util_pb);
slapi_pblock_get(util_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
if (!rc && (result == LDAP_SUCCESS)) {
- LDAPDebug(LDAP_DEBUG_CONFIG, "Added database config entry [%s]\n",
- ebuf, 0, 0);
+ LDAPDebug1Arg(LDAP_DEBUG_CONFIG, "Added database config entry [%s]\n", ebuf);
} else if (result == LDAP_ALREADY_EXISTS) {
- LDAPDebug(LDAP_DEBUG_TRACE, "Database config entry [%s] already exists - skipping\n",
- ebuf, 0, 0);
+ LDAPDebug1Arg(LDAP_DEBUG_TRACE, "Database config entry [%s] already exists - skipping\n", ebuf);
} else {
LDAPDebug(LDAP_DEBUG_ANY, "Unable to add config entry [%s] to the DSE: %d %d\n",
ebuf, result, rc);
@@ -294,7 +292,9 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
char *val = (char *) value;
char tmpbuf[BUFSIZ];
- errorbuf[0] = '\0';
+ if (errorbuf) {
+ errorbuf[0] = '\0';
+ }
if (!apply) {
/* we should really do some error checking here. */
@@ -425,10 +425,8 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
} else if (val > li->li_dbcachesize) {
delta = val - li->li_dbcachesize;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: dbcachememsize value is too large.");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: dbcachememsize value is too large.\n",
- 0, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: dbcachememsize value is too large.");
+ LDAPDebug0Args(LDAP_DEBUG_ANY,"Error: dbcachememsize value is too large.\n");
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -499,10 +497,8 @@ static int ldbm_config_dbncache_set(void *arg, void *value, char *errorbuf, int
if (val > li->li_dbncache) {
delta = val - li->li_dbncache;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: dbncache size value is too large.");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: dbncache size value is too large.\n",
- val, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: dbncache size value is too large.");
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,"Error: dbncache size value is too large.\n", val);
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -784,7 +780,7 @@ static int ldbm_config_db_old_idl_maxids_set(void *arg, void *value, char *error
if(val >= 0){
li->li_old_idl_maxids = val;
} else {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ slapi_create_errormsg(errorbuf, 0,
"Error: Invalid value for %s (%d). Value must be equal or greater than zero.",
CONFIG_DB_OLD_IDL_MAXIDS, val);
return LDAP_UNWILLING_TO_PERFORM;
@@ -848,10 +844,11 @@ static int ldbm_config_db_trickle_percentage_set(void *arg, void *value, char *e
int val = (int) ((uintptr_t)value);
if (val < 0 || val > 100) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: Invalid value for %s (%d). Must be between 0 and 100\n", CONFIG_DB_TRICKLE_PERCENTAGE, val);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", errorbuf, 0, 0);
- return LDAP_UNWILLING_TO_PERFORM;
+ slapi_create_errormsg(errorbuf, 0, "Error: Invalid value for %s (%d). Must be between 0 and 100\n",
+ CONFIG_DB_TRICKLE_PERCENTAGE, val);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Error: Invalid value for %s (%d). Must be between 0 and 100\n",
+ CONFIG_DB_TRICKLE_PERCENTAGE, val);
+ return LDAP_UNWILLING_TO_PERFORM;
}
if (apply) {
@@ -1081,10 +1078,8 @@ static int ldbm_config_db_cache_set(void *arg, void *value, char *errorbuf, int
if (val > li->li_dblayer_private->dblayer_cache_config) {
delta = val - li->li_dblayer_private->dblayer_cache_config;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: db cachesize value is too large");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: db cachesize value is too large.\n",
- val, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: db cachesize value is too large");
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,"Error: db cachesize value is too large.\n", val);
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -1214,10 +1209,8 @@ static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorb
if (val > li->li_import_cachesize) {
delta = val - li->li_import_cachesize;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: import cachesize value is too large.");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: import cachesize value is too large.\n",
- 0, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: import cachesize value is too large.");
+ LDAPDebug0Args(LDAP_DEBUG_ANY,"Error: import cachesize value is too large.\n");
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -1478,17 +1471,19 @@ static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *erro
u_int32_t val = (u_int32_t) ((uintptr_t)value);
if (val > DB_LOCK_YOUNGEST) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ slapi_create_errormsg(errorbuf, 0,
"Error: Invalid value for %s (%d). Must be between %d and %d inclusive",
CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST);
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf);
+ LDAPDebug(LDAP_DEBUG_ANY, "Error: Invalid value for deadlock policy (%d). Must be between %d and %d inclusive",
+ val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST);
return LDAP_UNWILLING_TO_PERFORM;
}
if (val == DB_LOCK_NORUN) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ slapi_create_errormsg(errorbuf, 0,
"Warning: Setting value for %s to (%d) will disable deadlock detection",
CONFIG_DB_DEADLOCK_POLICY, val);
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s\n", errorbuf);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Warning: Setting value for %s to (%d) will disable deadlock detection",
+ CONFIG_DB_DEADLOCK_POLICY, val);
}
if (apply) {
@@ -1907,15 +1902,15 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
config = get_config_info(config_array, attr_name);
if (NULL == config) {
LDAPDebug(LDAP_DEBUG_CONFIG, "Unknown config attribute %s\n", attr_name, 0, 0);
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Unknown config attribute %s\n", attr_name);
+ slapi_create_errormsg(err_buf, 0, "Unknown config attribute %s\n", attr_name);
return LDAP_SUCCESS; /* Ignore unknown attributes */
}
/* Some config attrs can't be changed while the server is running. */
if (phase == CONFIG_PHASE_RUNNING &&
!(config->config_flags & CONFIG_FLAG_ALLOW_RUNNING_CHANGE)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "%s can't be modified while the server is running.\n", attr_name);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "%s can't be modified while the server is running.\n", attr_name);
+ slapi_create_errormsg(err_buf, 0, "%s can't be modified while the server is running.\n", attr_name);
return LDAP_UNWILLING_TO_PERFORM;
}
@@ -1933,9 +1928,7 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
previously set to a non-default value */
if (SLAPI_IS_MOD_ADD(mod_op) && apply_mod &&
(config->config_flags & CONFIG_FLAG_PREVIOUSLY_SET)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE,
- "cannot add a value to single valued attribute %s.\n",
- attr_name);
+ slapi_create_errormsg(err_buf, 0, "cannot add a value to single valued attribute %s.\n", attr_name);
return LDAP_OBJECT_CLASS_VIOLATION;
}
}
@@ -1946,9 +1939,8 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
char buf[BUFSIZ];
ldbm_config_get(arg, config, buf);
if (PL_strncmp(buf, bval->bv_val, bval->bv_len)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE,
- "value [%s] for attribute %s does not match existing value [%s].\n",
- bval->bv_val, attr_name, buf);
+ slapi_create_errormsg(err_buf, 0,
+ "value [%s] for attribute %s does not match existing value [%s].\n", bval->bv_val, attr_name, buf);
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
@@ -1964,21 +1956,22 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
llval = db_atoi(str_val, &err);
/* check for parsing error (e.g. not a number) */
if (err) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is not a number\n",
- str_val, attr_name);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is not a number\n", str_val, attr_name);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Error: value %s for attr %s is not a number\n", str_val, attr_name);
return LDAP_UNWILLING_TO_PERFORM;
/* check for overflow */
} else if (LL_CMP(llval, >, llmaxint)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is greater than the maximum %d\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is greater than the maximum %d\n",
+ str_val, attr_name, maxint);
+ LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is greater than the maximum %d\n",
str_val, attr_name, maxint);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
/* check for underflow */
} else if (LL_CMP(llval, <, llminint)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is less than the minimum %d\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is less than the minimum %d\n",
+ str_val, attr_name, minint);
+ LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is less than the minimum %d\n",
str_val, attr_name, minint);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
}
/* convert 64 bit value to 32 bit value */
@@ -2003,21 +1996,24 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
llval = db_atoi(str_val, &err);
/* check for parsing error (e.g. not a number) */
if (err) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is not a number\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is not a number\n",
+ str_val, attr_name);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Error: value %s for attr %s is not a number\n",
str_val, attr_name);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
/* check for overflow */
} else if (LL_CMP(llval, >, llmaxint)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is greater than the maximum %d\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is greater than the maximum %d\n",
+ str_val, attr_name, maxint);
+ LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is greater than the maximum %d\n",
str_val, attr_name, maxint);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
/* check for underflow */
} else if (LL_CMP(llval, <, llminint)) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is less than the minimum %d\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is less than the minimum %d\n",
+ str_val, attr_name, minint);
+ LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is less than the minimum %d\n",
str_val, attr_name, minint);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
}
/* convert 64 bit value to 32 bit value */
@@ -2036,15 +2032,17 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
/* check for parsing error (e.g. not a number) */
if (err == EINVAL) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is not a number\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is not a number\n",
+ str_val, attr_name);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Error: value %s for attr %s is not a number\n",
str_val, attr_name);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
/* check for overflow */
} else if (err == ERANGE) {
- PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is outside the range of representable values\n",
+ slapi_create_errormsg(err_buf, 0, "Error: value %s for attr %s is outside the range of representable values\n",
+ str_val, attr_name);
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Error: value %s for attr %s is outside the range of representable values\n",
str_val, attr_name);
- LDAPDebug(LDAP_DEBUG_ANY, "%s", err_buf, 0, 0);
return LDAP_UNWILLING_TO_PERFORM;
}
retval = config->config_set_fn(arg, (void *) sz_val, err_buf, phase, apply_mod);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index e46941402..2506261e4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -109,10 +109,8 @@ ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, in
if (val > inst->inst_cache.c_maxsize) {
delta = val - inst->inst_cache.c_maxsize;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: cachememsize value is too large.");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: cachememsize value is too large.\n",
- 0, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: cachememsize value is too large.");
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "Error: cachememsize value is too large.\n");
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -153,10 +151,8 @@ ldbm_instance_config_dncachememsize_set(void *arg, void *value, char *errorbuf,
if (val > inst->inst_dncache.c_maxsize) {
delta = val - inst->inst_dncache.c_maxsize;
if (!util_is_cachesize_sane(&delta)){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Error: dncachememsize value is too large.");
- LDAPDebug( LDAP_DEBUG_ANY,"Error: dncachememsize value is too large.\n",
- 0, 0, 0);
+ slapi_create_errormsg(errorbuf, 0, "Error: dncachememsize value is too large.");
+ LDAPDebug0Args(LDAP_DEBUG_ANY,"Error: dncachememsize value is too large.\n");
return LDAP_UNWILLING_TO_PERFORM;
}
}
@@ -311,10 +307,9 @@ void
ldbm_instance_config_setup_default(ldbm_instance *inst)
{
config_info *config;
- char err_buf[BUFSIZ];
for (config = ldbm_instance_config; config->config_name != NULL; config++) {
- ldbm_config_set((void *)inst, config->config_name, ldbm_instance_config, NULL /* use default */, err_buf, CONFIG_PHASE_INITIALIZATION, 1 /* apply */, LDAP_MOD_REPLACE);
+ ldbm_config_set((void *)inst, config->config_name, ldbm_instance_config, NULL /* use default */, NULL, CONFIG_PHASE_INITIALIZATION, 1 /* apply */, LDAP_MOD_REPLACE);
}
}
@@ -440,7 +435,7 @@ parse_ldbm_instance_config_entry(ldbm_instance *inst, Slapi_Entry *e, config_inf
char *attr_name = NULL;
Slapi_Value *sval = NULL;
struct berval *bval;
- char err_buf[BUFSIZ];
+ char err_buf[SLAPI_DSE_RETURNTEXT_SIZE];
slapi_attr_get_type(attr, &attr_name);
@@ -833,7 +828,7 @@ out:
void
ldbm_instance_config_internal_set(ldbm_instance *inst, char *attrname, char *value)
{
- char err_buf[BUFSIZ];
+ char err_buf[SLAPI_DSE_RETURNTEXT_SIZE];
struct berval bval;
bval.bv_val = value;
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index f81edfb42..0a630acba 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -100,7 +100,7 @@ do_bind( Slapi_PBlock *pb )
Slapi_DN *sdn = NULL;
int bind_sdn_in_pb = 0; /* is sdn set in the pb? */
Slapi_Entry *referral;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
char **supported, **pmech;
char authtypebuf[256]; /* >26 (strlen(SLAPD_AUTH_SASL)+SASL_MECHNAMEMAX+1) */
Slapi_Entry *bind_target_entry = NULL;
@@ -655,7 +655,7 @@ do_bind( Slapi_PBlock *pb )
}
/* We could be serving multiple database backends. Select the appropriate one */
- if (slapi_mapping_tree_select(pb, &be, &referral, errorbuf) != LDAP_SUCCESS) {
+ if (slapi_mapping_tree_select(pb, &be, &referral, NULL) != LDAP_SUCCESS) {
send_nobackend_ldap_result( pb );
be = NULL;
goto free_and_return;
@@ -685,7 +685,7 @@ do_bind( Slapi_PBlock *pb )
Slapi_DN *pb_sdn;
slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &pb_sdn);
if (!pb_sdn) {
- PR_snprintf(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set NULL dn\n");
+ slapi_create_errormsg(errorbuf, 0, "Pre-bind plug-in set NULL dn\n");
send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
goto free_and_return;
} else if ((pb_sdn != sdn) || (sdn_updated = slapi_sdn_compare(original_sdn, pb_sdn))) {
@@ -696,7 +696,7 @@ do_bind( Slapi_PBlock *pb )
sdn = pb_sdn;
dn = slapi_sdn_get_dn(sdn);
if (!dn) {
- PR_snprintf(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set corrupted dn\n");
+ slapi_create_errormsg(errorbuf, 0, "Pre-bind plug-in set corrupted dn\n");
send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
goto free_and_return;
}
@@ -710,7 +710,7 @@ do_bind( Slapi_PBlock *pb )
slapi_be_Rlock(be);
slapi_pblock_set( pb, SLAPI_BACKEND, be );
} else {
- PR_snprintf(errorbuf, sizeof(errorbuf), "No matching backend for %s\n", dn);
+ slapi_create_errormsg(errorbuf, 0, "No matching backend for %s\n", dn);
send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
goto free_and_return;
}
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 88b803c0a..36a5be89d 100644
--- a/ldap/servers/slapd/compare.c
+++ b/ldap/servers/slapd/compare.c
@@ -41,7 +41,7 @@ do_compare( Slapi_PBlock *pb )
int err;
Slapi_DN sdn;
Slapi_Entry *referral = NULL;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
LDAPDebug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index c25a586fc..fd31b7beb 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -122,7 +122,7 @@ slapd_bootstrap_config(const char *configdir)
int done = 0;
PRInt32 nr = 0;
PRFileDesc *prfd = 0;
- char returntext[SLAPI_DSE_RETURNTEXT_SIZE] = "";
+ char returntext[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
char *buf = 0;
char *lastp = 0;
char *entrystr = 0;
@@ -198,7 +198,7 @@ slapd_bootstrap_config(const char *configdir)
slapi_sdn_init_ndn_byref(&plug_dn, PLUGIN_BASE_DN);
while ((entrystr = dse_read_next_entry(buf, &lastp)) != NULL)
{
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
/*
* XXXmcs: it would be better to also pass
* SLAPI_STR2ENTRY_REMOVEDUPVALS in the flags, but
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 91ad13ef6..b6113c814 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -442,7 +442,6 @@ disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
void
disk_monitoring_thread(void *nothing)
{
- char errorbuf[BUFSIZ];
char **dirs = NULL;
char *dirstr = NULL;
PRUint64 previous_mark = 0;
@@ -553,7 +552,7 @@ disk_monitoring_thread(void *nothing)
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
config_set_errorlog_level(CONFIG_LOGLEVEL_ATTRIBUTE,
STRINGIFYDEFINE(SLAPD_DEFAULT_ERRORLOG_LEVEL),
- errorbuf, CONFIG_APPLY);
+ NULL, CONFIG_APPLY);
continue;
}
/*
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index d3c4d8ac9..b2d840894 100644
--- a/ldap/servers/slapd/delete.c
+++ b/ldap/servers/slapd/delete.c
@@ -225,7 +225,7 @@ static void op_shared_delete (Slapi_PBlock *pb)
Slapi_Operation *operation;
Slapi_Entry *referral;
Slapi_Entry *ecopy = NULL;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
int err;
char *proxydn = NULL;
char *proxystr = NULL;
diff --git a/ldap/servers/slapd/detach.c b/ldap/servers/slapd/detach.c
index f7750f192..b5af952b5 100644
--- a/ldap/servers/slapd/detach.c
+++ b/ldap/servers/slapd/detach.c
@@ -52,7 +52,6 @@ detach( int slapd_exemode, int importexport_encrypt,
char *workingdir = 0;
char *errorlog = 0;
char *ptr = 0;
- char errorbuf[BUFSIZ];
extern char *config_get_errorlog(void);
if ( should_detach ) {
@@ -92,12 +91,12 @@ detach( int slapd_exemode, int importexport_encrypt,
*ptr = 0;
}
(void) chdir( errorlog );
- config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1);
+ config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, NULL, 1);
slapi_ch_free_string(&errorlog);
}
} else {
/* calling config_set_workingdir to check for validity of directory, don't apply */
- if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, workingdir, errorbuf, 0) == LDAP_OPERATIONS_ERROR) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, workingdir, NULL, 0) == LDAP_OPERATIONS_ERROR) {
return 1;
}
(void) chdir( workingdir );
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index a972f00e5..5f795cc28 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -2804,8 +2804,6 @@ ndn_cache_init()
void
ndn_cache_destroy()
{
- char *errorbuf = NULL;
-
if(!ndn_started){
return;
}
@@ -2818,11 +2816,11 @@ ndn_cache_destroy()
ndn_cache_lock = NULL;
}
if(ndn_cache_hashtable){
- ndn_cache_free();
+ ndn_cache_free();
PL_HashTableDestroy(ndn_cache_hashtable);
ndn_cache_hashtable = NULL;
}
- config_set_ndn_cache_enabled(CONFIG_NDN_CACHE, "off", errorbuf, 1 );
+ config_set_ndn_cache_enabled(CONFIG_NDN_CACHE, "off", NULL, 1 );
slapi_counter_destroy(&ndn_cache->cache_hits);
slapi_counter_destroy(&ndn_cache->cache_tries);
slapi_counter_destroy(&ndn_cache->cache_misses);
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 7bbf10ea1..dffd67e6d 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1814,8 +1814,7 @@ config_value_is_null( const char *attrname, const char *value, char *errorbuf,
int or_zero_length )
{
if ( NULL == value || ( or_zero_length && *value == '\0' )) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: deleting the value is not allowed.", attrname );
+ slapi_create_errormsg(errorbuf, 0, "%s: deleting the value is not allowed.", attrname);
return 1;
}
@@ -1870,9 +1869,9 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
errno = 0;
threshold = strtoll(value, &endp, 10);
if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lld",
- attrname, value, (long long int)LONG_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lld",
+ attrname, value, (long long int)LONG_MAX);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -1911,8 +1910,8 @@ config_set_disk_grace_period( const char *attrname, char *value, char *errorbuf,
period = strtol(value, &endp, 10);
if ( *endp != '\0' || period < 1 || errno == ERANGE ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, grace period must be at least 1 minute",
- attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid, grace period must be at least 1 minute", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -1948,8 +1947,7 @@ config_set_ndn_cache_max_size(const char *attrname, char *value, char *errorbuf,
size = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n", attrname, value);
return retVal;
}
@@ -1957,8 +1955,8 @@ config_set_ndn_cache_max_size(const char *attrname, char *value, char *errorbuf,
size = 0; /* same as -1 */
}
if(size > 0 && size < 1024000){
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "ndn_cache_max_size too low(%d), changing to "
- "%d bytes.\n",(int)size, NDN_DEFAULT_SIZE);
+ slapi_create_errormsg(errorbuf, 0,
+ "ndn_cache_max_size too low(%d), changing to %d bytes.\n",(int)size, NDN_DEFAULT_SIZE);
size = NDN_DEFAULT_SIZE;
}
if(apply){
@@ -1982,14 +1980,14 @@ config_set_sasl_maxbufsize(const char *attrname, char *value, char *errorbuf, in
size = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n", attrname, value);
return retVal;
}
if(size < default_size){
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "nsslapd-sasl-max-buffer-size is too low (%ld), "
- "setting to default value (%ld).\n",size, default_size);
+ slapi_create_errormsg(errorbuf, 0,
+ "nsslapd-sasl-max-buffer-size is too low (%ld), setting to default value (%ld).\n",
+ size, default_size);
size = default_size;
}
if(apply){
@@ -2027,10 +2025,9 @@ config_set_port( const char *attrname, char *port, char *errorbuf, int apply ) {
nPort = strtol(port, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nPort > LDAP_PORT_MAX || nPort < 0 ) {
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, ports must range from 0 to %d",
- attrname, port, LDAP_PORT_MAX );
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid, ports must range from 0 to %d", attrname, port, LDAP_PORT_MAX);
+ return retVal;
}
if ( nPort == 0 ) {
@@ -2063,9 +2060,8 @@ config_set_secureport( const char *attrname, char *port, char *errorbuf, int app
nPort = strtol(port, &endp, 10);
if (*endp != '\0' || errno == ERANGE || nPort > LDAP_PORT_MAX || nPort <= 0 ) {
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, ports must range from 1 to %d",
- attrname, port, LDAP_PORT_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid, ports must range from 1 to %d", attrname, port, LDAP_PORT_MAX);
}
if (apply) {
@@ -2077,7 +2073,7 @@ config_set_secureport( const char *attrname, char *port, char *errorbuf, int app
}
return retVal;
}
-
+
int
config_set_SSLclientAuth( const char *attrname, char *value, char *errorbuf, int apply ) {
@@ -2093,9 +2089,7 @@ config_set_SSLclientAuth( const char *attrname, char *value, char *errorbuf, int
strcasecmp (value, "allowed") != 0 &&
strcasecmp (value, "required")!= 0 ) {
retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf )
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: unsupported value: %s", attrname, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: unsupported value: %s", attrname, value);
return retVal;
}
else if ( !apply ) {
@@ -2116,9 +2110,7 @@ config_set_SSLclientAuth( const char *attrname, char *value, char *errorbuf, int
}
else {
retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf )
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: unsupported value: %s", attrname, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: unsupported value: %s", attrname, value);
}
CFG_UNLOCK_WRITE(slapdFrontendConfig);
@@ -2198,9 +2190,10 @@ config_set_snmp_index(const char *attrname, char *value, char *errorbuf, int app
snmp_index = strtol(value, &endp, 10);
if (*endp != '\0' || errno == ERANGE || snmp_index < snmp_index_disable) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", %s must be greater or equal to %lu (%lu means disabled)",
- attrname, value, CONFIG_SNMP_INDEX_ATTRIBUTE, snmp_index_disable, snmp_index_disable);
- retVal = LDAP_OPERATIONS_ERROR;
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", %s must be greater or equal to %lu (%lu means disabled)",
+ attrname, value, CONFIG_SNMP_INDEX_ATTRIBUTE, snmp_index_disable, snmp_index_disable);
+ retVal = LDAP_OPERATIONS_ERROR;
}
}
@@ -2461,7 +2454,7 @@ config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int app
sizelimit = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || sizelimit < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, sizelimit must range from -1 to %lld",
+ slapi_create_errormsg(errorbuf, 0, "%s: \"%s\" is invalid, sizelimit must range from -1 to %lld",
attrname, value, (long long int)LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
@@ -2505,8 +2498,9 @@ config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, in
pagedsizelimit = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || pagedsizelimit < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %lld",
- attrname, value, (long long int)LONG_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %lld",
+ attrname, value, (long long int)LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -2545,16 +2539,14 @@ config_set_pw_storagescheme( const char *attrname, char *value, char *errorbuf,
new_scheme = pw_name2scheme(value);
if ( new_scheme == NULL) {
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s. Valid schemes are: %s",
- attrname, value, scheme_list );
- } else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s (no pwdstorage scheme"
- " plugin loaded)",
- attrname, value);
- }
+ if ( scheme_list != NULL ) {
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid scheme - %s. Valid schemes are: %s",
+ attrname, value, scheme_list );
+ } else {
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid scheme - %s (no pwdstorage scheme plugin loaded)",
+ attrname, value);
+ }
retVal = LDAP_OPERATIONS_ERROR;
slapi_ch_free_string(&scheme_list);
return retVal;
@@ -2566,9 +2558,9 @@ config_set_pw_storagescheme( const char *attrname, char *value, char *errorbuf,
directory already encrypted. The scheme cannot and don't encrypt password if
they are in clear. We don't take it */
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "pw_storagescheme: invalid encoding scheme - %s\nValid values are: %s\n", value, scheme_list );
+ if (scheme_list) {
+ slapi_create_errormsg(errorbuf, 0,
+ "pw_storagescheme: invalid encoding scheme - %s\nValid values are: %s\n", value, scheme_list);
}
retVal = LDAP_UNWILLING_TO_PERFORM;
slapi_ch_free_string(&scheme_list);
@@ -2728,16 +2720,14 @@ config_set_pw_minlength( const char *attrname, char *value, char *errorbuf, int
minLength = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minLength < 2 || minLength > 512 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum length \"%s\" is invalid. "
- "The minimum length must range from 2 to 512.",
- value );
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum length \"%s\" is invalid. The minimum length must range from 2 to 512.", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
if ( apply ) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
+ CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->pw_policy.pw_minlength = minLength;
@@ -2763,12 +2753,11 @@ config_set_pw_mindigits( const char *attrname, char *value, char *errorbuf, int
minDigits = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minDigits < 0 || minDigits > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of digits \"%s\" is invalid. "
- "The minimum number of digits must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of digits \"%s\" is invalid. "
+ "The minimum number of digits must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2798,12 +2787,11 @@ config_set_pw_minalphas( const char *attrname, char *value, char *errorbuf, int
minAlphas = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minAlphas < 0 || minAlphas > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of alphas \"%s\" is invalid. "
- "The minimum number of alphas must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of alphas \"%s\" is invalid. "
+ "The minimum number of alphas must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2832,13 +2820,12 @@ config_set_pw_minuppers( const char *attrname, char *value, char *errorbuf, int
errno = 0;
minUppers = strtol(value, &endp, 10);
- if ( *endp != '\0' || errno == ERANGE || minUppers < 0 || minUppers > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of uppercase characters \"%s\" is invalid. "
- "The minimum number of uppercase characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ if ( *endp != '\0' || errno == ERANGE || minUppers < 0 || minUppers > 64 ) {
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of uppercase characters \"%s\" is invalid. "
+ "The minimum number of uppercase characters must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2868,12 +2855,11 @@ config_set_pw_minlowers( const char *attrname, char *value, char *errorbuf, int
minLowers = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minLowers < 0 || minLowers > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of lowercase characters \"%s\" is invalid. "
- "The minimum number of lowercase characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of lowercase characters \"%s\" is invalid. "
+ "The minimum number of lowercase characters must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2903,12 +2889,11 @@ config_set_pw_minspecials( const char *attrname, char *value, char *errorbuf, in
minSpecials = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minSpecials < 0 || minSpecials > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of special characters \"%s\" is invalid. "
- "The minimum number of special characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of special characters \"%s\" is invalid. "
+ "The minimum number of special characters must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2938,12 +2923,11 @@ config_set_pw_min8bit( const char *attrname, char *value, char *errorbuf, int ap
min8bit = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || min8bit < 0 || min8bit > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of 8-bit characters \"%s\" is invalid. "
- "The minimum number of 8-bit characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of 8-bit characters \"%s\" is invalid. "
+ "The minimum number of 8-bit characters must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -2973,12 +2957,11 @@ config_set_pw_maxrepeats( const char *attrname, char *value, char *errorbuf, int
maxRepeats = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || maxRepeats < 0 || maxRepeats > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password maximum number of repeated characters \"%s\" is invalid. "
- "The maximum number of repeated characters must range from 0 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password maximum number of repeated characters \"%s\" is invalid. "
+ "The maximum number of repeated characters must range from 0 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -3008,12 +2991,11 @@ config_set_pw_mincategories( const char *attrname, char *value, char *errorbuf,
minCategories = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minCategories < 1 || minCategories > 5 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum number of categories \"%s\" is invalid. "
- "The minimum number of categories must range from 1 to 5.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum number of categories \"%s\" is invalid. "
+ "The minimum number of categories must range from 1 to 5.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -3043,12 +3025,11 @@ config_set_pw_mintokenlength( const char *attrname, char *value, char *errorbuf,
minTokenLength = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || minTokenLength < 1 || minTokenLength > 64 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password minimum token length \"%s\" is invalid. "
- "The minimum token length must range from 1 to 64.",
- value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "password minimum token length \"%s\" is invalid. "
+ "The minimum token length must range from 1 to 64.", value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -3078,10 +3059,8 @@ config_set_pw_maxfailure( const char *attrname, char *value, char *errorbuf, int
maxFailure = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || maxFailure <= 0 || maxFailure > 32767 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password maximum retry \"%s\" is invalid. "
- "Password maximum failure must range from 1 to 32767",
- value );
+ slapi_create_errormsg(errorbuf, 0,
+ "password maximum retry \"%s\" is invalid. Password maximum failure must range from 1 to 32767", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3115,10 +3094,8 @@ config_set_pw_inhistory( const char *attrname, char *value, char *errorbuf, int
history = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || history < 1 || history > 24 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password history length \"%s\" is invalid. "
- "The password history must range from 1 to 24",
- value );
+ slapi_create_errormsg(errorbuf, 0,
+ "password history length \"%s\" is invalid. The password history must range from 1 to 24", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3151,9 +3128,7 @@ config_set_pw_lockduration( const char *attrname, char *value, char *errorbuf, i
duration = parse_duration(value);
if ( errno == ERANGE || duration <= 0 || duration > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password lockout duration \"%s\" is invalid. ",
- value );
+ slapi_create_errormsg(errorbuf, 0, "password lockout duration \"%s\" is invalid. ", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3182,9 +3157,7 @@ config_set_pw_resetfailurecount( const char *attrname, char *value, char *errorb
duration = parse_duration(value);
if ( errno == ERANGE || duration < 0 || duration > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password reset count duration \"%s\" is invalid. ",
- value );
+ slapi_create_errormsg(errorbuf, 0, "password reset count duration \"%s\" is invalid. ", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3326,9 +3299,9 @@ config_set_pw_gracelimit( const char *attrname, char *value, char *errorbuf, int
gracelimit = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || gracelimit < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "password grace limit \"%s\" is invalid, password grace limit must range from 0 to %lld",
- value , (long long int)LONG_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "password grace limit \"%s\" is invalid, password grace limit must range from 0 to %lld",
+ value , (long long int)LONG_MAX);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3549,9 +3522,8 @@ config_set_onoff(const char *attrname, char *value, int *configvalue, char *erro
CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
if (strcasecmp(value, "on") && strcasecmp(value, "off")) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\" or \"off\".",
- attrname, value );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\". Valid values are \"on\" or \"off\".", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -3753,10 +3725,9 @@ config_set_rootpw( const char *attrname, char *value, char *errorbuf, int apply
/* pwd enc func returns slapi_ch_malloc memory */
slapdFrontendConfig->rootpw = (slapdFrontendConfig->rootpwstoragescheme->pws_enc)(value);
} else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password scheme mismatch (passwd scheme is %s; "
- "password is clear text)", attrname,
- slapdFrontendConfig->rootpwstoragescheme->pws_name);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: password scheme mismatch (passwd scheme is %s; password is clear text)",
+ attrname, slapdFrontendConfig->rootpwstoragescheme->pws_name);
retVal = LDAP_PARAM_ERROR;
}
@@ -3769,25 +3740,25 @@ int
config_set_rootpwstoragescheme( const char *attrname, char *value, char *errorbuf, int apply ) {
int retVal = LDAP_SUCCESS;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- struct pw_scheme *new_scheme = NULL;
+ struct pw_scheme *new_scheme = NULL;
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
- new_scheme = pw_name2scheme ( value );
+ new_scheme = pw_name2scheme ( value );
if (new_scheme == NULL ) {
+ if (errorbuf) {
char * scheme_list = plugin_get_pwd_storage_scheme_list(PLUGIN_LIST_PWD_STORAGE_SCHEME);
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s. Valid schemes are: %s",
+ if ( scheme_list ) {
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid scheme - %s. Valid schemes are: %s",
attrname, value, scheme_list );
} else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid scheme - %s (no pwdstorage scheme"
- " plugin loaded)", attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid scheme - %s (no pwdstorage scheme plugin loaded)", attrname, value);
}
slapi_ch_free_string(&scheme_list);
+ }
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3863,12 +3834,12 @@ config_set_workingdir( const char *attrname, char *value, char *errorbuf, int ap
}
if ( PR_Access ( value, PR_ACCESS_EXISTS ) != 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Working directory \"%s\" does not exist.", value );
+ slapi_create_errormsg(errorbuf, 0, "Working directory \"%s\" does not exist.", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
if ( PR_Access ( value, PR_ACCESS_WRITE_OK ) != 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Working directory \"%s\" is not writeable.", value );
+ slapi_create_errormsg(errorbuf, 0, "Working directory \"%s\" is not writeable.", value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -3918,7 +3889,8 @@ config_set_threadnumber( const char *attrname, char *value, char *errorbuf, int
threadnum = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || threadnum < 1 || threadnum > 65535 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum thread number must range from 1 to 65535", attrname, value );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", maximum thread number must range from 1 to 65535", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -3947,7 +3919,9 @@ config_set_maxthreadsperconn( const char *attrname, char *value, char *errorbuf,
maxthreadnum = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || maxthreadnum < 1 || maxthreadnum > 65535 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum thread number per connection must range from 1 to 65535", attrname, value );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", maximum thread number per connection must range from 1 to 65535",
+ attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -3973,7 +3947,7 @@ config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, in
char *endp = NULL;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
+
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
@@ -3986,15 +3960,15 @@ config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, in
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum "
- "file descriptors must range from 1 to %d (the current process limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal);
- if ( nValue > maxVal ) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", maximum file descriptors must range from 1 to %d (the current process limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal, maxVal);
+ if ( nValue > maxVal ) {
+ nValue = maxVal;
+ retVal = LDAP_UNWILLING_TO_PERFORM;
+ } else {
+ retVal = LDAP_OPERATIONS_ERROR;
+ }
}
if (apply) {
@@ -4014,7 +3988,7 @@ config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int
char *endp = NULL;
struct rlimit rlp;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
+
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
@@ -4027,15 +4001,15 @@ config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int
nValue = strtol(value, &endp, 0);
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table "
- "size must range from 1 to %d (the current process maxdescriptors limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
- if ( nValue > maxVal) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", connection table size must range from 1 to %d (the current process maxdescriptors limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
+ if ( nValue > maxVal) {
+ nValue = maxVal;
+ retVal = LDAP_UNWILLING_TO_PERFORM;
+ } else {
+ retVal = LDAP_OPERATIONS_ERROR;
+ }
}
if (apply) {
@@ -4069,15 +4043,15 @@ config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", reserved file "
- "descriptors must range from 1 to %d (the current process maxdescriptors limit). "
- "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
- if ( nValue > maxVal) {
- nValue = maxVal;
- retVal = LDAP_UNWILLING_TO_PERFORM;
- } else {
- retVal = LDAP_OPERATIONS_ERROR;
- }
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", reserved file descriptors must range from 1 to %d (the current process maxdescriptors limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal, maxVal);
+ if ( nValue > maxVal) {
+ nValue = maxVal;
+ retVal = LDAP_UNWILLING_TO_PERFORM;
+ } else {
+ retVal = LDAP_OPERATIONS_ERROR;
+ }
}
if (apply) {
@@ -4089,8 +4063,6 @@ config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf
}
-
-
int
config_set_ioblocktimeout( const char *attrname, char *value, char *errorbuf, int apply ) {
int retVal = LDAP_SUCCESS;
@@ -4107,10 +4079,10 @@ config_set_ioblocktimeout( const char *attrname, char *value, char *errorbuf, in
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", I/O block timeout must range from 0 to %lld",
- attrname, value, (long long int)LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid value \"%s\", I/O block timeout must range from 0 to %lld",
+ attrname, value, (long long int)LONG_MAX);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -4134,7 +4106,7 @@ config_set_idletimeout( const char *attrname, char *value, char *errorbuf, int a
char *endp = NULL;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
+
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
@@ -4143,10 +4115,10 @@ config_set_idletimeout( const char *attrname, char *value, char *errorbuf, int a
nValue = strtol(value, &endp, 10);
if (*endp != '\0' || errno == ERANGE || nValue < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", idle timeout must range from 0 to %lld",
- attrname, value, (long long int)LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid value \"%s\", idle timeout must range from 0 to %lld",
+ attrname, value, (long long int)LONG_MAX);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if (apply) {
@@ -4167,7 +4139,7 @@ config_set_groupevalnestlevel( const char *attrname, char * value, char *errorbu
char *endp = NULL;
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
-
+
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
@@ -4176,11 +4148,10 @@ config_set_groupevalnestlevel( const char *attrname, char * value, char *errorbu
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 0 || nValue > 5 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", group eval nest level must range from 0 to 5",
- attrname, value );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", group eval nest level must range from 0 to 5", attrname, value);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
@@ -4235,8 +4206,6 @@ config_set_timelimit( const char *attrname, char *value, char *errorbuf, int app
Slapi_Backend *be = NULL;
char *cookie;
- *errorbuf = 0;
-
if ( config_value_is_null( attrname, value, errorbuf, 1 )) {
return LDAP_OPERATIONS_ERROR;
}
@@ -4245,11 +4214,11 @@ config_set_timelimit( const char *attrname, char *value, char *errorbuf, int app
nVal = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nVal < -1 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", time limit must range from -1 to %lld",
- attrname, value, (long long int)LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", time limit must range from -1 to %lld",
+ attrname, value, (long long int)LONG_MAX );
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -4260,7 +4229,7 @@ config_set_timelimit( const char *attrname, char *value, char *errorbuf, int app
while (be) {
be->be_timelimit = slapdFrontendConfig->timelimit;
be = slapi_get_next_backend (cookie);
- }
+ }
CFG_UNLOCK_WRITE(slapdFrontendConfig);
slapi_ch_free ((void **)&cookie);
@@ -4298,10 +4267,9 @@ config_set_accesslog( const char *attrname, char *value, char *errorbuf, int app
retVal = log_update_accesslogdir ( value, apply );
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open accesslog directory \"%s\", client accesses will "
- "not be logged.", value );
+ if (retVal != LDAP_SUCCESS) {
+ slapi_create_errormsg(errorbuf, 0,
+ "Cannot open accesslog directory \"%s\", client accesses will not be logged.", value);
}
if ( apply ) {
@@ -4325,12 +4293,10 @@ config_set_errorlog( const char *attrname, char *value, char *errorbuf, int appl
retVal = log_update_errorlogdir ( value, apply );
if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...",
- value );
+ slapi_create_errormsg(errorbuf, 0,
+ "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...", value);
syslog(LOG_ERR,
- "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...",
- value );
+ "Cannot open errorlog file \"%s\", errors cannot be logged. Exiting...", value);
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
}
@@ -4354,9 +4320,8 @@ config_set_auditlog( const char *attrname, char *value, char *errorbuf, int appl
retVal = log_update_auditlogdir ( value, apply );
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open auditlog directory \"%s\"", value );
+ if (retVal != LDAP_SUCCESS) {
+ slapi_create_errormsg(errorbuf, 0, "Cannot open auditlog directory \"%s\"", value);
}
if ( apply ) {
@@ -4379,9 +4344,8 @@ config_set_auditfaillog( const char *attrname, char *value, char *errorbuf, int
retVal = log_update_auditfaillogdir ( value, apply );
- if ( retVal != LDAP_SUCCESS ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "Cannot open auditfaillog directory \"%s\"", value );
+ if (retVal != LDAP_SUCCESS) {
+ slapi_create_errormsg(errorbuf, 0, "Cannot open auditfaillog directory \"%s\"", value);
}
if ( apply ) {
@@ -4409,9 +4373,7 @@ config_set_pw_maxage( const char *attrname, char *value, char *errorbuf, int app
age = parse_duration(value);
if ( age <= 0 || age > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password maximum age \"%s\" is invalid. ",
- attrname, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: password maximum age \"%s\" is invalid.", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -4436,9 +4398,7 @@ config_set_pw_minage( const char *attrname, char *value, char *errorbuf, int app
/* age in seconds */
age = parse_duration(value);
if ( age < 0 || age > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password minimum age \"%s\" is invalid. ",
- attrname, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: password minimum age \"%s\" is invalid.", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -4465,10 +4425,10 @@ config_set_pw_warning( const char *attrname, char *value, char *errorbuf, int ap
sec = parse_duration(value);
if (errno == ERANGE || sec < 0) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: password warning age \"%s\" is invalid, password warning "
- "age must range from 0 to %lld seconds",
- attrname, value, (long long int)LONG_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: password warning age \"%s\" is invalid, password warning "
+ "age must range from 0 to %lld seconds",
+ attrname, value, (long long int)LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
}
@@ -4497,11 +4457,11 @@ config_set_errorlog_level( const char *attrname, char *value, char *errorbuf, in
level = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: error log level \"%s\" is invalid,"
- " error log level must range from 0 to %lld",
- attrname, value, (long long int)LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0, "%s: error log level \"%s\" is invalid,"
+ " error log level must range from 0 to %lld",
+ attrname, value, (long long int)LONG_MAX);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -4532,11 +4492,11 @@ config_set_accesslog_level( const char *attrname, char *value, char *errorbuf, i
level = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: access log level \"%s\" is invalid,"
- " access log level must range from 0 to %lld",
- attrname, value, (long long int)LONG_MAX );
- retVal = LDAP_OPERATIONS_ERROR;
- return retVal;
+ slapi_create_errormsg(errorbuf, 0, "%s: access log level \"%s\" is invalid,"
+ " access log level must range from 0 to %lld",
+ attrname, value, (long long int)LONG_MAX);
+ retVal = LDAP_OPERATIONS_ERROR;
+ return retVal;
}
if ( apply ) {
@@ -4553,17 +4513,17 @@ int config_set_referral_mode(const char *attrname, char *url, char *errorbuf, in
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- slapdFrontendConfig->refer_mode=REFER_MODE_OFF;
+ slapdFrontendConfig->refer_mode=REFER_MODE_OFF;
if ((!url) || (!url[0])) {
- strcpy(errorbuf, "referral url must have a value");
- return LDAP_OPERATIONS_ERROR;
+ slapi_create_errormsg(errorbuf, 0, "referral url must have a value");
+ return LDAP_OPERATIONS_ERROR;
}
if (apply) {
- CFG_LOCK_WRITE(slapdFrontendConfig);
- slapdFrontendConfig->refer_url = slapi_ch_strdup(url);
- slapdFrontendConfig->refer_mode = REFER_MODE_ON;
- CFG_UNLOCK_WRITE(slapdFrontendConfig);
+ CFG_LOCK_WRITE(slapdFrontendConfig);
+ slapdFrontendConfig->refer_url = slapi_ch_strdup(url);
+ slapdFrontendConfig->refer_mode = REFER_MODE_ON;
+ CFG_UNLOCK_WRITE(slapdFrontendConfig);
}
return LDAP_SUCCESS;
}
@@ -4573,8 +4533,8 @@ config_set_versionstring( const char *attrname, char *version, char *errorbuf, i
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
if ((!version) || (!version[0])) {
- PL_strncpyz(errorbuf, "versionstring must have a value", SLAPI_DSE_RETURNTEXT_SIZE);
- return LDAP_OPERATIONS_ERROR;
+ slapi_create_errormsg(errorbuf, 0, "versionstring must have a value");
+ return LDAP_OPERATIONS_ERROR;
}
if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
@@ -5949,9 +5909,8 @@ config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int ap
errno = 0;
size = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n",attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
return retVal;
}
@@ -6015,9 +5974,9 @@ config_set_maxsasliosize( const char *attrname, char *value, char *errorbuf, int
}
if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from -1 to %lld",
- attrname, value, (long long int)LONG_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid. Value must range from -1 to %lld",
+ attrname, value, (long long int)LONG_MAX);
} else if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->maxsasliosize = maxsasliosize;
@@ -6069,9 +6028,8 @@ config_set_localssf( const char *attrname, char *value, char *errorbuf, int appl
}
if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from 0 to %d",
- attrname, value, INT_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid. Value must range from 0 to %d", attrname, value, INT_MAX);
} else if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->localssf = localssf;
@@ -6112,9 +6070,8 @@ config_set_minssf( const char *attrname, char *value, char *errorbuf, int apply
}
if (retVal != LDAP_SUCCESS) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid. Value must range from 0 to %d",
- attrname, value, INT_MAX );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%s\" is invalid. Value must range from 0 to %d", attrname, value, INT_MAX);
} else if (apply) {
CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->minssf = minssf;
@@ -6190,9 +6147,8 @@ config_set_max_filter_nest_level( const char *attrname, char *value,
errno = 0;
level = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) " "is invalid\n",attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
return retVal;
}
@@ -6880,9 +6836,7 @@ config_set_schemareplace( const char *attrname, char *value, char *errorbuf, int
0 != strcasecmp( value, CONFIG_SCHEMAREPLACE_STR_ON ) &&
0 != strcasecmp( value, CONFIG_SCHEMAREPLACE_STR_REPLICATION_ONLY )) {
retVal = LDAP_OPERATIONS_ERROR;
- if( errorbuf ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "unsupported value: %s", value );
- }
+ slapi_create_errormsg(errorbuf, 0, "unsupported value: %s", value);
}
}
@@ -6914,8 +6868,7 @@ config_set_outbound_ldap_io_timeout( const char *attrname, char *value,
errno = 0;
timeout = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n",attrname, value);
return LDAP_OPERATIONS_ERROR;
}
@@ -6973,9 +6926,8 @@ config_set_anon_access_switch( const char *attrname, char *value,
if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
(strcasecmp(value, "rootdse") != 0)) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"rootdse\".", attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\". Valid values are \"on\", \"off\", or \"rootdse\".", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -7011,9 +6963,8 @@ config_set_validate_cert_switch( const char *attrname, char *value,
if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
(strcasecmp(value, "warn") != 0)) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"warn\".", attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\". Valid values are \"on\", \"off\", or \"warn\".", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -7266,10 +7217,7 @@ config_set_default_naming_context(const char *attrname,
int in_init = 0;
suffix = slapi_create_dn_string("%s", value);
if (NULL == suffix) {
- if (errorbuf) {
- PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s is not a valid suffix.", value);
- }
+ slapi_create_errormsg(errorbuf, 0, "%s is not a valid suffix.", value);
return LDAP_INVALID_DN_SYNTAX;
}
sdn = slapi_get_first_suffix(&node, 0);
@@ -7284,10 +7232,7 @@ config_set_default_naming_context(const char *attrname,
sdn = slapi_get_next_suffix(&node, 0);
}
if (!in_init && (NULL == sdn)) { /* not in startup && no match */
- if (errorbuf) {
- PR_snprintf (errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s is not an existing suffix.", value);
- }
+ slapi_create_errormsg(errorbuf, 0, "%s is not an existing suffix.", value);
slapi_ch_free_string(&suffix);
return LDAP_NO_SUCH_OBJECT;
}
@@ -7328,9 +7273,8 @@ config_set_unhashed_pw_switch(const char *attrname, char *value,
if ((strcasecmp(value, "on") != 0) && (strcasecmp(value, "off") != 0) &&
(strcasecmp(value, "nolog") != 0)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"on\", "
- "\"off\", or \"nolog\".", attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\". Valid values are \"on\", \"off\", or \"nolog\".", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -7520,9 +7464,8 @@ config_set_connection_buffer( const char *attrname, char *value,
if ((strcasecmp(value, "0") != 0) && (strcasecmp(value, "1") != 0) &&
(strcasecmp(value, "2") != 0)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\". Valid values are \"0\", "
- "\"1\", or \"2\".", attrname, value);
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\". Valid values are \"0\", \"1\", or \"2\".", attrname, value);
retVal = LDAP_OPERATIONS_ERROR;
}
@@ -7549,8 +7492,7 @@ config_set_listen_backlog_size( const char *attrname, char *value,
errno = 0;
size = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) "
- "is invalid\n",attrname, value);
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n", attrname, value);
return LDAP_OPERATIONS_ERROR;
}
@@ -7631,8 +7573,8 @@ config_set(const char *attr, struct berval **values, char *errorbuf, int apply)
#if 0
debugHashTable(attr);
#endif
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Unknown attribute %s will be ignored", attr);
- slapi_log_error(SLAPI_LOG_FATAL, "config", "%s\n", errorbuf);
+ slapi_create_errormsg(errorbuf, 0, "Unknown attribute %s will be ignored", attr);
+ slapi_log_error(SLAPI_LOG_FATAL, "config_set", "Unknown attribute %s will be ignored", attr);
return LDAP_NO_SUCH_ATTRIBUTE;
}
@@ -7993,9 +7935,11 @@ config_allowed_to_delete_attrs(const char *attr_type)
}
void
-config_set_accesslog_enabled(int value){
+config_set_accesslog_enabled(int value)
+{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
+ errorbuf[0] = '\0';
CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->accesslog_logging_enabled = (int)value;
@@ -8005,12 +7949,16 @@ config_set_accesslog_enabled(int value){
log_set_logging(CONFIG_ACCESSLOG_LOGGING_ENABLED_ATTRIBUTE, "off", SLAPD_ACCESS_LOG, errorbuf, CONFIG_APPLY);
}
CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
+ if (errorbuf[0] != '\0') {
+ slapi_log_error(SLAPI_LOG_FATAL, "config", "config_set_accesslog_enabled: %s\n", errorbuf);
+ }
}
void
config_set_auditlog_enabled(int value){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
+ errorbuf[0] = '\0';
CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->auditlog_logging_enabled = (int)value;
@@ -8020,12 +7968,16 @@ config_set_auditlog_enabled(int value){
log_set_logging(CONFIG_AUDITLOG_LOGGING_ENABLED_ATTRIBUTE, "off", SLAPD_AUDIT_LOG, errorbuf, CONFIG_APPLY);
}
CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
+ if (errorbuf[0] != '\0') {
+ slapi_log_error(SLAPI_LOG_FATAL, "config", "config_set_auditlog_enabled: %s\n", errorbuf);
+ }
}
void
config_set_auditfaillog_enabled(int value){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
+ errorbuf[0] = '\0';
CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->auditfaillog_logging_enabled = (int)value;
@@ -8035,6 +7987,9 @@ config_set_auditfaillog_enabled(int value){
log_set_logging(CONFIG_AUDITFAILLOG_LOGGING_ENABLED_ATTRIBUTE, "off", SLAPD_AUDITFAIL_LOG, errorbuf, CONFIG_APPLY);
}
CFG_ONOFF_UNLOCK_WRITE(slapdFrontendConfig);
+ if (errorbuf[0] != '\0') {
+ slapi_log_error(SLAPI_LOG_FATAL, "config", "config_set_auditfaillog_enabled: %s\n", errorbuf);
+ }
}
int
@@ -8052,10 +8007,8 @@ config_set_maxsimplepaged_per_conn( const char *attrname, char *value, char *err
errno = 0;
size = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE){
- retVal = LDAP_OPERATIONS_ERROR;
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "(%s) value (%s) is invalid\n",
- attrname, value);
- return retVal;
+ slapi_create_errormsg(errorbuf, 0, "(%s) value (%s) is invalid\n", attrname, value);
+ return LDAP_OPERATIONS_ERROR;
}
if ( !apply ) {
@@ -8115,9 +8068,8 @@ config_set_malloc_mxfast(const char *attrname, char *value, char *errorbuf, int
errno = 0;
mxfast = strtol(value, &endp, 10);
if ((*endp != '\0') || (errno == ERANGE)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "limit \"%s\" is invalid, %s must range from 0 to %d",
- value, CONFIG_MALLOC_MXFAST, max);
+ slapi_create_errormsg(errorbuf, 0, "limit \"%s\" is invalid, %s must range from 0 to %d",
+ value, CONFIG_MALLOC_MXFAST, max);
return LDAP_OPERATIONS_ERROR;
}
CFG_ONOFF_LOCK_WRITE(slapdFrontendConfig);
@@ -8157,9 +8109,8 @@ config_set_malloc_trim_threshold(const char *attrname, char *value, char *errorb
errno = 0;
trim_threshold = strtol(value, &endp, 10);
if ((*endp != '\0') || (errno == ERANGE)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "limit \"%s\" is invalid, %s must range from 0 to %lld",
- value, CONFIG_MALLOC_TRIM_THRESHOLD, (long long int)LONG_MAX);
+ slapi_create_errormsg(errorbuf, 0, "limit \"%s\" is invalid, %s must range from 0 to %lld",
+ value, CONFIG_MALLOC_TRIM_THRESHOLD, (long long int)LONG_MAX);
return LDAP_OPERATIONS_ERROR;
}
@@ -8207,9 +8158,8 @@ config_set_malloc_mmap_threshold(const char *attrname, char *value, char *errorb
errno = 0;
mmap_threshold = strtol(value, &endp, 10);
if ((*endp != '\0') || (errno == ERANGE)) {
- PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "limit \"%s\" is invalid, %s must range from 0 to %d",
- value, CONFIG_MALLOC_MMAP_THRESHOLD, max);
+ slapi_create_errormsg(errorbuf, 0, "limit \"%s\" is invalid, %s must range from 0 to %d",
+ value, CONFIG_MALLOC_MMAP_THRESHOLD, max);
return LDAP_OPERATIONS_ERROR;
}
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 13f98bb53..d26b8acc0 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -310,9 +310,7 @@ log_set_logging(const char *attrname, char *value, int logtype, char *errorbuf,
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
if ( NULL == value ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: NULL value; valid values "
- "are \"on\" or \"off\"", attrname );
+ slapi_create_errormsg(errorbuf, 0, "%s: NULL value; valid values are \"on\" or \"off\"", attrname);
return LDAP_OPERATIONS_ERROR;
}
@@ -323,12 +321,11 @@ log_set_logging(const char *attrname, char *value, int logtype, char *errorbuf,
v = 0;
}
else {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", valid values "
- "are \"on\" or \"off\"", attrname, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid value \"%s\", valid values are \"on\" or \"off\"",
+ attrname, value);
return LDAP_OPERATIONS_ERROR;
}
-
+
if ( !apply ){
return LDAP_SUCCESS;
}
@@ -762,10 +759,9 @@ log_set_mode (const char *attrname, char *value, int logtype, char *errorbuf, in
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
if ( NULL == value ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: null value; valid values "
- "are are of the format \"yz-yz-yz-\" where y could be 'r' or '-',"
- " and z could be 'w' or '-'", attrname );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: null value; valid values are are of the format \"yz-yz-yz-\" where y could be 'r' or '-',"
+ " and z could be 'w' or '-'", attrname );
return LDAP_OPERATIONS_ERROR;
}
@@ -781,9 +777,9 @@ log_set_mode (const char *attrname, char *value, int logtype, char *errorbuf, in
if (loginfo.log_access_file &&
( chmod( loginfo.log_access_file, v ) != 0) ) {
int oserr = errno;
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: Failed to chmod access log file to %s: errno %d (%s)",
- attrname, value, oserr, slapd_system_strerror(oserr) );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: Failed to chmod access log file to %s: errno %d (%s)",
+ attrname, value, oserr, slapd_system_strerror(oserr));
retval = LDAP_UNWILLING_TO_PERFORM;
} else { /* only apply the changes if no file or if successful */
slapi_ch_free ( (void **) &fe_cfg->accesslog_mode );
@@ -797,9 +793,9 @@ log_set_mode (const char *attrname, char *value, int logtype, char *errorbuf, in
if (loginfo.log_error_file &&
( chmod( loginfo.log_error_file, v ) != 0) ) {
int oserr = errno;
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: Failed to chmod error log file to %s: errno %d (%s)",
- attrname, value, oserr, slapd_system_strerror(oserr) );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: Failed to chmod error log file to %s: errno %d (%s)",
+ attrname, value, oserr, slapd_system_strerror(oserr));
retval = LDAP_UNWILLING_TO_PERFORM;
} else { /* only apply the changes if no file or if successful */
slapi_ch_free ( (void **) &fe_cfg->errorlog_mode );
@@ -813,9 +809,9 @@ log_set_mode (const char *attrname, char *value, int logtype, char *errorbuf, in
if (loginfo.log_audit_file &&
( chmod( loginfo.log_audit_file, v ) != 0) ) {
int oserr = errno;
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: Failed to chmod audit log file to %s: errno %d (%s)",
- attrname, value, oserr, slapd_system_strerror(oserr) );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: Failed to chmod audit log file to %s: errno %d (%s)",
+ attrname, value, oserr, slapd_system_strerror(oserr));
retval = LDAP_UNWILLING_TO_PERFORM;
} else { /* only apply the changes if no file or if successful */
slapi_ch_free ( (void **) &fe_cfg->auditlog_mode );
@@ -1018,9 +1014,8 @@ log_set_rotationsync_enabled(const char *attrname, char *value, int logtype, cha
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
if ( NULL == value ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: NULL value; valid values "
- "are \"on\" or \"off\"", attrname );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: NULL value; valid values are \"on\" or \"off\"", attrname);
return LDAP_OPERATIONS_ERROR;
}
@@ -1031,9 +1026,8 @@ log_set_rotationsync_enabled(const char *attrname, char *value, int logtype, cha
v = LDAP_OFF;
}
else {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid value \"%s\", valid values "
- "are \"on\" or \"off\"", attrname, value );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: invalid value \"%s\", valid values are \"on\" or \"off\"", attrname, value);
return LDAP_OPERATIONS_ERROR;
}
@@ -1310,8 +1304,7 @@ int log_set_rotationtimeunit(const char *attrname, char *runit, int logtype, cha
logtype != SLAPD_ERROR_LOG &&
logtype != SLAPD_AUDIT_LOG &&
logtype != SLAPD_AUDITFAIL_LOG ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid log type: %d", attrname, logtype );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid log type: %d", attrname, logtype);
return LDAP_OPERATIONS_ERROR;
}
@@ -1322,8 +1315,7 @@ int log_set_rotationtimeunit(const char *attrname, char *runit, int logtype, cha
(strcasecmp(runit, "minute") == 0)) {
/* all good values */
} else {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: unknown unit \"%s\"", attrname, runit );
+ slapi_create_errormsg(errorbuf, 0, "%s: unknown unit \"%s\"", attrname, runit);
rv = LDAP_OPERATIONS_ERROR;
}
@@ -1431,8 +1423,7 @@ log_set_maxdiskspace(const char *attrname, char *maxdiskspace_str, int logtype,
logtype != SLAPD_ERROR_LOG &&
logtype != SLAPD_AUDIT_LOG &&
logtype != SLAPD_AUDITFAIL_LOG ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid log type: %d", attrname, logtype );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid log type: %d", attrname, logtype);
return LDAP_OPERATIONS_ERROR;
}
@@ -1465,9 +1456,9 @@ log_set_maxdiskspace(const char *attrname, char *maxdiskspace_str, int logtype,
maxdiskspace = -1;
} else if (maxdiskspace < mlogsize) {
rv = LDAP_OPERATIONS_ERROR;
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%d (MB)\" is less than max log size \"%d (MB)\"",
- attrname, s_maxdiskspace, (int)(mlogsize/LOG_MB_IN_BYTES) );
+ slapi_create_errormsg(errorbuf, 0,
+ "%s: \"%d (MB)\" is less than max log size \"%d (MB)\"",
+ attrname, s_maxdiskspace, (int)(mlogsize/LOG_MB_IN_BYTES));
}
switch (logtype) {
@@ -1522,8 +1513,7 @@ log_set_mindiskspace(const char *attrname, char *minfreespace_str, int logtype,
logtype != SLAPD_ERROR_LOG &&
logtype != SLAPD_AUDIT_LOG &&
logtype != SLAPD_AUDITFAIL_LOG ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid log type: %d", attrname, logtype );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid log type: %d", attrname, logtype);
rv = LDAP_OPERATIONS_ERROR;
}
@@ -1588,8 +1578,7 @@ log_set_expirationtime(const char *attrname, char *exptime_str, int logtype, cha
logtype != SLAPD_ERROR_LOG &&
logtype != SLAPD_AUDIT_LOG &&
logtype != SLAPD_AUDITFAIL_LOG ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid log type: %d", attrname, logtype );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid log type: %d", attrname, logtype);
rv = LDAP_OPERATIONS_ERROR;
}
@@ -1695,24 +1684,21 @@ log_set_expirationtimeunit(const char *attrname, char *expunit, int logtype, cha
logtype != SLAPD_ERROR_LOG &&
logtype != SLAPD_AUDIT_LOG &&
logtype != SLAPD_AUDITFAIL_LOG ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid log type: %d", attrname, logtype );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid log type: %d", attrname, logtype);
return LDAP_OPERATIONS_ERROR;
}
if ( NULL == expunit ) {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: NULL value", attrname );
+ slapi_create_errormsg(errorbuf, 0, "%s: NULL value", attrname);
return LDAP_OPERATIONS_ERROR;
}
if ( (strcasecmp(expunit, "month") == 0) ||
(strcasecmp(expunit, "week") == 0) ||
(strcasecmp(expunit, "day") == 0)) {
- /* we have good values */
+ /* we have good values */
} else {
- PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid time unit \"%s\"", attrname, expunit );
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid time unit \"%s\"", attrname, expunit);
rv = LDAP_OPERATIONS_ERROR;;
}
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 20c2cc3b0..08d2da6af 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -1600,17 +1600,16 @@ done:
CONFIG_DEFAULT_NAMING_CONTEXT, rc);
}
if (LDAP_SUCCESS == rc) {
- char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
/* Removing defaultNamingContext from cn=config entry
* was successful. The remove does not reset the
* global parameter. We need to reset it separately. */
if (config_set_default_naming_context(
CONFIG_DEFAULT_NAMING_CONTEXT,
NULL, errorbuf, CONFIG_APPLY)) {
- LDAPDebug2Args(LDAP_DEBUG_ANY,
- "mapping_tree_entry_delete_callback: "
- "setting NULL to %s failed. %s\n",
- CONFIG_DEFAULT_NAMING_CONTEXT, errorbuf);
+ slapi_log_error(SLAPI_LOG_FATAL, "mapping_tree",
+ "mapping_tree_entry_delete_callback: setting NULL to %s failed. %s\n",
+ CONFIG_DEFAULT_NAMING_CONTEXT, errorbuf);
}
}
}
@@ -2128,7 +2127,7 @@ int slapi_dn_write_needs_referral(Slapi_DN *target_sdn, Slapi_Entry **referral)
* referral is an output param that will be set to the selected referral.
* errorbuf is a pointer to a buffer that an error string will be written to
* if there is an error. The caller is responsible for passing in a big
- * enough chunk of memory. BUFSIZ should be fine. If errorbuf is NULL,
+ * enough chunk of memory. SLAPI_DSE_RETURNTEXT_SIZE should be fine. If errorbuf is NULL,
* no error string is written to it. The string returned in errorbuf
* would be a good candidate for sending back to the client to describe the
* error.
@@ -2226,10 +2225,11 @@ int slapi_mapping_tree_select(Slapi_PBlock *pb, Slapi_Backend **be, Slapi_Entry
(op_type != SLAPI_OPERATION_BIND) &&
(op_type != SLAPI_OPERATION_UNBIND))
{
+ if (errorbuf) {
+ PL_strncpyz(errorbuf, slapi_config_get_readonly() ?
+ "Server is read-only" : "database is read-only", sizeof(errorbuf));
+ }
ret = LDAP_UNWILLING_TO_PERFORM;
- PL_strncpyz(errorbuf, slapi_config_get_readonly() ?
- "Server is read-only" :
- "database is read-only", BUFSIZ);
slapi_be_Unlock(*be);
*be = NULL;
}
@@ -2335,10 +2335,11 @@ int slapi_mapping_tree_select_all(Slapi_PBlock *pb, Slapi_Backend **be_list,
if (be && !be_isdeleted(be))
{
if (be_index == BE_LIST_SIZE) { /* error - too many backends */
+ slapi_create_errormsg(errorbuf, 0,
+ "Error: too many backends match search request - cannot proceed");
+ slapi_log_error(SLAPI_LOG_FATAL, "mapping_tree",
+ "Error: too many backends match search request - cannot proceed");
ret_code = LDAP_ADMINLIMIT_EXCEEDED;
- PR_snprintf(errorbuf, BUFSIZ-1,
- "Error: too many backends match search request - cannot proceed");
- slapi_log_error(SLAPI_LOG_FATAL, NULL, "%s\n", errorbuf);
break;
} else {
be_list[be_index++]=be;
@@ -2469,10 +2470,9 @@ int slapi_mapping_tree_select_and_check(Slapi_PBlock *pb,char *newdn, Slapi_Back
const Slapi_DN *suffix = slapi_get_suffix_by_dn(target_sdn);
if ((*be != def_be) && (NULL == suffix))
{
+ slapi_create_errormsg(errorbuf, 0,
+ "Target entry \"%s\" does not exist\n", slapi_sdn_get_dn(target_sdn));
ret = LDAP_NO_SUCH_OBJECT;
- PR_snprintf(errorbuf, BUFSIZ,
- "Target entry \"%s\" does not exist\n",
- slapi_sdn_get_dn(target_sdn));
goto unlock_and_return;
}
if (suffix && (0 == slapi_sdn_compare(target_sdn, suffix)))
@@ -2484,30 +2484,26 @@ int slapi_mapping_tree_select_and_check(Slapi_PBlock *pb,char *newdn, Slapi_Back
if (!slapi_be_exist((const Slapi_DN *)&dn_newdn))
{
/* new_be is an empty backend */
+ slapi_create_errormsg(errorbuf, 0, "Backend for suffix \"%s\" does not exist\n", newdn);
ret = LDAP_NO_SUCH_OBJECT;
- PR_snprintf(errorbuf, BUFSIZ,
- "Backend for suffix \"%s\" does not exist\n", newdn);
goto unlock_and_return;
}
if (0 == slapi_sdn_compare(&dn_newdn, new_suffix))
{
ret = LDAP_ALREADY_EXISTS;
- PR_snprintf(errorbuf, BUFSIZ,
- "Suffix \"%s\" already exists\n", newdn);
+ slapi_create_errormsg(errorbuf, 0, "Suffix \"%s\" already exists\n", newdn);
goto unlock_and_return;
}
ret = LDAP_NAMING_VIOLATION;
- PR_snprintf(errorbuf, BUFSIZ, "Cannot rename suffix \"%s\"\n",
- slapi_sdn_get_dn(target_sdn));
+ slapi_create_errormsg(errorbuf, 0, "Cannot rename suffix \"%s\"\n", slapi_sdn_get_dn(target_sdn));
goto unlock_and_return;
}
else
{
if ((*be != new_be) || mtn_sdn_has_child(target_sdn))
{
+ slapi_create_errormsg(errorbuf, 0, "Cannot move entries across backends\n");
ret = LDAP_AFFECTS_MULTIPLE_DSAS;
- PR_snprintf(errorbuf, BUFSIZ,
- "Cannot move entries across backends\n");
goto unlock_and_return;
}
}
@@ -2637,11 +2633,9 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
target_sdn = operation_get_target_spec (op);
if (target_node->mtn_state == MTN_DISABLED) {
- if (errorbuf) {
- PR_snprintf(errorbuf, BUFSIZ,
+ slapi_create_errormsg(errorbuf, 0,
"Warning: Operation attempted on a disabled node : %s\n",
slapi_sdn_get_dn(target_node->mtn_subtree));
- }
result = LDAP_OPERATIONS_ERROR;
return result;
}
@@ -2773,12 +2767,8 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
}
(*index)++;
if (NULL == target_node->mtn_referral_entry) {
- if (errorbuf) {
- PR_snprintf(errorbuf, BUFSIZ,
- "Mapping tree node for %s is set to return a referral,"
- " but no referral is configured for it",
- slapi_sdn_get_ndn(target_node->mtn_subtree));
- }
+ slapi_create_errormsg(errorbuf, 0, "Mapping tree node for %s is set to return a referral,"
+ " but no referral is configured for it", slapi_sdn_get_ndn(target_node->mtn_subtree));
result = LDAP_OPERATIONS_ERROR;
} else {
result = LDAP_SUCCESS;
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 7465e1ebc..e0d9cd75e 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -219,8 +219,8 @@ do_modify( Slapi_PBlock *pb )
mod->mod_op = mod_op;
mod->mod_type = slapi_attr_syntax_normalize(type);
if ( !mod->mod_type || !*mod->mod_type ) {
- char ebuf[BUFSIZ];
- PR_snprintf (ebuf, BUFSIZ, "invalid type '%s'", type);
+ char ebuf[SLAPI_DSE_RETURNTEXT_SIZE];
+ PR_snprintf (ebuf, sizeof(ebuf), "invalid type '%s'", type);
op_shared_log_error_access (pb, "MOD", rawdn, ebuf);
send_ldap_result( pb, LDAP_INVALID_SYNTAX, NULL, ebuf, 0, NULL );
slapi_ch_free((void **)&type);
@@ -628,7 +628,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
int repl_op, internal_op, lastmod, skip_modified_attrs;
char *unhashed_pw_attr = NULL;
Slapi_Operation *operation;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
int err;
LDAPMod *lc_mod = NULL;
struct slapdplugin *p = NULL;
@@ -710,6 +710,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
* We could be serving multiple database backends. Select the
* appropriate one.
*/
+ errorbuf[0] = '\0';
if ((err = slapi_mapping_tree_select(pb, &be, &referral, errorbuf)) != LDAP_SUCCESS) {
send_ldap_result(pb, err, NULL, errorbuf, 0, NULL);
be = NULL;
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index d0ef1b1ff..4edd07e80 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -395,7 +395,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
int internal_op, repl_op, lastmod;
Slapi_Operation *operation;
Slapi_Entry *referral;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
int err;
char *proxydn = NULL;
char *proxystr = NULL;
@@ -571,6 +571,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
*/
/* slapi_mapping_tree_select_and_check ignores the case of newdn
* which is generated using newrdn above. */
+ errorbuf[0] = '\0';
if ((err = slapi_mapping_tree_select_and_check(pb, newdn, &be, &referral, errorbuf)) != LDAP_SUCCESS)
{
send_ldap_result(pb, err, NULL, errorbuf, 0, NULL);
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 41a1b3749..98505e984 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -225,7 +225,6 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
char *proxystr = NULL;
int proxy_err = LDAP_SUCCESS;
char *errtext = NULL;
- char errorbuf[BUFSIZ];
int nentries,pnentries;
int flag_search_base_found = 0;
int flag_no_such_object = 0;
@@ -434,8 +433,10 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
}
if (be_name == NULL) {
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
/* no specific backend was requested, use the mapping tree
*/
+ errorbuf[0] = '\0';
err_code = slapi_mapping_tree_select_all(pb, be_list, referral_list, errorbuf);
if (((err_code != LDAP_SUCCESS) && (err_code != LDAP_OPERATIONS_ERROR) && (err_code != LDAP_REFERRAL))
|| ((err_code == LDAP_OPERATIONS_ERROR) && (be_list[0] == NULL))) {
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index f728e1075..a0975ac53 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -791,9 +791,9 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
char *dn= (char*)slapi_sdn_get_ndn(sdn); /* jcm - Had to cast away const */
char *pwd = NULL;
char *p = NULL;
- char errormsg[ BUFSIZ ];
passwdPolicy *pwpolicy = NULL;
Slapi_Operation *operation = NULL;
+ char errormsg[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
/*
* check_pw_syntax_ext could be called with mod_op == LDAP_MOD_DELETE.
@@ -838,11 +838,9 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
if (!is_replication && !config_get_allow_hashed_pw() &&
((internal_op && pb->pb_conn && !slapi_dn_isroot(pb->pb_conn->c_dn)) ||
(!internal_op && !pw_is_pwp_admin(pb, pwpolicy)))) {
- PR_snprintf( errormsg, BUFSIZ,
- "invalid password syntax - passwords with storage scheme are not allowed");
+ PR_snprintf( errormsg, sizeof(errormsg) - 1, "invalid password syntax - passwords with storage scheme are not allowed");
if ( pwresponse_req == 1 ) {
- slapi_pwpolicy_make_response_control ( pb, -1, -1,
- LDAP_PWPOLICY_INVALIDPWDSYNTAX );
+ slapi_pwpolicy_make_response_control ( pb, -1, -1, LDAP_PWPOLICY_INVALIDPWDSYNTAX );
}
pw_send_ldap_result ( pb, LDAP_CONSTRAINT_VIOLATION, NULL, errormsg, 0, NULL );
return( 1 );
@@ -870,8 +868,7 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
if ( pwpolicy->pw_minlength >
ldap_utf8characters((char *)slapi_value_get_string( vals[i] )) )
{
- PR_snprintf( errormsg, BUFSIZ,
- "invalid password syntax - password must be at least %d characters long",
+ PR_snprintf( errormsg, sizeof(errormsg) - 1, "invalid password syntax - password must be at least %d characters long",
pwpolicy->pw_minlength );
if ( pwresponse_req == 1 ) {
slapi_pwpolicy_make_response_control ( pb, -1, -1,
@@ -944,42 +941,42 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
/* check for character based syntax limits */
if ( pwpolicy->pw_mindigits > num_digits ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
- "invalid password syntax - password must contain at least %d digit characters",
- pwpolicy->pw_mindigits );
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
+ "invalid password syntax - password must contain at least %d digit characters",
+ pwpolicy->pw_mindigits );
} else if ( pwpolicy->pw_minalphas > num_alphas ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d alphabetic characters",
pwpolicy->pw_minalphas );
} else if ( pwpolicy->pw_minuppers > num_uppers ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d uppercase characters",
pwpolicy->pw_minuppers );
} else if ( pwpolicy->pw_minlowers > num_lowers ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d lowercase characters",
- pwpolicy->pw_minlowers );
+ pwpolicy->pw_minlowers );
} else if ( pwpolicy->pw_minspecials > num_specials ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d special characters",
pwpolicy->pw_minspecials );
} else if ( pwpolicy->pw_min8bit > num_8bit ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d 8-bit characters",
pwpolicy->pw_min8bit );
} else if ( (pwpolicy->pw_maxrepeats != 0) && (pwpolicy->pw_maxrepeats < (max_repeated + 1)) ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - a character cannot be repeated more than %d times",
(pwpolicy->pw_maxrepeats + 1) );
} else if ( pwpolicy->pw_mincategories > num_categories ) {
syntax_violation = 1;
- PR_snprintf ( errormsg, BUFSIZ,
+ PR_snprintf ( errormsg, sizeof(errormsg) - 1,
"invalid password syntax - password must contain at least %d character "
"categories (valid categories are digit, uppercase, lowercase, special, and 8-bit characters)",
pwpolicy->pw_mincategories );
@@ -2179,16 +2176,14 @@ check_pw_duration_value( const char *attr_name, char *value,
age = parse_duration(value);
if (-1 == age) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "password minimum age \"%s\" is invalid. ", value );
+ slapi_create_errormsg(errorbuf, 0, "password minimum age \"%s\" is invalid. ", value);
retVal = LDAP_CONSTRAINT_VIOLATION;
} else if (0 == strcasecmp(CONFIG_PW_LOCKDURATION_ATTRIBUTE, attr_name)) {
if ( (age <= 0) ||
(age > (MAX_ALLOWED_TIME_IN_SECS - current_time())) ||
((-1 != minval) && (age < minval)) ||
((-1 != maxval) && (age > maxval))) {
- PR_snprintf ( errorbuf, BUFSIZ, "%s: \"%s\" seconds is invalid. ",
- attr_name, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: \"%s\" seconds is invalid. ", attr_name, value);
retVal = LDAP_CONSTRAINT_VIOLATION;
}
} else {
@@ -2196,8 +2191,7 @@ check_pw_duration_value( const char *attr_name, char *value,
(age > (MAX_ALLOWED_TIME_IN_SECS - current_time())) ||
((-1 != minval) && (age < minval)) ||
((-1 != maxval) && (age > maxval))) {
- PR_snprintf ( errorbuf, BUFSIZ, "%s: \"%s\" seconds is invalid. ",
- attr_name, value );
+ slapi_create_errormsg(errorbuf, 0, "%s: \"%s\" seconds is invalid. ", attr_name, value);
retVal = LDAP_CONSTRAINT_VIOLATION;
}
}
@@ -2214,9 +2208,7 @@ check_pw_resetfailurecount_value( const char *attr_name, char *value, long minva
/* in seconds */
duration = strtol (value, NULL, 0);
if ( duration < 0 || duration > (MAX_ALLOWED_TIME_IN_SECS - current_time()) ) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "password reset count duration \"%s\" seconds is invalid. ",
- value );
+ slapi_create_errormsg(errorbuf, 0, "password reset count duration \"%s\" seconds is invalid.", value);
retVal = LDAP_CONSTRAINT_VIOLATION;
}
@@ -2234,16 +2226,13 @@ check_pw_storagescheme_value( const char *attr_name, char *value, long minval, l
new_scheme = pw_name2scheme(value);
if ( new_scheme == NULL) {
if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "%s: invalid scheme - %s. Valid schemes are: %s",
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid scheme - %s. Valid schemes are: %s",
CONFIG_PW_STORAGESCHEME_ATTRIBUTE, value, scheme_list );
} else {
- PR_snprintf ( errorbuf, BUFSIZ,
- "%s: invalid scheme - %s (no pwdstorage scheme"
- " plugin loaded)",
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid scheme - %s (no pwdstorage scheme plugin loaded)",
CONFIG_PW_STORAGESCHEME_ATTRIBUTE, value);
}
- retVal = LDAP_CONSTRAINT_VIOLATION;
+ retVal = LDAP_CONSTRAINT_VIOLATION;
}
else if ( new_scheme->pws_enc == NULL )
{
@@ -2253,9 +2242,8 @@ check_pw_storagescheme_value( const char *attr_name, char *value, long minval, l
and won't encrypt passwords if they are in clear. We don't take it
*/
- if ( scheme_list != NULL ) {
- PR_snprintf ( errorbuf, BUFSIZ,
- "%s: invalid encoding scheme - %s\nValid values are: %s\n",
+ if (scheme_list) {
+ slapi_create_errormsg(errorbuf, 0, "%s: invalid encoding scheme - %s\nValid values are: %s\n",
CONFIG_PW_STORAGESCHEME_ATTRIBUTE, value, scheme_list );
}
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 76294ac6d..6528a93d6 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -756,7 +756,6 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
char authtype[256]; /* >26 (strlen(SLAPD_AUTH_SASL)+SASL_MECHNAMEMAX+1) */
Slapi_Entry *bind_target_entry = NULL, *referral = NULL;
Slapi_Backend *be = NULL;
- char errorbuf[BUFSIZ];
LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_check_bind\n", 0, 0, 0 );
@@ -956,7 +955,7 @@ sasl_check_result:
slapi_add_auth_response_control(pb, normdn);
}
- if (slapi_mapping_tree_select(pb, &be, &referral, errorbuf) != LDAP_SUCCESS) {
+ if (slapi_mapping_tree_select(pb, &be, &referral, NULL) != LDAP_SUCCESS) {
send_nobackend_ldap_result( pb );
be = NULL;
LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_check_bind\n", 0, 0, 0 );
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 806c38dad..52c1495ef 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -5345,13 +5345,13 @@ init_schema_dse_ext(char *schemadir, Slapi_Backend *be,
if (schema_flags & DSE_SCHEMA_NO_LOAD)
{
struct asyntaxinfo *tmpasip = NULL;
- rc = parse_at_str(attr_str, &tmpasip, errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ rc = parse_at_str(attr_str, &tmpasip, errorbuf, sizeof(errorbuf),
DSE_SCHEMA_NO_GLOCK|schema_flags, 0, 0, 0);
attr_syntax_free( tmpasip ); /* trash it */
}
else
{
- rc = parse_at_str(attr_str, NULL, errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ rc = parse_at_str(attr_str, NULL, errorbuf, sizeof(errorbuf),
schema_flags, 0, 0, 0);
}
if (rc)
@@ -5918,7 +5918,7 @@ schema_create_errormsg(
}
/* ok to cast here because rc is positive */
if ( (rc >= 0) && ((size_t)rc < errorbufsize) ) {
- (void)PR_vsnprintf( errorbuf + rc, errorbufsize - rc, fmt, ap );
+ (void)PR_vsnprintf( errorbuf + rc, errorbufsize - rc - 1, fmt, ap );
}
va_end( ap );
}
@@ -7175,7 +7175,7 @@ static struct objclass *
schema_berval_to_oclist(struct berval **oc_berval)
{
struct objclass *oc, *oc_list, *oc_tail;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
int schema_ds4x_compat, rc;
int i;
@@ -7185,12 +7185,11 @@ schema_berval_to_oclist(struct berval **oc_berval)
oc_list = NULL;
oc_tail = NULL;
if (oc_berval != NULL) {
- errorbuf[0] = '\0';
for (i = 0; oc_berval[i] != NULL; i++) {
/* parse the objectclass value */
oc = NULL;
if (LDAP_SUCCESS != (rc = parse_oc_str(oc_berval[i]->bv_val, &oc,
- errorbuf, sizeof (errorbuf), DSE_SCHEMA_NO_CHECK | DSE_SCHEMA_USE_PRIV_SCHEMA, 0,
+ errorbuf, sizeof(errorbuf), DSE_SCHEMA_NO_CHECK | DSE_SCHEMA_USE_PRIV_SCHEMA, 0,
schema_ds4x_compat, oc_list))) {
slapi_log_error(SLAPI_LOG_FATAL, "schema",
"parse_oc_str returned error: %s\n",
@@ -7222,17 +7221,16 @@ static struct asyntaxinfo *
schema_berval_to_atlist(struct berval **at_berval)
{
struct asyntaxinfo *at, *head = NULL, *at_list = NULL;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
int schema_ds4x_compat, rc = 0, i;
schema_ds4x_compat = config_get_ds4_compatible_schema();
if (at_berval != NULL) {
- errorbuf[0] = '\0';
for (i = 0; at_berval[i] != NULL; i++) {
/* parse the objectclass value */
at = NULL;
- rc = parse_at_str(at_berval[i]->bv_val, &at, errorbuf, sizeof (errorbuf),
+ rc = parse_at_str(at_berval[i]->bv_val, &at, errorbuf, sizeof(errorbuf),
DSE_SCHEMA_NO_CHECK | DSE_SCHEMA_USE_PRIV_SCHEMA, 0, schema_ds4x_compat, 0);
if (rc) {
slapi_log_error(SLAPI_LOG_FATAL, "schema",
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 903486993..dc70fdf69 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -1359,6 +1359,15 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
*/
int util_is_cachesize_sane(size_t *cachesize);
+/**
+ * Write an error message to the given error buffer.
+ *
+ * \param errorbuf. The buffer that the error message is written into. If NULL, nothing happens. It could be a static array or allocated memory. If it is allocated memory, the next param len should be given.
+ * \param len. The length of errorbuf. If 0 is given, sizeof(errorbuf) is used.
+ * \param fmt. The format of the error message.
+ */
+void slapi_create_errormsg(char *errorbuf, size_t len, const char *fmt, ...);
+
#ifdef __cplusplus
}
#endif
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 85c2c6f02..fd17c2851 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -1618,7 +1618,7 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
char ** family_list;
CERTCertificate *cert = NULL;
SECKEYPrivateKey *key = NULL;
- char errorbuf[BUFSIZ];
+ char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE] = {0};
char *val = NULL;
char *default_val = NULL;
int nFamilies = 0;
@@ -1650,7 +1650,6 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
StdPinObj = (SVRCOREStdPinObj *)SVRCORE_GetRegisteredPinObj();
SVRCORE_SetStdPinInteractive(StdPinObj, PR_FALSE);
#endif
- errorbuf[0] = '\0';
/*
* Cipher preferences must be set before any sslSocket is created
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index b9d2ea542..1ac7a5212 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1815,5 +1815,20 @@ out:
return issane;
}
+void
+slapi_create_errormsg(
+ char *errorbuf,
+ size_t len,
+ const char *fmt,
+ ...
+)
+{
+ if (errorbuf) {
+ va_list ap;
+ va_start(ap, fmt);
+ (void)PR_vsnprintf(errorbuf, len?len-1:sizeof(errorbuf)-1, fmt, ap);
+ va_end( ap );
+ }
+}
| 0 |
24b026971adfd97c4ff542aa56211250b54abc97
|
389ds/389-ds-base
|
Added nsslapd-ldifdir and nsslapd-bakdir
|
commit 24b026971adfd97c4ff542aa56211250b54abc97
Author: Rich Megginson <[email protected]>
Date: Fri Jun 29 21:59:13 2007 +0000
Added nsslapd-ldifdir and nsslapd-bakdir
diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in
index 42313e6e2..805bcb8b0 100644
--- a/ldap/ldif/template-dse.ldif.in
+++ b/ldap/ldif/template-dse.ldif.in
@@ -7,6 +7,8 @@ nsslapd-schemadir: %schema_dir%
nsslapd-lockdir: %lock_dir%
nsslapd-tmpdir: %tmp_dir%
nsslapd-certdir: %cert_dir%
+nsslapd-ldifdir: %ldif_dir%
+nsslapd-bakdir: %bak_dir%
nsslapd-saslpath: %sasl_path%
nsslapd-accesslog-logging-enabled: on
nsslapd-accesslog-maxlogsperdir: 10
| 0 |
4d2487e90d2a450e79393c3eb572421461351b71
|
389ds/389-ds-base
|
[147585] test plugin to verify the bug, the previous check in was not returning SUCCESS.
|
commit 4d2487e90d2a450e79393c3eb572421461351b71
Author: Noriko Hosoi <[email protected]>
Date: Fri Jun 24 01:19:40 2005 +0000
[147585] test plugin to verify the bug, the previous check in was not returning SUCCESS.
diff --git a/ldap/servers/slapd/test-plugins/testpreop.c b/ldap/servers/slapd/test-plugins/testpreop.c
index c71fba299..bc72dd030 100644
--- a/ldap/servers/slapd/test-plugins/testpreop.c
+++ b/ldap/servers/slapd/test-plugins/testpreop.c
@@ -176,6 +176,8 @@ testpreop_search( Slapi_PBlock *pb )
if ( slapi_pblock_get( pb, SLAPI_ORIGINAL_TARGET_DN, &base ) == 0 )
slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_ORIGINAL_TARGET_DN",
"%s\n", base );
+
+ return( 0 ); /* allow the operation to continue */
}
| 0 |
2e494bc7e5e73f97e8a425b22706418ff8879336
|
389ds/389-ds-base
|
Ticket 49014 - ns-accountstatus.pl shows wrong status for accounts inactivated by Account policy plugin
Bug Description: ns-accountstatus.pl shows wrong status for accounts inactivated
by inactivity. If there is no acct policy subentry the wrong
basedn was used to get the inactivity limit. This prevented the
script from detecting if an account was inactivated due to inactivity.
Fix Description: If there is no subentry, then use the existing config entry
to get the inactivity limit.
https://fedorahosted.org/389/ticket/49014
Reviewed by: nhosoi(Thanks!)
|
commit 2e494bc7e5e73f97e8a425b22706418ff8879336
Author: Mark Reynolds <[email protected]>
Date: Thu Oct 20 12:38:49 2016 -0400
Ticket 49014 - ns-accountstatus.pl shows wrong status for accounts inactivated by Account policy plugin
Bug Description: ns-accountstatus.pl shows wrong status for accounts inactivated
by inactivity. If there is no acct policy subentry the wrong
basedn was used to get the inactivity limit. This prevented the
script from detecting if an account was inactivated due to inactivity.
Fix Description: If there is no subentry, then use the existing config entry
to get the inactivity limit.
https://fedorahosted.org/389/ticket/49014
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/admin/src/scripts/ns-accountstatus.pl.in b/ldap/admin/src/scripts/ns-accountstatus.pl.in
index 37fc7fa97..a20d2df96 100644
--- a/ldap/admin/src/scripts/ns-accountstatus.pl.in
+++ b/ldap/admin/src/scripts/ns-accountstatus.pl.in
@@ -474,7 +474,7 @@ sub getAcctPolicy
close(LDAP1);
#
- # Now, get the DN for the cos template from the entry
+ # Now, get the DN for the account policy subEntry from the entry (if available)
#
$srch{base} = $entry;
$srch{filter} = "(objectclass=*)";
@@ -486,14 +486,19 @@ sub getAcctPolicy
s/\n //g;
if (/^$cosspecattr: (.*)/i){
$templateDN = $1;
+ break;
}
}
close(LDAP1);
#
- # Get the inactivity limit from the template]
+ # Get the inactivity limit
#
- $srch{base} = $templateDN;
+ $srch{base} = $configentry;
+ if ($templateDN){
+ # Use subEntry DN
+ $srch{base} = $templateDN;
+ }
$srch{filter} = "($limitattr=*)";
$srch{scope} = "base";
$srch{attrs} = "$limitattr";
| 0 |
f1e01ac448ad5eb3a42b380d8a1f53d35bcf9fed
|
389ds/389-ds-base
|
Ticket #374 - consumer can go into total update mode for no reason
https://fedorahosted.org/389/ticket/374
Reviewed by: rmeggins
Contributed by: telackey (Thanks!)
Branch: master
Fix Description: In the consumer replication extop code, ensure exclusive
access to the connection extension by checking the new fields, connid and
opid. If the connid and opid in the extension are not the same as the
current thread, just return an LDAP_BUSY to the supplier. Otherwise, set
the connid and opid of the current thread in the extension. This should
ensure that no other thread can access the connection extension.
Includes some test code that should help cause the problem during an
incremental update. Set the environment variable
export SLAPD_TEST_TICKET_374=1
in /etc/sysconfig/dirsrv-INST and restart the server.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit f1e01ac448ad5eb3a42b380d8a1f53d35bcf9fed
Author: Rich Megginson <[email protected]>
Date: Thu Sep 6 14:14:38 2012 -0600
Ticket #374 - consumer can go into total update mode for no reason
https://fedorahosted.org/389/ticket/374
Reviewed by: rmeggins
Contributed by: telackey (Thanks!)
Branch: master
Fix Description: In the consumer replication extop code, ensure exclusive
access to the connection extension by checking the new fields, connid and
opid. If the connid and opid in the extension are not the same as the
current thread, just return an LDAP_BUSY to the supplier. Otherwise, set
the connid and opid of the current thread in the extension. This should
ensure that no other thread can access the connection extension.
Includes some test code that should help cause the problem during an
incremental update. Set the environment variable
export SLAPD_TEST_TICKET_374=1
in /etc/sysconfig/dirsrv-INST and restart the server.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/repl.h b/ldap/servers/plugins/replication/repl.h
index 433be34e7..802e69cce 100644
--- a/ldap/servers/plugins/replication/repl.h
+++ b/ldap/servers/plugins/replication/repl.h
@@ -290,7 +290,13 @@ void ldapi_initialize_changenumbers(chglog4Info *cl4, changeNumber first, change
#define REPL_PROTOCOL_40 1
#define REPL_PROTOCOL_50_INCREMENTAL 2
#define REPL_PROTOCOL_50_TOTALUPDATE 3
-#define REPL_PROTOCOL_71_TOTALUPDATE 4
+/* TEL 20120529: REPL_PROTOCOL_71_TOTALUPDATE is never used in the code, and the
+ * equivalent code checking the 7.1 OID for incremental updates assigns the
+ * protocol version as REPL_PROTOCOL_50_INCREMENTAL. One or the other of these
+ * is wrong, but there are many tests for REPL_PROTOCOL_50_TOTALUPDATE that would
+ * need to be rewritten to to make use of REPL_PROTOCOL_71_TOTALUPDATE, so it
+ * seems safer and simpler to take this definition out. */
+/* #define REPL_PROTOCOL_71_TOTALUPDATE 4 */
/* In repl_globals.c */
int decrement_repl_active_threads();
@@ -355,12 +361,18 @@ typedef struct consumer_connection_extension
void *supplier_ruv; /* RUV* */
int isreplicationsession;
Slapi_Connection *connection;
+ PRLock *lock; /* protects entire structure */
+ int in_use_opid; /* the id of the operation actively using this, else -1 */
} consumer_connection_extension;
/* extension construct/destructor */
void* consumer_connection_extension_constructor (void *object,void *parent);
void consumer_connection_extension_destructor (void* ext,void *object,void *parent);
+/* extension helpers for managing exclusive access */
+consumer_connection_extension* consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 connid, int opid);
+int consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 connid, int opid, PRBool force);
+
/* mapping tree extension - stores replica object */
typedef struct multimaster_mtnode_extension
{
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
index 33b197d28..c68c9cb4a 100644
--- a/ldap/servers/plugins/replication/repl5_plugins.c
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
@@ -1382,6 +1382,9 @@ static const char *replica_get_purl_for_op (const Replica *r, Slapi_PBlock *pb,
Slapi_Connection *conn;
consumer_connection_extension *connext;
slapi_pblock_get(pb, SLAPI_CONNECTION, &conn);
+ /* TEL 20120531: There is a slim chance we want to take exclusive access
+ * to this instead. However, it isn't clear to me that it is worth the
+ * risk of changing this working code. */
connext = (consumer_connection_extension *)repl_con_get_ext(
REPL_CON_EXT_CONN, conn);
if (NULL == connext || NULL == connext->supplier_ruv)
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index b79280cde..9e0fb2440 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -494,9 +494,11 @@ replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
} else {
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
- "Released replica\n",
+ "Released replica held by locking_purl=%s\n",
connid, opid,
- slapi_sdn_get_dn(r->repl_root));
+ slapi_sdn_get_dn(r->repl_root),
+ r->locking_purl);
+
slapi_ch_free_string(&r->locking_purl);
r->repl_state_flags &= ~(REPLICA_IN_USE);
if (isInc)
diff --git a/ldap/servers/plugins/replication/repl_bind.c b/ldap/servers/plugins/replication/repl_bind.c
index dbc77a62c..c9b922907 100644
--- a/ldap/servers/plugins/replication/repl_bind.c
+++ b/ldap/servers/plugins/replication/repl_bind.c
@@ -72,6 +72,7 @@ legacy_preop_bind( Slapi_PBlock *pb )
slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM, "legacy_preop_bind: begin\n");
#endif
slapi_pblock_get( pb, SLAPI_CONNECTION, &conn );
+ /* TEL 20120529 - Is there any reason we must protect this connext access? */
connext = (consumer_connection_extension*) repl_con_get_ext (REPL_CON_EXT_CONN, conn);
if (NULL != connext)
{
diff --git a/ldap/servers/plugins/replication/repl_connext.c b/ldap/servers/plugins/replication/repl_connext.c
index 2969b15fa..1430aad25 100644
--- a/ldap/servers/plugins/replication/repl_connext.c
+++ b/ldap/servers/plugins/replication/repl_connext.c
@@ -70,6 +70,15 @@ void* consumer_connection_extension_constructor (void *object, void *parent)
ext->isreplicationsession= 0;
ext->supplier_ruv = NULL;
ext->connection = NULL;
+ ext->in_use_opid = -1;
+ ext->lock = PR_NewLock();
+ if (NULL == ext->lock)
+ {
+ slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "unable to create replication consumer connection extension lock - out of memory\n" );
+ /* no need to go through the full destructor, but still need to free up this memory */
+ slapi_ch_free((void **)&ext);
+ ext = NULL;
+ }
}
return ext;
@@ -125,7 +134,154 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
{
ruv_destroy ((RUV **)&connext->supplier_ruv);
}
+
+ if (connext->lock)
+ {
+ PR_DestroyLock(connext->lock);
+ connext->lock = NULL;
+ }
+
+ connext->in_use_opid = -1;
+
connext->connection = NULL;
slapi_ch_free((void **)&ext);
}
}
+
+/* Obtain exclusive access to this connection extension.
+ * Returns the consumer_connection_extension* if successful, else NULL.
+ *
+ * This is similar to obtaining exclusive access to the replica, but not identical.
+ * For the connection extension, you only want to hold on to exclusive access as
+ * long as it is being actively used to process an operation. Mainly that means
+ * while processing either a 'start' or an 'end' extended operation. This makes
+ * certain that if another 'start' or 'end' operation is received on the connection,
+ * the ops will not trample on each other's state. As soon as you are done with
+ * that single operation, it is time to relinquish the connection extension.
+ * That differs from acquiring exclusive access to the replica, which is held over
+ * after the 'start' operation and relinquished during the 'end' operation.
+ */
+consumer_connection_extension*
+consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 connid, int opid)
+{
+ consumer_connection_extension* ret = NULL;
+
+ /* step 1, grab the connext */
+ consumer_connection_extension* connext = (consumer_connection_extension*)
+ repl_con_get_ext(REPL_CON_EXT_CONN, conn);
+
+ if (NULL != connext)
+ {
+ /* step 2, acquire its lock */
+ PR_Lock(connext->lock);
+
+ /* step 3, see if it is not in use, or in use by us */
+ if (0 > connext->in_use_opid)
+ {
+ /* step 4, take it! */
+ connext->in_use_opid = opid;
+ ret = connext;
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Acquired consumer connection extension\n",
+ connid, opid);
+ }
+ else if (opid == connext->in_use_opid)
+ {
+ ret = connext;
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Reacquired consumer connection extension\n",
+ connid, opid);
+ }
+ else
+ {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Could not acquire consumer connection extension; it is in use by op=%d\n",
+ connid, opid, connext->in_use_opid);
+ }
+
+ /* step 5, drop the lock */
+ PR_Unlock(connext->lock);
+ }
+ else
+ {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Could not acquire consumer extension, it is NULL!\n",
+ connid, opid);
+ }
+
+ return ret;
+}
+
+/* Relinquish exclusive access to this connection extension.
+ * Returns 0 if exclusive access could NOT be relinquished, and non-zero if it was.
+ * Specifically:
+ * 1 if the extension was in use and was relinquished.
+ * 2 if the extension was not in use to begin with.
+ *
+ * The extension will only be relinquished if it was first acquired by this op,
+ * or if 'force' is TRUE. Do not use 'force' without a legitimate reason, such
+ * as when destroying the parent connection.
+ *
+ * cf. consumer_connection_extension_acquire_exclusive_access() for details on how,
+ * when, and why you would want to acquire and relinquish exclusive access.
+ */
+int
+consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 connid, int opid, PRBool force)
+{
+ int ret = 0;
+
+ /* step 1, grab the connext */
+ consumer_connection_extension* connext = (consumer_connection_extension*)
+ repl_con_get_ext(REPL_CON_EXT_CONN, conn);
+
+ if (NULL != connext)
+ {
+ /* step 2, acquire its lock */
+ PR_Lock(connext->lock);
+
+ /* step 3, see if it is in use */
+ if (0 > connext->in_use_opid)
+ {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Consumer connection extension is not in use\n",
+ connid, opid);
+ ret = 2;
+ }
+ else if (opid == connext->in_use_opid)
+ {
+ /* step 4, relinquish it (normal) */
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Relinquishing consumer connection extension\n",
+ connid, opid);
+ connext->in_use_opid = -1;
+ ret = 1;
+ }
+ else if (force)
+ {
+ /* step 4, relinquish it (forced) */
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Forced to relinquish consumer connection extension held by op=%d\n",
+ connid, opid, connext->in_use_opid);
+ connext->in_use_opid = -1;
+ ret = 1;
+ }
+ else
+ {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Not relinquishing consumer connection extension, it is held by op=%d!\n",
+ connid, opid, connext->in_use_opid);
+ }
+
+ /* step 5, drop the lock */
+ PR_Unlock(connext->lock);
+ }
+ else
+ {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d Could not relinquish consumer extension, it is NULL!\n",
+ connid, opid);
+ }
+
+ return ret;
+}
+
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
index 334b86bf5..ca8fc55f6 100644
--- a/ldap/servers/plugins/replication/repl_extop.c
+++ b/ldap/servers/plugins/replication/repl_extop.c
@@ -660,12 +660,16 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
* make sure it's there.
*/
slapi_pblock_get(pb, SLAPI_CONNECTION, &conn);
- connext = (consumer_connection_extension *)repl_con_get_ext(
- REPL_CON_EXT_CONN, conn);
+ connext = consumer_connection_extension_acquire_exclusive_access(conn, connid, opid);
if (NULL == connext)
{
- /* Something bad happened. Don't go any further */
- response = NSDS50_REPL_INTERNAL_ERROR;
+ /* TEL 20120531: This used to be a much worse and unexpected thing
+ * before acquiring exclusive access to the connext. Now it should
+ * be highly unusual, but not completely unheard of. We don't want to
+ * return an internal error here as before, because it will eventually
+ * result in a fatal error on the other end. Better to tell it
+ * we are busy instead--which is also probably true. */
+ response = NSDS50_REPL_REPLICA_BUSY;
goto send_response;
}
@@ -733,7 +737,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
/* Stash info that this is a total update session */
if (NULL != connext)
{
- connext->repl_protocol_version = REPL_PROTOCOL_71_TOTALUPDATE;
+ connext->repl_protocol_version = REPL_PROTOCOL_50_TOTALUPDATE;
}
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
@@ -897,6 +901,28 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
replica_object = NULL;
}
+ /* remove this code once ticket 374 is fixed */
+#define ENABLE_TEST_TICKET_374
+#ifdef ENABLE_TEST_TICKET_374
+ if (getenv("SLAPD_TEST_TICKET_374") && (opid > 20)) {
+ int i = 0;
+ int max = 480 * 5;
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%d op=%d repl=\"%s\": "
+ "374 - Starting sleep: connext->repl_protocol_version == %d\n",
+ connid, opid, repl_root, connext->repl_protocol_version);
+
+ while (REPL_PROTOCOL_50_INCREMENTAL == connext->repl_protocol_version && i++ < max) {
+ usleep(200000);
+ }
+
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%d op=%d repl=\"%s\": "
+ "374 - Finished sleep: connext->repl_protocol_version == %d\n",
+ connid, opid, repl_root, connext->repl_protocol_version);
+ }
+#endif
+
/* If this is incremental protocol get replica's ruv to return to the supplier */
if (connext->repl_protocol_version == REPL_PROTOCOL_50_INCREMENTAL)
{
@@ -921,12 +947,14 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
*/
ruv_copy_and_destroy(&supplier_ruv, (RUV **)&connext->supplier_ruv);
+ /* incremental update protocol */
if (connext->repl_protocol_version == REPL_PROTOCOL_50_INCREMENTAL)
{
/* The supplier ruv may have changed, so let's update the referrals */
consumer5_set_mapping_tree_state_for_replica(replica, connext->supplier_ruv);
}
- else /* full protocol */
+ /* total update protocol */
+ else if (connext->repl_protocol_version == REPL_PROTOCOL_50_TOTALUPDATE)
{
char *mtnstate = slapi_mtn_get_state(repl_root_sdn);
char **mtnreferral = slapi_mtn_get_referral(repl_root_sdn);
@@ -969,6 +997,26 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
charray_free(mtnreferral);
mtnreferral = NULL;
}
+ /* something unexpected at this point, like REPL_PROTOCOL_UNKNOWN */
+ else
+ {
+ /* TEL 20120529: This condition isn't supposed to happen, but it
+ * has been observed in the past when the consumer is under such
+ * stress that the supplier sends additional start extops before
+ * the consumer has finished processing an earlier one. Fixing
+ * the underlying race should prevent this from happening in the
+ * future at all, but just in case it is still worth testing the
+ * requested protocol explictly and returning an error here rather
+ * than assuming a total update was requested.
+ * https://fedorahosted.org/389/ticket/374 */
+ response = NSDS50_REPL_INTERNAL_ERROR;
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
+ "Unexpected update protocol received: %d. "
+ "Expected incremental or total.\n",
+ connid, opid, repl_root, connext->repl_protocol_version);
+ goto send_response;
+ }
response = NSDS50_REPL_REPLICA_READY;
/* Set the "is replication session" flag in the connection extension */
@@ -1148,6 +1196,13 @@ send_response:
{
ber_bvecfree(ruv_bervals);
}
+ /* connext (our hold on it at least) */
+ if (NULL != connext)
+ {
+ /* don't free it, just let go of it */
+ consumer_connection_extension_relinquish_exclusive_access(conn, connid, opid, PR_FALSE);
+ connext = NULL;
+ }
return return_value;
}
@@ -1186,8 +1241,15 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb)
*/
/* Get a hold of the connection extension object */
slapi_pblock_get(pb, SLAPI_CONNECTION, &conn);
- connext = (consumer_connection_extension *)repl_con_get_ext(
- REPL_CON_EXT_CONN, conn);
+ slapi_pblock_get (pb, SLAPI_OPERATION_ID, &opid);
+ if (opid) slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
+
+ /* TEL 20120531: unlike the replica, exclusive access to the connext should
+ * have been dropped at the end of the 'start' op. the only reason we couldn't
+ * get access to it would be if some other start or end op currently has it.
+ * if that is the case, the result of our getting it would be unpredictable anyway.
+ */
+ connext = consumer_connection_extension_acquire_exclusive_access(conn, connid, opid);
if (NULL != connext && NULL != connext->replica_acquired)
{
int zero= 0;
@@ -1265,8 +1327,6 @@ multimaster_extop_EndNSDS50ReplicationRequest(Slapi_PBlock *pb)
}
/* Relinquish control of the replica */
- slapi_pblock_get (pb, SLAPI_OPERATION_ID, &opid);
- if (opid) slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
replica_relinquish_exclusive_access(r, connid, opid);
object_release ((Object*)connext->replica_acquired);
connext->replica_acquired = NULL;
@@ -1310,6 +1370,13 @@ free_and_return:
{
ber_bvfree(resp_bval);
}
+ /* connext (our hold on it at least) */
+ if (NULL != connext)
+ {
+ /* don't free it, just let go of it */
+ consumer_connection_extension_relinquish_exclusive_access(conn, connid, opid, PR_FALSE);
+ connext = NULL;
+ }
return return_value;
}
| 0 |
8b4b71f2dca9a3433754dc74b83190ca333ad147
|
389ds/389-ds-base
|
Ticket #47669 - CI test: added test cases for ticket 47669
Description: Retro Changelog Plugin accepts invalid value in nsslapd-changelogmaxage attribute
https://fedorahosted.org/389/ticket/47669
|
commit 8b4b71f2dca9a3433754dc74b83190ca333ad147
Author: Noriko Hosoi <[email protected]>
Date: Tue Jun 16 18:06:43 2015 -0700
Ticket #47669 - CI test: added test cases for ticket 47669
Description: Retro Changelog Plugin accepts invalid value in nsslapd-changelogmaxage attribute
https://fedorahosted.org/389/ticket/47669
diff --git a/dirsrvtests/tickets/ticket47669_test.py b/dirsrvtests/tickets/ticket47669_test.py
new file mode 100644
index 000000000..f8d65f413
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47669_test.py
@@ -0,0 +1,248 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from ldap.controls import SimplePagedResultsControl
+from ldap.controls.simple import GetEffectiveRightsControl
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+CHANGELOG = 'cn=changelog5,cn=config'
+RETROCHANGELOG = 'cn=Retro Changelog Plugin,cn=plugins,cn=config'
+
+MAXAGE = 'nsslapd-changelogmaxage'
+TRIMINTERVAL = 'nsslapd-changelogtrim-interval'
+COMPACTDBINTERVAL = 'nsslapd-changelogcompactdb-interval'
+
+FILTER = '(cn=*)'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ # Here we have standalone instance up and running
+ return TopologyStandalone(standalone)
+
+def test_ticket47669_init(topo):
+ """
+ Add cn=changelog5,cn=config
+ Enable cn=Retro Changelog Plugin,cn=plugins,cn=config
+ """
+ log.info('Testing Ticket 47669 - Test duration syntax in the changelogs')
+
+ # bind as directory manager
+ topo.standalone.log.info("Bind as %s" % DN_DM)
+ topo.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ try:
+ changelogdir = "%s/changelog" % topo.standalone.dbdir
+ topo.standalone.add_s(Entry((CHANGELOG,
+ {'objectclass': 'top extensibleObject'.split(),
+ 'nsslapd-changelogdir': changelogdir})))
+ except ldap.LDAPError, e:
+ log.error('Failed to add ' + CHANGELOG + ': error ' + e.message['desc'])
+ assert False
+
+ try:
+ topo.standalone.modify_s(RETROCHANGELOG, [(ldap.MOD_REPLACE, 'nsslapd-pluginEnabled', 'on')])
+ except ldap.LDAPError, e:
+ log.error('Failed to enable ' + RETROCHANGELOG + ': error ' + e.message['desc'])
+ assert False
+
+ # restart the server
+ topo.standalone.restart(timeout=10)
+
+def add_and_check(topo, plugin, attr, val, isvalid):
+ """
+ Helper function to add/replace attr: val and check the added value
+ """
+ if isvalid:
+ log.info('Test %s: %s -- valid' % (attr, val))
+ try:
+ topo.standalone.modify_s(plugin, [(ldap.MOD_REPLACE, attr, val)])
+ except ldap.LDAPError, e:
+ log.error('Failed to add ' + attr + ': ' + val + ' to ' + plugin + ': error ' + e.message['desc'])
+ assert False
+ else:
+ log.info('Test %s: %s -- invalid' % (attr, val))
+ if plugin == CHANGELOG:
+ try:
+ topo.standalone.modify_s(plugin, [(ldap.MOD_REPLACE, attr, val)])
+ except ldap.LDAPError, e:
+ log.error('Expectedly failed to add ' + attr + ': ' + val + ' to ' + plugin + ': error ' + e.message['desc'])
+ else:
+ try:
+ topo.standalone.modify_s(plugin, [(ldap.MOD_REPLACE, attr, val)])
+ except ldap.LDAPError, e:
+ log.error('Failed to add ' + attr + ': ' + val + ' to ' + plugin + ': error ' + e.message['desc'])
+
+ try:
+ entries = topo.standalone.search_s(plugin, ldap.SCOPE_BASE, FILTER, [attr])
+ if isvalid:
+ if not entries[0].hasValue(attr, val):
+ log.fatal('%s does not have expected (%s: %s)' % (plugin, attr, val))
+ assert False
+ else:
+ if plugin == CHANGELOG:
+ if entries[0].hasValue(attr, val):
+ log.fatal('%s has unexpected (%s: %s)' % (plugin, attr, val))
+ assert False
+ else:
+ if not entries[0].hasValue(attr, val):
+ log.fatal('%s does not have expected (%s: %s)' % (plugin, attr, val))
+ assert False
+ except ldap.LDAPError, e:
+ log.fatal('Unable to search for entry %s: error %s' % (plugin, e.message['desc']))
+ assert False
+
+
+def test_ticket47669_changelog_maxage(topo):
+ """
+ Test nsslapd-changelogmaxage in cn=changelog5,cn=config
+ """
+ log.info('1. Test nsslapd-changelogmaxage in cn=changelog5,cn=config')
+
+ # bind as directory manager
+ topo.standalone.log.info("Bind as %s" % DN_DM)
+ topo.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ add_and_check(topo, CHANGELOG, MAXAGE, '12345', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '10s', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '30M', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '12h', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '2D', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '4w', True)
+ add_and_check(topo, CHANGELOG, MAXAGE, '-123', False)
+ add_and_check(topo, CHANGELOG, MAXAGE, 'xyz', False)
+
+def test_ticket47669_changelog_triminterval(topo):
+ """
+ Test nsslapd-changelogtrim-interval in cn=changelog5,cn=config
+ """
+ log.info('2. Test nsslapd-changelogtrim-interval in cn=changelog5,cn=config')
+
+ # bind as directory manager
+ topo.standalone.log.info("Bind as %s" % DN_DM)
+ topo.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '12345', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '10s', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '30M', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '12h', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '2D', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '4w', True)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, '-123', False)
+ add_and_check(topo, CHANGELOG, TRIMINTERVAL, 'xyz', False)
+
+def test_ticket47669_changelog_compactdbinterval(topo):
+ """
+ Test nsslapd-changelogcompactdb-interval in cn=changelog5,cn=config
+ """
+ log.info('3. Test nsslapd-changelogcompactdb-interval in cn=changelog5,cn=config')
+
+ # bind as directory manager
+ topo.standalone.log.info("Bind as %s" % DN_DM)
+ topo.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '12345', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '10s', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '30M', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '12h', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '2D', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '4w', True)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, '-123', False)
+ add_and_check(topo, CHANGELOG, COMPACTDBINTERVAL, 'xyz', False)
+
+def test_ticket47669_retrochangelog_maxage(topo):
+ """
+ Test nsslapd-changelogmaxage in cn=Retro Changelog Plugin,cn=plugins,cn=config
+ """
+ log.info('4. Test nsslapd-changelogmaxage in cn=Retro Changelog Plugin,cn=plugins,cn=config')
+
+ # bind as directory manager
+ topo.standalone.log.info("Bind as %s" % DN_DM)
+ topo.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '12345', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '10s', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '30M', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '12h', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '2D', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '4w', True)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, '-123', False)
+ add_and_check(topo, RETROCHANGELOG, MAXAGE, 'xyz', False)
+
+ topo.standalone.log.info("ticket47669 was successfully verified.")
+
+def test_ticket47669_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+def run_isolated():
+ """
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ """
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47669_init(topo)
+ test_ticket47669_changelog_maxage(topo)
+ test_ticket47669_changelog_triminterval(topo)
+ test_ticket47669_changelog_compactdbinterval(topo)
+ test_ticket47669_retrochangelog_maxage(topo)
+ test_ticket47669_final(topo)
+
+if __name__ == '__main__':
+ run_isolated()
+
| 0 |
0c8906b077d457c98a8615fd761e0032cb119b99
|
389ds/389-ds-base
|
Bug Description: Add support for managing automember to dsconf
Fix Description: Added the dsconf support and tests for creating, removing, editing and showing
the automember definitions.
https://pagure.io/lib389/issue/35
Author: Alisha Aneja
Review by: wibrown (thank you so much!!!)
|
commit 0c8906b077d457c98a8615fd761e0032cb119b99
Author: alisha17 <[email protected]>
Date: Wed Dec 13 10:52:16 2017 +1100
Bug Description: Add support for managing automember to dsconf
Fix Description: Added the dsconf support and tests for creating, removing, editing and showing
the automember definitions.
https://pagure.io/lib389/issue/35
Author: Alisha Aneja
Review by: wibrown (thank you so much!!!)
diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf
index 23a1c6f41..300756aef 100755
--- a/src/lib389/cli/dsconf
+++ b/src/lib389/cli/dsconf
@@ -28,6 +28,8 @@ from lib389.cli_conf.plugins import usn as cli_usn
from lib389.cli_conf.plugins import rootdn_ac as cli_rootdn_ac
from lib389.cli_conf.plugins import whoami as cli_whoami
from lib389.cli_conf.plugins import referint as cli_referint
+from lib389.cli_conf.plugins import automember as cli_automember
+
from lib389.cli_base import disconnect_instance, connect_instance
from lib389.cli_base.dsrc import dsrc_to_ldap, dsrc_arg_concat
@@ -75,7 +77,8 @@ if __name__ == '__main__':
cli_rootdn_ac.create_parser(subparsers)
cli_whoami.create_parser(subparsers)
cli_referint.create_parser(subparsers)
-
+ cli_automember.create_parser(subparsers)
+
args = parser.parse_args()
log = reset_get_logger('dsconf', args.verbose)
diff --git a/src/lib389/lib389/cli_conf/plugins/automember.py b/src/lib389/lib389/cli_conf/plugins/automember.py
new file mode 100644
index 000000000..d4330c342
--- /dev/null
+++ b/src/lib389/lib389/cli_conf/plugins/automember.py
@@ -0,0 +1,158 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016-2017 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+import ldap
+
+from lib389.plugins import AutoMembershipPlugin, AutoMembershipDefinition, AutoMembershipDefinitions
+from lib389.cli_conf.plugin import add_generic_plugin_parsers
+
+
+def list_definition(inst, basedn, log, args):
+ """
+ List automember definition if instance name
+ is given else show all automember definitions.
+
+ :param name: An instance
+ :type name: lib389.DirSrv
+
+ """
+
+ automembers = AutoMembershipDefinitions(inst)
+
+ if args.name is not None:
+ automember = automembers.get(args.name)
+ log.info(automember.display())
+ else:
+ all_definitions = automembers.list()
+
+ for definition in all_definitions:
+ log.info(definition.display())
+
+
+def create_definition(inst, basedn, log, args):
+ """
+ Create automember definition.
+
+ :param name: An instance
+ :type name: lib389.DirSrv
+ :param groupattr: autoMemberGroupingAttr value
+ :type groupattr: str
+ :param defaultgroup: autoMemberDefaultGroup value
+ :type defaultgroup: str
+ :param scope: autoMemberScope value
+ :type scope: str
+ :param filter: autoMemberFilter value
+ :type filter: str
+
+ """
+ automember_prop = {
+ 'cn': args.name,
+ 'autoMemberScope': args.scope,
+ 'autoMemberFilter': args.filter,
+ 'autoMemberDefaultGroup': args.defaultgroup,
+ 'autoMemberGroupingAttr': args.groupattr,
+ }
+
+ plugin = AutoMembershipPlugin(inst)
+ plugin.enable()
+
+ automembers = AutoMembershipDefinitions(inst)
+
+ automember = automembers.create(properties=automember_prop)
+ log.info("Automember definition created successfully!")
+
+
+def edit_definition(inst, basedn, log, args):
+ """
+ Edit automember definition
+
+ :param name: An instance
+ :type name: lib389.DirSrv
+ :param groupattr: autoMemberGroupingAttr value
+ :type groupattr: str
+ :param defaultgroup: autoMemberDefaultGroup value
+ :type defaultgroup: str
+ :param scope: autoMemberScope value
+ :type scope: str
+ :param filter: autoMemberFilter value
+ :type filter: str
+
+ """
+ automembers = AutoMembershipDefinitions(inst)
+ automember = automembers.get(args.name)
+
+ if args.scope is not None:
+ automember.replace("automemberscope", args.scope)
+ if args.filter is not None:
+ automember.replace("automemberfilter", args.filter)
+ if args.defaultgroup is not None:
+ automember.replace("automemberdefaultgroup", args.defaultgroup)
+ if args.groupattr is not None:
+ automember.replace("automembergroupingattr", args.groupattr)
+
+ log.info("Definition updated successfully.")
+
+
+def remove_definition(inst, basedn, log, args):
+ """
+ Remove automember definition for the given
+ instance.
+
+ :param name: An instance
+ :type name: lib389.DirSrv
+
+ """
+ automembers = AutoMembershipDefinitions(inst)
+ automember = automembers.get(args.name)
+
+ automember.delete()
+ log.info("Definition deleted successfully!")
+
+
+def create_parser(subparsers):
+ automember_parser = subparsers.add_parser('automember', help="Manage and configure automember plugin")
+
+ subcommands = automember_parser.add_subparsers(help='action')
+
+ add_generic_plugin_parsers(subcommands, AutoMembershipPlugin)
+
+ create_parser = subcommands.add_parser('create', help='Create automember definition.')
+ create_parser.set_defaults(func=create_definition)
+
+ create_parser.add_argument("name", nargs='?', required=True ,help='Set cn for group entry.')
+
+ create_parser.add_argument("--groupattr", help='Set member attribute in group entry.', default='member:dn')
+
+ create_parser.add_argument('--defaultgroup', required=True, help='Set default group to add member to.')
+
+ create_parser.add_argument('--scope', required=True, help='Set automember scope.')
+
+ create_parser.add_argument('--filter', help='Set automember filter.', default= '(objectClass=*)')
+
+ show_parser = subcommands.add_parser('list', help='List automember definition.')
+ show_parser.set_defaults(func=list_definition)
+
+ show_parser.add_argument("name", nargs='?', help='Set cn for group entry.')
+
+ edit_parser = subcommands.add_parser('edit', help='Edit automember definition.')
+ edit_parser.set_defaults(func=edit_definition)
+
+ edit_parser.add_argument("name", help='Set cn for group entry.')
+
+ edit_parser.add_argument("--groupattr", help='Set member attribute in group entry.')
+
+ edit_parser.add_argument('--defaultgroup', help='Set default group to add member to.')
+
+ edit_parser.add_argument('--scope', help='Set automember scope.')
+
+ edit_parser.add_argument('--filter', help='Set automember filter.')
+
+ remove_parser = subcommands.add_parser('remove', help='Remove automember definition.')
+ remove_parser.set_defaults(func=remove_definition)
+
+ remove_parser.add_argument("name", help='Set cn for group entry.')
diff --git a/src/lib389/lib389/plugins.py b/src/lib389/lib389/plugins.py
index 8180e7876..830ac7b18 100644
--- a/src/lib389/lib389/plugins.py
+++ b/src/lib389/lib389/plugins.py
@@ -488,7 +488,7 @@ class AutoMembershipDefinitions(DSLdapObjects):
:type basedn: str
"""
- def __init__(self, instance, basedn):
+ def __init__(self, instance, basedn="cn=Auto Membership Plugin,cn=plugins,cn=config"):
super(AutoMembershipDefinitions, self).__init__(instance)
self._objectclasses = ['top','autoMemberDefinition']
self._filterattrs = ['cn']
diff --git a/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py b/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py
new file mode 100644
index 000000000..bffb34c1f
--- /dev/null
+++ b/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py
@@ -0,0 +1,122 @@
+import pytest
+import ldap
+
+from lib389.tests.cli import topology as default_topology
+from lib389.cli_base import LogCapture, FakeArgs
+from lib389.plugins import AutoMembershipPlugin
+from lib389.cli_conf.plugins import automember as automember_cli
+
[email protected](scope="module")
+def topology(request):
+ topology = default_topology(request)
+
+ plugin = AutoMembershipPlugin(topology.standalone)
+ if not plugin.exists():
+ plugin.create()
+
+ # we need to restart the server after enabling the plugin
+ plugin.enable()
+ topology.standalone.restart()
+ topology.logcap.flush()
+
+ return topology
+
+
+def test_namenotexists_listdefinition(topology):
+ """
+ Test if non existent instance raises ldap.NO_SUCH_OBJECT exception
+ when showing automember definition.
+ """
+ args = FakeArgs()
+
+ args.name = "somerandomcn"
+
+ with pytest.raises(ldap.NO_SUCH_OBJECT):
+ automember_cli.list_definition(topology.standalone, None, topology.logcap.log, args)
+ log.info("Definition for instance {} does not exist".format(args.name))
+
+
+def test_createdefinition(topology):
+ """
+ Test if new automember definition is created successfully.
+ """
+ args = FakeArgs()
+
+ args.name = "sometestcn"
+ args.scope = "ou=People,dc=example,dc=com"
+ args.filter = "objectclass=*"
+ args.groupattr = "member:dn"
+ args.defaultgroup = "cn=linux-group,cn=groups,dc=example,dc=com"
+
+ automember_cli.create_definition(topology.standalone, None, topology.logcap.log, args)
+ assert topology.logcap.contains("Automember definition created successfully!")
+
+ topology.logcap.flush()
+
+
+def test_invalidattributes_createdefinition(topology):
+ """
+ Test if invalid attributes raise ldap.INVALID_SYNTAX exception
+ when creating new automember definition.
+ """
+ args = FakeArgs()
+
+ args.name = "sometestcn"
+ args.scope = "someinvalidscope"
+ args.filter = "objectclass=*"
+ args.groupattr = "member:dn"
+ args.defaultgroup = "someinvaliddefaultgroup"
+
+ with pytest.raises(ldap.INVALID_SYNTAX):
+ automember_cli.create_definition(topology.standalone, None, topology.logcap.log, args)
+ log.info("There are invalid attributes in the definition.")
+
+
+def test_ifnameexists_createdefinition(topology):
+ """
+ Test if already existing instance name raises ldap.ALREADY-EXISTS
+ exception when creating new automember definition.
+ """
+
+ args = FakeArgs()
+
+ args.name = "sometestcn"
+ args.scope = "ou=People,dc=example,dc=com"
+ args.filter = "objectclass=*"
+ args.groupattr = "member:dn"
+ args.defaultgroup = "cn=windows-group,cn=groups,dc=example,dc=com"
+
+ with pytest.raises(ldap.ALREADY_EXISTS):
+ automember_cli.create_definition(topology.standalone, None, topology.logcap.log, args)
+ log.info("Definition for instance {} already exists.".format(args.name))
+
+
+def test_editdefinition(topology):
+ """
+ Test if automember definition is updated successfully.
+ """
+ args = FakeArgs()
+
+ args.name = "sometestcn"
+ args.scope = "ou=People,dc=example,dc=com"
+ args.filter = "objectclass=*"
+ args.groupattr = "member:dn"
+ args.defaultgroup = "cn=windows-group,cn=groups,dc=example,dc=com"
+
+ a = automember_cli.edit_definition(topology.standalone, None, topology.logcap.log, args)
+
+ assert topology.logcap.contains("Definition updated successfully.")
+
+
+def test_nonexistentinstance_removedefinition(topology):
+ """
+ Test if non existent instance definition raises NO_SUCH_OBJECT
+ definition when removing automember definition.
+ """
+ args = FakeArgs()
+
+ args.name = "randomcn"
+
+ with pytest.raises(ldap.NO_SUCH_OBJECT):
+ automember_cli.remove_definition(topology.standalone, None, topology.logcap.log, args)
+ log.info("Definition for instance {} does not exist.".format(args.name))
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.