From 5ef5b7ebec21ac99a61466cf5861b7d301bc7da0 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 01 May 2009 01:14:55 +0000
Subject: [PATCH] Second fix for issue 3949: All ASN.1 parsing code now ignores trailing unrecognized SEQUENCE components.
---
opends/src/server/org/opends/server/controls/AccountUsableResponseControl.java | 51 +++++++++++++++++++++++++--------------------------
1 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/opends/src/server/org/opends/server/controls/AccountUsableResponseControl.java b/opends/src/server/org/opends/server/controls/AccountUsableResponseControl.java
index 49367c5..a86577c 100644
--- a/opends/src/server/org/opends/server/controls/AccountUsableResponseControl.java
+++ b/opends/src/server/org/opends/server/controls/AccountUsableResponseControl.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2009 Sun Microsystems, Inc.
*/
package org.opends.server.controls;
import org.opends.messages.Message;
@@ -103,32 +103,31 @@
int secondsBeforeUnlock = 0;
reader.readStartSequence();
- while(reader.hasNextElement())
+ if(reader.hasNextElement() &&
+ reader.peekType() == TYPE_INACTIVE)
{
- switch (reader.peekType())
- {
- case TYPE_INACTIVE:
- isInactive = reader.readBoolean();
- break;
- case TYPE_RESET:
- isReset = reader.readBoolean();
- break;
- case TYPE_EXPIRED:
- isExpired = reader.readBoolean();
- break;
- case TYPE_REMAINING_GRACE_LOGINS:
- remainingGraceLogins = (int)reader.readInteger();
- break;
- case TYPE_SECONDS_BEFORE_UNLOCK:
- isLocked = true;
- secondsBeforeUnlock = (int)reader.readInteger();
- break;
- default:
- Message message = ERR_ACCTUSABLERES_UNKNOWN_UNAVAILABLE_TYPE.
- get(byteToHex(reader.peekType()));
- throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
- message);
- }
+ isInactive = reader.readBoolean();
+ }
+ if(reader.hasNextElement() &&
+ reader.peekType() == TYPE_RESET)
+ {
+ isReset = reader.readBoolean();
+ }
+ if(reader.hasNextElement() &&
+ reader.peekType() == TYPE_EXPIRED)
+ {
+ isExpired = reader.readBoolean();
+ }
+ if(reader.hasNextElement() &&
+ reader.peekType() == TYPE_REMAINING_GRACE_LOGINS)
+ {
+ remainingGraceLogins = (int)reader.readInteger();
+ }
+ if(reader.hasNextElement() &&
+ reader.peekType() == TYPE_SECONDS_BEFORE_UNLOCK)
+ {
+ isLocked = true;
+ secondsBeforeUnlock = (int)reader.readInteger();
}
reader.readEndSequence();
--
Gitblit v1.10.0