db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r692179 - in /db/derby/code/trunk/java/engine/org/apache/derby/iapi: services/property/PropertyUtil.java util/IdUtil.java
Date Thu, 04 Sep 2008 18:07:56 GMT
Author: dag
Date: Thu Sep  4 11:07:56 2008
New Revision: 692179

URL: http://svn.apache.org/viewvc?rev=692179&view=rev
Log:
DERBY-3673 Add checks that a new role isn't already a user authorization id

Patch derby-3673-5. Corrects and cleans up Javadoc comments. No code changes.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java?rev=692179&r1=692178&r2=692179&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/property/PropertyUtil.java
Thu Sep  4 11:07:56 2008
@@ -522,13 +522,12 @@
 
 
 	/**
-	 * Return true if username is defined as an effective property
-	 * i.e. there exists a property "<code>derby.user.</code><userid>"
-	 * in the database (or, possibly, in system properties if not
-	 * forbidden by derby.database.propertiesOnly). Note that <userid>
-	 * found in a property will be normalized to internal form before
-	 * comparison is performed against username, which is presumed
-	 * normalized already.
+	 * Return {@code true} if {@code username} is defined as a built-in user
+	 * i.e. there exists a property {@code derby.user.}&lt;userid&gt; in the
+	 * database (or, possibly, in system properties if not forbidden by {@code
+	 * derby.database.propertiesOnly}). Note that &lt;userid&gt; found in a
+	 * property will be normalized to case normal form before comparison is
+	 * performed against username, which is presumed normalized already.
 	 *
 	 * @param set object which implements PersistentSet interface
 	 *        (TransactionController)
@@ -566,9 +565,9 @@
 
 	/**
 	 * Return true if username is defined as a system property
-	 * i.e. there exists a property "<code>derby.user.</code><userid>"
-	 * in the system properties. Note that <userid> will be
-	 * normalized to internal form before comparison is performed
+	 * i.e. there exists a property {@code derby.user.}&lt;userid&gt;
+	 * in the system properties. Note that &lt;userid&gt; will be
+	 * normalized to case normal form before comparison is performed
 	 * against username, which is presumed normalized already.
 	 * @param username Normalized authorization identifier
 	 * @return {@code true} if match found

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java?rev=692179&r1=692178&r2=692179&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/IdUtil.java Thu Sep  4 11:07:56
2008
@@ -202,37 +202,44 @@
 
 
 	/**
-	 * Given an internal SQL authorization identifier, convert it to a
+	 * Given a case normal form SQL authorization identifier, convert it to a
 	 * form that may be compared with the username of Derby builtin
-	 * authentication, which uses Java properties of the from
-	 * derby.user.<username>.
+	 * authentication, which uses Java properties of the form
+	 * {@code derby.user.}&lt;username&gt;.
+	 * <p>
+	 * The returned form is suitable for comparing against the property string,
+	 * cf.  {@code systemPropertiesExistsBuiltinUser}.
+	 * <p>
+	 * E.g.:
+	 * <p>
+	 * <pre>
+	 *  Argument -> Return
+	 *  ------------------
+	 *  EVE      -> eve       [will match Java property: derby.user.eve]
+	 *  eVe      -> "eVe"     [will match Java property: derby.user."eVe"]
+	 *  "eve"    -> """eve""" [will match Java property: derby.user."""eVe"""]
+	 *  \eve\    -> "\eve\"   [will match Java property: derby.user."\eve\"]
 	 *
-	 * The returned form is suitable for comparing to the property
-	 * string after it has been parsed by Java, e.g. any backslash
-	 * quotes has been processed. That is, this method does not add
-	 * backslash quotes, either.
+	 * The latter could look this if specified on a Unix shell command line:
 	 *
-	 * E.g.
-	 *  EVE -> eve   (never eVe, or EVE, or EVe: we use a lower case canonical
-	 *                form) [external property form: derby.user.eve]
-	 *  eVe -> "eVe"        [external property form: derby.user."eVe"]
-	 *  "eve" -> "eve"      [external property form: derby.user."\"eVe\""]
-	 *  \eve\ -> "\eve\"    [external property form: derby.user."\\eve\\"]
+	 *                      -Dderby.user.'"\eve\"'=&lt;password&gt;
 	 *
-	 * Since parseSQLIdentifier maps many-to-one, the backward mapping
-	 * is non-unique, so the chosen lower case canonical from is
-	 * arbitrary.
-	 *
-	 * E.g. we will not be able to correctly map back the non-canonical:
-	 *
-	 *                     [external property form: derby.user.eVe]
-	 *
-	 * since this is internally EVE (but see DERBY-3150), and maps back as eve.
-	 *
-	 * Note that the returned form is not necessarily parsable back
-	 * using parseSQLIdentifier; it may need further quoting, cf. examples
-	 * above of external property forms.
+	 * Note: The processing of properties specified on the command line do not
+	 * interpret backslash as escape in the way done by the
+	 * java.util.Properties#load method, so no extra backslash is needed above.
 	 *
+	 * </pre>
+	 * Since parseSQLIdentifier maps many-to-one, the backward mapping is
+	 * non-unique, so the chosen lower case canonical form is arbitrary,
+	 * e.g. we will not be able to correctly match the non-canonical:
+	 * <p>
+     * <pre>
+	 *                      [Java property: derby.user.eVe]
+	 * </pre>
+	 * since this is internally EVE (but see DERBY-3150), and maps back as eve
+	 * after the rules above.
+	 * @see org.apache.derby.iapi.services.property.PropertyUtil#propertiesContainsBuiltinUser
+	 * @see org.apache.derby.iapi.services.property.PropertyUtil#systemPropertiesExistsBuiltinUser
 	 */
 	public static String SQLIdentifier2CanonicalPropertyUsername(String authid){
 		boolean needsQuote = false;



Mime
View raw message