[389-ds-base] branch 389-ds-base-1.4.1 updated: Issue 50499 - Fix npm audit issues
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 4f84db6 Issue 50499 - Fix npm audit issues
4f84db6 is described below
commit 4f84db6edd7e48b26a45904d7b00bff2ab51f0de
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Fri Sep 27 17:23:49 2019 -0400
Issue 50499 - Fix npm audit issues
Description; Updated npm handlebars package
relates: https://pagure.io/389-ds-base/issue/50499
(cherry picked from commit 2e85b4a3efcc63d0a502a1a1c3e0495138294961)
---
src/cockpit/389-console/package-lock.json | 58 +++++++++++++++++++++++++++++--
src/cockpit/389-console/package.json | 1 +
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/src/cockpit/389-console/package-lock.json b/src/cockpit/389-console/package-lock.json
index 68977e6..6b4ebfb 100644
--- a/src/cockpit/389-console/package-lock.json
+++ b/src/cockpit/389-console/package-lock.json
@@ -6052,6 +6052,40 @@
"resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz",
"integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw=="
},
+ "handlebars": {
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.3.tgz",
+ "integrity": "sha512-VupOxR91xcGojfINrzMqrvlyYbBs39sXIrWa7YdaQWeBudOlvKEGvCczMfJPgnuwHE/zyH1M6J+IUP6cgDVyxg==",
+ "requires": {
+ "neo-async": "^2.6.0",
+ "optimist": "^0.6.1",
+ "source-map": "^0.6.1",
+ "uglify-js": "^3.1.4"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "2.20.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
+ "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
+ "optional": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ },
+ "uglify-js": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
+ "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
+ "optional": true,
+ "requires": {
+ "commander": "~2.20.0",
+ "source-map": "~0.6.1"
+ }
+ }
+ }
+ },
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@@ -7541,8 +7575,7 @@
"neo-async": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz",
- "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==",
- "dev": true
+ "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA=="
},
"nice-try": {
"version": "1.0.5",
@@ -7815,6 +7848,27 @@
"mimic-fn": "^1.0.0"
}
},
+ "optimist": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
+ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
+ "requires": {
+ "minimist": "~0.0.1",
+ "wordwrap": "~0.0.2"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
+ "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8="
+ },
+ "wordwrap": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
+ "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
+ }
+ }
+ },
"optionator": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
diff --git a/src/cockpit/389-console/package.json b/src/cockpit/389-console/package.json
index 7a05da6..420fb6f 100644
--- a/src/cockpit/389-console/package.json
+++ b/src/cockpit/389-console/package.json
@@ -52,6 +52,7 @@
"@patternfly/react-core": "^3.58.1",
"bootstrap": "^4.3.1",
"file-loader": "^4.1.0",
+ "handlebars": "^4.3.3",
"node-sass": "4.11.0",
"patternfly": "^3.59.3",
"patternfly-react": "^2.34.3",
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch master updated: Issue 50499 - Fix npm audit issues
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
The following commit(s) were added to refs/heads/master by this push:
new 2e85b4a Issue 50499 - Fix npm audit issues
2e85b4a is described below
commit 2e85b4a3efcc63d0a502a1a1c3e0495138294961
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Fri Sep 27 17:23:49 2019 -0400
Issue 50499 - Fix npm audit issues
Description; Updated npm handlebars package
relates: https://pagure.io/389-ds-base/issue/50499
---
src/cockpit/389-console/package-lock.json | 58 +++++++++++++++++++++++++++++--
src/cockpit/389-console/package.json | 1 +
2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/src/cockpit/389-console/package-lock.json b/src/cockpit/389-console/package-lock.json
index 68977e6..6b4ebfb 100644
--- a/src/cockpit/389-console/package-lock.json
+++ b/src/cockpit/389-console/package-lock.json
@@ -6052,6 +6052,40 @@
"resolved": "https://registry.npmjs.org/gud/-/gud-1.0.0.tgz",
"integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw=="
},
+ "handlebars": {
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.3.tgz",
+ "integrity": "sha512-VupOxR91xcGojfINrzMqrvlyYbBs39sXIrWa7YdaQWeBudOlvKEGvCczMfJPgnuwHE/zyH1M6J+IUP6cgDVyxg==",
+ "requires": {
+ "neo-async": "^2.6.0",
+ "optimist": "^0.6.1",
+ "source-map": "^0.6.1",
+ "uglify-js": "^3.1.4"
+ },
+ "dependencies": {
+ "commander": {
+ "version": "2.20.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
+ "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
+ "optional": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+ },
+ "uglify-js": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
+ "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
+ "optional": true,
+ "requires": {
+ "commander": "~2.20.0",
+ "source-map": "~0.6.1"
+ }
+ }
+ }
+ },
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@@ -7541,8 +7575,7 @@
"neo-async": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz",
- "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==",
- "dev": true
+ "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA=="
},
"nice-try": {
"version": "1.0.5",
@@ -7815,6 +7848,27 @@
"mimic-fn": "^1.0.0"
}
},
+ "optimist": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
+ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
+ "requires": {
+ "minimist": "~0.0.1",
+ "wordwrap": "~0.0.2"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
+ "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8="
+ },
+ "wordwrap": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
+ "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
+ }
+ }
+ },
"optionator": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
diff --git a/src/cockpit/389-console/package.json b/src/cockpit/389-console/package.json
index 7a05da6..420fb6f 100644
--- a/src/cockpit/389-console/package.json
+++ b/src/cockpit/389-console/package.json
@@ -52,6 +52,7 @@
"@patternfly/react-core": "^3.58.1",
"bootstrap": "^4.3.1",
"file-loader": "^4.1.0",
+ "handlebars": "^4.3.3",
"node-sass": "4.11.0",
"patternfly": "^3.59.3",
"patternfly-react": "^2.34.3",
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch 389-ds-base-1.4.1 updated: Bump version to 1.4.1.8
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 67d69bf Bump version to 1.4.1.8
67d69bf is described below
commit 67d69bf61076867183adc56da9e5ae28cb2f13a5
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Thu Sep 26 10:23:27 2019 -0400
Bump version to 1.4.1.8
---
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION.sh b/VERSION.sh
index 1d564da..64df546 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=4
-VERSION_MAINT=1.7
+VERSION_MAINT=1.8
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch master updated: bump version to 1.4.2.2
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
The following commit(s) were added to refs/heads/master by this push:
new 11bb10f bump version to 1.4.2.2
11bb10f is described below
commit 11bb10ffae38a03c4ef400d4054d9c3978324876
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Thu Sep 26 09:43:18 2019 -0400
bump version to 1.4.2.2
---
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION.sh b/VERSION.sh
index 9e53a79..3f538e1 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=4
-VERSION_MAINT=2.1
+VERSION_MAINT=2.2
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch 389-ds-base-1.4.1 updated: Issue 50545 - Port repl-monitor.pl to lib389 CLI
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 8c896dc Issue 50545 - Port repl-monitor.pl to lib389 CLI
8c896dc is described below
commit 8c896dc89e39b4017b2c4d709fb743b87795ebc4
Author: Simon Pichugin <spichugi(a)redhat.com>
AuthorDate: Wed Sep 11 20:21:17 2019 +0200
Issue 50545 - Port repl-monitor.pl to lib389 CLI
Description: Add a new command to 'dsconf replication' CLI.
'dsconf replication monitor' generates a report which
shows the replication topology to which the instance does belong.
Additional arguments:
-c or --connections [CONNECTION [CONNECTION ...]]
The connection values for monitoring other not
connected topologies. The format:
'host:port:binddn:bindpwd'. You can use regex for host
and port. You can set bindpwd to * and it will be
requested at the runtime or you can include the path
to the password file in square brackets - [~/pwd.txt]
-a or --aliases [ALIAS [ALIAS ...]]
If a host:port is assigned an alias, then the alias
instead of host:port will be displayed in the output.
The format: alias=host:port
Also, ~/.dsrc can be used for specifying the connections and aliases.
[repl-monitor-connections]
connection1 = server1.example.com:38901:cn=Directory manager:*
connection2 = server2.example.com:38902:cn=Directory manager:[~/pwd.txt]
connection3 = hub1.example.com:.*:cn=Directory manager:password
[repl-monitor-aliases]
M1 = server1.example.com:38901
M2 = server2.example.com:38902
https://pagure.io/389-ds-base/issue/50545
Reviewed by: mreynolds (Thanks!)
---
src/lib389/cli/dsconf | 3 +-
src/lib389/cli/dsidm | 3 +-
src/lib389/lib389/_constants.py | 1 +
src/lib389/lib389/agreement.py | 2 +-
src/lib389/lib389/cli_base/dsrc.py | 75 +++++++++---
src/lib389/lib389/cli_conf/replication.py | 105 ++++++++++++++++-
src/lib389/lib389/replica.py | 186 +++++++++++++++++++++++++++++-
7 files changed, 353 insertions(+), 22 deletions(-)
diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf
index 22635ca..1940b8e 100755
--- a/src/lib389/cli/dsconf
+++ b/src/lib389/cli/dsconf
@@ -16,6 +16,7 @@ import sys
import signal
import json
import ast
+from lib389._constants import DSRC_HOME
from lib389.cli_conf import config as cli_config
from lib389.cli_conf import backend as cli_backend
from lib389.cli_conf import directory_manager as cli_directory_manager
@@ -109,7 +110,7 @@ if __name__ == '__main__':
log.debug("Inspired by works of: ITS, The University of Adelaide")
# Now that we have our args, see how they relate with our instance.
- dsrc_inst = dsrc_to_ldap("~/.dsrc", args.instance, log.getChild('dsrc'))
+ dsrc_inst = dsrc_to_ldap(DSRC_HOME, args.instance, log.getChild('dsrc'))
# Now combine this with our arguments
dsrc_inst = dsrc_arg_concat(args, dsrc_inst)
diff --git a/src/lib389/cli/dsidm b/src/lib389/cli/dsidm
index aab6f6f..7fd77b6 100755
--- a/src/lib389/cli/dsidm
+++ b/src/lib389/cli/dsidm
@@ -15,6 +15,7 @@ import argparse
import argcomplete
import sys
import signal
+from lib389._constants import DSRC_HOME
from lib389.cli_idm import account as cli_account
from lib389.cli_idm import initialise as cli_init
from lib389.cli_idm import organizationalunit as cli_ou
@@ -96,7 +97,7 @@ if __name__ == '__main__':
log.debug("Inspired by works of: ITS, The University of Adelaide")
# Now that we have our args, see how they relate with our instance.
- dsrc_inst = dsrc_to_ldap("~/.dsrc", args.instance, log.getChild('dsrc'))
+ dsrc_inst = dsrc_to_ldap(DSRC_HOME, args.instance, log.getChild('dsrc'))
# Now combine this with our arguments
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index a1fa6ee..1ad72b5 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -346,4 +346,5 @@ args_instance = {SER_DEPLOYED_DIR: os.environ.get('PREFIX', None),
# Helper for linking dse.ldif values to the parse_config function
args_dse_keys = SER_PROPNAME_TO_ATTRNAME
+DSRC_HOME = '~/.dsrc'
DSRC_CONTAINER = '/data/config/container.inf'
diff --git a/src/lib389/lib389/agreement.py b/src/lib389/lib389/agreement.py
index 84e2f8c..a9ee68c 100644
--- a/src/lib389/lib389/agreement.py
+++ b/src/lib389/lib389/agreement.py
@@ -366,7 +366,7 @@ class Agreement(DSLdapObject):
return (json.dumps(result))
else:
retstr = (
- "Status for agreement: \"%(cn)s\" (%(nsDS5ReplicaHost)s:"
+ "Status For Agreement: \"%(cn)s\" (%(nsDS5ReplicaHost)s:"
"%(nsDS5ReplicaPort)s)" "\n"
"Replica Enabled: %(nsds5ReplicaEnabled)s" "\n"
"Update In Progress: %(nsds5replicaUpdateInProgress)s" "\n"
diff --git a/src/lib389/lib389/cli_base/dsrc.py b/src/lib389/lib389/cli_base/dsrc.py
index 5056514..bbd160e 100644
--- a/src/lib389/lib389/cli_base/dsrc.py
+++ b/src/lib389/lib389/cli_base/dsrc.py
@@ -8,8 +8,10 @@
import sys
import os
+import json
import ldap
-from lib389.properties import *
+from lib389.properties import (SER_LDAP_URL, SER_ROOT_DN, SER_LDAPI_ENABLED,
+ SER_LDAPI_SOCKET, SER_LDAPI_AUTOBIND)
from lib389._constants import DSRC_CONTAINER
MAJOR, MINOR, _, _, _ = sys.version_info
@@ -17,6 +19,7 @@ MAJOR, MINOR, _, _, _ = sys.version_info
if MAJOR >= 3:
import configparser
+
def dsrc_arg_concat(args, dsrc_inst):
"""
Given a set of argparse args containing:
@@ -65,6 +68,23 @@ def dsrc_arg_concat(args, dsrc_inst):
dsrc_inst['starttls'] = True
return dsrc_inst
+
+def _read_dsrc(path, log, case_sensetive=False):
+ path = os.path.expanduser(path)
+ log.debug("dsrc path: %s" % path)
+ log.debug("dsrc container path: %s" % DSRC_CONTAINER)
+ config = configparser.ConfigParser()
+ if case_sensetive:
+ config.optionxform = str
+ # First read our container config if it exists
+ # Then overlap the user config.
+ config.read([DSRC_CONTAINER, path])
+
+ log.debug("dsrc instances: %s" % config.sections())
+
+ return config
+
+
def dsrc_to_ldap(path, instance_name, log):
"""
Given a path to a file, return the required details for an instance.
@@ -84,15 +104,7 @@ def dsrc_to_ldap(path, instance_name, log):
tls_reqcert = [never, hard, allow]
starttls = [true, false]
"""
- path = os.path.expanduser(path)
- log.debug("dsrc path: %s" % path)
- log.debug("dsrc container path: %s" % DSRC_CONTAINER)
- config = configparser.ConfigParser()
- # First read our container config if it exists
- # Then overlap the user config.
- config.read([DSRC_CONTAINER, path])
-
- log.debug("dsrc instances: %s" % config.sections())
+ config = _read_dsrc(path, log)
# Does our section exist?
if not config.has_section(instance_name):
@@ -109,14 +121,15 @@ def dsrc_to_ldap(path, instance_name, log):
dsrc_inst['binddn'] = config.get(instance_name, 'binddn', fallback=None)
dsrc_inst['saslmech'] = config.get(instance_name, 'saslmech', fallback=None)
if dsrc_inst['saslmech'] is not None and dsrc_inst['saslmech'] not in ['EXTERNAL', 'PLAIN']:
- raise Exception("~/.dsrc [%s] saslmech must be one of EXTERNAL or PLAIN" % instance_name)
+ raise Exception("%s [%s] saslmech must be one of EXTERNAL or PLAIN" % (path, instance_name))
dsrc_inst['tls_cacertdir'] = config.get(instance_name, 'tls_cacertdir', fallback=None)
dsrc_inst['tls_cert'] = config.get(instance_name, 'tls_cert', fallback=None)
dsrc_inst['tls_key'] = config.get(instance_name, 'tls_key', fallback=None)
dsrc_inst['tls_reqcert'] = config.get(instance_name, 'tls_reqcert', fallback='hard')
if dsrc_inst['tls_reqcert'] not in ['never', 'allow', 'hard']:
- raise Exception("dsrc tls_reqcert value invalid. ~/.dsrc [%s] tls_reqcert should be one of never, allow or hard" % instance_name)
+ raise Exception("dsrc tls_reqcert value invalid. %s [%s] tls_reqcert should be one of never, allow or hard" % (instance_name,
+ path))
if dsrc_inst['tls_reqcert'] == 'never':
dsrc_inst['tls_reqcert'] = ldap.OPT_X_TLS_NEVER
elif dsrc_inst['tls_reqcert'] == 'allow':
@@ -133,9 +146,45 @@ def dsrc_to_ldap(path, instance_name, log):
dsrc_inst['args'][SER_LDAPI_SOCKET] = dsrc_inst['uri'][9:]
dsrc_inst['args'][SER_LDAPI_AUTOBIND] = "on"
-
# Return the dict.
log.debug("dsrc completed with %s" % dsrc_inst)
return dsrc_inst
+def dsrc_to_repl_monitor(path, log):
+ """
+ Given a path to a file, return the required details for an instance.
+
+ The connection values for monitoring other not connected topologies. The format:
+ 'host:port:binddn:bindpwd'. You can use regex for host and port. You can set bindpwd
+ to * and it will be requested at the runtime.
+
+ If a host:port is assigned an alias, then the alias instead of host:port will be
+ displayed in the output. The format: "alias=host:port".
+
+ The file should be an ini file, and instance should identify a section.
+
+ The ini fileshould have the content:
+
+ [repl-monitor-connections]
+ connection1 = server1.example.com:38901:cn=Directory manager:*
+ connection2 = server2.example.com:38902:cn=Directory manager:[~/pwd.txt]
+ connection3 = hub1.example.com:.*:cn=Directory manager:password
+
+ [repl-monitor-aliases]
+ M1 = server1.example.com:38901
+ M2 = server2.example.com:38902
+ """
+
+ config = _read_dsrc(path, log, case_sensetive=True)
+ dsrc_repl_monitor = {"connections": None,
+ "aliases": None}
+
+ if config.has_section("repl-monitor-connections"):
+ dsrc_repl_monitor["connections"] = [conn for _, conn in config.items("repl-monitor-connections")]
+
+ if config.has_section("repl-monitor-aliases"):
+ dsrc_repl_monitor["aliases"] = {alias: inst for alias, inst in config.items("repl-monitor-aliases")}
+
+ log.debug(f"dsrc completed with {dsrc_repl_monitor}")
+ return dsrc_repl_monitor
diff --git a/src/lib389/lib389/cli_conf/replication.py b/src/lib389/lib389/cli_conf/replication.py
index eb8297d..de2099f 100644
--- a/src/lib389/lib389/cli_conf/replication.py
+++ b/src/lib389/lib389/cli_conf/replication.py
@@ -6,16 +6,16 @@
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
+import re
import logging
-import time
-import base64
import os
import json
import ldap
from getpass import getpass
-from lib389._constants import *
-from lib389.utils import is_a_dn, ensure_str
-from lib389.replica import Replicas, BootstrapReplicationManager, RUV, Changelog5, ChangelogLDIF
+from lib389._constants import ReplicaRole, DSRC_HOME
+from lib389.cli_base.dsrc import dsrc_to_repl_monitor
+from lib389.utils import is_a_dn
+from lib389.replica import Replicas, ReplicationMonitor, BootstrapReplicationManager, Changelog5, ChangelogLDIF
from lib389.tasks import CleanAllRUVTask, AbortCleanAllRUVTask
from lib389._mapped_object import DSLdapObjects
@@ -338,6 +338,90 @@ def set_repl_config(inst, basedn, log, args):
log.info("Successfully updated replication configuration")
+def get_repl_monitor_info(inst, basedn, log, args):
+ connection_data = dsrc_to_repl_monitor(DSRC_HOME, log)
+
+ # Additional details for the connections to the topology
+ def get_credentials(host, port):
+ found = False
+ if args.connections:
+ connections = args.connections
+ elif connection_data["connections"]:
+ connections = connection_data["connections"]
+ else:
+ connections = []
+
+ if connections:
+ for connection_str in connections:
+ if len(connection_str.split(":")) != 4:
+ raise ValueError(f"Connection string {connection_str} is in wrong format."
+ "It should be host:port:binddn:bindpw")
+ host_regex = connection_str.split(":")[0]
+ port_regex = connection_str.split(":")[1]
+ if re.match(host_regex, host) and re.match(port_regex, port):
+ found = True
+ binddn = connection_str.split(":")[2]
+ bindpw = connection_str.split(":")[3]
+ # Search for the password file or ask the user to write it
+ if bindpw.startswith("[") and bindpw.endswith("]"):
+ pwd_file_path = os.path.expanduser(bindpw[1:][:-1])
+ try:
+ with open(pwd_file_path) as f:
+ bindpw = f.readline().strip()
+ except FileNotFoundError:
+ bindpw = getpass(f"File '{pwd_file_path}' was not found. Please, enter "
+ f"a password for {binddn} on {host}:{port}: ").rstrip()
+ if bindpw == "*":
+ bindpw = getpass(f"Enter a password for {binddn} on {host}:{port}: ").rstrip()
+ if not found:
+ binddn = input(f'\nEnter a bind DN for {host}:{port}: ').rstrip()
+ bindpw = getpass(f"Enter a password for {binddn} on {host}:{port}: ").rstrip()
+
+ return {"binddn": binddn,
+ "bindpw": bindpw}
+
+ repl_monitor = ReplicationMonitor(inst)
+ report_dict = repl_monitor.generate_report(get_credentials)
+
+ if args.json:
+ log.info(json.dumps({"type": "list", "items": report_dict}))
+ else:
+ for instance, report_data in report_dict.items():
+ found_alias = False
+ if args.aliases:
+ aliases = {al.split("=")[0]: al.split("=")[1] for al in args.aliases}
+ elif connection_data["aliases"]:
+ aliases = connection_data["aliases"]
+ else:
+ aliases = {}
+ if aliases:
+ for alias_name, alias_host_port in aliases.items():
+ if alias_host_port.lower() == instance.lower():
+ supplier_header = f"Supplier: {alias_name} ({instance})"
+ found_alias = True
+ break
+ if not found_alias:
+ supplier_header = f"Supplier: {instance}"
+ log.info(supplier_header)
+ # Draw a line with the same length as the header
+ log.info("-".join(["" for _ in range(0, len(supplier_header)+1)]))
+ if "status" in report_data and report_data["status"] == "Unavailable":
+ status = report_data["status"]
+ reason = report_data["reason"]
+ log.info(f"Status: {status}")
+ log.info(f"Reason: {reason}\n")
+ else:
+ for replica in report_data:
+ replica_root = replica["replica_root"]
+ replica_id = replica["replica_id"]
+ maxcsn = replica["maxcsn"]
+ log.info(f"Replica Root: {replica_root}")
+ log.info(f"Replica ID: {replica_id}")
+ log.info(f"Max CSN: {maxcsn}\n")
+ for agreement_status in replica["agmts_status"]:
+ log.info(agreement_status)
+
+
def create_cl(inst, basedn, log, args):
cl = Changelog5(inst)
try:
@@ -1033,6 +1117,17 @@ def create_parser(subparsers):
repl_set_parser.add_argument('--repl-release-timeout', help="A timeout in seconds a replication master should send "
"updates before it yields its replication session")
+ repl_monitor_parser = repl_subcommands.add_parser('monitor', help='Get the full replication topology report')
+ repl_monitor_parser.set_defaults(func=get_repl_monitor_info)
+ repl_monitor_parser.add_argument('-c', '--connections', nargs="*",
+ help="The connection values for monitoring other not connected topologies. "
+ "The format: 'host:port:binddn:bindpwd'. You can use regex for host and port. "
+ "You can set bindpwd to * and it will be requested at the runtime or "
+ "you can include the path to the password file in square brackets - [~/pwd.txt]")
+ repl_monitor_parser.add_argument('-a', '--aliases', nargs="*",
+ help="If a host:port is assigned an alias, then the alias instead of "
+ "host:port will be displayed in the output. The format: alias=host:port")
+#
############################################
# Replication Agmts
############################################
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index 48a14cf..7f2fd5e 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -1381,10 +1381,62 @@ class Replica(DSLdapObject):
"""Return the set of agreements related to this suffix replica
:param: winsync: If True then return winsync replication agreements,
otherwise return teh standard replication agreements.
- :returns: Agreements object
+ :returns: A list Replicas objects
"""
return Agreements(self._instance, self.dn, winsync=winsync)
+ def get_consumer_replicas(self, get_credentials):
+ """Return the set of consumer replicas related to this suffix replica through its agreements
+
+ :param get_credentials: A user-defined callback function which returns the binding credentials
+ using given host and port data - {"binddn": "cn=Directory Manager",
+ "bindpw": "password"}
+ :returns: Replicas object
+ """
+
+ agmts = self.get_agreements()
+ result_replicas = []
+ connections = []
+
+ try:
+ for agmt in agmts:
+ host = agmt.get_attr_val_utf8("nsDS5ReplicaHost")
+ port = agmt.get_attr_val_utf8("nsDS5ReplicaPort")
+ protocol = agmt.get_attr_val_utf8("nsDS5ReplicaTransportInfo").lower()
+
+ # The function should be defined outside and
+ # it should have all the logic for figuring out the credentials
+ credentials = get_credentials(host, port)
+ if not credentials["binddn"]:
+ report_data[supplier] = {"status": "Unavailable",
+ "reason": "Bind DN was not specified"}
+ continue
+
+ # Open a connection to the consumer
+ consumer = DirSrv(verbose=self._instance.verbose)
+ args_instance[SER_HOST] = host
+ if protocol == "ssl" or protocol == "ldaps":
+ args_instance[SER_SECURE_PORT] = int(port)
+ else:
+ args_instance[SER_PORT] = int(port)
+ args_instance[SER_ROOT_DN] = credentials["binddn"]
+ args_instance[SER_ROOT_PW] = credentials["bindpw"]
+ args_standalone = args_instance.copy()
+ consumer.allocate(args_standalone)
+ try:
+ consumer.open()
+ except ldap.LDAPError as e:
+ self._log.debug(f"Connection to consumer ({host}:{port}) failed, error: {e}")
+ raise
+ connections.append(consumer)
+ result_replicas.append(Replicas(consumer))
+ except:
+ for conn in connections:
+ conn.close()
+ raise
+
+ return result_replicas
+
def get_rid(self):
"""Return the current replicas RID for this suffix
@@ -1412,6 +1464,15 @@ class Replica(DSLdapObject):
return RUV(data)
+ def get_maxcsn(self):
+ """Return the current replica's maxcsn for this suffix
+
+ :returns: str
+ """
+ replica_id = self.get_rid()
+ replica_ruvs = self.get_ruv()
+ return replica_ruvs._rid_maxcsn.get(replica_id, '00000000000000000000')
+
def get_ruv_agmt_maxcsns(self):
"""Return the in memory ruv of this replica suffix.
@@ -2232,3 +2293,126 @@ class ReplicationManager(object):
replicas = Replicas(instance)
replica = replicas.get(self._suffix)
return replica.get_rid()
+
+
+class ReplicationMonitor(object):
+ """The lib389 replication monitor. This is used to check the status
+ of many instances at once.
+ It also allows to monitor independent topologies and get them into
+ the one combined report.
+
+ :param instance: A supplier or hub for replication topology monitoring
+ :type instance: list of DirSrv objects
+ :param logger: A logging interface
+ :type logger: python logging
+ """
+
+ def __init__(self, instance, logger=None):
+ self._instance = instance
+ if logger is not None:
+ self._log = logger
+ else:
+ self._log = logging.getLogger(__name__)
+
+ def _get_replica_status(self, instance, report_data, use_json):
+ """Load all of the status data to report
+ and add new hostname:port pairs for future processing
+ """
+
+ replicas_status = []
+ replicas = Replicas(instance)
+ for replica in replicas.list():
+ replica_id = replica.get_rid()
+ replica_root = replica.get_suffix()
+ replica_maxcsn = replica.get_maxcsn()
+ agmts_status = []
+ agmts = replica.get_agreements()
+ for agmt in agmts.list():
+ host = agmt.get_attr_val_utf8_l("nsds5replicahost")
+ port = agmt.get_attr_val_utf8_l("nsds5replicaport")
+ protocol = agmt.get_attr_val_utf8_l('nsds5replicatransportinfo')
+ # Supply protocol here because we need it only for connection
+ # and agreement status is already preformatted for the user output
+ consumer = f"{host}:{port}:{protocol}"
+ if consumer not in report_data:
+ report_data[consumer] = None
+ agmts_status.append(agmt.status(use_json))
+ replicas_status.append({"replica_id": replica_id,
+ "replica_root": replica_root,
+ "maxcsn": replica_maxcsn,
+ "agmts_status": agmts_status})
+ return replicas_status
+
+ def generate_report(self, get_credentials, use_json=False):
+ """Generate a replication report for each supplier or hub and the instances
+ that are connected with it by agreements.
+
+ :param get_credentials: A user-defined callback function with parameters (host, port) which returns
+ a dictionary with binddn and bindpw keys -
+ example values "cn=Directory Manager" and "password"
+ :type get_credentials: function
+ :returns: dict
+ """
+ report_data = {}
+
+ initial_inst_key = f"{self._instance.host.lower()}:{str(self._instance.port).lower()}"
+ # Do this on an initial instance to get the agreements to other instances
+ report_data[initial_inst_key] = self._get_replica_status(self._instance, report_data, use_json)
+
+ # Check if at least some replica report on other instances was generated
+ repl_exists = False
+
+ # While we have unprocessed instances - continue
+ while True:
+ try:
+ supplier = [host_port for host_port, processed_data in report_data.items() if processed_data is None][0]
+ except IndexError:
+ break
+
+ s_splitted = supplier.split(":")
+ supplier_hostname = s_splitted[0]
+ supplier_port = s_splitted[1]
+ supplier_protocol = s_splitted[2]
+
+ # The function should be defined outside and
+ # it should have all the logic for figuring out the credentials.
+ # It is done for flexibility purpuses between CLI, WebUI and lib389 API applications
+ credentials = get_credentials(supplier_hostname, supplier_port)
+ if not credentials["binddn"]:
+ report_data[supplier] = {"status": "Unavailable",
+ "reason": "Bind DN was not specified"}
+ continue
+
+ # Open a connection to the consumer
+ supplier_inst = DirSrv(verbose=self._instance.verbose)
+ args_instance[SER_HOST] = supplier_hostname
+ if supplier_protocol == "ssl" or supplier_protocol == "ldaps":
+ args_instance[SER_SECURE_PORT] = int(supplier_port)
+ else:
+ args_instance[SER_PORT] = int(supplier_port)
+ args_instance[SER_ROOT_DN] = credentials["binddn"]
+ args_instance[SER_ROOT_PW] = credentials["bindpw"]
+ args_standalone = args_instance.copy()
+ supplier_inst.allocate(args_standalone)
+ try:
+ supplier_inst.open()
+ except ldap.LDAPError as e:
+ self._log.debug(f"Connection to consumer ({supplier_hostname}:{supplier_port}) failed, error: {e}")
+ report_data[supplier] = {"status": "Unavailable",
+ "reason": e.args[0]['desc']}
+ continue
+
+ report_data[supplier] = self._get_replica_status(supplier_inst, report_data, use_json)
+ repl_exists = True
+
+ # Now remove the protocol from the name
+ report_data_final = {}
+ for key, value in report_data.items():
+ # We take the initial instance only if it is the only existing part of the report
+ if key != initial_inst_key or not repl_exists:
+ if not value:
+ value = {"status": "Unavailable",
+ "reason": "No replicas were found"}
+ report_data_final[":".join(key.split(":")[:2])] = value
+
+ return report_data_final
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch 389-ds-base-1.4.1 updated: Issue 50620 - Fix regressions from 50506 (slapi_enry_attr_get_ref)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new f6c7e2c Issue 50620 - Fix regressions from 50506 (slapi_enry_attr_get_ref)
f6c7e2c is described below
commit f6c7e2cb396936ee0746b2a72c03866e5c1d4f46
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Sep 24 12:43:48 2019 -0400
Issue 50620 - Fix regressions from 50506 (slapi_enry_attr_get_ref)
Description: Some crashes were found in upstream testing. Needed
to revert slapi_entry_attr_get_ref() back to slapi_entry_attr_get_charptr()
relates: https://pagure.io/389-ds-base/issue/50620
Reviewed by: tbordaz(Thanks!)
---
ldap/servers/plugins/automember/automember.c | 6 ++-
ldap/servers/plugins/dna/dna.c | 48 +++++++++++++++-------
ldap/servers/plugins/mep/mep.c | 4 +-
ldap/servers/plugins/pam_passthru/pam_ptconfig.c | 3 +-
.../plugins/replication/windows_protocol_util.c | 3 +-
ldap/servers/plugins/roles/roles_cache.c | 7 +++-
ldap/servers/slapd/back-ldbm/ldbm_add.c | 3 +-
ldap/servers/slapd/back-ldbm/ldbm_index_config.c | 8 ++--
8 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index d7919a0..185fc26 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -584,7 +584,7 @@ automember_parse_config_entry(Slapi_Entry *e, int apply)
}
/* Load the filter */
- value = (char *)slapi_entry_attr_get_ref(e, AUTOMEMBER_FILTER_TYPE);
+ value = slapi_entry_attr_get_charptr(e, AUTOMEMBER_FILTER_TYPE);
if (value) {
/* Convert to a Slapi_Filter to improve performance. */
if (NULL == (entry->filter = slapi_str2filter(value))) {
@@ -595,6 +595,7 @@ automember_parse_config_entry(Slapi_Entry *e, int apply)
AUTOMEMBER_FILTER_TYPE, entry->dn, value);
ret = -1;
}
+ slapi_ch_free_string(&value);
if (ret != 0) {
goto bail;
}
@@ -993,7 +994,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
"--> automember_parse_regex_entry\n");
/* Make sure the target group was specified. */
- target_group = (char *)slapi_entry_attr_get_ref(e, AUTOMEMBER_TARGET_GROUP_TYPE);
+ target_group = slapi_entry_attr_get_charptr(e, AUTOMEMBER_TARGET_GROUP_TYPE);
if (!target_group) {
slapi_log_err(SLAPI_LOG_ERR, AUTOMEMBER_PLUGIN_SUBSYSTEM,
"automember_parse_regex_entry - The %s config "
@@ -1142,6 +1143,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
}
bail:
+ slapi_ch_free_string(&target_group);
slapi_log_err(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM,
"<-- automember_parse_regex_entry\n");
}
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index a63bac9..1ee2713 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -988,9 +988,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
"----------> %s [%s]\n", DNA_TYPE, entry->types[i]);
}
- value = (char *)slapi_entry_attr_get_ref(e, DNA_NEXTVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_NEXTVAL);
if (value) {
entry->nextval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
slapi_log_err(SLAPI_LOG_ERR, DNA_PLUGIN_SUBSYSTEM,
"dna_parse_config_entry - The %s config "
@@ -1023,9 +1024,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
entry->interval = 1;
#ifdef DNA_ENABLE_INTERVAL
- value = (char *)slapi_entry_attr_get_ref(e, DNA_INTERVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_INTERVAL);
if (value) {
entry->interval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
}
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
@@ -1121,9 +1123,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
/* optional, if not specified set -1 which is converted to the max unsigned
* value */
- value = (char *)slapi_entry_attr_get_ref(e, DNA_MAXVAL);
+ value = slapi_entry_attr_get_charptr(e, DNA_MAXVAL);
if (value) {
entry->maxval = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
entry->maxval = -1;
}
@@ -1246,7 +1249,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
entry->shared_cfg_base);
}
- value = (char *)slapi_entry_attr_get_ref(e, DNA_THRESHOLD);
+ value = slapi_entry_attr_get_charptr(e, DNA_THRESHOLD);
if (value) {
entry->threshold = strtoull(value, 0, 0);
@@ -1258,6 +1261,8 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
slapi_log_err(SLAPI_LOG_ERR, DNA_PLUGIN_SUBSYSTEM,
"----------> %s too low, setting to [%s]\n", DNA_THRESHOLD, value);
}
+
+ slapi_ch_free_string(&value);
} else {
entry->threshold = 1;
}
@@ -1266,9 +1271,10 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
"dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_THRESHOLD,
entry->threshold);
- value = (char *)slapi_entry_attr_get_ref(e, DNA_RANGE_REQUEST_TIMEOUT);
+ value = slapi_entry_attr_get_charptr(e, DNA_RANGE_REQUEST_TIMEOUT);
if (value) {
entry->timeout = strtoull(value, 0, 0);
+ slapi_ch_free_string(&value);
} else {
entry->timeout = DNA_DEFAULT_TIMEOUT;
}
@@ -1277,7 +1283,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
"dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_RANGE_REQUEST_TIMEOUT,
entry->timeout);
- value = (char *)slapi_entry_attr_get_ref(e, DNA_NEXT_RANGE);
+ value = slapi_entry_attr_get_charptr(e, DNA_NEXT_RANGE);
if (value) {
char *p = NULL;
@@ -1323,6 +1329,8 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
DNA_NEXT_RANGE, entry->dn);
ret = DNA_FAILURE;
}
+
+ slapi_ch_free_string(&value);
}
/* If we were only called to validate config, we can
@@ -2287,7 +2295,7 @@ dna_first_free_value(struct configEntry *config_entry,
int multitype = 0;
int result, status;
PRUint64 tmpval, sval, i;
- const char *strval = NULL;
+ char *strval = NULL;
/* check if the config is already out of range */
if (config_entry->nextval > config_entry->maxval) {
@@ -2411,7 +2419,7 @@ dna_first_free_value(struct configEntry *config_entry,
* type from the list of types directly. */
sval = 0;
for (i = 0; NULL != entries[i]; i++) {
- strval = slapi_entry_attr_get_ref(entries[i], config_entry->types[0]);
+ strval = slapi_entry_attr_get_charptr(entries[i], config_entry->types[0]);
errno = 0;
sval = strtoull(strval, 0, 0);
if (errno) {
@@ -2419,6 +2427,7 @@ dna_first_free_value(struct configEntry *config_entry,
status = LDAP_OPERATIONS_ERROR;
goto cleanup;
}
+ slapi_ch_free_string(&strval);
if (tmpval != sval)
break;
@@ -2444,6 +2453,7 @@ dna_first_free_value(struct configEntry *config_entry,
cleanup:
slapi_ch_free_string(&filter);
+ slapi_ch_free_string(&strval);
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
@@ -2964,7 +2974,7 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server, char **bind
char *attrs[6];
char *filter = NULL;
char *bind_cred = NULL;
- const char *transport = NULL;
+ char *transport = NULL;
Slapi_Entry **entries = NULL;
int ret = LDAP_OPERATIONS_ERROR;
@@ -3049,7 +3059,7 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server, char **bind
*bind_dn = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_BIND_DN);
*bind_method = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_BIND_METHOD);
bind_cred = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_CREDS);
- transport = slapi_entry_attr_get_ref(entries[0], DNA_REPL_TRANSPORT);
+ transport = slapi_entry_attr_get_charptr(entries[0], DNA_REPL_TRANSPORT);
*port = slapi_entry_attr_get_int(entries[0], DNA_REPL_PORT);
/* Check if we should use SSL */
@@ -3106,10 +3116,11 @@ dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server, char **bind
ret = 0;
bail:
- slapi_ch_free_string(&bind_cred);
+ slapi_ch_free_string(&transport);
slapi_ch_free_string(&filter);
slapi_sdn_free(&range_sdn);
slapi_ch_free_string(&replica_dn);
+ slapi_ch_free_string(&bind_cred);
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
@@ -3468,21 +3479,24 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
* for types where the magic value is set. We do not
* generate a value for missing types. */
for (i = 0; config_entry->types && config_entry->types[i]; i++) {
- value = (char *)slapi_entry_attr_get_ref(e, config_entry->types[i]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[i]);
if (value) {
if (config_entry->generate == NULL || !slapi_UTF8CASECMP(config_entry->generate, value)) {
slapi_ch_array_add(&types_to_generate, slapi_ch_strdup(config_entry->types[i]));
}
+ slapi_ch_free_string(&value);
}
}
} else {
/* For a single type range, we generate the value if
* the magic value is set or if the type is missing. */
- value = (char *)slapi_entry_attr_get_ref(e, config_entry->types[0]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[0]);
+
if ((config_entry->generate == NULL) || (0 == value) ||
(value && !slapi_UTF8CASECMP(config_entry->generate, value))) {
slapi_ch_array_add(&types_to_generate, slapi_ch_strdup(config_entry->types[0]));
}
+ slapi_ch_free_string(&value);
}
if (types_to_generate && types_to_generate[0]) {
@@ -4139,24 +4153,28 @@ dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
* for types where the magic value is set. We do not
* generate a value for missing types. */
for (i = 0; config_entry->types && config_entry->types[i]; i++) {
- value = (char *)slapi_entry_attr_get_ref(e, config_entry->types[i]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[i]);
+
if (value && !slapi_UTF8CASECMP(value, DNA_NEEDS_UPDATE)) {
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[i]));
/* Need to remove DNA_NEEDS_UPDATE */
slapi_entry_attr_delete(e, config_entry->types[i]);
}
+ slapi_ch_free_string(&value);
}
} else {
/* For a single type range, we generate the value if
* the magic value is set or if the type is missing. */
- value = (char *)slapi_entry_attr_get_ref(e, config_entry->types[0]);
+ value = slapi_entry_attr_get_charptr(e, config_entry->types[0]);
+
if (0 == value || (value && !slapi_UTF8CASECMP(value, DNA_NEEDS_UPDATE))) {
slapi_ch_array_add(&types_to_generate,
slapi_ch_strdup(config_entry->types[0]));
/* Need to remove DNA_NEEDS_UPDATE */
slapi_entry_attr_delete(e, config_entry->types[0]);
}
+ slapi_ch_free_string(&value);
}
} else {
/* check mods for DNA_NEEDS_UPDATE*/
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index a636622..ca9a64b 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -533,7 +533,7 @@ mep_parse_config_entry(Slapi_Entry *e, int apply)
}
/* Load the origin filter */
- value = (char *)slapi_entry_attr_get_ref(e, MEP_FILTER_TYPE);
+ value = (char *)slapi_entry_attr_get_charptr(e, MEP_FILTER_TYPE);
if (value) {
/* Convert to a Slapi_Filter to improve performance. */
if (NULL == (entry->origin_filter = slapi_str2filter(value))) {
@@ -544,7 +544,7 @@ mep_parse_config_entry(Slapi_Entry *e, int apply)
MEP_FILTER_TYPE, slapi_sdn_get_dn(entry->sdn), value);
ret = -1;
}
-
+ slapi_ch_free_string(&value);
if (ret != 0) {
goto bail;
}
diff --git a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
index 19a3428..46a76d8 100644
--- a/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
+++ b/ldap/servers/plugins/pam_passthru/pam_ptconfig.c
@@ -495,7 +495,7 @@ pam_passthru_validate_config(Slapi_Entry *e, char *returntext)
}
/* Validate filter by converting to Slapi_Filter */
- pam_filter_str = (char *)slapi_entry_attr_get_ref(e, PAMPT_FILTER_ATTR);
+ pam_filter_str = (char *)slapi_entry_attr_get_charptr(e, PAMPT_FILTER_ATTR);
if (pam_filter_str) {
pam_filter = slapi_str2filter(pam_filter_str);
if (pam_filter == NULL) {
@@ -524,6 +524,7 @@ done:
slapi_ch_array_free(includes);
includes = NULL;
slapi_filter_free(pam_filter, 1);
+ slapi_ch_free_string(&pam_filter_str);
return rc;
}
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 0d287fd..3658139 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -3440,7 +3440,7 @@ map_windows_tombstone_dn(Slapi_Entry *e, Slapi_DN **dn, Private_Repl_Protocol *p
cn = slapi_entry_attr_get_ref(e, "ntuserdomainid");
}
- guid = (char *)slapi_entry_attr_get_ref(e, "ntUniqueId");
+ guid = slapi_entry_attr_get_charptr(e, "ntUniqueId");
if (guid) {
/* the GUID is in a different form in the tombstone DN, so
* we need to transform it from the way we store it. */
@@ -3476,6 +3476,7 @@ map_windows_tombstone_dn(Slapi_Entry *e, Slapi_DN **dn, Private_Repl_Protocol *p
slapi_entry_get_dn(e));
rc = 1;
}
+ slapi_ch_free_string(&guid);
return rc;
}
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c
index 15af6a2..de99ba2 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -1154,7 +1154,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry, role_object **resu
char *parent = NULL;
/* Get the filter and retrieve the filter attribute */
- filter_attr_value = (char *)slapi_entry_attr_get_ref(role_entry, ROLE_FILTER_ATTR_NAME);
+ filter_attr_value = (char *)slapi_entry_attr_get_charptr(role_entry, ROLE_FILTER_ATTR_NAME);
if (filter_attr_value == NULL) {
/* Means probably no attribute or no value there */
slapi_ch_free((void **)&this_role);
@@ -1197,6 +1197,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry, role_object **resu
ROLE_FILTER_ATTR_NAME, filter_attr_value,
ROLE_FILTER_ATTR_NAME);
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
}
@@ -1208,6 +1209,7 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry, role_object **resu
if (filter == NULL) {
/* An error has occured */
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
if (roles_check_filter(filter)) {
@@ -1218,11 +1220,12 @@ roles_cache_create_object_from_entry(Slapi_Entry *role_entry, role_object **resu
filter_attr_value,
ROLE_FILTER_ATTR_NAME);
slapi_ch_free((void **)&this_role);
+ slapi_ch_free_string(&filter_attr_value);
return SLAPI_ROLE_ERROR_FILTER_BAD;
}
/* Store on the object */
this_role->filter = filter;
-
+ slapi_ch_free_string(&filter_attr_value);
break;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index ce8be3e..d0d88bf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -573,13 +573,14 @@ ldbm_back_add(Slapi_PBlock *pb)
}
/* And copy the reason from e */
- reason = (char *)slapi_entry_attr_get_ref(e, "nsds5ReplConflict");
+ reason = slapi_entry_attr_get_charptr(e, "nsds5ReplConflict");
if (reason) {
if (!slapi_entry_attr_hasvalue(addingentry->ep_entry, "nsds5ReplConflict", reason)) {
slapi_entry_add_string(addingentry->ep_entry, "nsds5ReplConflict", reason);
slapi_log_err(SLAPI_LOG_REPL, "ldbm_back_add", "Resurrection of %s - Added Conflict reason %s\n",
dn, reason);
}
+ slapi_ch_free_string(&reason);
}
/* Clear the Tombstone Flag in the entry */
slapi_entry_clear_flag(addingentry->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index b535192..68377d7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -49,6 +49,7 @@ ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e, const char *trace_st
}
if (index_name != NULL) {
+ slapi_ch_free_string(index_name);
*index_name = slapi_ch_strdup(attrValue->bv_val);
}
@@ -113,7 +114,7 @@ ldbm_instance_index_config_add_callback(Slapi_PBlock *pb __attribute__((unused))
void *arg)
{
ldbm_instance *inst = (ldbm_instance *)arg;
- char *index_name;
+ char *index_name = NULL;
returntext[0] = '\0';
*returncode = ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
@@ -129,7 +130,7 @@ ldbm_instance_index_config_add_callback(Slapi_PBlock *pb __attribute__((unused))
PR_ASSERT(ai != NULL);
ai->ai_indexmask |= INDEX_OFFLINE;
}
- slapi_ch_free((void **)&index_name);
+ slapi_ch_free_string(&index_name);
return SLAPI_DSE_CALLBACK_OK;
} else {
return SLAPI_DSE_CALLBACK_ERROR;
@@ -358,7 +359,7 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry *e)
int rc = LDAP_SUCCESS;
struct attrinfo *ai = NULL;
- index_name = (char *)slapi_entry_attr_get_ref(e, "cn");
+ index_name = slapi_entry_attr_get_charptr(e, "cn");
if (index_name) {
ainfo_get(inst->inst_be, index_name, &ai);
}
@@ -373,6 +374,7 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry *e)
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
}
+ slapi_ch_free_string(&index_name);
return rc;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 5 months
[389-ds-base] branch 389-ds-base-1.4.0 updated: Bump version to 1.4.0.28
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.0
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.0 by this push:
new c60d593 Bump version to 1.4.0.28
c60d593 is described below
commit c60d59349e422588de2d9b4f651ae8b0fe023b5f
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Sep 17 12:00:40 2019 -0400
Bump version to 1.4.0.28
---
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION.sh b/VERSION.sh
index f8b5c57..eb12c03 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=4
-VERSION_MAINT=0.27
+VERSION_MAINT=0.28
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 6 months
[389-ds-base] branch 389-ds-base-1.4.1 updated: Bump version to 1.4.1.7
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.1
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.1 by this push:
new 429cb64 Bump version to 1.4.1.7
429cb64 is described below
commit 429cb64bc06486f344c86ba97a3e30daa6f95dfa
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Sep 17 11:24:39 2019 -0400
Bump version to 1.4.1.7
---
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION.sh b/VERSION.sh
index 9a7d5ca..1d564da 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=4
-VERSION_MAINT=1.6
+VERSION_MAINT=1.7
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 6 months
[389-ds-base] branch master updated: Bump version to 1.4.2.1
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
The following commit(s) were added to refs/heads/master by this push:
new 2b44a27 Bump version to 1.4.2.1
2b44a27 is described below
commit 2b44a279814d49a0f8f87caebf35c1a6c10023bc
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Tue Sep 17 10:36:30 2019 -0400
Bump version to 1.4.2.1
---
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION.sh b/VERSION.sh
index 3d8b8d9..9e53a79 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=4
-VERSION_MAINT=2.0
+VERSION_MAINT=2.1
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 6 months
[389-ds-base] branch 389-ds-base-1.4.0 updated: Ticket 50581 - ns-slapd crashes during ldapi search
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
tbordaz pushed a commit to branch 389-ds-base-1.4.0
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.0 by this push:
new 6d2b128 Ticket 50581 - ns-slapd crashes during ldapi search
6d2b128 is described below
commit 6d2b1282de97c0790ea2db4bfbe6c83641eaec81
Author: Thierry Bordaz <tbordaz(a)redhat.com>
AuthorDate: Mon Sep 2 16:48:45 2019 +0200
Ticket 50581 - ns-slapd crashes during ldapi search
Bug Description:
Using ldapi, if the length of the socket file path exceeds
46 bytes it triggers a buffer overflow while reseting a connection.
Reset happens at open/close/error.
Fix Description:
Use a buffer sized for a PRNetAddr.local.path (~100bytes)
Use of MAXPATHLEN (4kb) is too much.
https://pagure.io/389-ds-base/issue/50581
Reviewed by: William Brown, Alexander Bokovoy, Mark Reynolds, Simon Pichugi
Platforms tested: F30 (thanks !!)
Flag Day: no
Doc impact: no
---
dirsrvtests/tests/suites/basic/basic_test.py | 114 +++++++++++++++++++++++++++
ldap/servers/slapd/connection.c | 39 +++++----
2 files changed, 136 insertions(+), 17 deletions(-)
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
index d926f64..5e738c1 100644
--- a/dirsrvtests/tests/suites/basic/basic_test.py
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
@@ -12,6 +12,7 @@
"""
from subprocess import check_output, Popen
+from lib389 import DirSrv
from lib389.idm.user import UserAccounts
import pytest
from lib389.tasks import *
@@ -21,6 +22,16 @@ from lib389.dbgen import dbgen
from lib389.idm.organizationalunit import OrganizationalUnits
from lib389._constants import DN_DM, PASSWORD, PW_DM
from lib389.topologies import topology_st
+from lib389.paths import Paths
+from lib389.idm.directorymanager import DirectoryManager
+from lib389.config import LDBMConfig
+from lib389.dseldif import DSEldif
+from lib389.rootdse import RootDSE
+
+
+pytestmark = pytest.mark.tier0
+
+default_paths = Paths()
log = logging.getLogger(__name__)
@@ -1247,6 +1258,109 @@ sample_entries = yes
request.addfinalizer(fin)
+(a)pytest.fixture(scope="module")
+def dscreate_ldapi_instance(request):
+ template_file = "/tmp/dssetup.inf"
+ longname_serverid = "test_longname_deadbeef_deadbeef_deadbeef_deadbeef_deadbeef"
+ template_text = """[general]
+config_version = 2
+# This invalid hostname ...
+full_machine_name = localhost.localdomain
+# Means we absolutely require this.
+strict_host_checking = False
+# In tests, we can be run in containers, NEVER trust
+# that systemd is there, or functional in any capacity
+systemd = False
+
+[slapd]
+instance_name = %s
+root_dn = cn=directory manager
+root_password = someLongPassword_123
+# We do not have access to high ports in containers,
+# so default to something higher.
+port = 38999
+secure_port = 63699
+
+
+[backend-userroot]
+suffix = dc=example,dc=com
+sample_entries = yes
+""" % longname_serverid
+
+ with open(template_file, "w") as template_fd:
+ template_fd.write(template_text)
+
+ # Unset PYTHONPATH to avoid mixing old CLI tools and new lib389
+ tmp_env = os.environ
+ if "PYTHONPATH" in tmp_env:
+ del tmp_env["PYTHONPATH"]
+ try:
+ subprocess.check_call([
+ 'dscreate',
+ 'from-file',
+ template_file
+ ], env=tmp_env)
+ except subprocess.CalledProcessError as e:
+ log.fatal("dscreate failed! Error ({}) {}".format(e.returncode, e.output))
+ assert False
+
+ inst = DirSrv(verbose=True, external_log=log)
+ dse_ldif = DSEldif(inst,
+ serverid=longname_serverid)
+
+ socket_path = dse_ldif.get("cn=config", "nsslapd-ldapifilepath")
+ inst.local_simple_allocate(
+ serverid=longname_serverid,
+ ldapuri=f"ldapi://{socket_path[0].replace('/', '%2f')}",
+ password="someLongPassword_123"
+ )
+ inst.ldapi_enabled = 'on'
+ inst.ldapi_socket = socket_path
+ inst.ldapi_autobind = 'off'
+ try:
+ inst.open()
+ except:
+ log.fatal("Failed to connect via ldapi to %s instance" % longname_serverid)
+ os.remove(template_file)
+ try:
+ subprocess.check_call(['dsctl', longname_serverid, 'remove', '--do-it'])
+ except subprocess.CalledProcessError as e:
+ log.fatal("Failed to remove test instance Error ({}) {}".format(e.returncode, e.output))
+
+ def fin():
+ os.remove(template_file)
+ try:
+ subprocess.check_call(['dsctl', longname_serverid, 'remove', '--do-it'])
+ except subprocess.CalledProcessError as e:
+ log.fatal("Failed to remove test instance Error ({}) {}".format(e.returncode, e.output))
+
+ request.addfinalizer(fin)
+
+ return inst
+
+
+(a)pytest.mark.skipif(not get_user_is_root() or not default_paths.perl_enabled or ds_is_older('1.4.0.0'),
+ reason="This test is only required with new admin cli, and requires root.")
+(a)pytest.mark.bz1748016
+(a)pytest.mark.ds50581
+def test_dscreate_longname(dscreate_ldapi_instance):
+ """Test that an instance with a long name can
+ handle ldapi connection using a long socket name
+
+ :id: 5d72d955-aff8-4741-8c9a-32c1c707cf1f
+ :setup: None
+ :steps:
+ 1. create an instance with a long serverId name, that open a ldapi connection
+ 2. Connect with ldapi, that hit 50581 and crash the instance
+ :expectedresults:
+ 1. Should succeeds
+ 2. Should succeeds
+ """
+
+ root_dse = RootDSE(dscreate_ldapi_instance)
+ log.info(root_dse.get_supported_ctrls())
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 81d49e0..acdbdb3 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -253,6 +253,8 @@ connection_reset(Connection *conn, int ns, PRNetAddr *from, int fromLen __attrib
char *pTmp = is_SSL ? "SSL " : "";
char *str_ip = NULL, *str_destip;
char buf_ip[256], buf_destip[256];
+ char buf_ldapi[sizeof(from->local.path) + 1] = {0};
+ char buf_destldapi[sizeof(from->local.path) + 1] = {0};
char *str_unknown = "unknown";
int in_referral_mode = config_check_referral_mode();
@@ -272,18 +274,18 @@ connection_reset(Connection *conn, int ns, PRNetAddr *from, int fromLen __attrib
slapi_ch_free((void **)&conn->cin_addr); /* just to be conservative */
if (from->raw.family == PR_AF_LOCAL) { /* ldapi */
conn->cin_addr = (PRNetAddr *)slapi_ch_malloc(sizeof(PRNetAddr));
- PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
+ PL_strncpyz(buf_ldapi, from->local.path, sizeof(from->local.path));
memcpy(conn->cin_addr, from, sizeof(PRNetAddr));
- if (!buf_ip[0]) {
+ if (!buf_ldapi[0]) {
PR_GetPeerName(conn->c_prfd, from);
- PL_strncpyz(buf_ip, from->local.path, sizeof(from->local.path));
+ PL_strncpyz(buf_ldapi, from->local.path, sizeof(from->local.path));
memcpy(conn->cin_addr, from, sizeof(PRNetAddr));
- if (!buf_ip[0]) {
+ if (!buf_ldapi[0]) {
/* Cannot derive local address, need something for logging */
- PL_strncpyz(buf_ip, "local", sizeof(buf_ip));
+ PL_strncpyz(buf_ldapi, "local", sizeof(buf_ldapi));
}
}
- str_ip = buf_ip;
+ str_ip = buf_ldapi;
} else if (((from->ipv6.ip.pr_s6_addr32[0] != 0) || /* from contains non zeros */
(from->ipv6.ip.pr_s6_addr32[1] != 0) ||
(from->ipv6.ip.pr_s6_addr32[2] != 0) ||
@@ -346,21 +348,24 @@ connection_reset(Connection *conn, int ns, PRNetAddr *from, int fromLen __attrib
memset(conn->cin_destaddr, 0, sizeof(PRNetAddr));
if (PR_GetSockName(conn->c_prfd, conn->cin_destaddr) == 0) {
if (conn->cin_destaddr->raw.family == PR_AF_LOCAL) { /* ldapi */
- PL_strncpyz(buf_destip, conn->cin_destaddr->local.path,
+ PL_strncpyz(buf_destldapi, conn->cin_destaddr->local.path,
sizeof(conn->cin_destaddr->local.path));
- if (!buf_destip[0]) {
- PL_strncpyz(buf_destip, "unknown local file", sizeof(buf_destip));
+ if (!buf_destldapi[0]) {
+ PL_strncpyz(buf_destldapi, "unknown local file", sizeof(buf_destldapi));
}
- } else if (PR_IsNetAddrType(conn->cin_destaddr, PR_IpAddrV4Mapped)) {
- PRNetAddr v4destaddr = {{0}};
- v4destaddr.inet.family = PR_AF_INET;
- v4destaddr.inet.ip = conn->cin_destaddr->ipv6.ip.pr_s6_addr32[3];
- PR_NetAddrToString(&v4destaddr, buf_destip, sizeof(buf_destip));
+ str_destip = buf_destldapi;
} else {
- PR_NetAddrToString(conn->cin_destaddr, buf_destip, sizeof(buf_destip));
+ if (PR_IsNetAddrType(conn->cin_destaddr, PR_IpAddrV4Mapped)) {
+ PRNetAddr v4destaddr = {{0}};
+ v4destaddr.inet.family = PR_AF_INET;
+ v4destaddr.inet.ip = conn->cin_destaddr->ipv6.ip.pr_s6_addr32[3];
+ PR_NetAddrToString(&v4destaddr, buf_destip, sizeof (buf_destip));
+ } else {
+ PR_NetAddrToString(conn->cin_destaddr, buf_destip, sizeof (buf_destip));
+ }
+ buf_destip[sizeof (buf_destip) - 1] = '\0';
+ str_destip = buf_destip;
}
- buf_destip[sizeof(buf_destip) - 1] = '\0';
- str_destip = buf_destip;
} else {
str_destip = str_unknown;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 6 months