Fix CodeQL note-severity alerts: dead parameters of private methods (#834)
| | |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 Manuel Gaupp |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | |
| | | final Syntax element = numericOID2Syntaxes.get(numericOID); |
| | | if (element != null) { |
| | | removeSyntax(element, null); |
| | | removeSyntax(element); |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | syntax, syntax.getOID(), conflictingSyntax.getOID()); |
| | | throw new ConflictingSchemaElementException(message); |
| | | } |
| | | removeSyntax(conflictingSyntax, null); |
| | | removeSyntax(conflictingSyntax); |
| | | } |
| | | |
| | | numericOID2Syntaxes.put(syntax.getOID(), syntax); |
| | |
| | | } |
| | | } |
| | | |
| | | private void removeSyntax(final Syntax syntax, NamesMapping names) { |
| | | private void removeSyntax(final Syntax syntax) { |
| | | for (Map.Entry<String, List<String>> property : syntax.getExtraProperties().entrySet()) { |
| | | if ("x-enum".equalsIgnoreCase(property.getKey())) { |
| | | removeMatchingRule(OMR_OID_GENERIC_ENUM + "." + syntax.getOID()); |
| | |
| | | try { |
| | | syntax.validate(schema, warnings); |
| | | } catch (final SchemaException e) { |
| | | removeSyntax(syntax, names); |
| | | removeSyntax(syntax); |
| | | warnings.add(ERR_SYNTAX_VALIDATION_FAIL.get(syntax, e.getMessageObject())); |
| | | } |
| | | } |
| | |
| | | return configureCollectionSubResource( |
| | | config, resourceId, urlTemplate, dnTemplate, isReadOnly); |
| | | } else { |
| | | return configureSingletonSubResource( |
| | | config, resourceId, urlTemplate, dnTemplate, isReadOnly); |
| | | return configureSingletonSubResource(resourceId, urlTemplate, dnTemplate, isReadOnly); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private static SubResource configureSingletonSubResource(final JsonValue config, |
| | | final String resourceId, |
| | | private static SubResource configureSingletonSubResource(final String resourceId, |
| | | final String urlTemplate, |
| | | final String dnTemplate, |
| | | final Boolean isReadOnly) { |
| | |
| | | /** Notify this controller that authentication data have changed in the connection pool. */ |
| | | @Override |
| | | public void notifyAuthDataChanged() { |
| | | notifyAuthDataChanged(null); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that authentication data have changed in the |
| | | * connection pool for the specified url. |
| | | * The controller starts refreshing the node which represent entries from the |
| | | * url. |
| | | * @param url the URL of the connection that changed. |
| | | */ |
| | | private void notifyAuthDataChanged(LDAPURL url) { |
| | | // TODO: temporary implementation |
| | | // we should refresh only nodes : |
| | | // - whose URL matches 'url' |
| | | // - whose URL matches the URL of the connection that changed |
| | | // - whose errorType == ERROR_SOLVING_REFERRAL and |
| | | // errorArg == url |
| | | // errorArg == that URL |
| | | startRefreshReferralNodes(rootNode); |
| | | } |
| | | |
| | |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | |
| | | { |
| | | final List<String> args = getObfuscatedCommandLineArguments(getDSConfigCommandLineArguments(index)); |
| | | args.removeAll(getConfigCommandLineArguments()); |
| | | printEquivalentCommandLine(getConfigCommandLineName(index), args, |
| | | printEquivalentCommandLine(getConfigCommandLineName(), args, |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_INDEX.get()); |
| | | } |
| | | }); |
| | |
| | | * @return the path of the command line to be used to delete the specified |
| | | * index. |
| | | */ |
| | | private String getConfigCommandLineName(AbstractIndexDescriptor index) |
| | | private String getConfigCommandLineName() |
| | | { |
| | | if (isServerRunning()) |
| | | { |
| | |
| | | |
| | | hmConnectionHandlersMonitor.clear(); |
| | | |
| | | readSchemaIfNeeded(connWrapper, errors); |
| | | readSchemaIfNeeded(connWrapper); |
| | | |
| | | try |
| | | { |
| | |
| | | exceptions = Collections.unmodifiableList(errors); |
| | | } |
| | | |
| | | private void readSchemaIfNeeded(final ConnectionWrapper connWrapper, final List<Exception> errors) |
| | | private void readSchemaIfNeeded(final ConnectionWrapper connWrapper) |
| | | { |
| | | if (mustReadSchema()) |
| | | { |
| | |
| | | |
| | | if (entry.isDirectory()) |
| | | { |
| | | String perm = getDirectoryFileSystemPermissions(destination); |
| | | String perm = getDirectoryFileSystemPermissions(); |
| | | addPermission(destination, permissions, perm); |
| | | if (!Utils.createDirectory(destination)) |
| | | { |
| | |
| | | |
| | | /** |
| | | * Returns the file system permissions for a directory. |
| | | * @param path the directory for which we want the file permissions. |
| | | * @return the file system permissions for the directory. |
| | | */ |
| | | private String getDirectoryFileSystemPermissions(File path) |
| | | private String getDirectoryFileSystemPermissions() |
| | | { |
| | | // TODO We should get this dynamically during build? |
| | | return "755"; |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | | /** This class provides an enumeration of the allowed authmethod types. */ |
| | | enum EnumAuthMethod { |
| | | /** The enumeration type when the bind rule has specified authentication of none. */ |
| | | AUTHMETHOD_NONE ("none"), |
| | | AUTHMETHOD_NONE, |
| | | /** The enumeration type when the bind rule has specified authentication of simple. */ |
| | | AUTHMETHOD_SIMPLE ("simple"), |
| | | AUTHMETHOD_SIMPLE, |
| | | /** The enumeration type when the bind rule has specified authentication of ssl client auth. */ |
| | | AUTHMETHOD_SSL ("ssl"), |
| | | AUTHMETHOD_SSL, |
| | | /** The enumeration type when the bind rule has specified authentication of a sasl mechanism. */ |
| | | AUTHMETHOD_SASL ("sasl"); |
| | | |
| | | /** |
| | | * Creates a new enumeration type for this authmethod. |
| | | * @param authmethod The authemethod name. |
| | | */ |
| | | EnumAuthMethod (String authmethod){ |
| | | } |
| | | AUTHMETHOD_SASL; |
| | | } |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | /** |
| | | * There are aren't any allow ACIs. |
| | | */ |
| | | NO_ALLOW_ACIS(0), |
| | | NO_ALLOW_ACIS, |
| | | |
| | | /** |
| | | * An deny ACI either evaluated to FAIL or to TRUE. |
| | | */ |
| | | EVALUATED_DENY_ACI(1), |
| | | EVALUATED_DENY_ACI, |
| | | |
| | | /** |
| | | * An allow evaluated to true. |
| | | */ |
| | | EVALUATED_ALLOW_ACI(2), |
| | | EVALUATED_ALLOW_ACI, |
| | | |
| | | /** |
| | | * None of the allow and deny ACIs evaluated to true. |
| | | */ |
| | | NO_MATCHED_ALLOWS_ACIS(3), |
| | | NO_MATCHED_ALLOWS_ACIS, |
| | | |
| | | /** |
| | | * No specific reason could be determined. |
| | | */ |
| | | NO_REASON(4), |
| | | NO_REASON, |
| | | |
| | | /** |
| | | * The authorization DN has bypass-acl privileges. |
| | | */ |
| | | SKIP_ACI(5); |
| | | |
| | | /** |
| | | * Create a new enumeration type for the specified result value. |
| | | * @param v The value of the result. |
| | | */ |
| | | EnumEvalReason(int v) {} |
| | | SKIP_ACI; |
| | | } |
| | |
| | | /** |
| | | * This enumeration is returned when the result of the evaluation is TRUE. |
| | | */ |
| | | TRUE(0), |
| | | TRUE, |
| | | /** |
| | | * This enumeration is returned when the result of the evaluation is FALSE. |
| | | */ |
| | | FALSE(1), |
| | | FALSE, |
| | | /** |
| | | * This enumeration is returned when the result of the evaluation is FAIL. |
| | | * This should only be returned when a system failure occurred. |
| | | */ |
| | | FAIL(2), |
| | | FAIL, |
| | | /** |
| | | * This is an internal enumeration used during evaluation of bind rule when |
| | | * internal processing of the evaluation is undefined. It is never returned |
| | | * back as a result of the evaluation. |
| | | */ |
| | | ERR(3); |
| | | |
| | | /** |
| | | * Create a new enumeration type for the specified result value. |
| | | * @param v The value of the result. |
| | | */ |
| | | EnumEvalResult(int v) { |
| | | } |
| | | |
| | | ERR; |
| | | /** |
| | | * The method tries to determine if the result was undefined, and if so |
| | | * it returns an FAIL enumeration. If the result was not undefined (the |
| | |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | * The enumeration type when the "userdn" URL contains only a DN (no |
| | | * filter or scope) and that DN has no pattern. |
| | | */ |
| | | DN(0), |
| | | DN, |
| | | /** |
| | | * The enumeration type when the "userdn" URL contains only a DN (no |
| | | * filter or scope) and that DN has a substring pattern. |
| | | */ |
| | | DNPATTERN(1), |
| | | DNPATTERN, |
| | | /** The enumeration type when the "userdn" URL has the value of: "ldap:///all". */ |
| | | ALL(2), |
| | | ALL, |
| | | /** The enumeration type when the "userdn" URL has the value of: "ldap:///parent". */ |
| | | PARENT(3), |
| | | PARENT, |
| | | /** The enumeration type when the "userdn" URL has the value of: "ldap:///self". */ |
| | | SELF(4), |
| | | SELF, |
| | | /** The enumeration type when the "userdn" URL has the value of: "ldap:///anyone". */ |
| | | ANYONE(5), |
| | | ANYONE, |
| | | /** The enumeration type when the "userdn" URL is contains a DN (suffix), a scope and a filter. */ |
| | | URL(6); |
| | | |
| | | /** |
| | | * Constructor taking an integer value. |
| | | * @param v Integer value. |
| | | */ |
| | | EnumUserDNType(int v) {} |
| | | URL; |
| | | } |
| | |
| | | jsonConfig.setLogDirectory(logDirectory.getAbsolutePath()); |
| | | jsonConfig.setName(publisher.getName()); |
| | | jsonConfig.setTopics(Collections.singleton(publisher.getCommonAuditTopic())); |
| | | addJsonHandlerBufferingConfig(config, jsonConfig); |
| | | addHandlerRetentionConfig(publisher, config, jsonConfig); |
| | | addHandlerRotationConfig(publisher, config, jsonConfig); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void addJsonHandlerBufferingConfig(JsonConfigData config, JsonAuditEventHandlerConfiguration auditConfig) |
| | | { |
| | | JsonAuditEventHandlerConfiguration.EventBufferingConfiguration jsonBufferingConfig = |
| | | new JsonAuditEventHandlerConfiguration.EventBufferingConfiguration(); |
| | | } |
| | | |
| | | private void addHandlerRotationConfig(PublisherConfig publisher, HandlerConfigData config, |
| | | FileBasedEventHandlerConfiguration auditConfig) throws ConfigException |
| | | { |
| | |
| | | } |
| | | |
| | | if (StaticUtils.isFips()) { |
| | | putAdminTrustManagerConfigAttribute(trustManagerProviderDN, DN_ADMIN_TRUST_MANAGER); |
| | | putAdminTrustManagerConfigAttribute(DN_ADMIN_TRUST_MANAGER); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void putAdminTrustManagerConfigAttribute(final Argument trustManagerProviderDN, final String attributeDN) |
| | | private void putAdminTrustManagerConfigAttribute(final String attributeDN) |
| | | throws ConfigureDSException |
| | | { |
| | | if (keyManagerProviderDN.isPresent()) |
| | |
| | | case SASL_MECHANISM_EXTERNAL: |
| | | return doSASLExternal(bindDN, saslProperties, requestControls, responseControls); |
| | | case SASL_MECHANISM_GSSAPI: |
| | | return doSASLGSSAPI(bindDN, bindPassword, saslProperties, requestControls, responseControls); |
| | | return doSASLGSSAPI(bindDN, bindPassword, saslProperties); |
| | | case SASL_MECHANISM_PLAIN: |
| | | return doSASLPlain(bindDN, bindPassword, saslProperties, requestControls, responseControls); |
| | | default: |
| | |
| | | * to process the SASL bind. SASL EXTERNAL does not |
| | | * take any properties, so this should be empty or |
| | | * <CODE>null</CODE>. |
| | | * @param requestControls The set of controls to include the request to the |
| | | * server. |
| | | * @param responseControls A list to hold the set of controls included in |
| | | * the response from the server. |
| | | * |
| | | * @return A message providing additional information about the bind if |
| | | * appropriate, or <CODE>null</CODE> if there is no special |
| | |
| | | */ |
| | | private String doSASLGSSAPI(ByteSequence bindDN, |
| | | ByteSequence bindPassword, |
| | | Map<String,List<String>> saslProperties, |
| | | List<Control> requestControls, |
| | | List<Control> responseControls) |
| | | Map<String,List<String>> saslProperties) |
| | | throws ClientException, LDAPException |
| | | { |
| | | String kdc = null; |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | |
| | | if (checkStoppability.isPresent()) |
| | | { |
| | | System.exit(checkStoppability(argParser, out, err)); |
| | | System.exit(checkStoppability(argParser, out)); |
| | | } |
| | | |
| | | // If both a bind password and bind password file were provided, then return |
| | |
| | | * on the different parameters passed. |
| | | * @param argParser the ArgumentParser with the arguments already parsed. |
| | | * @param out the print stream to use for standard output. |
| | | * @param err the print stream to use for standard error. |
| | | * @return the error code that we return when we are checking the stoppability |
| | | * of the server. |
| | | */ |
| | | private static int checkStoppability(ArgumentParser argParser, |
| | | PrintStream out, PrintStream err) |
| | | private static int checkStoppability(ArgumentParser argParser, PrintStream out) |
| | | { |
| | | int returnValue; |
| | | boolean isServerRunning; |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | * Portions Copyright 2026 3A Systems, LLC. |
| | | */ |
| | | package org.opends.server.tools.upgrade; |
| | | |
| | |
| | | import static org.opends.server.tools.upgrade.Upgrade.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.util.ArrayList; |
| | |
| | | /** Flag indicating whether the global arguments have already been initialized. */ |
| | | private boolean globalArgumentsInitialized; |
| | | |
| | | private UpgradeCli(InputStream in, OutputStream out, OutputStream err) |
| | | private UpgradeCli(OutputStream out, OutputStream err) |
| | | { |
| | | super(new PrintStream(out), new PrintStream(err)); |
| | | this.parser = |
| | |
| | | public static int main(String[] args, boolean initializeServer, |
| | | OutputStream outStream, OutputStream errStream) |
| | | { |
| | | final UpgradeCli app = new UpgradeCli(System.in, outStream, errStream); |
| | | final UpgradeCli app = new UpgradeCli(outStream, errStream); |
| | | |
| | | // Run the application. |
| | | return app.run(args, initializeServer); |
| | |
| | | { |
| | | arg.clearValues(); |
| | | arg.addValue(value); |
| | | commandBuilder.addArgument(arg); |
| | | if (obfuscated) |
| | | { |
| | | commandBuilder.addObfuscatedArgument(arg); |
| | | } |
| | | else |
| | | { |
| | | commandBuilder.addArgument(arg); |
| | | } |
| | | } |
| | | } |
| | | |