Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@@ -4,22 +4,12 @@ include ../../build/rules.make
LIBRARY = Novell.Directory.Ldap.dll
ifeq (net_1_1_java, $(PROFILE))
LIB_MCS_FLAGS = \
/nowarn:649 /nowarn:169 /nowarn:219 /nowarn:168 \
-r:$(corlib) \
-r:System.dll \
-r:rt.dll \
-r:J2SE.Helpers.dll \
$(RESX_RES:%=/res:%)
else
LIB_MCS_FLAGS = \
-warn:1 -nowarn:612 \
-r:$(corlib) \
-r:System.dll \
-r:Mono.Security.dll \
$(RESX_RES:%=/res:%)
endif
include ../../build/library.make
@@ -33,16 +23,7 @@ $(RESULTCODE_MESSAGES): Novell.Directory.Ldap.Utilclass/ResultCodeMessages.txt
$(RESGEN) $< $@
EXTRA_DISTFILES = \
net_1_1_java_Novell.Directory.Ldap.dll.sources \
Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs \
Novell.Directory.Ldap.Security.jvm/AuthenticationCallbackHandler.cs \
Novell.Directory.Ldap.Security.jvm/ChangeLog \
Novell.Directory.Ldap.Security.jvm/CreateContextPrivilegedAction.cs \
Novell.Directory.Ldap.Security.jvm/ExchangeTokenPrivilegedAction.cs \
Novell.Directory.Ldap.Security.jvm/Krb5Helper.cs \
Novell.Directory.Ldap.Security.jvm/SecureStream.cs \
Novell.Directory.Ldap.Security.jvm/UnwrapPrivilegedAction.cs \
Novell.Directory.Ldap.Security.jvm/WrapPrivilegedAction.cs \
Novell.Directory.Ldap.Utilclass/ExceptionMessages.resx \
Novell.Directory.Ldap.Utilclass/ExceptionMessages.txt \
Novell.Directory.Ldap.Utilclass/ResultCodeMessages.resx \

View File

@@ -1,80 +0,0 @@
//
// Novell.Directory.Ldap.Security.AuthenticationCallbackHandler.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using javax.security.auth.callback;
using java.io;
namespace Novell.Directory.Ldap.Security
{
internal class AuthenticationCallbackHandler : CallbackHandler
{
#region Fields
private readonly string _username;
private readonly string _password;
#endregion //Fields
#region Constructors
public AuthenticationCallbackHandler(string username, string password)
{
_username = username;
_password = password;
}
#endregion // Constructors
#region Methods
public void handle(Callback [] callbacks)
{
for (int i = 0; i < callbacks.Length; i++) {
if (callbacks [i] is NameCallback) {
NameCallback nc = (NameCallback) callbacks [i];
nc.setName (_username);
}
else if (callbacks [i] is PasswordCallback) {
PasswordCallback pc = (PasswordCallback) callbacks [i];
pc.setPassword (_password.ToCharArray ());
}
else {
throw new UnsupportedCallbackException (callbacks [i], "Unrecognized Callback");
}
}
}
#endregion // Methods
}
}

View File

@@ -1,27 +0,0 @@
2005-11-06 Konstantin Triger <kostat@mainsoft.com>
* SecureStream.cs, CreateContextPrivilegedAction.cs, Krb5Helper.cs:
create GSSCredential only once, cleanup
2005-11-03 Konstantin Triger <kostat@mainsoft.com>
* CreateContextPrivilegedAction.cs: always require mutual auth;
require integrity by default.
* Krb5Helper.cs: for wrap/unwrap: always create MessageProp with
pribState set.
2005-14-08 Boris Kirzner <borisk@mainsoft.com>
* Krb5Helper.cs: ExchangeTokens does proper final handshaking. Wrap/Unwrap
perform no action if no integrity and encryption accured.
* SecureStream.cs: Private convertion methods became internal, used by
Krb5Helper.
2005-28-07 Boris Kirzner <borisk@mainsoft.com>
* Novell.Directory.Ldap.Security.jvm/ExchangeTokenPrivilegedAction.cs,
Novell.Directory.Ldap.Security.jvm/CreateContextPrivilegedAction.cs,
Novell.Directory.Ldap.Security.jvm/SecureStream.cs,
Novell.Directory.Ldap.Security.jvm/WrapPrivilegedAction.cs,
Novell.Directory.Ldap.Security.jvm/Krb5Helper.cs,
Novell.Directory.Ldap.Security.jvm/UnwrapPrivilegedAction.cs,
Novell.Directory.Ldap.Security.jvm/AuthenticationCallbackHandler.cs: added
new classes implementing kerberos authntication support.

View File

@@ -1,105 +0,0 @@
//
// Novell.Directory.Ldap.Security.CreateContextPrivilegedAction.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using java.security;
using org.ietf.jgss;
namespace Novell.Directory.Ldap.Security
{
internal class CreateContextPrivilegedAction : PrivilegedAction
{
#region Fields
private readonly bool _encryption;
private readonly bool _signing;
private readonly bool _delegation;
private readonly string _name;
private readonly string _clientName;
private readonly string _mech;
#endregion //Fields
#region Constructors
public CreateContextPrivilegedAction(string name, string clientName, string mech, bool encryption, bool signing, bool delegation)
{
_name = name;
_clientName = clientName;
_mech = mech;
_encryption = encryption;
_signing = signing;
_delegation = delegation;
}
#endregion // Constructors
#region Methods
public object run()
{
try {
Oid krb5Oid = new Oid (_mech);
GSSManager manager = GSSManager.getInstance ();
GSSName clientName =
manager.createName(_clientName, GSSName__Finals.NT_USER_NAME);
GSSCredential clientCreds =
manager.createCredential(clientName,
GSSContext__Finals.INDEFINITE_LIFETIME,
krb5Oid,
GSSCredential__Finals.INITIATE_ONLY);
// try {
GSSName serverName = manager.createName (_name, GSSName__Finals.NT_HOSTBASED_SERVICE, krb5Oid);
GSSContext context = manager.createContext (serverName, krb5Oid, clientCreds, GSSContext__Finals.INDEFINITE_LIFETIME);
context.requestMutualAuth(true);
context.requestConf (_encryption);
if (!_encryption || _signing)
context.requestInteg (!_encryption || _signing);
context.requestCredDeleg (_delegation);
return context;
// }
// finally {
// // Calling this throws GSSException: Operation unavailable...
// clientCreds.dispose();
// }
}
catch (GSSException e) {
throw new PrivilegedActionException (e);
}
}
#endregion // Methods
}
}

View File

@@ -1,73 +0,0 @@
//
// Novell.Directory.Ldap.Security.ExchangeTokenPrivilegedAction.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using org.ietf.jgss;
using java.security;
namespace Novell.Directory.Ldap.Security
{
internal class ExchangeTokenPrivilegedAction : PrivilegedAction
{
#region Fields
private readonly sbyte [] _token;
private readonly GSSContext _context;
#endregion // Fields
#region Constructors
public ExchangeTokenPrivilegedAction(GSSContext context, sbyte [] token)
{
_token = token;
_context = context;
}
#endregion // Constructors
#region Methods
public object run()
{
try {
sbyte [] token = _context.initSecContext (_token, 0, _token.Length);
return token;
}
catch (GSSException e) {
throw new PrivilegedActionException (e);
}
}
#endregion // Methods
}
}

View File

@@ -1,197 +0,0 @@
//
// Novell.Directory.Ldap.Security.Krb5Helper.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using vmw.common;
using java.security;
using javax.security.auth;
using org.ietf.jgss;
namespace Novell.Directory.Ldap.Security
{
internal class Krb5Helper : IDisposable
{
enum QOP {
NO_PROTECTION = 1,
INTEGRITY_ONLY_PROTECTION = 2,
PRIVACY_PROTECTION = 4
}
#region Fields
internal static readonly sbyte [] EmptyToken = new sbyte [0];
private readonly bool _encryption;
private readonly bool _signing;
private readonly bool _delegation;
private readonly GSSContext _context;
#endregion // Fields
#region Constructors
public Krb5Helper(string name, string clientName, Subject subject, AuthenticationTypes authenticationTypes, string mech)
{
_encryption = (authenticationTypes & AuthenticationTypes.Sealing) != 0;
_signing = (authenticationTypes & AuthenticationTypes.Signing) != 0;
_delegation = (authenticationTypes & AuthenticationTypes.Delegation) != 0;
CreateContextPrivilegedAction action = new CreateContextPrivilegedAction (name, clientName, mech,_encryption,_signing,_delegation);
try {
_context = (GSSContext) Subject.doAs (subject,action);
}
catch (PrivilegedActionException e) {
throw new LdapException ("Problem performing token exchange with the server",LdapException.OTHER,"",e.getCause());
}
}
#endregion // Constructors
#region Properties
internal GSSContext Context
{
get { return _context; }
}
#endregion // Properties
#region Methods
public sbyte [] ExchangeTokens(sbyte [] clientToken)
{
if (Context.isEstablished ()) {
if (clientToken == null || clientToken.Length == 0)
return Krb5Helper.EmptyToken;
//final handshake
byte [] challengeData = (byte []) TypeUtils.ToByteArray (clientToken);
byte [] gssOutToken = Unwrap (challengeData, 0, challengeData.Length, new MessageProp (false));
QOP myCop = QOP.NO_PROTECTION;
if (_encryption)
myCop = QOP.PRIVACY_PROTECTION;
else if (_signing || (((QOP)gssOutToken [0] & QOP.INTEGRITY_ONLY_PROTECTION) != 0))
myCop = QOP.INTEGRITY_ONLY_PROTECTION;
if ((myCop & (QOP)gssOutToken [0]) == 0)
throw new LdapException ("Server does not support the requested security level", 80, "");
int srvMaxBufSize = SecureStream.NetworkByteOrderToInt (gssOutToken, 1, 3);
//int rawSendSize = Context.getWrapSizeLimit(0, _encryption, srvMaxBufSize);
byte [] gssInToken = new byte [4];
gssInToken [0] = (byte) myCop;
SecureStream.IntToNetworkByteOrder (srvMaxBufSize, gssInToken, 1, 3);
gssOutToken = Wrap (gssInToken, 0, gssInToken.Length, new MessageProp (true));
return TypeUtils.ToSByteArray (gssOutToken);
}
sbyte [] token = Context.initSecContext (clientToken, 0, clientToken.Length);
if (Context.isEstablished ()) {
if (Context.getConfState () != _encryption)
throw new LdapException ("Encryption protocol was not established layer between client and server", 80, "");
if (Context.getCredDelegState () != _delegation)
throw new LdapException ("Credential delegation was not established layer between client and server", 80, "");
if (_signing && (Context.getIntegState () != _signing))
throw new LdapException ("Signing protocol was not established layer between client and server", 80, "");
if (token == null)
return EmptyToken;
}
return token;
}
public byte [] Wrap(byte [] outgoing, int start, int len)
{
return Wrap (outgoing, start, len, new MessageProp(true));
}
public byte [] Wrap(byte [] outgoing, int start, int len, MessageProp messageProp)
{
if (!Context.isEstablished ())
throw new LdapException ("GSSAPI authentication not completed",LdapException.OTHER,"");
if (!(Context.getConfState () || Context.getIntegState ())) {
// in the case no encryption and no integrity required - return the original data
byte [] buff = new byte [len];
Array.Copy (outgoing, start, buff, 0, len);
return buff;
}
sbyte [] result = Context.wrap (TypeUtils.ToSByteArray (outgoing), start, len, messageProp);
return (byte []) TypeUtils.ToByteArray (result);
}
public byte [] Unwrap(byte [] incoming, int start, int len)
{
return Unwrap (incoming, start, len, new MessageProp(true));
}
public byte [] Unwrap(byte [] incoming, int start, int len, MessageProp messageProp)
{
if (!Context.isEstablished ())
throw new LdapException ("GSSAPI authentication not completed",LdapException.OTHER,"");
if (!(Context.getConfState () || Context.getIntegState ())) {
// in the case no encryption and no integrity required - return the original data
byte [] buff = new byte [len];
Array.Copy (incoming, start, buff, 0, len);
return buff;
}
sbyte [] result = Context.unwrap (TypeUtils.ToSByteArray (incoming), start, len, messageProp);
return (byte []) TypeUtils.ToByteArray (result);
}
#endregion // Methods
#region IDisposable Members
public void Dispose() {
Context.dispose();
}
#endregion
}
}

View File

@@ -1,208 +0,0 @@
//
// Novell.Directory.Ldap.Security.SecureStream.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
namespace Novell.Directory.Ldap.Security
{
internal class SecureStream : Stream
{
#region Fields
private readonly Stream _stream;
private readonly Krb5Helper _helper;
private readonly byte [] _lenBuf = new byte [4];
private byte [] _buffer;
private int _bufferPosition;
#endregion // Fields
#region Constructors
public SecureStream(Stream stream, Krb5Helper helper): base ()
{
_stream = stream;
_helper = helper;
}
#endregion // Constructors
#region Properties
public override bool CanRead
{
get { return _stream.CanRead; }
}
public override bool CanSeek
{
get { return _stream.CanSeek; }
}
public override bool CanWrite
{
get { return _stream.CanWrite; }
}
public override long Length
{
get { throw new NotSupportedException (); }
}
public override long Position
{
get { throw new NotSupportedException (); }
set { throw new NotSupportedException (); }
}
#endregion // Properties
#region Methods
public override void Flush()
{
_stream.Flush ();
}
public override int Read( byte [] buffer, int offset, int count)
{
if (_buffer == null || _bufferPosition >= _buffer.Length) {
int actual = Fill ();
while (actual == 0)
actual = Fill ();
if (actual == -1)
return -1;
}
int available = _buffer.Length - _bufferPosition;
if (count > available) {
Array.Copy (_buffer, _bufferPosition, buffer, offset, available);
_bufferPosition = _buffer.Length;
return available;
}
else {
Array.Copy (_buffer, _bufferPosition, buffer, offset, count);
_bufferPosition += count;
return count;
}
}
public override void Close() {
_stream.Close();
_helper.Dispose();
}
private int Fill()
{
int actual = ReadAll (_lenBuf, 4);
if (actual != 4)
return -1;
int length = NetworkByteOrderToInt (_lenBuf, 0, 4);
// if (length > _recvMaxBufSize)
// throw new LdapException(length + " exceeds the negotiated receive buffer size limit: " + _recvMaxBufSize, 80, "");
byte [] rawBuffer = new byte [length];
actual = ReadAll (rawBuffer, length);
if (actual != length)
throw new LdapException("Expected to read " + length + " bytes, but get " + actual, 80, "");
_buffer = _helper.Unwrap (rawBuffer, 0, length);
_bufferPosition = 0;
return _buffer.Length;
}
private int ReadAll(byte [] buffer, int total)
{
int count = 0;
int pos = 0;
while (total > 0) {
count = _stream.Read (buffer, pos, total);
if (count == -1)
break;
//return ((pos == 0) ? -1 : pos);
pos += count;
total -= count;
}
return pos;
}
public override long Seek(long offset, SeekOrigin loc)
{
return _stream.Seek (offset, loc);
}
public override void SetLength(long value)
{
_stream.SetLength (value);
}
public override void Write(byte [] buffer, int offset, int count)
{
// FIXME: use GSSCOntext.getWrapSizeLimit to divide the buffer
// Generate wrapped token
byte [] wrappedToken = _helper.Wrap (buffer, offset, count);
// Write out length
IntToNetworkByteOrder (wrappedToken.Length, _lenBuf, 0, 4);
_stream.Write (_lenBuf, 0, 4);
// Write out wrapped token
_stream.Write (wrappedToken, 0, wrappedToken.Length);
}
internal static int NetworkByteOrderToInt(byte [] buf, int start, int count)
{
int answer = 0;
for (int i = 0; i < count; i++) {
answer <<= 8;
answer |= ((int)buf [start + i] & 0xff);
}
return answer;
}
internal static void IntToNetworkByteOrder(int num, byte [] buf, int start, int count)
{
for (int i = count-1; i >= 0; i--) {
buf [start + i] = (byte)(num & 0xff);
num >>= 8;
}
}
#endregion // Methods
}
}

View File

@@ -1,80 +0,0 @@
//
// Novell.Directory.Ldap.Security.UnwrapPrivilegedAction.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using vmw.common;
using java.security;
using org.ietf.jgss;
namespace Novell.Directory.Ldap.Security
{
internal class UnwrapPrivilegedAction : PrivilegedAction
{
#region Fields
private readonly byte [] _buffer;
private readonly int _start;
private readonly int _len;
private readonly GSSContext _context;
private readonly MessageProp _messageProperties;
#endregion // Fields
#region Constructors
public UnwrapPrivilegedAction(GSSContext context, byte [] buffer, int start, int len, MessageProp messageProperties)
{
_buffer = buffer;
_start = start;
_len = len;
_context = context;
_messageProperties = messageProperties;
}
#endregion // Constructors
#region Methods
public object run()
{
try {
sbyte [] result = _context.unwrap (TypeUtils.ToSByteArray (_buffer), _start, _len, _messageProperties);
return (byte []) TypeUtils.ToByteArray (result);
}
catch (GSSException e) {
throw new PrivilegedActionException (e);
}
}
#endregion // Methods
}
}

View File

@@ -1,80 +0,0 @@
//
// Novell.Directory.Ldap.Security.WrapPrivilegedAction.cs
//
// Authors:
// Boris Kirzner <borsk@mainsoft.com>
// Konstantin Triger <kostat@mainsoft.com>
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using vmw.common;
using java.security;
using org.ietf.jgss;
namespace Novell.Directory.Ldap.Security
{
internal class WrapPrivilegedAction : PrivilegedAction
{
#region Fields
private readonly byte [] _buffer;
private readonly int _start;
private readonly int _len;
private readonly GSSContext _context;
private readonly MessageProp _messageProperties;
#endregion // Fields
#region Constructors
public WrapPrivilegedAction(GSSContext context, byte [] buffer, int start, int len, MessageProp messageProperties)
{
_buffer = buffer;
_start = start;
_len = len;
_context = context;
_messageProperties = messageProperties;
}
#endregion // Constructors
#region Methods
public object run()
{
try {
sbyte [] result = _context.wrap (TypeUtils.ToSByteArray (_buffer), _start, _len, _messageProperties);
return (byte []) TypeUtils.ToByteArray (result);
}
catch (GSSException e) {
throw new PrivilegedActionException (e);
}
}
#endregion // Methods
}
}

View File

@@ -33,11 +33,6 @@ using System;
namespace Novell.Directory.Ldap.Utilclass
{
#if TARGET_JVM
// This dummy class workarounds a MS CSC bug by using SupportClass before
// using its inner class (SupportClass.AbstractSetSupport)
class RespExtensionSetDummy : SupportClass {}
#endif
/// <summary> This class extends the AbstractSet and Implements the Set
/// so that it can be used to maintain a list of currently

View File

@@ -48,9 +48,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright(" (C) 2003 Novell, Inc")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if !TARGET_JVM
[assembly: CLSCompliant(true)]
#endif
//
// Version information for an assembly consists of the following four values:
@@ -65,8 +63,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion (Consts.FxVersion)]
#if (!TARGET_JVM)
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../mono.pub")]
#endif

View File

@@ -34,10 +34,8 @@ using System.Threading;
using Novell.Directory.Ldap.Asn1;
using Novell.Directory.Ldap.Rfc2251;
using Novell.Directory.Ldap.Utilclass;
#if !TARGET_JVM
using Mono.Security.Protocol.Tls;
using Mono.Security.X509.Extensions;
#endif
using Syscert = System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;
using System.Net;
@@ -45,9 +43,7 @@ using System.Net.Sockets;
using System.Collections;
using System.IO;
using System.Text;
#if !TARGET_JVM
using Mono.Security.X509;
#endif
using System.Text.RegularExpressions;
using System.Globalization;
using System.Reflection;
@@ -735,7 +731,6 @@ namespace Novell.Directory.Ldap
{
if ((in_Renamed == null) || (out_Renamed == null))
{
#if !TARGET_JVM
if(Ssl)
{
this.host = host;
@@ -796,13 +791,10 @@ namespace Novell.Directory.Ldap
out_Renamed = (System.IO.Stream) sslstream;*/
}
else{
#endif
socket = new System.Net.Sockets.TcpClient(host, port);
in_Renamed = (System.IO.Stream) socket.GetStream();
out_Renamed = (System.IO.Stream) socket.GetStream();
#if !TARGET_JVM
}
#endif
}
else
{
@@ -1140,11 +1132,9 @@ namespace Novell.Directory.Ldap
if (socket != null || sock != null)
{
#if !TARGET_JVM
// Just before closing the sockets, abort the reader thread
if ((reader != null) && (reason != "reader: thread stopping"))
reader.Abort();
#endif
// Close the socket
try
{
@@ -1264,7 +1254,6 @@ namespace Novell.Directory.Ldap
/* package */
internal void startTLS()
{
#if !TARGET_JVM
try
{
waitForReader(null);
@@ -1333,7 +1322,6 @@ namespace Novell.Directory.Ldap
throw new LdapException("The host is unknown", LdapException.CONNECT_ERROR, null, uhe);
}
return ;
#endif
}
/*
@@ -1544,15 +1532,6 @@ namespace Novell.Directory.Ldap
// before closing sockets, from shutdown
return;
}
#if TARGET_JVM
catch (ObjectDisposedException)
{
// we do not support Thread.Abort under java
// so we close the stream and the working thread
// catches ObjectDisposedException exception
return;
}
#endif
catch (System.IO.IOException ioe)
{

View File

@@ -1 +1 @@
f6c72497f9ebb2e89ab4dfc6ca0449f273721981
35ee09ca1511efe2fa2328e3243d485753151325

View File

@@ -87,14 +87,10 @@ using System;
[CLSCompliantAttribute(false)]
public static sbyte[] ToSByteArray(byte[] byteArray)
{
#if TARGET_JVM
return vmw.common.TypeUtils.ToSByteArray(byteArray);
#else
sbyte[] sbyteArray = new sbyte[byteArray.Length];
for(int index=0; index < byteArray.Length; index++)
sbyteArray[index] = (sbyte) byteArray[index];
return sbyteArray;
#endif
}
/*******************************/
/// <summary>
@@ -105,14 +101,10 @@ using System;
[CLSCompliantAttribute(false)]
public static byte[] ToByteArray(sbyte[] sbyteArray)
{
#if TARGET_JVM
return (byte[])vmw.common.TypeUtils.ToByteArray(sbyteArray);;
#else
byte[] byteArray = new byte[sbyteArray.Length];
for(int index=0; index < sbyteArray.Length; index++)
byteArray[index] = (byte) sbyteArray[index];
return byteArray;
#endif
}
/// <summary>

View File

@@ -1,3 +0,0 @@
#include Novell.Directory.Ldap.dll.sources
Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs
Novell.Directory.Ldap.Security.jvm/*.cs