[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] ensure names are trimmed
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] ensure names are trimmed |
Date: |
Sun, 01 Jan 2006 15:02:20 +0100 |
Hi Raif,
On Tue, 2005-12-27 at 11:31 +1100, Raif S. Naffah wrote:
> pls. find attached a patch for security related classes. the patch
> ensures that names of provider, service and (message digest)
> algorithm
> are trimmed before being used as keys for search.
Committed with a similar change as with the previous patch (I am
probable anal about this, trim() isn't expensive) as follows:
2006-01-01 Raif S. Naffah <address@hidden>
* java/security/MessageDigest.java (getInstance(String,String)):
Use trimmed copy of provider name.
* gnu/java/security/Engine.java
(getInstance(String,String,Provider,Object[])): Use trimmed copy of
service and algorithm names.
Also updated the copyright year (happy new year!).
Could you also add a mauve test for this one?
Thanks,
Mark
Index: gnu/java/security/Engine.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/Engine.java,v
retrieving revision 1.2
diff -u -r1.2 Engine.java
--- gnu/java/security/Engine.java 2 Jul 2005 20:32:14 -0000 1.2
+++ gnu/java/security/Engine.java 1 Jan 2006 13:59:27 -0000
@@ -1,5 +1,5 @@
/* Engine -- generic getInstance method.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -130,7 +130,14 @@
Provider provider, Object[] initArgs)
throws InvocationTargetException, NoSuchAlgorithmException
{
- if (service == null || algorithm == null
+ if (service != null)
+ service = service.trim();
+
+ if (algorithm != null)
+ algorithm = algorithm.trim();
+
+ if (service == null || service.length() == 0
+ || algorithm == null || algorithm.length() == 0
|| provider == null || initArgs == null)
throw new IllegalArgumentException();
Index: java/security/MessageDigest.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/MessageDigest.java,v
retrieving revision 1.13
diff -u -r1.13 MessageDigest.java
--- java/security/MessageDigest.java 2 Jul 2005 20:32:40 -0000 1.13
+++ java/security/MessageDigest.java 1 Jan 2006 13:59:27 -0000
@@ -1,5 +1,5 @@
/* MessageDigest.java --- The message digest interface.
- Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -167,6 +167,9 @@
public static MessageDigest getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
+ if (provider != null)
+ provider = provider.trim();
+
if (provider == null || provider.length() == 0)
throw new IllegalArgumentException("Illegal provider");
signature.asc
Description: This is a digitally signed message part
- Re: [cp-patches] ensure names are trimmed,
Mark Wielaard <=