From ae87e6cb5638813d0000c58ea16761e9b9809ee3 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Sun, 24 Jan 2021 14:09:50 -0500 Subject: [PATCH] Issue 4093 - fix compiler warnings and update doxygen Description: Update the doxy file (doxygen), fix compiler warnings (x86_64, arm, and s390x), and update Rust cargo file. relates: https://github.com/389ds/389-ds-base/issues/4093 Reviewed by: firstyear, spichugi, & progier(Thanks!!!) --- docs/slapi.doxy.in | 391 +++++++++++++----- ldap/servers/plugins/acctpolicy/acct_util.c | 8 +- ldap/servers/plugins/acl/acl.c | 30 +- ldap/servers/plugins/acl/acllas.c | 23 +- ldap/servers/plugins/acl/aclparse.c | 33 +- ldap/servers/plugins/acl/aclutil.c | 17 +- ldap/servers/plugins/chainingdb/cb_controls.c | 6 +- ldap/servers/plugins/chainingdb/cb_search.c | 7 +- ldap/servers/plugins/collation/config.c | 10 +- ldap/servers/plugins/collation/orfilter.c | 14 +- ldap/servers/plugins/memberof/memberof.c | 5 +- ldap/servers/plugins/memberof/memberof.h | 4 +- .../plugins/memberof/memberof_config.c | 10 +- ldap/servers/plugins/mep/mep.c | 3 +- .../plugins/posix-winsync/posix-winsync.c | 14 +- ldap/servers/plugins/pwdstorage/pwdstorage.h | 4 +- ldap/servers/plugins/referint/referint.c | 5 +- ldap/servers/plugins/replication/cl5_api.c | 19 +- ldap/servers/plugins/replication/repl5.h | 6 +- ldap/servers/plugins/replication/repl5_agmt.c | 12 +- .../plugins/replication/repl5_agmtlist.c | 14 +- .../plugins/replication/repl5_plugins.c | 3 +- .../plugins/replication/repl5_replica.c | 8 +- .../replication/repl5_replica_config.c | 14 +- ldap/servers/plugins/replication/repl_extop.c | 6 +- .../plugins/replication/repl_globals.c | 6 +- ldap/servers/plugins/replication/urp.c | 6 +- .../replication/windows_inc_protocol.c | 6 +- ldap/servers/plugins/retrocl/retrocl.c | 14 +- ldap/servers/plugins/roles/roles_cache.c | 44 +- ldap/servers/plugins/syntaxes/string.c | 4 +- ldap/servers/plugins/usn/usn_cleanup.c | 14 +- ldap/servers/slapd/auth.h | 4 +- .../back-ldbm/db-bdb/bdb_import_threads.c | 2 +- .../slapd/back-ldbm/ldbm_instance_config.c | 8 +- .../servers/slapd/back-ldbm/proto-back-ldbm.h | 4 +- ldap/servers/slapd/backend_manager.c | 6 +- ldap/servers/slapd/dn.c | 38 +- ldap/servers/slapd/filtercmp.c | 7 +- ldap/servers/slapd/libglobs.c | 4 +- ldap/servers/slapd/main.c | 4 +- ldap/servers/slapd/mapping_tree.c | 42 +- ldap/servers/slapd/opshared.c | 8 +- ldap/servers/slapd/plugin.c | 6 +- ldap/servers/slapd/protect_db.c | 10 +- ldap/servers/slapd/proto-slap.h | 32 +- ldap/servers/slapd/pw.c | 20 +- ldap/servers/slapd/pw_verify.c | 4 +- ldap/servers/slapd/security_wrappers.c | 6 +- ldap/servers/slapd/slapi-plugin.h | 4 +- ldap/servers/slapd/slapi-private.h | 4 +- ldap/servers/slapd/slapi_pal.c | 4 +- ldap/servers/slapd/task.c | 24 +- ldap/servers/slapd/tools/ldclt/data.c | 34 +- ldap/servers/slapd/tools/ldclt/ldapfct.c | 175 ++++---- ldap/servers/slapd/tools/ldclt/ldclt.c | 40 +- ldap/servers/slapd/tools/ldclt/ldclt.h | 155 +------ ldap/servers/slapd/tools/ldclt/scalab01.c | 25 +- ldap/servers/slapd/tools/ldclt/threadMain.c | 6 +- ldap/servers/slapd/util.c | 4 +- ldap/servers/slapd/vattr.c | 4 +- ldap/servers/snmp/main.c | 4 +- lib/base/ereport.cpp | 4 +- lib/base/shexp.cpp | 10 +- lib/base/util.cpp | 12 +- lib/ldaputil/encode.c | 10 +- lib/libaccess/acl.tab.cpp | 24 +- lib/libaccess/acl.yy.cpp | 46 +-- lib/libaccess/lasip.cpp | 84 ++-- lib/libadmin/util.c | 6 +- src/Cargo.lock | 42 +- src/rewriters/adfilter.c | 12 +- src/svrcore/src/cache.c | 14 +- 73 files changed, 862 insertions(+), 850 deletions(-) diff --git a/docs/slapi.doxy.in b/docs/slapi.doxy.in index 1cafc50ced..8ce74bf509 100644 --- a/docs/slapi.doxy.in +++ b/docs/slapi.doxy.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.9.1 +# Doxyfile 1.8.20 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -17,11 +17,11 @@ # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -93,6 +93,14 @@ ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. @@ -179,6 +187,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -199,6 +217,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -226,16 +252,15 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -264,17 +289,26 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # @@ -285,7 +319,7 @@ EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -293,6 +327,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -318,7 +361,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -343,6 +386,13 @@ IDL_PROPERTY_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent @@ -397,6 +447,19 @@ TYPEDEF_HIDES_STRUCT = YES LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -417,6 +480,12 @@ EXTRACT_ALL = NO EXTRACT_PRIVATE = NO +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -471,8 +540,8 @@ HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -495,7 +564,7 @@ INTERNAL_DOCS = NO # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# (including Cygwin) and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = YES @@ -682,7 +751,7 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -727,11 +796,18 @@ WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = NO +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -755,16 +831,15 @@ WARN_LOGFILE = # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with -# spaces. +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src/libsds/include/sds.h \ - # ldap/servers/slapd/slapi-plugin.h \ +INPUT = src/libsds/include/sds.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -772,12 +847,19 @@ INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen +# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = @@ -863,6 +945,10 @@ IMAGE_PATH = # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -872,6 +958,10 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = @@ -924,7 +1014,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO @@ -956,12 +1046,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -983,6 +1073,38 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the "-p" option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1014,7 +1136,7 @@ IGNORE_PREFIX = #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: NO. +# The default value is: YES. GENERATE_HTML = YES @@ -1052,7 +1174,6 @@ HTML_FILE_EXTENSION = .html # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = -# HTML_HEADER = docs/doc_header.html # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard @@ -1097,13 +1218,12 @@ HTML_EXTRA_STYLESHEET = docs/custom.css # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. -# HTML_EXTRA_FILES = docs/nunc-stans-intro.png \ -# docs/nunc-stans-job-states.png +HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1132,12 +1252,24 @@ HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1161,13 +1293,13 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1206,7 +1338,7 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output @@ -1237,7 +1369,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1282,7 +1414,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1290,7 +1422,7 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1299,7 +1431,7 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1307,7 +1439,7 @@ QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1315,7 +1447,7 @@ QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1399,6 +1531,17 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1408,7 +1551,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1419,8 +1562,14 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1447,8 +1596,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1490,7 +1639,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1509,7 +1658,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1522,7 +1671,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1574,21 +1723,35 @@ LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. @@ -1607,9 +1770,12 @@ COMPACT_LATEX = NO PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names -# that should be included in the LaTeX output. To get the times font for -# instance you can specify -# EXTRA_PACKAGES=times +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1670,9 +1836,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1706,12 +1874,28 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1751,9 +1935,9 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. @@ -1762,8 +1946,8 @@ RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = @@ -1849,6 +2033,13 @@ XML_OUTPUT = xml XML_PROGRAMLISTING = YES +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- @@ -1881,9 +2072,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2050,12 +2241,6 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- @@ -2069,15 +2254,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2210,7 +2386,8 @@ INCLUDED_BY_GRAPH = YES # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2221,7 +2398,8 @@ CALL_GRAPH = NO # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2244,11 +2422,15 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). -# Possible values are: png, jpg, gif and svg. +# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2299,6 +2481,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. diff --git a/ldap/servers/plugins/acctpolicy/acct_util.c b/ldap/servers/plugins/acctpolicy/acct_util.c index f432092fe6..b27eeaff1f 100644 --- a/ldap/servers/plugins/acctpolicy/acct_util.c +++ b/ldap/servers/plugins/acctpolicy/acct_util.c @@ -16,6 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Contributors: Hewlett-Packard Development Company, L.P. + +Copyright (C) 2021 Red Hat, Inc. ******************************************************************************/ #include @@ -27,7 +29,7 @@ Hewlett-Packard Development Company, L.P. #include "slapi-plugin.h" /* Globals */ -static void *plugin_id = NULL; +static void *global_plugin_id = NULL; /* attributes that no clients are allowed to add or modify */ static char *protected_attrs_login_recording[] = {"createTimestamp", NULL}; @@ -180,7 +182,7 @@ free_acctpolicy(acctPolicy **policy) void set_identity(void *identity) { - plugin_id = identity; + global_plugin_id = identity; } /* @@ -189,7 +191,7 @@ set_identity(void *identity) void * get_identity() { - return (plugin_id); + return (global_plugin_id); } /* diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c index 83af9fd1dd..c9e9794afc 100644 --- a/ldap/servers/plugins/acl/acl.c +++ b/ldap/servers/plugins/acl/acl.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1655,16 +1655,19 @@ acl_modified(Slapi_PBlock *pb, int optype, Slapi_DN *e_sdn, void *change) group_change = 1; if (optype == SLAPI_OPERATION_MODIFY) { Slapi_Attr *a = NULL; - int rv; - rv = slapi_entry_attr_find(e, "uniqueMember", &a); - if (rv != 0) + int rc; + rc = slapi_entry_attr_find(e, "uniqueMember", &a); + if (rc != 0) { break; - rv = slapi_entry_attr_find(e, "Member", &a); - if (rv != 0) + } + rc = slapi_entry_attr_find(e, "Member", &a); + if (rc != 0) { break; - rv = slapi_entry_attr_find(e, "MemberURL", &a); - if (rv != 0) + } + rc = slapi_entry_attr_find(e, "MemberURL", &a); + if (rc != 0) { break; + } /* That means we are not changing the member ** list, so it's okay to let go this ** change @@ -2455,7 +2458,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a { Targetattrfilter **attrFilterArray = NULL; Targetattrfilter *attrFilter = NULL; - Slapi_Attr *attr_ptr = NULL; + Slapi_Attr *target_attr_ptr = NULL; Slapi_Value *sval; const struct berval *attrVal; int k; @@ -2481,9 +2484,10 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a * If this filter applies to an attribute in the entry, * apply it to the entry. * Otherwise just ignore it. - * */ - if (slapi_entry_attr_find(aclpb->aclpb_curr_entry, attrFilter->attr_str, &attr_ptr) == 0) { + if (slapi_entry_attr_find(aclpb->aclpb_curr_entry, + attrFilter->attr_str, + &target_attr_ptr) == 0) { /* * This is an applicable filter. * The filter is to be applied to the entry being added or deleted. @@ -2493,7 +2497,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a */ sval = NULL; attrVal = NULL; - k = slapi_attr_first_value(attr_ptr, &sval); + k = slapi_attr_first_value(target_attr_ptr, &sval); done = 0; while (k != -1 && !done) { attrVal = slapi_value_get_berval(sval); @@ -2509,7 +2513,7 @@ acl__resource_match_aci(Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *a slapi_entry_free(aclpb->aclpb_filter_test_entry); } - k = slapi_attr_next_value(attr_ptr, k, &sval); + k = slapi_attr_next_value(target_attr_ptr, k, &sval); } /* while */ /* diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c index a5602e1983..94eea35f16 100644 --- a/ldap/servers/plugins/acl/acllas.c +++ b/ldap/servers/plugins/acl/acllas.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1516,14 +1516,14 @@ DS_LASLdapUrlAttrEval(NSErr_t *errp __attribute__((unused)), char *attr_name __a if (levels[i] == 0) { /* parent[0] or the target itself */ Slapi_Value *sval = NULL; const struct berval *attrVal; - Slapi_Attr *attrs; - int i; + Slapi_Attr *target_attrs; + int ii = 0; /* Get the attr from the resouce entry */ if (0 == slapi_entry_attr_find(lasinfo.resourceEntry, - attrName, &attrs)) { - i = slapi_attr_first_value(attrs, &sval); - if (i == -1) { + attrName, &target_attrs)) { + ii = slapi_attr_first_value(target_attrs, &sval); + if (ii == -1) { /* Attr val not there * so it's value cannot equal other one */ matched = ACL_FALSE; @@ -1541,7 +1541,7 @@ DS_LASLdapUrlAttrEval(NSErr_t *errp __attribute__((unused)), char *attr_name __a lasinfo.clientDn, attrVal->bv_val); if (matched != ACL_TRUE) - i = slapi_attr_next_value(attrs, i, &sval); + ii = slapi_attr_next_value(target_attrs, ii, &sval); if (matched == ACL_DONT_KNOW) { got_undefined = 1; } @@ -1956,7 +1956,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb, char *attrs[5]; char *currDN; - int i, j; + int i; int result = ACL_FALSE; struct eval_info info = {0}; int nesting_level; @@ -2147,7 +2147,6 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb, */ while (1) { int evalNext = 0; - int j; if (info.c_idx > info.lu_idx) { /* That means we have crossed the limit. We ** may end of in this situation if we @@ -2162,7 +2161,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb, if ((NULL == groupMember) || ((currDN = groupMember->member) != NULL)) break; - for (j = 0; j < info.c_idx; j++) { + for (size_t j = 0; j < info.c_idx; j++) { groupMember = info.memberInfo[j]; if (groupMember->member && (slapi_utf8casecmp((ACLUCHP)currDN, (ACLUCHP)groupMember->member) == 0)) { @@ -2225,7 +2224,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb, int already_cached = 0; parentGroup = (groupMember->parentId < 0) ? NULL : info.memberInfo[groupMember->parentId]; - for (j = 0; j < u_group->aclug_numof_member_group; j++) { + for (size_t j = 0; j < u_group->aclug_numof_member_group; j++) { if (slapi_utf8casecmp((ACLUCHP)groupMember->member, (ACLUCHP)u_group->aclug_member_groups[j]) == 0) { already_cached = 1; @@ -2270,7 +2269,7 @@ acllas__user_ismember_of_group(struct acl_pblock *aclpb, int already_cached = 0; parentGroup = (groupMember->parentId < 0) ? NULL : info.memberInfo[groupMember->parentId]; - for (j = 0; j < u_group->aclug_numof_notmember_group; j++) { + for (size_t j = 0; j < u_group->aclug_numof_notmember_group; j++) { if (slapi_utf8casecmp((ACLUCHP)groupMember->member, (ACLUCHP)u_group->aclug_notmember_groups[j]) == 0) { already_cached = 1; diff --git a/ldap/servers/plugins/acl/aclparse.c b/ldap/servers/plugins/acl/aclparse.c index 577251ebd2..a8061b83c4 100644 --- a/ldap/servers/plugins/acl/aclparse.c +++ b/ldap/servers/plugins/acl/aclparse.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -267,7 +267,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf) if ((s = strstr(str, "!=")) != NULL) { type |= ACI_TARGET_ATTR_NOT; - strncpy(s, single_space, 1); + memcpy(s, single_space, 1); } /* Get individual components of the targetattr. * (targetattr = "cn || u* || phone ||tel:add:(tel=1234) @@ -365,7 +365,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf) } if ((s = strstr(str, "!=")) != NULL) { type |= ACI_TARGET_NOT; - strncpy(s, single_space, 1); + memcpy(s, single_space, 1); } if ((s = strchr(str, '=')) != NULL) { s++; @@ -433,7 +433,7 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf) } if ((s = strstr(str, "!=")) != NULL) { type |= ACI_TARGET_NOT; - strncpy(s, single_space, 1); + memcpy(s, single_space, 1); } if ((s = strchr(str, '=')) != NULL) { s++; @@ -602,17 +602,16 @@ __aclp__parse_aci(char *str, aci_t *aci_item, char **errbuf) * things are missing. * * Input: -* char *str - String containg the acl text -* int *err - error status +* char *str - String containing the acl text +* int *err - error status * * Returns: * 0 --- good status -* <0 --- error +* <0 --- error * * Error Handling: * None. * -* **************************************************************************/ static int __aclp__sanity_check_acltxt(aci_t *aci_item, char *str) @@ -630,8 +629,8 @@ __aclp__sanity_check_acltxt(aci_t *aci_item, char *str) newstr = str; while ((s = strstr(newstr, "authenticate")) != NULL) { - char *next; - next = s + 12; + char *next_str; + next_str = s + 12; s--; while (s > str && ldap_utf8isspace(s)) LDAP_UTF8DEC(s); @@ -640,7 +639,7 @@ __aclp__sanity_check_acltxt(aci_t *aci_item, char *str) return ACL_INVALID_AUTHORIZATION; } else { - newstr = next; + newstr = next_str; } } @@ -1603,7 +1602,7 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf) } while (str != 0 && *str != 0) { - int lenstr = 0; + int len_str = 0; __acl_strip_leading_space(&str); @@ -1630,9 +1629,9 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf) */ attr = (Targetattr *)slapi_ch_calloc(1, sizeof(Targetattr)); /* strip double quotes */ - lenstr = strlen(str); - if (*str == '"' && *(str + lenstr - 1) == '"') { - *(str + lenstr - 1) = '\0'; + len_str = strlen(str); + if (*str == '"' && *(str + len_str - 1) == '"') { + *(str + len_str - 1) = '\0'; str++; } if (strchr(str, '*')) { @@ -1643,8 +1642,8 @@ __aclp__init_targetattr(aci_t *aci, char *attr_val, char **errbuf) char *newline = NULL; struct slapi_filter *f = NULL; - if (lenstr > 92) { /* 100 - 8 for "(attr=%s)\0" */ - newline = slapi_ch_malloc(lenstr + 8); + if (len_str > 92) { /* 100 - 8 for "(attr=%s)\0" */ + newline = slapi_ch_malloc(len_str + 8); lineptr = newline; } diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c index 93dfa6bc12..ea636bb5ca 100644 --- a/ldap/servers/plugins/acl/aclutil.c +++ b/ldap/servers/plugins/acl/aclutil.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -688,7 +688,6 @@ acl_dn_component_match(const char *ndn __attribute__((unused)), char *match_this char * acl_match_macro_in_target(const char *ndn, char *match_this, char *macro_ptr) { - char *macro_prefix = NULL; int macro_prefix_len = 0; char *macro_suffix = NULL; @@ -780,21 +779,21 @@ acl_match_macro_in_target(const char *ndn, char *match_this, char *macro_ptr) /* * ($dn) matches ndn[0..ndn_len-macro_suffix_len] */ - int matched_val_len = 0; + int val_len = 0; - matched_val_len = ndn_len - macro_suffix_len; + val_len = ndn_len - macro_suffix_len; - matched_val = (char *)slapi_ch_malloc(matched_val_len + 1); + matched_val = (char *)slapi_ch_malloc(val_len + 1); strncpy(matched_val, ndn, ndn_len - macro_suffix_len); /* * Null terminate matched_val, removing trailing "," if there is * one. */ - if (matched_val_len > 1) { - if (matched_val[matched_val_len - 1] == ',') { - matched_val[matched_val_len - 1] = '\0'; + if (val_len > 1) { + if (matched_val[val_len - 1] == ',') { + matched_val[val_len - 1] = '\0'; } else { - matched_val[matched_val_len] = '\0'; + matched_val[val_len] = '\0'; } } ret_val = matched_val; diff --git a/ldap/servers/plugins/chainingdb/cb_controls.c b/ldap/servers/plugins/chainingdb/cb_controls.c index 19ca465489..92292123c5 100644 --- a/ldap/servers/plugins/chainingdb/cb_controls.c +++ b/ldap/servers/plugins/chainingdb/cb_controls.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -116,7 +116,6 @@ cb_update_controls(Slapi_PBlock *pb, int cCount = 0; int dCount = 0; - int i; char *proxyDN = NULL; LDAPControl **reqControls = NULL; LDAPControl **ctrls = NULL; @@ -129,6 +128,7 @@ cb_update_controls(Slapi_PBlock *pb, int addauth = (ctrl_flags & CB_UPDATE_CONTROLS_ADDAUTH); int isabandon = (ctrl_flags & CB_UPDATE_CONTROLS_ISABANDON); int op_type = 0; + size_t i; *controls = NULL; slapi_pblock_get(pb, SLAPI_OPERATION_TYPE, &op_type); @@ -216,8 +216,6 @@ cb_update_controls(Slapi_PBlock *pb, /* Add to the control list later */ } else { - - int i; for (i = 0; cbb->config.forward_ctrls != NULL && cbb->config.forward_ctrls[i] != NULL; ++i) { if (strcmp(cbb->config.forward_ctrls[i], reqControls[cCount]->ldctl_oid) == 0) { break; diff --git a/ldap/servers/plugins/chainingdb/cb_search.c b/ldap/servers/plugins/chainingdb/cb_search.c index 803e4cceb0..1fb2aaae8d 100644 --- a/ldap/servers/plugins/chainingdb/cb_search.c +++ b/ldap/servers/plugins/chainingdb/cb_search.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -631,7 +631,6 @@ chainingdb_next_search_entry(Slapi_PBlock *pb) */ { struct berval bv; - int i; struct berval *bvals[2]; Slapi_Entry *anEntry = slapi_entry_alloc(); slapi_entry_set_sdn(anEntry, target_sdn); @@ -643,8 +642,8 @@ chainingdb_next_search_entry(Slapi_PBlock *pb) bv.bv_len = strlen(bv.bv_val); slapi_entry_add_values(anEntry, "objectclass", bvals); - for (i = 0; referrals && referrals[i] != NULL; i++) { - bv.bv_val = referrals[i]; + for (size_t ii = 0; referrals && referrals[ii] != NULL; ii++) { + bv.bv_val = referrals[ii]; bv.bv_len = strlen(bv.bv_val); slapi_entry_add_values(anEntry, "ref", bvals); } diff --git a/ldap/servers/plugins/collation/config.c b/ldap/servers/plugins/collation/config.c index 44fdf0c1c7..7c53728faf 100644 --- a/ldap/servers/plugins/collation/config.c +++ b/ldap/servers/plugins/collation/config.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -149,7 +149,7 @@ void collation_read_config(char *fname) { FILE *fp; - char *line; + char *cfg_line; int cargc; char *cargv[MAXARGS]; int lineno; @@ -165,13 +165,13 @@ collation_read_config(char *fname) slapi_log_err(SLAPI_LOG_CONFIG, "collation_read_config", "Reading config file %s\n", fname); fp_getline_init(&lineno); - while ((line = fp_getline(fp, &lineno)) != NULL) { + while ((cfg_line = fp_getline(fp, &lineno)) != NULL) { /* skip comments and blank lines */ - if (line[0] == '#' || line[0] == '\0') { + if (cfg_line[0] == '#' || cfg_line[0] == '\0') { continue; } slapi_log_err(SLAPI_LOG_CONFIG, COLLATE_PLUGIN_SUBSYSTEM, - "collation_read_config - line %d: %s\n", lineno, line); + "collation_read_config - line %d: %s\n", lineno, cfg_line); fp_parse_line(line, &cargc, cargv); if (cargc < 1) { slapi_log_err(SLAPI_LOG_ERR, COLLATE_PLUGIN_SUBSYSTEM, diff --git a/ldap/servers/plugins/collation/orfilter.c b/ldap/servers/plugins/collation/orfilter.c index c092d77ca2..1ed17c097f 100644 --- a/ldap/servers/plugins/collation/orfilter.c +++ b/ldap/servers/plugins/collation/orfilter.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -184,12 +184,12 @@ ss_filter_match(or_filter_t * or, struct berval **vals) auto char *limit = v.bv_val; auto char *end; auto struct berval **vkeys; - auto struct berval *vals[2]; + auto struct berval *final_vals[2]; auto struct berval key; rc = -1; - vals[0] = &v; - vals[1] = NULL; + final_vals[0] = &v; + final_vals[1] = NULL; key.bv_val = (*k)->bv_val; key.bv_len = (*k)->bv_len - 1; /* In the following lines it will loop to find @@ -209,15 +209,15 @@ ss_filter_match(or_filter_t * or, struct berval **vals) v.bv_val = end; while (1) { v.bv_len = end - v.bv_val + 1; - vkeys = ix->ix_index(ix, vals, NULL); + vkeys = ix->ix_index(ix, final_vals, NULL); if (vkeys && vkeys[0]) { auto const struct berval *vkey = vkeys[0]; if (vkey->bv_len > key.bv_len) { if (--attempts <= 0) { break; } /* else Try looking at another character; - it may combine, and produce a shorter key. - */ + it may combine, and produce a shorter key. + */ } else if (SLAPI_BERVAL_EQ(vkey, &key)) { rc = 0; break; diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c index e9e1ec4c7f..190e65157a 100644 --- a/ldap/servers/plugins/memberof/memberof.c +++ b/ldap/servers/plugins/memberof/memberof.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -3146,15 +3146,12 @@ memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data) if (config->group_filter) { if (slapi_filter_test_simple(e, config->group_filter)) { - const char *ndn; memberof_cached_value *ht_grp; /* This entry is not a group * if (likely) we cached its ancestor it is useless * so free this memory */ - ndn = slapi_sdn_get_ndn(sdn); - #if MEMBEROF_CACHE_DEBUG slapi_log_err(SLAPI_LOG_PLUGIN, MEMBEROF_PLUGIN_SUBSYSTEM, "memberof_fix_memberof_callback: This is NOT a group %s\n", ndn); #endif diff --git a/ldap/servers/plugins/memberof/memberof.h b/ldap/servers/plugins/memberof/memberof.h index f049d384bf..6ac9a20b91 100644 --- a/ldap/servers/plugins/memberof/memberof.h +++ b/ldap/servers/plugins/memberof/memberof.h @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -103,6 +103,6 @@ void memberof_release_config(void); PRUint64 get_plugin_started(void); void ancestor_hashtable_entry_free(memberof_cached_value *entry); PLHashTable *hashtable_new(int usetxn); -int memberof_use_txn(); +int memberof_use_txn(void); #endif /* _MEMBEROF_H_ */ diff --git a/ldap/servers/plugins/memberof/memberof_config.c b/ldap/servers/plugins/memberof/memberof_config.c index 586be11a97..59fab6b8b7 100644 --- a/ldap/servers/plugins/memberof/memberof_config.c +++ b/ldap/servers/plugins/memberof/memberof_config.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -302,7 +302,7 @@ memberof_validate_config(Slapi_PBlock *pb, if ((config_dn = (char *)slapi_entry_attr_get_ref(e, SLAPI_PLUGIN_SHARED_CONFIG_AREA))) { /* Now check the shared config attribute, validate it now */ - Slapi_Entry *e = NULL; + Slapi_Entry *config_e = NULL; int rc = 0; rc = slapi_dn_syntax_check(pb, config_dn, 1); @@ -315,9 +315,9 @@ memberof_validate_config(Slapi_PBlock *pb, } config_sdn = slapi_sdn_new_dn_byval(config_dn); - slapi_search_internal_get_entry(config_sdn, NULL, &e, memberof_get_plugin_id()); - if (e) { - slapi_entry_free(e); + slapi_search_internal_get_entry(config_sdn, NULL, &config_e, memberof_get_plugin_id()); + if (config_e) { + slapi_entry_free(config_e); *returncode = LDAP_SUCCESS; } else { /* config area does not exist! */ diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index 4f433ce638..b96750cfc1 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/ldap/servers/plugins/mep/mep.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -2687,7 +2687,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) LDAPMod mod; LDAPMod *mods[3]; char *vals[2]; - int result = LDAP_SUCCESS; Slapi_PBlock *mep_pb = slapi_pblock_new(); Slapi_Entry *new_managed_entry = NULL; Slapi_DN *managed_sdn = NULL; diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c index 56efb2330f..51a55b643a 100644 --- a/ldap/servers/plugins/posix-winsync/posix-winsync.c +++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c @@ -1,6 +1,7 @@ /** Author: Carsten Grzemba grzemba@contac-dt.de> * * Copyright (C) 2011 contac Datentechnik GmbH + * Copyright (C) 2021 Red Hat, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -985,10 +986,10 @@ posix_winsync_pre_ds_mod_user_cb(void *cbdata, slapi_value_init_string(voc, "shadowAccount"); if (slapi_attr_value_find(oc_attr, slapi_value_get_berval(voc)) != 0) { - Slapi_Value *oc_nv = slapi_value_new(); + Slapi_Value *shadow_oc_nv = slapi_value_new(); - slapi_value_init_string(oc_nv, "shadowAccount"); - slapi_valueset_add_value(oc_vs, oc_nv); + slapi_value_init_string(shadow_oc_nv, "shadowAccount"); + slapi_valueset_add_value(oc_vs, shadow_oc_nv); slapi_log_err(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "<-- _pre_ds_mod_user_cb add oc:shadowAccount\n"); } @@ -1832,17 +1833,16 @@ posix_winsync_pre_ad_add_user_cb(void *cookie __attribute__((unused)), for (rc = slapi_entry_first_attr(ds_entry, &attr); attr && (rc == 0); rc = slapi_entry_next_attr(ds_entry, attr, &attr)) { char *type = NULL; - size_t i = 0; slapi_attr_get_type(attr, &type); slapi_log_err(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "_pre_ad_add_user_cb -- check add attr: %s\n", type); - for (; attr_map[i].windows_attribute_name != NULL; i++) { - if (0 == slapi_attr_type_cmp(type, attr_map[i].ldap_attribute_name, SLAPI_TYPE_CMP_SUBTYPE)) { + for (size_t ii = 0; attr_map[ii].windows_attribute_name != NULL; ii++) { + if (0 == slapi_attr_type_cmp(type, attr_map[ii].ldap_attribute_name, SLAPI_TYPE_CMP_SUBTYPE)) { Slapi_ValueSet *vs = NULL; slapi_attr_get_valueset(attr, &vs); - slapi_entry_add_valueset(ad_entry, attr_map[i].windows_attribute_name, vs); + slapi_entry_add_valueset(ad_entry, attr_map[ii].windows_attribute_name, vs); slapi_valueset_free(vs); slapi_log_err(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, diff --git a/ldap/servers/plugins/pwdstorage/pwdstorage.h b/ldap/servers/plugins/pwdstorage/pwdstorage.h index 7d0e45866b..72b3822241 100644 --- a/ldap/servers/plugins/pwdstorage/pwdstorage.h +++ b/ldap/servers/plugins/pwdstorage/pwdstorage.h @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -95,7 +95,7 @@ char *pbkdf2_sha256_pw_enc(const char *pwd); int pbkdf2_sha256_pw_cmp(const char *userpwd, const char *dbpwd); /* For testing pbkdf2 only */ -uint64_t pbkdf2_sha256_benchmark_iterations(); +uint64_t pbkdf2_sha256_benchmark_iterations(void); PRUint32 pbkdf2_sha256_calculate_iterations(uint64_t time_nsec); /* Utility functions */ diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index fd5356d726..9d18beb7ea 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -929,9 +929,6 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ char *p = NULL; size_t dnlen = 0; int rc = 0; - int nval = 0; - - slapi_attr_get_numvalues(attr, &nval); if (NULL == newRDN && NULL == newsuperior) { /* in delete mode */ diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index ced3d5b705..4acf8c9dc6 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2010 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -470,7 +470,7 @@ cl5ImportLDIF(const char *clDir, const char *ldifFile, Replica *replica) LDIFFP *file = NULL; int buflen = 0; ldif_record_lineno_t lineno = 0; - int rc; + int rc = 0; char *buff = NULL; slapi_operation_parameters op; char *replGen = NULL; @@ -1360,7 +1360,7 @@ cldb_StopThreads(Replica *replica, void *arg) interval = PR_MillisecondsToInterval(100); while ((threads = slapi_counter_get_value(cldb->clThreads)) > 0) { slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name_cl, - "cldb_StopThreads -Waiting for threads to exit: %lu thread(s) still active\n", + "cldb_StopThreads - Waiting for threads to exit: %" PRIu64 " thread(s) still active\n", threads); DS_Sleep(interval); } @@ -1587,7 +1587,7 @@ cl5DBData2Entry(const char *data, PRUint32 len __attribute__((unused)), CL5Entry char *strCSN; PRUint32 thetime; slapi_operation_parameters *op; - LDAPMod **add_mods; + LDAPMod **add_mods = NULL; char *rawDN = NULL; char s[CSN_STRSIZE]; @@ -1905,7 +1905,6 @@ static int _cl5ReadMod(Slapi_Mod *smod, char **buff, void *clcrypt_handle) { char *pos = *buff; - int i; PRInt32 val_count; char *type; int op; @@ -1929,7 +1928,7 @@ _cl5ReadMod(Slapi_Mod *smod, char **buff, void *clcrypt_handle) slapi_mod_set_type(smod, type); slapi_ch_free((void **)&type); - for (i = 0; i < val_count; i++) { + for (size_t i = 0; i < val_count; i++) { _cl5ReadBerval(&bv, &pos); decbv = NULL; rc = 0; @@ -1945,10 +1944,10 @@ _cl5ReadMod(Slapi_Mod *smod, char **buff, void *clcrypt_handle) char encstr[128]; char *encend = encstr + 128; char *ptr; - int i; - for (i = 0, ptr = encstr; (i < bv.bv_len) && (ptr < encend - 6); - i++, ptr += 3) { - sprintf(ptr, "%x", 0xff & bv.bv_val[i]); + int ii; + for (ii = 0, ptr = encstr; (ii < bv.bv_len) && (ptr < encend - 6); + ii++, ptr += 3) { + sprintf(ptr, "%x", 0xff & bv.bv_val[ii]); } if (ptr >= encend - 6) { sprintf(ptr, "..."); diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h index ffd97bddbd..9038b5416a 100644 --- a/ldap/servers/plugins/replication/repl5.h +++ b/ldap/servers/plugins/replication/repl5.h @@ -557,8 +557,8 @@ void *multimaster_mtnode_extension_constructor(void *object, void *parent); void multimaster_mtnode_extension_destructor(void *ext, void *object, void *parent); /* general extension functions - repl_ext.c */ -void repl_sup_init_ext(); /* initializes registrations - must be called first */ -void repl_con_init_ext(); /* initializes registrations - must be called first */ +void repl_sup_init_ext(void); /* initializes registrations - must be called first */ +void repl_con_init_ext(void); /* initializes registrations - must be called first */ int repl_sup_register_ext(ext_type type); /* registers an extension of the specified type */ int repl_con_register_ext(ext_type type); /* registers an extension of the specified type */ void *repl_sup_get_ext(ext_type type, void *object); /* retireves the extension from the object */ @@ -834,7 +834,7 @@ int replica_config_init(void); void replica_config_destroy(void); int get_replica_type(Replica *r); int replica_execute_cleanruv_task_ext(Replica *r, ReplicaId rid); -void add_cleaned_rid(cleanruv_data *data); +void add_cleaned_rid(cleanruv_data *clean_data); int is_cleaned_rid(ReplicaId rid); int32_t check_and_set_cleanruv_task_count(ReplicaId rid); int32_t check_and_set_abort_cleanruv_task_count(void); diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c index 5f048f3ffd..693358efae 100644 --- a/ldap/servers/plugins/replication/repl5_agmt.c +++ b/ldap/servers/plugins/replication/repl5_agmt.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -2964,21 +2964,21 @@ agmt_get_consumer_rid(Repl_Agmt *agmt, void *conn) { if (agmt->consumerRID <= 0 || agmt->tmpConsumerRID) { - char *mapping_tree_node = NULL; + char *mt_node = NULL; struct berval **bvals = NULL; /* This function converts the old style DN to the new one. */ - mapping_tree_node = + mt_node = slapi_create_dn_string("cn=replica,cn=\"%s\",cn=mapping tree,cn=config", slapi_sdn_get_dn(agmt->replarea)); - if (NULL == mapping_tree_node) { + if (NULL == mt_node) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "agmt_get_consumer_rid: failed to normalize " "replica dn for %s\n", slapi_sdn_get_dn(agmt->replarea)); agmt->consumerRID = 0; } - conn_read_entry_attribute(conn, mapping_tree_node, "nsDS5ReplicaID", &bvals); + conn_read_entry_attribute(conn, mt_node, "nsDS5ReplicaID", &bvals); if (NULL != bvals && NULL != bvals[0]) { char *ridstr = slapi_ch_malloc(bvals[0]->bv_len + 1); memcpy(ridstr, bvals[0]->bv_val, bvals[0]->bv_len); @@ -2987,7 +2987,7 @@ agmt_get_consumer_rid(Repl_Agmt *agmt, void *conn) slapi_ch_free((void **)&ridstr); ber_bvecfree(bvals); } - slapi_ch_free_string(&mapping_tree_node); + slapi_ch_free_string(&mt_node); } agmt->tmpConsumerRID = 0; diff --git a/ldap/servers/plugins/replication/repl5_agmtlist.c b/ldap/servers/plugins/replication/repl5_agmtlist.c index 18b641f8cd..b55f9429f0 100644 --- a/ldap/servers/plugins/replication/repl5_agmtlist.c +++ b/ldap/servers/plugins/replication/repl5_agmtlist.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -170,12 +170,12 @@ id_extended_agreement(Repl_Agmt *agmt __attribute__((unused)), LDAPMod **mods, S slapi_entry_attr_find(e, "objectclass", &sattr); if (sattr) { Slapi_Value *sval = NULL; - const char *val = NULL; + const char *oc_val = NULL; for (i = slapi_attr_first_value(sattr, &sval); i >= 0; i = slapi_attr_next_value(sattr, i, &sval)) { - val = slapi_value_get_string(sval); - if ((0 == strcasecmp(val, "top")) || - (0 == strcasecmp(val, "nsds5replicationAgreement"))) { + oc_val = slapi_value_get_string(sval); + if ((0 == strcasecmp(oc_val, "top")) || + (0 == strcasecmp(oc_val, "nsds5replicationAgreement"))) { continue; } else { /* the entry has an additional objectclass, accept mods */ @@ -558,8 +558,8 @@ agmtlist_modify_callback(Slapi_PBlock *pb, } } else if (slapi_attr_types_equivalent(mods[i]->mod_type, "nsds5debugreplicatimeout")) { - char *val = (char *)slapi_entry_attr_get_ref(e, "nsds5debugreplicatimeout"); - repl5_set_debug_timeout(val); + char *timeout_val = (char *)slapi_entry_attr_get_ref(e, "nsds5debugreplicatimeout"); + repl5_set_debug_timeout(timeout_val); } else if (slapi_attr_is_last_mod(mods[i]->mod_type) || strcasecmp(mods[i]->mod_type, "description") == 0) { /* ignore modifier's name and timestamp attributes and the description. */ diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c index f4a75e206d..5cdb18a3fe 100644 --- a/ldap/servers/plugins/replication/repl5_plugins.c +++ b/ldap/servers/plugins/replication/repl5_plugins.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -1100,7 +1100,6 @@ write_changelog_and_ruv(Slapi_PBlock *pb) */ if (0 == return_value) { char csn_str[CSN_STRSIZE] = {'\0'}; - int rc; const char *dn = op_params ? REPL_GET_DN(&op_params->target_address) : "unknown"; Slapi_DN *sdn = op_params ? (&op_params->target_address)->sdn : NULL; char *uniqueid = op_params ? op_params->target_address.uniqueid : "unknown"; diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c index 7db0c1678a..4842fa779d 100644 --- a/ldap/servers/plugins/replication/repl5_replica.c +++ b/ldap/servers/plugins/replication/repl5_replica.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -2187,13 +2187,13 @@ replica_delete_task_config(Slapi_Entry *e, char *attr, char *value) void replica_check_for_tasks(time_t when __attribute__((unused)), void *arg) { - const Slapi_DN *repl_root = (Slapi_DN *)arg; + const Slapi_DN *replica_root = (Slapi_DN *)arg; Slapi_Entry *e = NULL; Replica *r = NULL; char **clean_vals; - e = _replica_get_config_entry(repl_root, NULL); - r = replica_get_replica_from_dn(repl_root); + e = _replica_get_config_entry(replica_root, NULL); + r = replica_get_replica_from_dn(replica_root); if (e == NULL || r == NULL || ldif_dump_is_running() == PR_TRUE) { /* If db2ldif is being run, do not check if there are incomplete tasks */ diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c index 69917f4697..8456774296 100644 --- a/ldap/servers/plugins/replication/repl5_replica_config.c +++ b/ldap/servers/plugins/replication/repl5_replica_config.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2020 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -2636,7 +2636,7 @@ set_cleaned_rid(ReplicaId rid) * Add the rid and maxcsn to the repl config (so we can resume after a server restart) */ void -add_cleaned_rid(cleanruv_data *cleanruv_data) +add_cleaned_rid(cleanruv_data *clean_data) { Slapi_PBlock *pb; struct berval *vals[2]; @@ -2650,9 +2650,9 @@ add_cleaned_rid(cleanruv_data *cleanruv_data) Replica *r; char *forcing; - rid = cleanruv_data->rid; - r = cleanruv_data->replica; - forcing = cleanruv_data->force; + rid = clean_data->rid; + r = clean_data->replica; + forcing = clean_data->force; if (r == NULL) { return; @@ -2661,8 +2661,8 @@ add_cleaned_rid(cleanruv_data *cleanruv_data) * Write the rid & maxcsn to the config entry */ data = slapi_ch_smprintf("%d:%s:%d:%s", - rid, forcing, cleanruv_data->original_task ? 1 : 0, - cleanruv_data->repl_root); + rid, forcing, clean_data->original_task ? 1 : 0, + clean_data->repl_root); dn = replica_get_dn(r); pb = slapi_pblock_new(); mod.mod_op = LDAP_MOD_ADD | LDAP_MOD_BVALUES; diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c index dadb494d1d..ba0f2f41a9 100644 --- a/ldap/servers/plugins/replication/repl_extop.c +++ b/ldap/servers/plugins/replication/repl_extop.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1527,8 +1527,8 @@ multimaster_extop_cleanruv(Slapi_PBlock *pb) /* We are caught up */ break; } else { - char csnstr[CSN_STRSIZE]; - csn_as_string(maxcsn, PR_FALSE, csnstr); + char csn_str[CSN_STRSIZE]; + csn_as_string(maxcsn, PR_FALSE, csn_str); slapi_log_err(SLAPI_LOG_NOTICE, repl_plugin_name, "multimaster_extop_cleanruv - CleanAllRUV Task - Not ruv caught up maxcsn(%s)\n", csnstr); } DS_Sleep(PR_SecondsToInterval(5)); diff --git a/ldap/servers/plugins/replication/repl_globals.c b/ldap/servers/plugins/replication/repl_globals.c index 000777fdda..6d71671a9e 100644 --- a/ldap/servers/plugins/replication/repl_globals.c +++ b/ldap/servers/plugins/replication/repl_globals.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -138,14 +138,14 @@ const char *type_nsds5BeginReplicaRefresh = "nsds5BeginReplicaRefresh"; static int repl_active_threads; int -decrement_repl_active_threads() +decrement_repl_active_threads(void) { PR_AtomicIncrement(&repl_active_threads); return repl_active_threads; } int -increment_repl_active_threads() +increment_repl_active_threads(void) { PR_AtomicDecrement(&repl_active_threads); return repl_active_threads; diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c index ed340c9d88..35b8a77934 100644 --- a/ldap/servers/plugins/replication/urp.c +++ b/ldap/servers/plugins/replication/urp.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1464,8 +1464,8 @@ urp_add_check_tombstone (Slapi_PBlock *pb, char *sessionid, Slapi_Entry *entry, /* the tombstone is from an entry added later than the received one */ Slapi_Value *tomb_value; const char *adduniqueid = slapi_entry_get_uniqueid (entries[i]); - const char *basedn = slapi_entry_get_dn_const (entry); - char *newrdn = get_rdn_plus_uniqueid ( sessionid, basedn, adduniqueid ); + const char *base_dn = slapi_entry_get_dn_const (entry); + char *newrdn = get_rdn_plus_uniqueid ( sessionid, base_dn, adduniqueid ); char *parentdn = slapi_dn_parent_ext(slapi_entry_get_dn_const(entries[i]),1); char *conflict_dn = slapi_ch_smprintf("%s,%s",newrdn, parentdn); slapi_log_err(SLAPI_LOG_REPL, sessionid, diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c index 310bedcca2..d5ed150a32 100644 --- a/ldap/servers/plugins/replication/windows_inc_protocol.c +++ b/ldap/servers/plugins/replication/windows_inc_protocol.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2020 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -324,10 +324,10 @@ windows_inc_run(Private_Repl_Protocol *prp) if (interval != current_interval) { current_interval = interval; if (dirsync) { - int rc = slapi_eq_cancel_rel(dirsync); + int rv = slapi_eq_cancel_rel(dirsync); slapi_log_err(SLAPI_LOG_REPL, windows_repl_plugin_name, "windows_inc_run - Cancelled dirsync: %p, rval: %d\n", - dirsync, rc); + dirsync, rv); } dirsync = slapi_eq_repeat_rel(periodic_dirsync, (void *)prp, slapi_current_rel_time_t(), interval); diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c index 8d6135dad2..ef6f72370f 100644 --- a/ldap/servers/plugins/retrocl/retrocl.c +++ b/ldap/servers/plugins/retrocl/retrocl.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -369,7 +369,6 @@ retrocl_start(Slapi_PBlock *pb) Slapi_Entry *e = NULL; char **values = NULL; int num_vals = 0; - int i = 0; retrocl_rootdse_init(pb); @@ -394,7 +393,7 @@ retrocl_start(Slapi_PBlock *pb) values = slapi_entry_attr_get_charray_ext(e, CONFIG_CHANGELOG_EXCLUDE_SUFFIX, &num_vals); if (values) { /* Validate the syntax before we create our DN array */ - for (i = 0; i < num_vals; i++) { + for (size_t i = 0; i < num_vals; i++) { if (slapi_dn_syntax_check(pb, values[i], 1)) { /* invalid dn syntax */ slapi_log_err(SLAPI_LOG_ERR, RETROCL_PLUGIN_NAME, @@ -405,7 +404,7 @@ retrocl_start(Slapi_PBlock *pb) } /* Now create our SDN array */ retrocl_excludes = (Slapi_DN **)slapi_ch_calloc(sizeof(Slapi_DN *), num_vals + 1); - for (i = 0; i < num_vals; i++) { + for (size_t i = 0; i < num_vals; i++) { retrocl_excludes[i] = slapi_sdn_new_dn_byval(values[i]); } slapi_ch_array_free(values); @@ -413,7 +412,7 @@ retrocl_start(Slapi_PBlock *pb) /* Get the include suffixes */ values = slapi_entry_attr_get_charray_ext(e, CONFIG_CHANGELOG_INCLUDE_SUFFIX, &num_vals); if (values) { - for (i = 0; i < num_vals; i++) { + for (size_t i = 0; i < num_vals; i++) { /* Validate the syntax before we create our DN array */ if (slapi_dn_syntax_check(pb, values[i], 1)) { /* invalid dn syntax */ @@ -425,7 +424,7 @@ retrocl_start(Slapi_PBlock *pb) } /* Now create our SDN array */ retrocl_includes = (Slapi_DN **)slapi_ch_calloc(sizeof(Slapi_DN *), num_vals + 1); - for (i = 0; i < num_vals; i++) { + for (size_t i = 0; i < num_vals; i++) { retrocl_includes[i] = slapi_sdn_new_dn_byval(values[i]); } slapi_ch_array_free(values); @@ -474,7 +473,6 @@ retrocl_start(Slapi_PBlock *pb) values = slapi_entry_attr_get_charray(e, "nsslapd-attribute"); if (values != NULL) { int n = 0; - int i = 0; slapi_log_err(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "retrocl_start - nsslapd-attribute:\n"); @@ -489,7 +487,7 @@ retrocl_start(Slapi_PBlock *pb) slapi_log_err(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "retrocl_start - Attributes:\n"); - for (i = 0; i < n; i++) { + for (size_t i = 0; i < n; i++) { char *value = values[i]; size_t length = strlen(value); diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c index 3d076a4cba..10363d74eb 100644 --- a/ldap/servers/plugins/roles/roles_cache.c +++ b/ldap/servers/plugins/roles/roles_cache.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -413,29 +413,29 @@ roles_cache_trigger_update_suffix(void *handle __attribute__((unused)), char *be roles_cache_def *current_role = roles_list; const Slapi_DN *be_suffix_dn = NULL; Slapi_DN *top_suffix_dn = NULL; - Slapi_Backend *backend = NULL; + Slapi_Backend *be = NULL; int found = 0; slapi_rwlock_wrlock(global_lock); if ((new_be_state == SLAPI_BE_STATE_DELETE) || (new_be_state == SLAPI_BE_STATE_OFFLINE)) { /* Invalidate and rebuild the whole cache */ - roles_cache_def *current_role = NULL; + roles_cache_def *curr_role = NULL; roles_cache_def *next_role = NULL; Slapi_DN *sdn = NULL; void *node = NULL; roles_cache_def *new_suffix = NULL; /* Go through all the roles list and trigger the associated structure */ - current_role = roles_list; - while (current_role) { - slapi_lock_mutex(current_role->change_lock); - current_role->keeprunning = 0; - next_role = current_role->next; - slapi_notify_condvar(current_role->something_changed, 1); - slapi_unlock_mutex(current_role->change_lock); - - current_role = next_role; + curr_role = roles_list; + while (curr_role) { + slapi_lock_mutex(curr_role->change_lock); + curr_role->keeprunning = 0; + next_role = curr_role->next; + slapi_notify_condvar(curr_role->something_changed, 1); + slapi_unlock_mutex(curr_role->change_lock); + + curr_role = next_role; } /* rebuild a new one */ @@ -457,9 +457,9 @@ roles_cache_trigger_update_suffix(void *handle __attribute__((unused)), char *be } /* Backend back on line or new one created*/ - backend = slapi_be_select_by_instance_name(be_name); - if (backend != NULL) { - be_suffix_dn = slapi_be_getsuffix(backend, 0); + be = slapi_be_select_by_instance_name(be_name); + if (be != NULL) { + be_suffix_dn = slapi_be_getsuffix(be, 0); top_suffix_dn = roles_cache_get_top_suffix((Slapi_DN *)be_suffix_dn); } @@ -1465,13 +1465,13 @@ roles_cache_listroles_ext(vattr_context *c, Slapi_Entry *entry, int return_value roles_cache_def *roles_cache = NULL; int rc = 0; roles_cache_build_result arg; - Slapi_Backend *backend = NULL; + Slapi_Backend *be = NULL; slapi_log_err(SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_listroles\n"); - backend = slapi_mapping_tree_find_backend_for_sdn(slapi_entry_get_sdn(entry)); - if ((backend != NULL) && slapi_be_is_flag_set(backend, SLAPI_BE_FLAG_REMOTE_DATA)) { + be = slapi_mapping_tree_find_backend_for_sdn(slapi_entry_get_sdn(entry)); + if ((be != NULL) && slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) { /* the entry is not local, so don't return anything */ return (-1); } @@ -1671,15 +1671,15 @@ static int roles_cache_find_roles_in_suffix(Slapi_DN *target_entry_dn, roles_cache_def **list_of_roles) { int rc = -1; - Slapi_Backend *backend = NULL; + Slapi_Backend *be = NULL; slapi_log_err(SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_find_roles_in_suffix\n"); *list_of_roles = NULL; - backend = slapi_mapping_tree_find_backend_for_sdn(target_entry_dn); - if ((backend != NULL) && !slapi_be_is_flag_set(backend, SLAPI_BE_FLAG_REMOTE_DATA)) { - Slapi_DN *suffix = roles_cache_get_top_suffix((Slapi_DN *)slapi_be_getsuffix(backend, 0)); + be = slapi_mapping_tree_find_backend_for_sdn(target_entry_dn); + if ((be != NULL) && !slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) { + Slapi_DN *suffix = roles_cache_get_top_suffix((Slapi_DN *)slapi_be_getsuffix(be, 0)); roles_cache_def *current_role = roles_list; /* Go through all the roles list and trigger the associated structure */ diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c index e05ca7f693..36f9be586e 100644 --- a/ldap/servers/plugins/syntaxes/string.c +++ b/ldap/servers/plugins/syntaxes/string.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -342,7 +342,7 @@ string_filter_sub(Slapi_PBlock *pb, char *initial, char **any, char * final, Sla len = bvp->bv_len; if (len < sizeof(buf)) { realval = buf; - strncpy(realval, bvp->bv_val, sizeof(buf)); + strcpy(realval, bvp->bv_val); } else if (len < tmpbufsize) { realval = tmpbuf; strncpy(realval, bvp->bv_val, tmpbufsize); diff --git a/ldap/servers/plugins/usn/usn_cleanup.c b/ldap/servers/plugins/usn/usn_cleanup.c index bdb55e6b18..8b5938350f 100644 --- a/ldap/servers/plugins/usn/usn_cleanup.c +++ b/ldap/servers/plugins/usn/usn_cleanup.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -238,7 +238,7 @@ usn_cleanup_add(Slapi_PBlock *pb, { PRThread *thread = NULL; char *suffix = NULL; - char *backend = NULL; + char *backend_str = NULL; char *maxusn = NULL; char *bind_dn; struct usn_cleanup_data *cleanup_data = NULL; @@ -263,10 +263,10 @@ usn_cleanup_add(Slapi_PBlock *pb, /* get args */ suffix = slapi_entry_attr_get_charptr(e, "suffix"); - backend = (char *)slapi_entry_attr_get_ref(e, "backend"); + backend_str = (char *)slapi_entry_attr_get_ref(e, "backend"); maxusn = slapi_entry_attr_get_charptr(e, "maxusn_to_delete"); - if (!suffix && !backend) { + if (!suffix && !backend_str) { slapi_log_err(SLAPI_LOG_ERR, USN_PLUGIN_SUBSYSTEM, "usn_cleanup_add - Both suffix and backend are missing.\n"); snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, @@ -277,14 +277,14 @@ usn_cleanup_add(Slapi_PBlock *pb, } /* suffix is not given, but backend is; get the suffix */ - if (!suffix && backend) { - be = slapi_be_select_by_instance_name(backend); + if (!suffix && backend_str) { + be = slapi_be_select_by_instance_name(backend_str); be_suffix = slapi_be_getsuffix(be, 0); if (be_suffix) { suffix = slapi_ch_strdup(slapi_sdn_get_ndn(be_suffix)); } else { slapi_log_err(SLAPI_LOG_ERR, USN_PLUGIN_SUBSYSTEM, - "usn_cleanup_add - Backend %s is invalid.\n", backend); + "usn_cleanup_add - Backend %s is invalid.\n", backend_str); *returncode = LDAP_PARAM_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto bail; diff --git a/ldap/servers/slapd/auth.h b/ldap/servers/slapd/auth.h index 7a2744518d..fd442b8d77 100644 --- a/ldap/servers/slapd/auth.h +++ b/ldap/servers/slapd/auth.h @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -16,7 +16,7 @@ #include -void client_auth_init(); +void client_auth_init(void); void handle_handshake_done(PRFileDesc *prfd, void *clientData); int handle_bad_certificate(void *clientData, PRFileDesc *prfd); diff --git a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import_threads.c b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import_threads.c index 905a84e74b..3e7854f383 100644 --- a/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import_threads.c +++ b/ldap/servers/slapd/back-ldbm/db-bdb/bdb_import_threads.c @@ -352,7 +352,7 @@ import_producer(void *param) int str2entry_flags = 0; int finished = 0; int detected_eof = 0; - int fd, curr_file, curr_lineno; + int fd, curr_file, curr_lineno = 0; char *curr_filename = NULL; int idx; ldif_context c; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c index 8ff17a50de..31465bf433 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -58,7 +58,7 @@ ldbm_instance_config_cachesize_get(void *arg) { ldbm_instance *inst = (ldbm_instance *)arg; - return (void *)cache_get_max_entries(&(inst->inst_cache)); + return (void *)((uintptr_t)cache_get_max_entries(&(inst->inst_cache))); } static int @@ -98,7 +98,7 @@ ldbm_instance_config_cachememsize_get(void *arg) { ldbm_instance *inst = (ldbm_instance *)arg; - return (void *)cache_get_max_size(&(inst->inst_cache)); + return (void *)((uintptr_t)cache_get_max_size(&(inst->inst_cache))); } static int @@ -182,7 +182,7 @@ ldbm_instance_config_dncachememsize_get(void *arg) { ldbm_instance *inst = (ldbm_instance *)arg; - return (void *)cache_get_max_size(&(inst->inst_dncache)); + return (void *)((uintptr_t)cache_get_max_size(&(inst->inst_dncache))); } static int diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h index 854e814bea..e8ec431e33 100644 --- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -254,7 +254,7 @@ int64_t idl_compare(IDList *a, IDList *b); /* * idl_set.c */ -IDListSet *idl_set_create(); +IDListSet *idl_set_create(void); void idl_set_destroy(IDListSet *idl_set); void idl_set_insert_idl(IDListSet *idl_set, IDList *idl); void idl_set_insert_complement_idl(IDListSet *idl_set, IDList *idl); diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c index 503de2ca9d..e55161ceb2 100644 --- a/ldap/servers/slapd/backend_manager.c +++ b/ldap/servers/slapd/backend_manager.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -29,20 +29,18 @@ Slapi_Backend * slapi_be_new(const char *type, const char *name, int isprivate, int logchanges) { Slapi_Backend *be; - int i; /* should add some locking here to prevent concurrent access */ if (nbackends == maxbackends) { int oldsize = maxbackends; maxbackends += BACKEND_GRAB_SIZE; backends = (Slapi_Backend **)slapi_ch_realloc((char *)backends, maxbackends * sizeof(Slapi_Backend *)); - for (i = oldsize; i < maxbackends; i++){ + for (size_t i = oldsize; i < maxbackends; i++){ /* init the new be pointers so we can track empty slots */ backends[i] = NULL; } } - be = (Slapi_Backend *)slapi_ch_calloc(1, sizeof(Slapi_Backend)); be->be_lock = slapi_new_rwlock(); be_init(be, type, name, isprivate, logchanges, defsize, deftime); diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c index 8f5327d469..9ed83c773a 100644 --- a/ldap/servers/slapd/dn.c +++ b/ldap/servers/slapd/dn.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -2912,20 +2912,6 @@ static int32_t ndn_enabled = 0; static ARCacheChar *cache = NULL; #endif -static struct ndn_cache * -ndn_thread_cache_create(size_t thread_max_size, size_t slots) { - size_t t_cache_size = sizeof(struct ndn_cache) + (slots * sizeof(struct ndn_cache_value *)); - struct ndn_cache *t_cache = (struct ndn_cache *)slapi_ch_calloc(1, t_cache_size); - -#ifdef RUST_ENABLE - t_cache->cache = cache; -#else - t_cache->max_size = thread_max_size; - t_cache->slots = slots; -#endif - - return t_cache; -} #ifdef RUST_ENABLE #else @@ -3010,10 +2996,11 @@ ndn_thread_cache_value_destroy(struct ndn_cache *t_cache, struct ndn_cache_value } #endif + +#ifndef RUST_ENABLE static void ndn_thread_cache_destroy(void *v_cache) { struct ndn_cache *t_cache = (struct ndn_cache *)v_cache; -#ifndef RUST_ENABLE /* * FREE ALL THE NODES!!! */ @@ -3024,13 +3011,11 @@ ndn_thread_cache_destroy(void *v_cache) { ndn_thread_cache_value_destroy(t_cache, node); node = next_node; } -#endif slapi_ch_free((void **)&t_cache); } -#ifndef RUST_ENABLE static void -ndn_cache_key_init() { +ndn_cache_key_init(void) { if (pthread_key_create(&ndn_cache_key, ndn_thread_cache_destroy) != 0) { /* Log a scary warning? */ slapi_log_err(SLAPI_LOG_ERR, "ndn_cache_init", "Failed to create pthread key, aborting.\n"); @@ -3193,6 +3178,21 @@ ndn_cache_add(char *dn, size_t dn_len, char *ndn, size_t ndn_len) } #else +static struct ndn_cache * +ndn_thread_cache_create(size_t thread_max_size, size_t slots) { + size_t t_cache_size = sizeof(struct ndn_cache) + (slots * sizeof(struct ndn_cache_value *)); + struct ndn_cache *t_cache = (struct ndn_cache *)slapi_ch_calloc(1, t_cache_size); + +#ifdef RUST_ENABLE + t_cache->cache = cache; +#else + t_cache->max_size = thread_max_size; + t_cache->slots = slots; +#endif + + return t_cache; +} + static int ndn_cache_lookup(char *dn, size_t dn_len, char **ndn, char **udn, int *rc) { diff --git a/ldap/servers/slapd/filtercmp.c b/ldap/servers/slapd/filtercmp.c index f7e3ed4d56..7386881b00 100644 --- a/ldap/servers/slapd/filtercmp.c +++ b/ldap/servers/slapd/filtercmp.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -344,7 +344,6 @@ slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2) struct berval *inval1[2], *inval2[2], **outval1, **outval2; int ret; Slapi_Attr sattr; - int cmplen; slapi_log_err(SLAPI_LOG_TRACE, "slapi_filter_compare", "=>\n"); @@ -379,11 +378,11 @@ slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2) if (key1 && key2) { struct berval bvkey1 = { slapi_value_get_length(key1[0]), - slapi_value_get_string(key1[0]) + (char *)slapi_value_get_string(key1[0]) }; struct berval bvkey2 = { slapi_value_get_length(key2[0]), - slapi_value_get_string(key2[0]) + (char *)slapi_value_get_string(key2[0]) }; ret = slapi_berval_cmp(&bvkey1, &bvkey2); } diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c index 5ef20127f5..949e99c5d4 100644 --- a/ldap/servers/slapd/libglobs.c +++ b/ldap/servers/slapd/libglobs.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -146,7 +146,7 @@ char *ldap_srvtab = ""; /* Note that the 'attrname' arguments are used only for log messages */ typedef int (*ConfigSetFunc)(const char *attrname, char *value, char *errorbuf, int apply); typedef int (*LogSetFunc)(const char *attrname, char *value, int whichlog, char *errorbuf, int apply); -typedef void * (*ConfigGenInitFunc)(); +typedef void * (*ConfigGenInitFunc)(void); typedef enum { CONFIG_INT, /* maps to int */ diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 73e1e4c443..9fe103e6dd 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -978,7 +978,7 @@ main(int argc, char **argv) /* log the max fd limit as it is typically set in env/systemd */ slapi_log_err(SLAPI_LOG_INFO, "main", - "Setting the maximum file descriptor limit to: %ld\n", + "Setting the maximum file descriptor limit to: %" PRId64 "\n", config_get_maxdescriptors()); if (mcfg.slapd_exemode != SLAPD_EXEMODE_REFERRAL) { diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c index e8b406ad40..79dbe362c3 100644 --- a/ldap/servers/slapd/mapping_tree.c +++ b/ldap/servers/slapd/mapping_tree.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -881,7 +881,7 @@ mt_suffix_ord_cmp(const void *p1, const void *p2) } static int -mapping_tree_node_build_tree() +mapping_tree_node_build_tree(void) { Slapi_Entry **entries = NULL; char *filter = NULL; @@ -1002,7 +1002,6 @@ mapping_tree_entry_modify_callback(Slapi_PBlock *pb, void *arg __attribute__((unused))) { LDAPMod **mods; - int i; mapping_tree_node *node; Slapi_DN *subtree; Slapi_Attr *attr; @@ -1027,7 +1026,7 @@ mapping_tree_entry_modify_callback(Slapi_PBlock *pb, return SLAPI_DSE_CALLBACK_ERROR; } - for (i = 0; (mods != NULL) && (mods[i] != NULL); i++) { + for (size_t i = 0; (mods != NULL) && (mods[i] != NULL); i++) { if (strcasecmp(mods[i]->mod_type, "cn") == 0) { mapping_tree_node *parent_node; /* if we are deleting this attribute the new parent @@ -1103,9 +1102,9 @@ mapping_tree_entry_modify_callback(Slapi_PBlock *pb, mtn_unlock(); } else if (strcasecmp(mods[i]->mod_type, "nsslapd-state") == 0) { - Slapi_Value *val; + Slapi_Value *state_val; const char *new_state; - Slapi_Attr *attr; + Slapi_Attr *state_attr; /* state change * for now only allow replace @@ -1126,9 +1125,9 @@ mapping_tree_entry_modify_callback(Slapi_PBlock *pb, return SLAPI_DSE_CALLBACK_ERROR; } - slapi_entry_attr_find(entryAfter, "nsslapd-state", &attr); - slapi_attr_first_value(attr, &val); - new_state = slapi_value_get_string(val); + slapi_entry_attr_find(entryAfter, "nsslapd-state", &state_attr); + slapi_attr_first_value(state_attr, &state_val); + new_state = slapi_value_get_string(state_val); if (mtn_state_to_int(new_state, entryAfter) == MTN_BACKEND) { if (slapi_entry_attr_find(entryAfter, "nsslapd-backend", &attr)) { @@ -1143,7 +1142,7 @@ mapping_tree_entry_modify_callback(Slapi_PBlock *pb, if ((mtn_state_to_int(new_state, entryAfter) == MTN_REFERRAL) || (mtn_state_to_int(new_state, entryAfter) == MTN_REFERRAL_ON_UPDATE)) { - if (slapi_entry_attr_find(entryAfter, "nsslapd-referral", &attr)) { + if (slapi_entry_attr_find(entryAfter, "nsslapd-referral", &state_attr)) { PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "need to set nsslapd-referral before moving to referral state\n"); slapi_sdn_free(&subtree); slapi_ch_free_string(&plugin_fct); @@ -1434,7 +1433,6 @@ mapping_tree_entry_delete_callback(Slapi_PBlock *pb __attribute__((unused)), int result = SLAPI_DSE_CALLBACK_OK; mapping_tree_node *node = NULL; Slapi_DN *subtree; - int i; int removed = 0; mtn_wlock(); @@ -1504,9 +1502,9 @@ mapping_tree_entry_delete_callback(Slapi_PBlock *pb __attribute__((unused)), * We can not delete the default naming attribute, so instead * replace it only if there is another suffix available */ - void *node = NULL; + void *suffix_node = NULL; Slapi_DN *sdn; - sdn = slapi_get_first_suffix(&node, 0); + sdn = slapi_get_first_suffix(&suffix_node, 0); if (sdn) { char *replacement_suffix = (char *)slapi_sdn_get_dn(sdn); int rc = _mtn_update_config_param(LDAP_MOD_REPLACE, @@ -1544,9 +1542,9 @@ mapping_tree_entry_delete_callback(Slapi_PBlock *pb __attribute__((unused)), * most of the plugins will try to search upon this notification * and should we keep the lock we would end with a dead-lock */ - for (i = 0; ((i < node->mtn_be_count) && (node->mtn_backend_names) && - (node->mtn_backend_names[i])); - i++) { + for (size_t i = 0; ((i < node->mtn_be_count) && (node->mtn_backend_names) && + (node->mtn_backend_names[i])); i++) + { if ((node->mtn_be_states[i] != SLAPI_BE_STATE_DELETE) && (NULL != slapi_be_select_by_instance_name( node->mtn_backend_names[i]))) { @@ -2080,13 +2078,11 @@ slapi_mapping_tree_select(Slapi_PBlock *pb, Slapi_Backend **be, Slapi_Entry **re int op_type; int fixup = 0; - if (slapi_atomic_load_32(&mapping_tree_freed, __ATOMIC_RELAXED)) { /* shutdown detected */ return LDAP_OPERATIONS_ERROR; } - if (errorbuf) { errorbuf[0] = '\0'; } @@ -2149,12 +2145,12 @@ slapi_mapping_tree_select(Slapi_PBlock *pb, Slapi_Backend **be, Slapi_Entry **re (((*be)->be_readonly && !fixup) || ((slapi_config_get_readonly() && !fixup) && !slapi_be_private(*be)))) { - unsigned long op_type = operation_get_type(op); + unsigned long be_op_type = operation_get_type(op); - if ((op_type != SLAPI_OPERATION_SEARCH) && - (op_type != SLAPI_OPERATION_COMPARE) && - (op_type != SLAPI_OPERATION_BIND) && - (op_type != SLAPI_OPERATION_UNBIND)) { + if ((be_op_type != SLAPI_OPERATION_SEARCH) && + (be_op_type != SLAPI_OPERATION_COMPARE) && + (be_op_type != SLAPI_OPERATION_BIND) && + (be_op_type != SLAPI_OPERATION_UNBIND)) { if (errorbuf) { PL_strncpyz(errorbuf, slapi_config_get_readonly() ? "Server is read-only" : "database is read-only", ebuflen); } diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c index 61b9e50cb4..4f4210435e 100644 --- a/ldap/servers/slapd/opshared.c +++ b/ldap/servers/slapd/opshared.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -979,12 +979,12 @@ op_shared_search(Slapi_PBlock *pb, int send_result) } else { /* Manage DSA was set, referral must be sent as an entry */ int attrsonly; - char **attrs = NULL; + char **dsa_attrs = NULL; - slapi_pblock_get(pb, SLAPI_SEARCH_ATTRS, &attrs); + slapi_pblock_get(pb, SLAPI_SEARCH_ATTRS, &dsa_attrs); slapi_pblock_get(pb, SLAPI_SEARCH_ATTRSONLY, &attrsonly); slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, referral); - switch (send_ldap_search_entry(pb, referral, NULL, attrs, attrsonly)) { + switch (send_ldap_search_entry(pb, referral, NULL, dsa_attrs, attrsonly)) { case 0: flag_search_base_found++; nentries++; diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 1dec338489..8e0b0de87d 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -2902,8 +2902,8 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group, slapi_p if (!status && group) /* uses group's config; see plugin_get_config */ { - struct slapi_componentid *cid = (struct slapi_componentid *)group; - plugin->plg_group = (struct slapdplugin *)cid->sci_plugin; + struct slapi_componentid *group_cid = (struct slapi_componentid *)group; + plugin->plg_group = (struct slapdplugin *)group_cid->sci_plugin; } else if (!status) /* using own config */ { plugin_config_init(&(plugin->plg_conf)); diff --git a/ldap/servers/slapd/protect_db.c b/ldap/servers/slapd/protect_db.c index b36e440c30..c723b919fb 100644 --- a/ldap/servers/slapd/protect_db.c +++ b/ldap/servers/slapd/protect_db.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -194,17 +194,16 @@ make_sure_dir_exists(char *dir) static void add_this_process_to(char *dir_name) { - char file_name[MAXPATHLEN]; + char *file_name; struct passwd *pw; struct stat stat_buffer; PRFileDesc *prfd; slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig(); - snprintf(file_name, sizeof(file_name), "%s/%d", dir_name, getpid()); - file_name[sizeof(file_name) - 1] = (char)0; - + file_name = PR_smprintf("%s/%d", dir_name, getpid()); if ((prfd = PR_Open(file_name, PR_RDWR | PR_CREATE_FILE, 0644)) == NULL) { slapi_log_err(SLAPI_LOG_WARNING, "add_this_process_to", FILE_CREATE_WARNING, file_name); + slapi_ch_free_string(&file_name); return; } @@ -219,6 +218,7 @@ add_this_process_to(char *dir_name) } } } + slapi_ch_free_string(&file_name); PR_Close(prfd); } diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index d624fca0cd..d585a5044a 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -108,8 +108,8 @@ struct asyntaxinfo *attr_syntax_get_global_at(void); struct asyntaxinfo *attr_syntax_find(struct asyntaxinfo *at1, struct asyntaxinfo *at2); void attr_syntax_swap_ht(void); /* - * Call attr_syntax_return() when you are done using a value returned - * by attr_syntax_get_by_oid() or attr_syntax_get_by_name(). + * Call attr_syntax_return(void) when you are done using a value returned + * by attr_syntax_get_by_oid(void) or attr_syntax_get_by_name(void). */ void attr_syntax_return(struct asyntaxinfo *asi); void attr_syntax_return_locking_optional(struct asyntaxinfo *asi, PRBool use_lock); @@ -606,12 +606,12 @@ int32_t config_get_enable_upgrade_hash(void); int32_t config_set_enable_upgrade_hash(const char *attrname, char *value, char *errorbuf, int apply); -int32_t config_get_enable_ldapssotoken(); +int32_t config_get_enable_ldapssotoken(void); int32_t config_set_enable_ldapssotoken(const char *attrname, char *value, char *errorbuf, int apply); -char * config_get_ldapssotoken_secret(); +char * config_get_ldapssotoken_secret(void); int32_t config_set_ldapssotoken_secret(const char *attrname, char *value, char *errorbuf, int apply); int32_t config_set_ldapssotoken_ttl(const char *attrname, char *value, char *errorbuf, int apply); -int32_t config_get_ldapssotoken_ttl(); +int32_t config_get_ldapssotoken_ttl(void); int is_abspath(const char *); @@ -1071,13 +1071,13 @@ int read_schema_dse(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry *ent void oc_lock_read(void); void oc_lock_write(void); void oc_unlock(void); -/* Note: callers of g_get_global_oc_nolock() must hold a read or write lock */ +/* Note: callers of g_get_global_oc_nolock(void) must hold a read or write lock */ struct objclass *g_get_global_oc_nolock(void); -/* Note: callers of g_set_global_oc_nolock() must hold a write lock */ +/* Note: callers of g_set_global_oc_nolock(void) must hold a write lock */ void g_set_global_oc_nolock(struct objclass *newglobaloc); -/* Note: callers of g_get_global_schema_csn() must hold a read lock */ +/* Note: callers of g_get_global_schema_csn(void) must hold a read lock */ const CSN *g_get_global_schema_csn(void); -/* Note: callers of g_set_global_schema_csn() must hold a write lock. */ +/* Note: callers of g_set_global_schema_csn(void) must hold a write lock. */ /* csn is consumed. */ void g_set_global_schema_csn(CSN *csn); void slapi_schema_expand_objectclasses(Slapi_Entry *e); @@ -1096,7 +1096,7 @@ void supplier_learn_new_definitions(struct berval **objectclasses, struct berval */ void normalize_oc(void); void normalize_oc_nolock(void); -/* Note: callers of oc_update_inheritance_nolock() must hold a write lock */ +/* Note: callers of oc_update_inheritance_nolock(void) must hold a write lock */ void oc_update_inheritance_nolock(struct objclass *oc); /* @@ -1108,7 +1108,7 @@ void do_search(Slapi_PBlock *pb); /* * ssl.c */ -char *check_private_certdir(); +char *check_private_certdir(void); int slapd_nss_init(int init_ssl, int config_available); int slapd_ssl_init(void); int slapd_ssl_init2(PRFileDesc **fd, int startTLS); @@ -1458,10 +1458,10 @@ void subentry_create_filter(Slapi_Filter **filter); */ void vattr_init(void); void vattr_global_lock_create(void); -void vattr_rdlock(); -void vattr_rd_unlock(); -void vattr_wrlock(); -void vattr_wr_unlock(); +void vattr_rdlock(void); +void vattr_rd_unlock(void); +void vattr_wrlock(void); +void vattr_wr_unlock(void); void vattr_cleanup(void); /* diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c index d0c86949c9..b5c6eefc40 100644 --- a/ldap/servers/slapd/pw.c +++ b/ldap/servers/slapd/pw.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2018 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -1649,8 +1649,8 @@ add_password_attrs(Slapi_PBlock *pb, Operation *op __attribute__((unused)), Slap if (!strcasecmp((*a)->a_type, "passwordexpirationtime")) { Slapi_Value *sval; if (slapi_attr_first_value(*a, &sval) == 0) { - const struct berval *bv = slapi_value_get_berval(sval); - existing_exptime = parse_genTime(bv->bv_val); + const struct berval *pw_bv = slapi_value_get_berval(sval); + existing_exptime = parse_genTime(pw_bv->bv_val); } has_expirationtime = 1; @@ -1942,9 +1942,9 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn) /* If we already allocated a pw policy, return it */ if (pb != NULL) { - passwdPolicy *pwdpolicy = slapi_pblock_get_pwdpolicy(pb); - if (pwdpolicy != NULL) { - return pwdpolicy; + passwdPolicy *existing_pwdpolicy = slapi_pblock_get_pwdpolicy(pb); + if (existing_pwdpolicy != NULL) { + return existing_pwdpolicy; } } @@ -2039,11 +2039,11 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn) } if (e) { - Slapi_Attr *attr = NULL; - rc = slapi_entry_attr_find(e, "pwdpolicysubentry", &attr); - if (attr && (0 == rc)) { + Slapi_Attr *e_attr = NULL; + rc = slapi_entry_attr_find(e, "pwdpolicysubentry", &e_attr); + if (e_attr && (0 == rc)) { /* If the entry has pwdpolicysubentry, use the PwPolicy. */ - values = valueset_dup(&attr->a_present_values); + values = valueset_dup(&e_attr->a_present_values); } else { /* Otherwise, retrieve the policy from CoS Cache */ rc = slapi_vattr_values_get(e, "pwdpolicysubentry", &values, diff --git a/ldap/servers/slapd/pw_verify.c b/ldap/servers/slapd/pw_verify.c index 2615aa11f1..20ec332119 100644 --- a/ldap/servers/slapd/pw_verify.c +++ b/ldap/servers/slapd/pw_verify.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2016 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -108,7 +108,7 @@ pw_verify_token_dn(Slapi_PBlock *pb) { slapi_pblock_get(pb, SLAPI_BIND_CREDENTIALS, &cred); slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &sdn); - char *dn = slapi_sdn_get_dn(sdn); + char *dn = (char *)slapi_sdn_get_dn(sdn); char *key = config_get_ldapssotoken_secret(); uint64_t tok_ttl = (uint64_t)config_get_ldapssotoken_ttl(); diff --git a/ldap/servers/slapd/security_wrappers.c b/ldap/servers/slapd/security_wrappers.c index 9c63318347..27cdf2f1a7 100644 --- a/ldap/servers/slapd/security_wrappers.c +++ b/ldap/servers/slapd/security_wrappers.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -231,8 +231,8 @@ slapd_pk11_setSlotPWValues(PK11SlotInfo *slot, int askpw, int timeout) * One can imagine to set NSS ON when system FIPS is OFF but it makes no real sense */ #define FIPS_ENABLED "/proc/sys/crypto/fips_enabled" -PRBool -slapd_system_isFIPS() +static PRBool +slapd_system_isFIPS(void) { PRBool rc = PR_FALSE; PRFileDesc *prfd; diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index afecb94088..d532851afd 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -1,6 +1,6 @@ /* BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. * All rights reserved. * @@ -8422,7 +8422,7 @@ int32_t slapi_atomic_decr_32(int32_t *ptr, int memorder); uint64_t slapi_atomic_decr_64(uint64_t *ptr, int memorder); /* helper function */ -const char * slapi_fetch_attr(Slapi_Entry *e, const char *attrname, char *default_val); +const char * slapi_fetch_attr(Slapi_Entry *e, char *attrname, char *default_val); /** * Get a Slapi_Entry via an internal search. The caller then needs to call diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index 1990d7a2e6..5e5600c6eb 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * Copyright (C) 2020 William Brown * All rights reserved. * @@ -1378,7 +1378,7 @@ int slapi_client_uses_non_nss(LDAP *ld); int slapi_client_uses_openssl(LDAP *ld); /* rewriters.c */ -int32_t rewriters_init(); +int32_t rewriters_init(void); /* ssl.c */ /* diff --git a/ldap/servers/slapd/slapi_pal.c b/ldap/servers/slapd/slapi_pal.c index f658d461eb..2cf57b38af 100644 --- a/ldap/servers/slapd/slapi_pal.c +++ b/ldap/servers/slapd/slapi_pal.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2017 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -124,7 +124,7 @@ _spal_dir_exist(char *path) } static char * -_spal_cgroupv2_path() { +_spal_cgroupv2_path(void) { FILE *f; char s[MAXPATHLEN + 1] = {0}; char *res = NULL; diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c index 672726f9c3..3b9b75b810 100644 --- a/ldap/servers/slapd/task.c +++ b/ldap/servers/slapd/task.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1071,8 +1071,8 @@ task_import_add(Slapi_PBlock *pb __attribute__((unused)), slapi_pblock_set(mypb, SLAPI_TASK_FLAGS, &task_flags); if (NULL != encrypt_on_import && 0 == strcasecmp(encrypt_on_import, "true")) { - int32_t encrypt_on_import = 1; - slapi_pblock_set(mypb, SLAPI_LDIF2DB_ENCRYPT, &encrypt_on_import); + int32_t encrypt_import = 1; + slapi_pblock_set(mypb, SLAPI_LDIF2DB_ENCRYPT, &encrypt_import); } rv = (be->be_database->plg_ldif2db)(mypb); @@ -1435,8 +1435,8 @@ task_export_add(Slapi_PBlock *pb __attribute__((unused)), int32_t task_flags = SLAPI_TASK_RUNNING_AS_TASK; slapi_pblock_set(mypb, SLAPI_TASK_FLAGS, &task_flags); if (NULL != decrypt_on_export && 0 == strcasecmp(decrypt_on_export, "true")) { - int32_t decrypt_on_export = 1; - slapi_pblock_set(mypb, SLAPI_DB2LDIF_DECRYPT, &decrypt_on_export); + int32_t decrypt_export = 1; + slapi_pblock_set(mypb, SLAPI_DB2LDIF_DECRYPT, &decrypt_export); } /* start the export as a separate thread */ @@ -2459,7 +2459,7 @@ task_fixup_tombstones_add(Slapi_PBlock *pb, struct task_tombstone_data *task_data = NULL; const Slapi_DN *base_sdn = NULL; PRThread *thread = NULL; - char **backend = NULL; + char **backend_list = NULL; char **suffix = NULL; char **base = NULL; const char *stripcsn = NULL; @@ -2485,22 +2485,22 @@ task_fixup_tombstones_add(Slapi_PBlock *pb, } } } - if ((backend = slapi_entry_attr_get_charray(e, TASK_TOMBSTONE_FIXUP_BACKEND))) { - for (i = 0; backend && backend[i]; i++) { - if ((be = slapi_be_select_by_instance_name(backend[i]))) { + if ((backend_list = slapi_entry_attr_get_charray(e, TASK_TOMBSTONE_FIXUP_BACKEND))) { + for (i = 0; backend_list && backend_list[i]; i++) { + if ((be = slapi_be_select_by_instance_name(backend_list[i]))) { if ((base_sdn = slapi_be_getsuffix(be, 0))) { slapi_ch_array_add(&base, slapi_ch_strdup(slapi_sdn_get_ndn(base_sdn))); } else { /* failed to get a suffix */ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, - "Failed to find a suffix for the backend(%s)\n", backend[i]); + "Failed to find a suffix for the backend(%s)\n", backend_list[i]); *returncode = LDAP_UNWILLING_TO_PERFORM; goto done; } } else { /* Failed to find a backend */ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, - "Failed to find a backend using (%s)\n", backend[i]); + "Failed to find a backend using (%s)\n", backend_list[i]); *returncode = LDAP_UNWILLING_TO_PERFORM; goto done; } @@ -2559,7 +2559,7 @@ task_fixup_tombstones_add(Slapi_PBlock *pb, done: slapi_ch_array_free(suffix); - slapi_ch_array_free(backend); + slapi_ch_array_free(backend_list); if (*returncode != LDAP_SUCCESS) { return SLAPI_DSE_CALLBACK_ERROR; diff --git a/ldap/servers/slapd/tools/ldclt/data.c b/ldap/servers/slapd/tools/ldclt/data.c index 9576b10f21..da17c897d0 100644 --- a/ldap/servers/slapd/tools/ldclt/data.c +++ b/ldap/servers/slapd/tools/ldclt/data.c @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -231,14 +231,14 @@ loadImages( *****************************************************************************/ int getImage( - LDAPMod *attribute) + LDAPMod *attr) { int imageNumber; /* The image we will select */ int ret; /* Return value */ /* - * Select the next image - */ + * Select the next image + */ if ((ret = ldclt_mutex_lock(&(mctx.imagesLast_mutex))) != 0) /*JLS 29-11-00*/ { fprintf(stderr, @@ -260,34 +260,34 @@ getImage( } /* - * Create the data structure required - */ - attribute->mod_bvalues = (struct berval **) + * Create the data structure required + */ + attr->mod_bvalues = (struct berval **) malloc(2 * sizeof(struct berval *)); - if (attribute->mod_bvalues == NULL) /*JLS 06-03-00*/ + if (attr->mod_bvalues == NULL) /*JLS 06-03-00*/ { /*JLS 06-03-00*/ printf("Error: cannot malloc(attribute->mod_bvalues), error=%d (%s)\n", errno, strerror(errno)); /*JLS 06-03-00*/ return (-1); /*JLS 06-03-00*/ } /*JLS 06-03-00*/ - attribute->mod_bvalues[0] = (struct berval *)malloc(sizeof(struct berval)); - if (attribute->mod_bvalues[0] == NULL) /*JLS 06-03-00*/ + attr->mod_bvalues[0] = (struct berval *)malloc(sizeof(struct berval)); + if (attr->mod_bvalues[0] == NULL) /*JLS 06-03-00*/ { /*JLS 06-03-00*/ printf("Error: cannot malloc(attribute->mod_bvalues[0]), error=%d (%s)\n", errno, strerror(errno)); /*JLS 06-03-00*/ return (-1); /*JLS 06-03-00*/ } /*JLS 06-03-00*/ - attribute->mod_bvalues[1] = NULL; + attr->mod_bvalues[1] = NULL; /* - * Fill the bvalue with the image data - */ - attribute->mod_bvalues[0]->bv_len = mctx.images[imageNumber].length; - attribute->mod_bvalues[0]->bv_val = mctx.images[imageNumber].data; + * Fill the bvalue with the image data + */ + attr->mod_bvalues[0]->bv_len = mctx.images[imageNumber].length; + attr->mod_bvalues[0]->bv_val = mctx.images[imageNumber].data; /* - * Normal end - */ + * Normal end + */ return (0); } diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c index 8ed83cc20b..f310eb3c90 100644 --- a/ldap/servers/slapd/tools/ldclt/ldapfct.c +++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -676,7 +676,7 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass ((!(binded)) || (mode & BIND_EACH_OPER))) { struct berval *servercredp = NULL; const char *binddn = NULL; - const char *passwd = NULL; + const char *pwd = NULL; if (tttctx && (buildNewBindDN(tttctx) < 0)) { /*JLS 05-01-01*/ ret = -1; @@ -684,29 +684,29 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass } if (tttctx && tttctx->bufPasswd) { binddn = tttctx->bufBindDN; - passwd = tttctx->bufPasswd; + pwd = tttctx->bufPasswd; } else if (bufPasswd) { binddn = bufBindDN; - passwd = bufPasswd; + pwd = bufPasswd; } else if (mctx.passwd) { binddn = mctx.bindDN; - passwd = mctx.passwd; + pwd = mctx.passwd; } if (passwd) { - cred.bv_val = (char *)passwd; - cred.bv_len = strlen(passwd); + cred.bv_val = (char *)pwd; + cred.bv_len = strlen(pwd); } if (mode & VERY_VERBOSE) printf("ldclt[%d]: T%03d: Before ldap_simple_bind_s (%s, %s)\n", mctx.pid, thrdNum, binddn ? binddn : "Anonymous", - passwd ? passwd : "NO PASSWORD PROVIDED"); + pwd ? pwd : "NO PASSWORD PROVIDED"); ret = ldap_sasl_bind_s(ld, binddn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, &servercredp); /*JLS 05-01-01*/ ber_bvfree(servercredp); if (mode & VERY_VERBOSE) printf("ldclt[%d]: T%03d: After ldap_simple_bind_s (%s, %s)\n", mctx.pid, thrdNum, binddn, - passwd ? passwd : "NO PASSWORD PROVIDED"); + pwd ? pwd : "NO PASSWORD PROVIDED"); if (ret == LDAP_SUCCESS) { /*JLS 18-12-00*/ if (tttctx) { tttctx->binded = 1; /*JLS 18-12-00*/ @@ -719,7 +719,7 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass if (!(mode & QUIET)) { /*JLS 18-12-00*/ printf("ldclt[%d]: T%03d: Cannot ldap_simple_bind_s (%s, %s), error=%d (%s)\n", mctx.pid, thrdNum, binddn, - passwd ? passwd : "NO PASSWORD PROVIDED", + pwd ? pwd : "NO PASSWORD PROVIDED", ret, my_ldap_err2string(ret)); fflush(stdout); /*JLS 18-12-00*/ } /*JLS 18-12-00*/ @@ -732,7 +732,7 @@ connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPass } else { /*JLS 18-12-00*/ printf("ldclt[%d]: T%03d: Cannot ldap_simple_bind_s (%s, %s), error=%d (%s)\n", mctx.pid, thrdNum, binddn, - passwd ? passwd : "NO PASSWORD PROVIDED", + pwd ? pwd : "NO PASSWORD PROVIDED", ret, my_ldap_err2string(ret)); fflush(stdout); /*JLS 18-12-00*/ if (tttctx) @@ -1293,13 +1293,13 @@ buildNewModAttribFile( char *newDn, LDAPMod **attrs) { - int nbAttribs; /* Nb of attributes */ - LDAPMod attribute; /* To build the attributes */ + int nbAttribs; /* Nb of attributes */ + LDAPMod attr; /* To build the attributes */ struct berval *bv = malloc(sizeof(struct berval)); - attribute.mod_bvalues = (struct berval **)malloc(2 * sizeof(struct berval *)); + attr.mod_bvalues = (struct berval **)malloc(2 * sizeof(struct berval *)); int rc = 0; - if ((bv == NULL) || (attribute.mod_bvalues == NULL)) { + if ((bv == NULL) || (attr.mod_bvalues == NULL)) { rc = -1; goto error; } @@ -1326,12 +1326,12 @@ buildNewModAttribFile( bv->bv_val = mctx.attrplFileContent; attrs[0] = NULL; /* No attributes yet */ nbAttribs = 0; /* No attributes yet */ - attribute.mod_op = LDAP_MOD_REPLACE | LDAP_MOD_BVALUES; - attribute.mod_type = mctx.attrplName; - attribute.mod_bvalues[0] = bv; - attribute.mod_bvalues[1] = NULL; + attr.mod_op = LDAP_MOD_REPLACE | LDAP_MOD_BVALUES; + attr.mod_type = mctx.attrplName; + attr.mod_bvalues[0] = bv; + attr.mod_bvalues[1] = NULL; - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) { + if (addAttrib(attrs, nbAttribs++, &attr) < 0) { rc = -1; goto error; } @@ -1342,8 +1342,8 @@ buildNewModAttribFile( if (bv != NULL) { free(bv); } - if (attribute.mod_bvalues != NULL) { - free(attribute.mod_bvalues); + if (attr.mod_bvalues != NULL) { + free(attr.mod_bvalues); } done: @@ -1368,7 +1368,7 @@ buildNewModAttrib( LDAPMod **attrs) { int nbAttribs; /* Nb of attributes */ - LDAPMod attribute; /* To build the attributes */ + LDAPMod attr; /* To build the attributes */ /* * Build the new DN @@ -1387,10 +1387,10 @@ buildNewModAttrib( */ attrs[0] = NULL; /* No attributes yet */ nbAttribs = 0; /* No attributes yet */ - attribute.mod_op = LDAP_MOD_REPLACE; - attribute.mod_type = mctx.attrplName; - attribute.mod_values = strList1(tttctx->bufAttrpl); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_REPLACE; + attr.mod_type = mctx.attrplName; + attr.mod_values = strList1(tttctx->bufAttrpl); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); /* @@ -1416,10 +1416,10 @@ buildVersatileObject( vers_object *object, LDAPMod **attrs) { - int nbAttribs; /* Nb of attributes */ - LDAPMod attribute; /* To build the attributes */ - int i; /* For the loop */ - char *newValue; /* New values for the attributes */ + int nbAttribs; /* Nb of attributes */ + LDAPMod attr; /* To build the attributes */ + int i; /* For the loop */ + char *newValue; /* New values for the attributes */ /* * Initialization @@ -1436,25 +1436,25 @@ buildVersatileObject( tttctx->buf2[i] = tttctx->bufFilter[i]; tttctx->buf2[i] = '\0'; strcpy(tttctx->bufObject1, tttctx->buf2); - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = tttctx->bufObject1; - attribute.mod_values = strList1(&(tttctx->bufFilter[i + 1])); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = tttctx->bufObject1; + attr.mod_values = strList1(&(tttctx->bufFilter[i + 1])); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); /* * We are certain that there is enough space in attrs */ for (i = 0; i < object->attribsNb; i++) { - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = object->attribs[i].name; + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = object->attribs[i].name; newValue = buildVersatileAttribute(tttctx, object, &(object->attribs[i])); if (newValue == NULL) return (-1); - attribute.mod_values = strList1(newValue); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_values = strList1(newValue); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); } @@ -1478,9 +1478,9 @@ buildNewEntry( char *newDn, LDAPMod **attrs) { - int nbAttribs; /* Nb of attributes */ - LDAPMod attribute; /* To build the attributes */ - int i; /* To loop */ + int nbAttribs; /* Nb of attributes */ + LDAPMod attr; /* To build the attributes */ + int i; /* To loop */ /* * Build the new DN @@ -1527,21 +1527,24 @@ buildNewEntry( */ attrs[0] = NULL; /* No attributes yet */ nbAttribs = 0; /* No attributes yet */ - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = "objectclass"; - attribute.mod_values = NULL; - if (mctx.mode & OC_PERSON) - attribute.mod_values = strList1("person"); - if (mctx.mode & OC_EMAILPERSON) - attribute.mod_values = strList1("emailPerson"); - if (mctx.mode & OC_INETORGPRSON) /*JLS 07-11-00*/ - attribute.mod_values = strList1("inetOrgPerson"); /*JLS 07-11-00*/ - if (attribute.mod_values == NULL) { + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = "objectclass"; + attr.mod_values = NULL; + if (mctx.mode & OC_PERSON) { + attr.mod_values = strList1("person"); + } + if (mctx.mode & OC_EMAILPERSON) { + attr.mod_values = strList1("emailPerson"); + } + if (mctx.mode & OC_INETORGPRSON) { + attr.mod_values = strList1("inetOrgPerson"); + } + if (attr.mod_values == NULL) { printf("ldclt[%d]: T%03d: attribute objectclass not defined (supported values are person/emailPerson/inetOrgPerson)\n", - mctx.pid, tttctx->thrdNum); + mctx.pid, tttctx->thrdNum); return -1; } - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); /* @@ -1552,10 +1555,10 @@ buildNewEntry( for (i = 0; tttctx->bufFilter[i] != '='; i++) tttctx->buf2[i] = tttctx->bufFilter[i]; tttctx->buf2[i] = '\0'; - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = tttctx->buf2; - attribute.mod_values = strList1(&(tttctx->bufFilter[i + 1])); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = tttctx->buf2; + attr.mod_values = strList1(&(tttctx->bufFilter[i + 1])); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); /* @@ -1564,25 +1567,25 @@ buildNewEntry( if (mctx.mode & (OC_PERSON | OC_EMAILPERSON | OC_INETORGPRSON)) /*JLS 07-11-00*/ { if (strcmp(tttctx->buf2, "cn")) { - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = "cn"; - attribute.mod_values = strList1("toto cn"); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = "cn"; + attr.mod_values = strList1("toto cn"); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); } if (strcmp(tttctx->buf2, "sn")) { - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = "sn"; - attribute.mod_values = strList1("toto sn"); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = "sn"; + attr.mod_values = strList1("toto sn"); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); } if ((mctx.mode & OC_INETORGPRSON) && (mctx.mod2 & M2_DEREF)) { - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = LDCLT_DEREF_ATTR; + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = LDCLT_DEREF_ATTR; /* refer itself */ - attribute.mod_values = strList1(newDn); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_values = strList1(newDn); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); } } @@ -1592,11 +1595,11 @@ buildNewEntry( */ if (mctx.mode & (OC_EMAILPERSON | OC_INETORGPRSON)) /*JLS 07-11-00*/ { - attribute.mod_op = (LDAP_MOD_ADD | LDAP_MOD_BVALUES); - attribute.mod_type = "jpegPhoto"; - if (getImage(&attribute) < 0) + attr.mod_op = (LDAP_MOD_ADD | LDAP_MOD_BVALUES); + attr.mod_type = "jpegPhoto"; + if (getImage(&attr) < 0) return (-1); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); } @@ -1646,7 +1649,7 @@ createMissingNodes( char attrVal[256]; /* nodeDN's rdn attribute value */ char *objClass; /* Object class to create */ int nbAttribs; /* Nb of attributes */ - LDAPMod attribute; /* To build the attributes */ + LDAPMod attr; /* To build the attributes */ LDAPMod *attrs[4]; /* Attributes of this entry */ /* @@ -1750,15 +1753,15 @@ createMissingNodes( */ attrs[0] = NULL; /* No attributes yet */ nbAttribs = 0; /* No attributes yet */ - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = "objectclass"; - attribute.mod_values = strList1(objClass); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = "objectclass"; + attr.mod_values = strList1(objClass); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); - attribute.mod_op = LDAP_MOD_ADD; - attribute.mod_type = attrName; - attribute.mod_values = strList1(attrVal); - if (addAttrib(attrs, nbAttribs++, &attribute) < 0) + attr.mod_op = LDAP_MOD_ADD; + attr.mod_type = attrName; + attr.mod_values = strList1(attrVal); + if (addAttrib(attrs, nbAttribs++, &attr) < 0) return (-1); /* @@ -2369,9 +2372,9 @@ ldclt_write_genldif( ldclt_flush_genldif(); /* - * Add to the buffer - */ - strncpy(ldclt_write_genldif_pt, str, lgth); + * Add to the buffer + */ + memcpy(ldclt_write_genldif_pt, str, lgth); ldclt_write_genldif_pt += lgth; ldclt_write_genldif_nb += lgth; } diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.c b/ldap/servers/slapd/tools/ldclt/ldclt.c index 586a14713e..5753894388 100644 --- a/ldap/servers/slapd/tools/ldclt/ldclt.c +++ b/ldap/servers/slapd/tools/ldclt/ldclt.c @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -178,7 +178,6 @@ copyVersObject( vers_object *srcobj) { vers_object *newobj; /* New object */ - int i; /* For the loops */ /* * Copy the object and initiates the buffers... @@ -190,7 +189,7 @@ copyVersObject( /* * Initiates the variables */ - for (i = 0; i + VAR_MIN < VAR_MAX; i++) + for (size_t i = 0; i + VAR_MIN < VAR_MAX; i++) if (srcobj->var[i] == NULL) newobj->var[i] = NULL; else @@ -209,7 +208,7 @@ copyVersObject( /* * Copy each attribute */ - for (i = 0; i < srcobj->attribsNb; i++) + for (size_t i = 0; i < srcobj->attribsNb; i++) if (copyVersAttribute(&(srcobj->attribs[i]), &(newobj->attribs[i])) < 0) return (NULL); @@ -1161,7 +1160,7 @@ basicInit(void) return (-1); } - strncpy(mctx.attRefDef, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1)); + memcpy(mctx.attRefDef, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1)); mctx.attRefDef[strlen(mctx.attrpl + i + 1)] = '\0'; } @@ -1190,7 +1189,7 @@ basicInit(void) return (-1); } - strncpy(mctx.attrplFile, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1)); + memcpy(mctx.attrplFile, mctx.attrpl + i + 1, strlen(mctx.attrpl + i + 1)); mctx.attrplFile[strlen(mctx.attrpl + i + 1)] = '\0'; /* @@ -2165,11 +2164,11 @@ decodeExecParams( /* **************************************************************************** - FUNCTION : buildArgListString + FUNCTION : buildArgListString PURPOSE : Saved the arguments of ldclt into a string. - INPUT : argc, argv - OUTPUT : None. - RETURN : The resulting string. + INPUT : argc, argv + OUTPUT : None. + RETURN : The resulting string. DESCRIPTION : *****************************************************************************/ char * @@ -2182,8 +2181,8 @@ buildArgListString( int i; /* For the loops */ /* - * Compute the length - */ + * Compute the length + */ lgth = 0; for (i = 0; i < argc; i++) { lgth += strlen(argv[i]) + 1; @@ -2192,7 +2191,9 @@ buildArgListString( } argvList = (char *)malloc(lgth); argvList[0] = '\0'; - strcat(argvList, argv[0]); + if (argv && argv[0]) { + strcat(argvList, argv[0]); + } for (i = 1; i < argc; i++) { strcat(argvList, " "); if ((strchr(argv[i], ' ') == NULL) && (strchr(argv[i], '\t') == NULL)) @@ -2204,7 +2205,6 @@ buildArgListString( } } - return (argvList); } @@ -2223,7 +2223,6 @@ main( char **argv) { int opt_ret; /* For getopt() */ - int i; /* For the loops */ time_t tim; /* For time() */ /*JLS 18-08-00*/ char *argvList; /* To keep track in core files */ /*JLS 07-12-00*/ int found; /* General purpose variable */ /*JLS 18-12-00*/ @@ -2298,7 +2297,7 @@ main( */ mctx.object.attribsNb = 0; /*JLS 23-03-01*/ mctx.object.rdn = NULL; /*JLS 23-03-01*/ - for (i = 0; i + VAR_MIN < VAR_MAX; i++) /*JLS 23-03-01*/ + for (size_t i = 0; i + VAR_MIN < VAR_MAX; i++) mctx.object.var[i] = NULL; /*JLS 23-03-01*/ /* @@ -2339,7 +2338,7 @@ main( break; case 'I': found = 0; /*JLS 18-12-00*/ - for (i = 0; i < mctx.ignErrNb; i++) /*JLS 18-12-00*/ + for (size_t i = 0; i < mctx.ignErrNb; i++) if (mctx.ignErr[i] == atoi(optarg)) /*JLS 18-12-00*/ found = 1; /*JLS 18-12-00*/ if (found) /*JLS 18-12-00*/ @@ -2547,6 +2546,7 @@ main( } if (mctx.filter != NULL) /*JLS 07-12-00*/ { /*JLS 07-12-00*/ + size_t i; for (i = 0; (mctx.filter[i] != '\0') && (mctx.filter[i] != '='); i++) ; if (mctx.filter[i] != '=') { @@ -2735,7 +2735,7 @@ main( if (mctx.attrlistNb > 0) /*JLS 15-03-01*/ { /*JLS 15-03-01*/ printf("Attributes list ="); /*JLS 15-03-01*/ - for (i = 0; i < mctx.attrlistNb; i++) /*JLS 15-03-01*/ + for (size_t i = 0; i < mctx.attrlistNb; i++) /*JLS 15-03-01*/ printf(" %s", mctx.attrlist[i]); /*JLS 15-03-01*/ printf("\n"); /*JLS 15-03-01*/ } /*JLS 15-03-01*/ @@ -2819,13 +2819,13 @@ main( printf("Async max pending = %d\n", mctx.asyncMax); printf("Async min pending = %d\n", mctx.asyncMin); } - for (i = 0; i < mctx.ignErrNb; i++) + for (size_t i = 0; i < mctx.ignErrNb; i++) printf("Ignore error = %d (%s)\n", mctx.ignErr[i], my_ldap_err2string(mctx.ignErr[i])); fflush(stdout); if (mctx.slavesNb > 0) { printf("Slave(s) to check ="); - for (i = 0; i < mctx.slavesNb; i++) + for (size_t i = 0; i < mctx.slavesNb; i++) printf(" %s", mctx.slaves[i]); printf("\n"); } diff --git a/ldap/servers/slapd/tools/ldclt/ldclt.h b/ldap/servers/slapd/tools/ldclt/ldclt.h index 814773cc20..063765f64e 100644 --- a/ldap/servers/slapd/tools/ldclt/ldclt.h +++ b/ldap/servers/slapd/tools/ldclt/ldclt.h @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -13,159 +13,6 @@ #include #endif - -/* - FILE : ldclt.h - AUTHOR : Jean-Luc SCHWING - VERSION : 1.0 - DATE : 03 December 1998 - DESCRIPTION : - This file is the main include file of the tool named - "ldclt" - LOCAL : None. - HISTORY : ----------+--------------+------------------------------------------------------ -dd/mm/yy | Author | Comments ----------+--------------+------------------------------------------------------ -03/12/98 | JL Schwing | Creation ----------+--------------+------------------------------------------------------ -10/12/98 | JL Schwing | 1.2 : Add stats numbers in main_context. ----------+--------------+------------------------------------------------------ -10/12/98 | JL Schwing | 1.3 : Implement asynchronous mode. ----------+--------------+------------------------------------------------------ -11/12/98 | JL Schwing | 1.4 : Implement max errors threshold. ----------+--------------+------------------------------------------------------ -14/12/98 | JL Schwing | 1.5 : Implement "-e close". ----------+--------------+------------------------------------------------------ -16/12/98 | JL Schwing | 1.6 : Implement "-e add" and "-e delete". - | Add counter nb timeouts (no activity). ----------+--------------+------------------------------------------------------ -28/12/98 | JL Schwing | 1.7 : Add tag asyncHit. ----------+--------------+------------------------------------------------------ -29/12/98 | JL Schwing | 1.8 : Implement -Q. ----------+--------------+------------------------------------------------------ -11/01/99 | JL Schwing | 1.9 : Implement "-e emailPerson". ----------+--------------+------------------------------------------------------ -13/01/99 | JL Schwing | 1.10: Implement "-e string". ----------+--------------+------------------------------------------------------ -14/01/99 | JL Schwing | 1.11: Implement "-s ". ----------+--------------+------------------------------------------------------ -18/01/99 | JL Schwing | 1.12: Implement "-e randombase". ----------+--------------+------------------------------------------------------ -18/01/99 | JL Schwing | 1.13: Implement "-e v2". ----------+--------------+------------------------------------------------------ -21/01/99 | JL Schwing | 1.14: Implement "-e ascii". ----------+--------------+------------------------------------------------------ -26/01/99 | JL Schwing | 1.15: Implement "-e noloop". ----------+--------------+------------------------------------------------------ -28/01/99 | JL Schwing | 1.16: Implement "-T ". ----------+--------------+------------------------------------------------------ -04/05/99 | JL Schwing | 1.17: Implement operations list. ----------+--------------+------------------------------------------------------ -06/05/99 | JL Schwing | 1.22: Implement "-e modrdn". ----------+--------------+------------------------------------------------------ -19/05/99 | JL Schwing | 1.25: Implement "-e rename". ----------+--------------+------------------------------------------------------ -27/05/99 | JL Schwing | 1.26 : Add statistics to check threads. ----------+--------------+------------------------------------------------------ -28/05/99 | JL Schwing | 1.27 : Add new option -W (wait). ----------+--------------+------------------------------------------------------ -02/06/99 | JL Schwing | 1.28 : Add flag in main ctx to know if slave was - | connected or not. - | Add counter of operations received in check threads. ----------+--------------+------------------------------------------------------ -04/08/00 | JL Schwing | 1.29: Add stats on nb inactivity per thread. ----------+--------------+------------------------------------------------------ -08/08/00 | JL Schwing | 1.30: Print global statistics every 1000 loops. ----------+--------------+------------------------------------------------------ -18/08/00 | JL Schwing | 1.31: Print global statistics every 15' - | Print begin and end dates. ----------+--------------+------------------------------------------------------ -25/08/00 | JL Schwing | 1.32: Implement consistent exit status... ----------+--------------+------------------------------------------------------ -19/09/00 | JL Schwing | 1.33: Port on Netscape's libldap. This is realized in - | such a way that this library become the default - | way so a ifdef for Solaris will be used... ----------+--------------+---------------------------------------------------- -11/10/00 | B Kolics | 1.34: Added 'SSL' to the list of running modes and - | | certfile to main_context structure ----------+--------------+------------------------------------------------------ -07/11/00 | JL Schwing | 1.35: Add handlers for dynamic load of ssl-related - | functions. ------------------------------------------------------------------------------ -07/11/00 | JL Schwing | 1.36: Implement "-e inetOrgPerson". ----------+--------------+------------------------------------------------------ -13/11/00 | JL Schwing | 1.37: Add new options "-e randombaselow and ...high" ----------+--------------+------------------------------------------------------ -16/11/00 | JL Schwing | 1.38: Implement "-e imagesdir=path". - | lint-cleanup. ----------+--------------+------------------------------------------------------ -17/11/00 | JL Schwing | 1.39: Implement "-e smoothshutdown". ----------+--------------+------------------------------------------------------ -21/11/00 | JL Schwing | 1.40: Implement "-e attreplace=name:mask" - | Increase max number of threads from 512 to 1000. ----------+--------------+------------------------------------------------------ -22/11/00 | JL Schwing | 1.41: Will now use LD_LIBRARY_PATH to load libssl. ----------+--------------+------------------------------------------------------ -24/11/00 | JL Schwing | 1.41: Added SSL client authentication ----------+--------------+------------------------------------------------------ -28/11/00 | JL Schwing | 1.43: Port on NT 4. ----------+--------------+------------------------------------------------------ -15/12/00 | JL Schwing | 1.44: Add more trace in VERY_VERBOSE mode. ----------+--------------+------------------------------------------------------ -15/12/00 | JL Schwing | 1.45: Implement "-e counteach". - | Implement "-e withnewparent". ----------+--------------+------------------------------------------------------ -18/12/00 | JL Schwing | 1.46: Add exit status EXIT_INIT and EXIT_RESSOURCE. ----------+--------------+------------------------------------------------------ -03/01/01 | JL Schwing | 1.47: Implement "-e attrsonly=value". ----------+--------------+------------------------------------------------------ -05/01/01 | JL Schwing | 1.48: Implement "-e randombinddn" and associated - | "-e randombinddnlow/high" ----------+--------------+------------------------------------------------------ -08/01/01 | JL Schwing | 1.49: Implement "-e scalab01". ----------+--------------+------------------------------------------------------ -12/01/01 | JL Schwing | 1.50: Second set of options for -e scalab01 ----------+--------------+------------------------------------------------------ -06/03/01 | JL Schwing | 1.51: Change DEF_ATTRSONLY from 1 to 0 ----------+--------------+------------------------------------------------------ -08/03/01 | JL Schwing | 1.52: Change referrals handling. ----------+--------------+------------------------------------------------------ -14/03/01 | JL Schwing | 1.53: Implement "-e commoncounter" ----------+--------------+------------------------------------------------------ -14/03/01 | JL Schwing | 1.54: Implement "-e dontsleeponserverdown". ----------+--------------+------------------------------------------------------ -14/03/01 | JL Schwing | 1.55: Lint cleanup. ----------+--------------+------------------------------------------------------ -15/03/01 | JL Schwing | 1.56: Implement "-e attrlist=name:name:name" - | Implement "-e randomattrlist=name:name:name" ----------+--------------+------------------------------------------------------ -19/03/01 | JL Schwing | 1.57: Implement "-e object=filename" - | Implement "-e genldif=filename" ----------+--------------+------------------------------------------------------ -21/03/01 | JL Schwing | 1.58: Implements variables in "-e object=filename" ----------+--------------+------------------------------------------------------ -23/03/01 | JL Schwing | 1.59: Implements data file list support in variants. - | Implements "-e rdn=value". ----------+--------------+------------------------------------------------------ -28/03/01 | JL Schwing | 1.60: Update options checking for "-e rdn=value". ----------+--------------+------------------------------------------------------ -28/03/01 | JL Schwing | 1.61: Support -e commoncounter with -e rdn/object - | Increase MAX_ATTRIBS from 20 to 40 - | Remove MAX_ATTRLIST - use MAX_ATTRIBS. ----------+--------------+------------------------------------------------------ -02/04/01 | JL Schwing | 1.62: Bug fix : large files support for -e genldif. ----------+--------------+------------------------------------------------------ -05/04/01 | JL Schwing | 1.63: Implement -e append. ----------+--------------+------------------------------------------------------ -11/04/01 | JL Schwing | 1.64: Implement [INCRFROMFILE(myfile)] ----------+--------------+------------------------------------------------------ -03/05/01 | JL Schwing | 1.64: Implement -e randombinddnfromfile=filename. ----------+--------------+------------------------------------------------------ -04/05/01 | JL Schwing | 1.65: Implement -e bindonly. ----------+--------------+------------------------------------------------------ -*/ - #ifndef LDCLT_H #define LDCLT_H diff --git a/ldap/servers/slapd/tools/ldclt/scalab01.c b/ldap/servers/slapd/tools/ldclt/scalab01.c index d198552297..6322366e51 100644 --- a/ldap/servers/slapd/tools/ldclt/scalab01.c +++ b/ldap/servers/slapd/tools/ldclt/scalab01.c @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -492,19 +492,12 @@ readAttrValue( char *filter; /* Filter used for searching */ /* - * First, ldap_search() the entry. - */ + * First, ldap_search() the entry. + */ attrs[0] = attname; attrs[1] = NULL; - filter = (char *)malloc((4 + strlen(attname)) * sizeof(char)); - if (NULL == filter) { - printf("ldclt[%d]: %s: Out of memory\n", mctx.pid, ident); - fflush(stdout); - return (-1); - } - - sprintf(filter, "(%s=*)", attname); + filter = PR_smprintf("(%s=*)", attname); ret = ldap_search_ext_s(ldapCtx, dn, LDAP_SCOPE_BASE, filter, attrs, 0, NULL, NULL, NULL, -1, &res); free(filter); @@ -583,7 +576,7 @@ writeAttrValue( char *value) { int ret; /* Return value */ - LDAPMod attribute; /* To build the attributes */ + LDAPMod attr; /* To build the attributes */ LDAPMod *attrsmod[2]; /* Modify attributes */ char *pvalues[2]; /* To build the values list */ @@ -592,10 +585,10 @@ writeAttrValue( */ pvalues[0] = value; pvalues[1] = NULL; - attribute.mod_op = LDAP_MOD_REPLACE; - attribute.mod_type = attname; - attribute.mod_values = pvalues; - attrsmod[0] = &attribute; + attr.mod_op = LDAP_MOD_REPLACE; + attr.mod_type = attname; + attr.mod_values = pvalues; + attrsmod[0] = &attr; attrsmod[1] = NULL; /* diff --git a/ldap/servers/slapd/tools/ldclt/threadMain.c b/ldap/servers/slapd/tools/ldclt/threadMain.c index 1ffeedb83c..988f25eab2 100644 --- a/ldap/servers/slapd/tools/ldclt/threadMain.c +++ b/ldap/servers/slapd/tools/ldclt/threadMain.c @@ -2,7 +2,7 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2006 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -535,9 +535,9 @@ msgIdAdd( */ tttctx->lastMsgId->next = NULL; tttctx->lastMsgId->msgid = msgid; - strncpy(tttctx->lastMsgId->str, str, sizeof(tttctx->lastMsgId->str)); + memcpy(tttctx->lastMsgId->str, str, sizeof(tttctx->lastMsgId->str)); tttctx->lastMsgId->str[sizeof(tttctx->lastMsgId->str) - 1] = '\0'; - strncpy(tttctx->lastMsgId->dn, dn, sizeof(tttctx->lastMsgId->dn)); + memcpy(tttctx->lastMsgId->dn, dn, sizeof(tttctx->lastMsgId->dn)); tttctx->lastMsgId->dn[sizeof(tttctx->lastMsgId->dn) - 1] = '\0'; tttctx->lastMsgId->attribs = attribs; diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c index 7d0dc078a7..7b2e15ffa9 100644 --- a/ldap/servers/slapd/util.c +++ b/ldap/servers/slapd/util.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -1563,7 +1563,7 @@ get_internal_conn_op (uint64_t *connid, int32_t *op_id, int32_t *op_internal_id, * to free the returned string value. */ const char * -slapi_fetch_attr(Slapi_Entry *e, const char *attrname, char *default_val) +slapi_fetch_attr(Slapi_Entry *e, char *attrname, char *default_val) { Slapi_Attr *attr; Slapi_Value *val = NULL; diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c index 7c70f41575..c9fd28a30b 100644 --- a/ldap/servers/slapd/vattr.c +++ b/ldap/servers/slapd/vattr.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -150,7 +150,7 @@ vattr_global_lock_create() } } static int -global_vattr_lock_get_acquired_count() +global_vattr_lock_get_acquired_count(void) { int *nb_acquired; nb_acquired = (int *) PR_GetThreadPrivate(thread_private_global_vattr_lock); diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c index 4b672ead0e..6856bf8575 100644 --- a/ldap/servers/snmp/main.c +++ b/ldap/servers/snmp/main.c @@ -1,5 +1,5 @@ /* --- BEGIN COPYRIGHT BLOCK --- - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -148,7 +148,7 @@ main(int argc, char *argv[]) /* agent-logdir setting looks ok */ if ((log_hdl->token = malloc(strlen(agent_logdir) + strlen(LDAP_AGENT_LOGFILE) + 2)) != NULL) { - strncpy((char *)log_hdl->token, agent_logdir, strlen(agent_logdir) + 1); + memcpy((char *)log_hdl->token, agent_logdir, strlen(agent_logdir) + 1); /* add a trailing slash if needed */ if (*(agent_logdir + strlen(agent_logdir)) != '/') strcat((char *)log_hdl->token, "/"); diff --git a/lib/base/ereport.cpp b/lib/base/ereport.cpp index 3836c76c14..944f009cb0 100644 --- a/lib/base/ereport.cpp +++ b/lib/base/ereport.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -23,8 +23,6 @@ #include "file.h" /* system_fopenWA, system_write_atomic */ #include "util.h" /* util_vsprintf */ #include "ereport.h" -#include "slapi-plugin.h" - #include #include /* vsprintf */ #include /* strcpy */ diff --git a/lib/base/shexp.cpp b/lib/base/shexp.cpp index c4918055bf..0f57128e58 100644 --- a/lib/base/shexp.cpp +++ b/lib/base/shexp.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -30,7 +30,7 @@ int valid_subexp(char *exp, char stop) { - register int x,y,t; + int x,y,t; int nsc,tld; x=0;nsc=0;tld=0; @@ -113,7 +113,7 @@ int _shexp_match(char *str, char *exp); int handle_union(char *str, char *exp) { char *e2 = (char *) MALLOC(sizeof(char)*strlen(exp)); - register int t,p2,p1 = 1; + int t,p2,p1 = 1; int cp; while(1) { @@ -141,7 +141,7 @@ int handle_union(char *str, char *exp) int _shexp_match(char *str, char *exp) { - register int x,y; + int x,y; int ret,neg; ret = 0; @@ -222,7 +222,7 @@ int _shexp_match(char *str, char *exp) } NSAPI_PUBLIC int shexp_match(char *str, char *xp) { - register int x; + int x; char *exp = STRDUP(xp); for(x=strlen(exp)-1;x;--x) { diff --git a/lib/base/util.cpp b/lib/base/util.cpp index 49b9bd1665..73aba21c02 100644 --- a/lib/base/util.cpp +++ b/lib/base/util.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -35,8 +35,8 @@ NSAPI_PUBLIC int util_itoa(int i, char *a) { - register int x, y, p; - register char c; + int x, y, p; + char c; int negative; negative = 0; @@ -75,7 +75,7 @@ NSAPI_PUBLIC int util_itoa(int i, char *a) */ #define UTIL_PRF_MAXSIZE 1048576 -NSAPI_PUBLIC int util_vsnprintf(char *s, int n, register const char *fmt, +NSAPI_PUBLIC int util_vsnprintf(char *s, int n, const char *fmt, va_list args) { return PR_vsnprintf(s, n, fmt, args); @@ -91,7 +91,7 @@ NSAPI_PUBLIC int util_snprintf(char *s, int n, const char *fmt, ...) return rc; } -NSAPI_PUBLIC int util_vsprintf(char *s, register const char *fmt, va_list args) +NSAPI_PUBLIC int util_vsprintf(char *s, const char *fmt, va_list args) { return PR_vsnprintf(s, UTIL_PRF_MAXSIZE, fmt, args); } @@ -397,7 +397,7 @@ static void _util_strftime_conv(char *pt, int n, int digits, char pad) { static char buf[10]; - register char *p; + char *p; if (n >= 100) { p = buf + sizeof(buf)-2; diff --git a/lib/ldaputil/encode.c b/lib/ldaputil/encode.c index 3219c8da1e..ea7f5b005f 100644 --- a/lib/ldaputil/encode.c +++ b/lib/ldaputil/encode.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -47,7 +47,7 @@ Snip-n-shift, snip-n-shift, etc.... for (p = dst, i = 0; i < srclen; i += 3) { /* Do 3 bytes of src */ - register char b0, b1, b2; + char b0, b1, b2; b0 = src[0]; if (i == srclen - 1) @@ -94,9 +94,9 @@ const unsigned char pr2six[256] = { static char * _uudecode(const char *bufcoded) { - register const char *bufin = bufcoded; - register unsigned char *bufout; - register int nprbytes; + const char *bufin = bufcoded; + unsigned char *bufout; + int nprbytes; unsigned char *bufplain; int nbytesdecoded; diff --git a/lib/libaccess/acl.tab.cpp b/lib/libaccess/acl.tab.cpp index edeafe4aa0..2bad680915 100644 --- a/lib/libaccess/acl.tab.cpp +++ b/lib/libaccess/acl.tab.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -695,7 +695,7 @@ int acl_Parse(void) int acl_Parse() #endif { - register ACLSTYPE *aclpvt = 0; /* top of value stack for $vars */ + ACLSTYPE *aclpvt = 0; /* top of value stack for $vars */ #if defined(__cplusplus) || defined(lint) /* @@ -733,10 +733,10 @@ int acl_Parse() #endif { - register ACLSTYPE *acl_pv; /* top of value stack */ - register int *acl_ps; /* top of state stack */ - register int acl_state; /* current state */ - register int acl_n; /* internal state number info */ + ACLSTYPE *acl_pv; /* top of value stack */ + int *acl_ps; /* top of state stack */ + int acl_state; /* current state */ + int acl_n; /* internal state number info */ goto aclstack; /* moved from 6 lines above to here to please C++ */ /* @@ -774,7 +774,7 @@ int acl_Parse() */ if ( acldebug ) { - register int acl_i; + int acl_i; printf( "State %d, token ", acl_state ); if ( aclchar == 0 ) @@ -862,7 +862,7 @@ int acl_Parse() #if ACLDEBUG if ( acldebug && acltmp ) { - register int acl_i; + int acl_i; printf( "Received token " ); if ( aclchar == 0 ) @@ -904,7 +904,7 @@ int acl_Parse() #if ACLDEBUG if ( acldebug && acltmp ) { - register int acl_i; + int acl_i; printf( "Received token " ); if ( aclchar == 0 ) @@ -931,7 +931,7 @@ int acl_Parse() ** look through exception table */ { - register int *aclxi = aclexca; + int *aclxi = aclexca; /* The first element of the last pair is -2, so we * need to make sure we don't increment past it. */ @@ -1023,7 +1023,7 @@ int acl_Parse() */ if ( acldebug ) { - register int acl_i; + int acl_i; printf( "Error recovery discards " ); if ( aclchar == 0 ) @@ -1083,7 +1083,7 @@ int acl_Parse() */ { /* length of production doubled with extra bit */ - register int acl_len = aclr2[ acl_n ]; + int acl_len = aclr2[ acl_n ]; if ( !( acl_len & 01 ) ) { diff --git a/lib/libaccess/acl.yy.cpp b/lib/libaccess/acl.yy.cpp index 8abb24b271..f7e6dc050f 100644 --- a/lib/libaccess/acl.yy.cpp +++ b/lib/libaccess/acl.yy.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -614,9 +614,9 @@ ACL_MALLOC_DECL ACL_DECL { - register acl_state_type acl_current_state; - register char *acl_cp, *acl_bp; - register int acl_act; + acl_state_type acl_current_state; + char *acl_cp, *acl_bp; + int acl_act; #line 47 "aclscan.l" @@ -663,7 +663,7 @@ ACL_DECL acl_match: do { - register ACL_CHAR acl_c = acl_ec[ACL_SC_TO_UI(*acl_cp)]; + ACL_CHAR acl_c = acl_ec[ACL_SC_TO_UI(*acl_cp)]; if ( acl_accept[acl_current_state] ) { acl_last_accepting_state = acl_current_state; @@ -1125,10 +1125,10 @@ ECHO; */ static int acl_get_next_buffer() - { - register char *dest = acl_current_buffer->acl_ch_buf; - register char *source = acltext_ptr; - register int number_to_move, i; +{ + char *dest = acl_current_buffer->acl_ch_buf; + char *source = acltext_ptr; + int number_to_move, i; int ret_val; if ( acl_c_buf_p > &acl_current_buffer->acl_ch_buf[acl_n_chars + 1] ) @@ -1256,14 +1256,14 @@ static int acl_get_next_buffer() static acl_state_type acl_get_previous_state() { - register acl_state_type acl_current_state; - register char *acl_cp; + acl_state_type acl_current_state; + char *acl_cp; acl_current_state = acl_start; for ( acl_cp = acltext_ptr + ACL_MORE_ADJ; acl_cp < acl_c_buf_p; ++acl_cp ) { - register ACL_CHAR acl_c = (*acl_cp ? acl_ec[ACL_SC_TO_UI(*acl_cp)] : 1); + ACL_CHAR acl_c = (*acl_cp ? acl_ec[ACL_SC_TO_UI(*acl_cp)] : 1); if ( acl_accept[acl_current_state] ) { acl_last_accepting_state = acl_current_state; @@ -1295,10 +1295,10 @@ static acl_state_type acl_try_NUL_trans( acl_current_state ) acl_state_type acl_current_state; #endif { - register int acl_is_jam; - register char *acl_cp = acl_c_buf_p; + int acl_is_jam; + char *acl_cp = acl_c_buf_p; - register ACL_CHAR acl_c = 1; + ACL_CHAR acl_c = 1; if ( acl_accept[acl_current_state] ) { acl_last_accepting_state = acl_current_state; @@ -1319,14 +1319,14 @@ acl_state_type acl_current_state; #ifndef ACL_NO_UNPUT #ifdef ACL_USE_PROTOS -static void aclunput( int c, register char *acl_bp ) +static void aclunput( int c, char *acl_bp ) #else static void aclunput( c, acl_bp ) int c; -register char *acl_bp; +char *acl_bp; #endif { - register char *acl_cp = acl_c_buf_p; + char *acl_cp = acl_c_buf_p; /* undo effects of setting up acltext */ *acl_cp = acl_hold_char; @@ -1334,10 +1334,10 @@ register char *acl_bp; if ( acl_cp < acl_current_buffer->acl_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = acl_n_chars + 2; - register char *dest = &acl_current_buffer->acl_ch_buf[ + int number_to_move = acl_n_chars + 2; + char *dest = &acl_current_buffer->acl_ch_buf[ acl_current_buffer->acl_buf_size + 2]; - register char *source = + char *source = &acl_current_buffer->acl_ch_buf[number_to_move]; while ( source > acl_current_buffer->acl_ch_buf ) @@ -1795,7 +1795,7 @@ aclconst char *s2; int n; #endif { - register int i; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -1809,7 +1809,7 @@ static int acl_flex_strlen( s ) aclconst char *s; #endif { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; diff --git a/lib/libaccess/lasip.cpp b/lib/libaccess/lasip.cpp index f3af15becf..c9580b293c 100644 --- a/lib/libaccess/lasip.cpp +++ b/lib/libaccess/lasip.cpp @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -465,13 +465,11 @@ int LASIpEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, PList_t global_auth) { LASIpContext_t *context = NULL; - LASIpTree_t *node = NULL; IPAddr_t ip; PRNetAddr *client_addr = NULL; struct in_addr client_inaddr; char ip_str[124]; int retcode; - int value; int bit; int rc = LAS_EVAL_INVALID; int rv; @@ -546,46 +544,45 @@ int LASIpEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, /* * Check if IP is ipv4/ipv6 */ - if ( PR_IsNetAddrType( client_addr, PR_IpAddrV4Mapped) || client_addr->raw.family == PR_AF_INET ) { - /* - * IPv4 - */ - - /* Set the appropriate s_addr for ipv4 or ipv4 mapped to ipv6 */ - if (client_addr->raw.family == PR_AF_INET) { - client_inaddr.s_addr = client_addr->inet.ip; - } else { - client_inaddr.s_addr = client_addr->ipv6.ip._S6_un._S6_u32[3]; - } + if ( PR_IsNetAddrType( client_addr, PR_IpAddrV4Mapped) || client_addr->raw.family == PR_AF_INET ) { + /* + * IPv4 + */ - node = context->treetop; - ip = (IPAddr_t)PR_ntohl( client_inaddr.s_addr ); - - if(node == NULL){ - rc = (comparator == CMP_OP_EQ ? LAS_EVAL_FALSE : LAS_EVAL_TRUE); - } else { - for (bit = 31; bit >= 0; bit--) { - value = (ip & (IPAddr_t) (1 << bit)) ? 1 : 0; - if (LAS_IP_IS_CONSTANT(node->action[value])){ - /* Reached a result, so return it */ - if (comparator == CMP_OP_EQ){ - rc = (int)(PRSize)node->action[value]; - break; - } else { - rc = ((int)(PRSize)node->action[value] == LAS_EVAL_TRUE) ? LAS_EVAL_FALSE : LAS_EVAL_TRUE; - break; - } - } else { - /* Move on to the next bit */ - node = node->action[value]; - } - } - } - if(rc == LAS_EVAL_INVALID){ - sprintf(ip_str, "%x", (unsigned int)ip); - nserrGenerate(errp, ACLERRINTERNAL, ACLERR5240, ACL_Program, 2, - XP_GetAdminStr(DBT_lasipevalReach32BitsWithoutConcl_), ip_str); - } + /* Set the appropriate s_addr for ipv4 or ipv4 mapped to ipv6 */ + if (client_addr->raw.family == PR_AF_INET) { + client_inaddr.s_addr = client_addr->inet.ip; + } else { + client_inaddr.s_addr = client_addr->ipv6.ip._S6_un._S6_u32[3]; + } + LASIpTree_t *node = context->treetop; + ip = (IPAddr_t)PR_ntohl( client_inaddr.s_addr ); + + if(node == NULL){ + rc = (comparator == CMP_OP_EQ ? LAS_EVAL_FALSE : LAS_EVAL_TRUE); + } else { + for (bit = 31; bit >= 0; bit--) { + int value = (ip & (IPAddr_t) (1 << bit)) ? 1 : 0; + if (LAS_IP_IS_CONSTANT(node->action[value])){ + /* Reached a result, so return it */ + if (comparator == CMP_OP_EQ){ + rc = (int)(PRSize)node->action[value]; + break; + } else { + rc = ((int)(PRSize)node->action[value] == LAS_EVAL_TRUE) ? LAS_EVAL_FALSE : LAS_EVAL_TRUE; + break; + } + } else { + /* Move on to the next bit */ + node = node->action[value]; + } + } + } + if(rc == LAS_EVAL_INVALID){ + sprintf(ip_str, "%x", (unsigned int)ip); + nserrGenerate(errp, ACLERRINTERNAL, ACLERR5240, ACL_Program, 2, + XP_GetAdminStr(DBT_lasipevalReach32BitsWithoutConcl_), ip_str); + } } else { /* * IPv6 @@ -595,7 +592,6 @@ int LASIpEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, int bit_position = 15; int field = 0; int addr = 0; - int value; node = context->treetop_ipv6; if ( node == NULL ) { @@ -603,7 +599,7 @@ int LASIpEval(NSErr_t *errp, char *attr_name, CmpOp_t comparator, } else { addr = PR_ntohs( ipv6->_S6_un._S6_u16[field]); for (bit = 127; bit >= 0 ; bit--, bit_position--) { - value = (addr & (1 << bit_position)) ? 1 : 0; + int value = (addr & (1 << bit_position)) ? 1 : 0; if (LAS_IP_IS_CONSTANT(node->action[value])) { /* Reached a result, so return it */ if (comparator == CMP_OP_EQ){ diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c index 775bc90e5a..521f2af538 100644 --- a/lib/libadmin/util.c +++ b/lib/libadmin/util.c @@ -1,6 +1,6 @@ /** BEGIN COPYRIGHT BLOCK * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission. - * Copyright (C) 2005 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -50,8 +50,8 @@ alert_word_wrap(char *str, int width, char *linefeed) char *ans = NULL; int counter = 0; int lsc = 0, lsa = 0; - register int strc = 0, ansc = 0; - register int x = 0; + int strc = 0, ansc = 0; + int x = 0; /* assume worst case */ ans = (char *)MALLOC((strlen(str) * strlen(linefeed)) + 32); diff --git a/src/Cargo.lock b/src/Cargo.lock index 550545941f..83330859b3 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -2,12 +2,12 @@ # It is not intended for manual editing. [[package]] name = "ahash" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75b7e6a93ecd6dbd2c225154d0fa7f86205574ecaa6c87429fb5f66ee677c44" +checksum = "796540673305a66d127804eef19ad696f1f204b8c1025aaca4958c17eab32877" dependencies = [ - "getrandom 0.2.1", - "lazy_static", + "getrandom 0.2.2", + "once_cell", "version_check", ] @@ -271,9 +271,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -447,6 +447,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + [[package]] name = "openssl" version = "0.10.32" @@ -569,9 +575,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha", @@ -595,7 +601,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.2", ] [[package]] @@ -645,18 +651,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.119" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.119" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", @@ -704,9 +710,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", @@ -763,7 +769,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.1", + "getrandom 0.2.2", ] [[package]] diff --git a/src/rewriters/adfilter.c b/src/rewriters/adfilter.c index fcea027c86..84582228fa 100644 --- a/src/rewriters/adfilter.c +++ b/src/rewriters/adfilter.c @@ -1,5 +1,5 @@ /** BEGIN COPYRIGHT BLOCK - * Copyright (C) 2020 Red Hat, Inc. + * Copyright (C) 2021 Red Hat, Inc. * All rights reserved. * * License: GPL (version 3 or any later version). @@ -246,20 +246,20 @@ substitute_string_objectsid(Slapi_Filter *f, void *arg) } loglevel = LDAP_DEBUG_ANY; if (loglevel_is_set(loglevel)) { - char logbuf[100] = {0}; + char debug_logbuf[100] = {0}; char filterbuf[1024] = {0}; char *valueb64, *valueb64_sav; size_t lenb64; size_t maxcopy; - if (sizeof(logbuf) <= ((bin_sid.length * 2) + 1)) { - maxcopy = (sizeof(logbuf)/2) - 1; + if (sizeof(debug_logbuf) <= ((bin_sid.length * 2) + 1)) { + maxcopy = (sizeof(debug_logbuf)/2) - 1; } else { maxcopy = bin_sid.length; } for (size_t i = 0, j = 0; i < maxcopy; i++) { - PR_snprintf(logbuf + j, 3, "%02x", bin_sid.sid[i]); + PR_snprintf(debug_logbuf + j, 3, "%02x", bin_sid.sid[i]); j += 2; } lenb64 = LDIF_SIZE_NEEDED(strlen("encodedb64"), bin_sid.length); @@ -268,7 +268,7 @@ substitute_string_objectsid(Slapi_Filter *f, void *arg) slapi_log_err(SLAPI_LOG_INFO, rewriter_name, "substitute_string_objectsid component %s : 0x%s (%s)\n", slapi_filter_to_string(f, filterbuf, sizeof (filterbuf)), - logbuf, + debug_logbuf, valueb64_sav); slapi_ch_free_string(&valueb64_sav); } diff --git a/src/svrcore/src/cache.c b/src/svrcore/src/cache.c index cd355c1e1c..e6f4fc704d 100644 --- a/src/svrcore/src/cache.c +++ b/src/svrcore/src/cache.c @@ -2,7 +2,7 @@ * Copyright (C) 1998 Netscape Communications Corporation. * All Rights Reserved. * - * Copyright 2016 Red Hat, Inc. and/or its affiliates. + * Copyright 2021 Red Hat, Inc. and/or its affiliates. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -94,7 +94,7 @@ static char * getPin(SVRCOREPinObj *ctx, const char *tokenName, PRBool retry) { SVRCORECachedPinObj *obj = (SVRCORECachedPinObj*)ctx; - Node **link, *node; + Node **link, *node_ptr; char *pin = 0; /* @@ -102,16 +102,16 @@ getPin(SVRCOREPinObj *ctx, const char *tokenName, PRBool retry) * a retry, or getting the stored value fails. This loop terminates * with 'pin' set to any valid cached value. */ - for(link = &obj->pinList;(node = *link) != NULL;link = &node->next) + for(link = &obj->pinList;(node_ptr = *link) != NULL;link = &node_ptr->next) { - if (strcmp(node->tokenName, tokenName) != 0) continue; + if (strcmp(node_ptr->tokenName, tokenName) != 0) continue; if (retry || - SVRCORE_Pk11StoreGetPin(&pin, node->store) != SVRCORE_Success) + SVRCORE_Pk11StoreGetPin(&pin, node_ptr->store) != SVRCORE_Success) { - *link = node->next; + *link = node_ptr->next; - freeNode(node); + freeNode(node_ptr); } break;