コード例 #1
0
        public byte[] SecurityExit(MQChannelExit channelExitParms, MQChannelDefinition channelDefinition, byte[] dataBuffer, ref int dataOffset, ref int dataLength, ref int dataMaxLength)
        {
            if (channelExitParms.ExitID != MQC.MQXT_CHANNEL_SEC_EXIT)
            {
                channelExitParms.ExitResponse = MQC.MQXCC_SUPPRESS_FUNCTION;
                return(null);
            }
            else
            {
                switch (channelExitParms.ExitReason)
                {
                case MQC.MQXR_INIT:
                case MQC.MQXR_INIT_SEC:
                case MQC.MQXR_SEC_MSG:
                case MQC.MQXR_TERM:
                    channelExitParms.ExitResponse = MQC.MQXCC_OK;
                    break;

                case MQC.MQXR_SEC_PARMS:
                    string userId = channelExitParms.SecurityParms?.UserId;
                    if ((userId != null) && (userId.Length < 13))
                    {
                        channelDefinition.MCAUserIdentifier = Encoding.UTF8.GetBytes(channelExitParms.SecurityParms.UserId.PadRight(12, ' '));
                    }
                    channelExitParms.ExitResponse = MQC.MQXCC_OK;
                    break;

                default:
                    channelExitParms.ExitResponse = MQC.MQXCC_SUPPRESS_FUNCTION;
                    break;
                }
                return(null);
            }
        }
コード例 #2
0
        internal MQSession GetSession(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFAPLevel)
        {
            uint method = 0x598;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFAPLevel });
            MQSession result = null;
            bool      flag   = CommonServices.TraceEnabled();

            try
            {
                int num2 = 0;
                for (num2 = 0; (num2 < 3) && (result == null); num2++)
                {
                    result = this.GetSessionFromEligibleConnection();
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                if (result == null)
                {
                    result = this.GetSessionFromNewConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFAPLevel);
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                result.InitOAMFlow(mqcsp);
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }
コード例 #3
0
        internal void AddChannelEntry(MQChannelDefinition channel)
        {
            uint method = 0x27;

            this.TrEntry(method, new object[] { channel });
            try
            {
                MQChannelEntry entry = new MQChannelEntry(channel, null);
                if (entry.Channel.ClientChannelWeight == 0)
                {
                    if (this.thisAlphaEntry != null)
                    {
                        this.thisAlphaEntry.Next = entry;
                    }
                    else
                    {
                        this.alphaEntry = entry;
                    }
                    entry.Next          = null;
                    this.thisAlphaEntry = entry;
                }
                else
                {
                    entry.Next         = this.weightedEntry;
                    this.weightedEntry = entry;
                    this.totalWeight  += channel.ClientChannelWeight;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #4
0
ファイル: MQSession.cs プロジェクト: halfsilvered/TestCodes
        internal void Disconnect()
        {
            uint method = 0x629;

            this.TrEntry(method);
            try
            {
                if (!this.disconnected && (this.parentConnection != null))
                {
                    MQChannelDefinition negotiatedChannel = this.parentConnection.NegotiatedChannel;
                    int fapLevel = this.parentConnection.FapLevel;
                    if (this.exitsActive)
                    {
                        this.exits.TermExits();
                    }
                    this.parentConnection.RemoveSession(this.conversationId, true);
                    this.ReleaseOwnedTsh();
                    this.SetDisconnected();
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #5
0
        private MQSession GetSessionFromNewConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            uint method = 0x599;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            MQFAPConnection connection = null;
            MQSession       session    = null;

            try
            {
                this.connectionsLock.Acquire();
                connection = this.CreateAndConnectConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFapLevel);
                session    = connection.AssignSession();
                session.ParentConnection = connection;
                session.InitSendReceiveExits(true);
                if (connection.GetFreeConversations() > 0)
                {
                    this.AddConnection(connection);
                }
            }
            finally
            {
                this.connectionsLock.Release();
                base.TrExit(method);
            }
            return(session);
        }
コード例 #6
0
        byte[] MQSecurityExit.SecurityExit(MQChannelExit channelExitParms, MQChannelDefinition channelDefinition, byte[] dataBuffer, ref int dataOffset, ref int dataLength, ref int dataMaxLength)
        {
            if (channelExitParms == null)
            {
                throw new ArgumentNullException(nameof(channelExitParms));
            }
            if (channelDefinition == null)
            {
                throw new ArgumentNullException(nameof(channelDefinition));
            }

            byte[] result = null;



            if (channelExitParms.ExitID == MQC.MQXT_CHANNEL_SEC_EXIT)
            {
                switch (channelExitParms.ExitReason)
                {
                // MCA Initializtion
                case MQC.MQXR_INIT:
                    channelExitParms.ExitResponse = MQC.MQCC_OK;
                    break;

                // Initiate Security Exchange state
                case MQC.MQXR_INIT_SEC:
                    if (channelDefinition.ChannelType == MQC.MQCHT_SVRCONN)     // server sends msg, requires client to respond
                    {
                        channelExitParms.ExitResponse = MQC.MQXCC_SEND_AND_REQUEST_SEC_MSG;
                    }
                    else if (channelDefinition.ChannelType == MQC.MQCHT_CLNTCONN)     // client end does nothing at this point
                    {
                        channelExitParms.ExitResponse = MQC.MQCC_OK;
                    }
                    break;

                // Security Message Received
                case MQC.MQXR_SEC_MSG:
                    if (channelDefinition.ChannelType == MQC.MQCHT_SVRCONN)     // server side receives message
                    {
                        // channel starts
                        channelExitParms.ExitResponse = MQC.MQCC_OK;
                    }
                    else if (channelDefinition.ChannelType == MQC.MQCHT_CLNTCONN)     // client side receives message from server
                    {
                        result     = Encoding.ASCII.GetBytes(channelDefinition.SecurityUserData);
                        dataLength = result.Length;
                        channelExitParms.ExitResponse = MQC.MQXCC_SEND_SEC_MSG;
                    }
                    break;

                case MQC.MQXR_TERM:
                    channelExitParms.ExitResponse = MQC.MQCC_OK;
                    break;
                }
            }
            return(result);
        }
コード例 #7
0
        internal MQChannelDefinition SelectChannelEntry(MQChannelDefinition cd, MQThreadChannelEntry threadChlEntry)
        {
            uint method = 0x29;

            this.TrEntry(method, new object[] { cd, threadChlEntry });
            MQChannelEntry thisWeightedEntry = null;

            try
            {
                if (cd != null)
                {
                    thisWeightedEntry = this.SelectNamedEntry(cd);
                }
                else if (threadChlEntry.ThisWeightedEntry != null)
                {
                    threadChlEntry.ThisWeightedEntry = threadChlEntry.ThisWeightedEntry.Next;
                    if (threadChlEntry.ThisWeightedEntry != threadChlEntry.FirstWeightedEntry)
                    {
                        thisWeightedEntry = threadChlEntry.ThisWeightedEntry;
                    }
                }
                else
                {
                    if (threadChlEntry.ThisAlphaEntry != null)
                    {
                        threadChlEntry.ThisAlphaEntry = threadChlEntry.ThisAlphaEntry.Next;
                    }
                    else
                    {
                        threadChlEntry.ThisAlphaEntry = this.thisAlphaEntry;
                    }
                    if (threadChlEntry.ThisAlphaEntry != null)
                    {
                        thisWeightedEntry = threadChlEntry.ThisAlphaEntry;
                    }
                    else if (this.thisWeightedEntry != null)
                    {
                        if (this.thisWeightedEntry.Channel.ConnectionAffinity == 1)
                        {
                            thisWeightedEntry = this.thisWeightedEntry;
                        }
                        else
                        {
                            thisWeightedEntry = this.SelectRandomEntry(threadChlEntry);
                        }
                        threadChlEntry.FirstWeightedEntry = thisWeightedEntry;
                        threadChlEntry.ThisWeightedEntry  = thisWeightedEntry;
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return((thisWeightedEntry == null) ? null : thisWeightedEntry.Channel);
        }
コード例 #8
0
        public MQChannelDefinition NewMQCD()
        {
            uint method = 0x2e3;

            this.TrEntry(method);
            MQChannelDefinition result = new MQChannelDefinition();

            base.TrExit(method, result);
            return(result);
        }
コード例 #9
0
 internal MQConnectionSpecification(NmqiEnvironment nmqiEnv, MQFAPConnectionPool mqConnectionPool, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, int nmqiFlags, string uidFlowUserId, string uidFlowPassword, int ccsid) : base(nmqiEnv)
 {
     this.connectionsLock     = new Lock();
     this.eligibleConnections = new ArrayList();
     base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { nmqiEnv, mqConnectionPool, mqcd, nmqiFlags, uidFlowUserId, (uidFlowPassword == null) ? uidFlowPassword : "******", ccsid });
     this.connectionPool  = mqConnectionPool;
     this.mqcd            = mqcd;
     this.mqsco           = sslConfigOptions;
     this.nmqiFlags       = nmqiFlags;
     this.uidFlowUserId   = uidFlowUserId;
     this.uidFlowPassword = uidFlowPassword;
     this.ccsid           = ccsid;
 }
コード例 #10
0
        public void CreateChannelEntryLists(IEnumerator enumerator)
        {
            uint method = 0x4c9;

            this.TrEntry(method, new object[] { enumerator });
            while (enumerator.MoveNext())
            {
                MQChannelDefinition current = (MQChannelDefinition)enumerator.Current;
                this.AddChannelEntry(current);
            }
            if (this.weightedEntry != null)
            {
                this.OrderWeightedChannelEntry();
            }
            this.thisAlphaEntry    = this.alphaEntry;
            this.thisWeightedEntry = this.weightedEntry;
            base.TrExit(method);
        }
コード例 #11
0
        private MQChannelEntry SelectNamedEntry(MQChannelDefinition cd)
        {
            uint method = 0x2a;

            this.TrEntry(method, new object[] { cd });
            MQChannelEntry alphaEntry    = this.alphaEntry;
            MQChannelEntry weightedEntry = null;
            string         channelName   = cd.ChannelName;

            try
            {
                while (alphaEntry != null)
                {
                    if (alphaEntry.Channel.ChannelName.CompareTo(channelName) == 0)
                    {
                        break;
                    }
                    alphaEntry = alphaEntry.Next;
                }
                if (alphaEntry != null)
                {
                    return(alphaEntry);
                }
                alphaEntry    = this.weightedEntry;
                weightedEntry = this.weightedEntry;
                while (alphaEntry != null)
                {
                    if (alphaEntry.Channel.ChannelName.CompareTo(channelName) == 0)
                    {
                        return(alphaEntry);
                    }
                    alphaEntry = alphaEntry.Next;
                    if (alphaEntry == weightedEntry)
                    {
                        return(null);
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(alphaEntry);
        }
コード例 #12
0
 internal MQTCPConnection(NmqiEnvironment nmqiEnv, MQConnectionSpecification spec, MQFAP fap, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, int options) : base(nmqiEnv, spec.MQChannelDef.Clone())
 {
     this.timeout             = 0x1d4c0;
     this.timeoutChanged      = true;
     this.maxTransmissionSize = 0x7ff6;
     this.Lock = new object();
     base.TrConstructor("%Z% %W%  %I% %E% %U%");
     this.conname = mqcd.ConnectionName;
     this.nextHeartBeatSendTime = DateTime.Now.AddSeconds((double)this.timeout);
     this.localAddr             = mqcd.LocalAddress;
     cfg                       = base.env.Cfg;
     this.mqcd                 = mqcd;
     this.sslConfigOptions     = sslConfigOptions;
     base.fap                  = fap;
     base.remoteConnectionSpec = spec;
     base.connectOptions       = options;
     base.nmqiFlags            = spec.NmqiFlags;
     base.commsBufferPool      = fap.CommsBufferPool;
 }
コード例 #13
0
        private void RetrieveAndValidateSSLParams(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions)
        {
            uint method = 0x637;

            this.TrEntry(method);
            try
            {
                if (sslConfigOptions != null)
                {
                    this.keyStore = sslConfigOptions.KeyRepository;
                    if ((this.keyStore == null) || ((this.keyStore != "*SYSTEM") && (this.keyStore != "*USER")))
                    {
                        base.throwNewMQException(2, 0x94d);
                    }
                    base.TrText(method, "KeyStore is " + this.keyStore);
                    string str = base.GetString(sslConfigOptions.CerfificateLabel);
                    if ((str != null) & (str != ""))
                    {
                        this.clientCertName = str;
                    }
                    this.maxkeyresetcount = sslConfigOptions.KeyResetCount;
                    base.TrText(method, "KeyResetCount is " + this.maxkeyresetcount);
                    this.sslCertRevocationCheck = sslConfigOptions.CertRevocationCheck;
                    base.TrText(method, "CertificationCheck = " + Convert.ToString(this.sslCertRevocationCheck));
                    if (mqcd != null)
                    {
                        this.cipherSpec = mqcd.SSLCipherSpec;
                        base.TrText(method, "CipherSpec value is " + this.cipherSpec);
                        this.sslPeerName = mqcd.SSLPeerName;
                        base.TrText(method, "SSLPEERNAME value is " + this.sslPeerName);
                        if (this.sslPeerName == null)
                        {
                            base.throwNewMQException(2, 0x95f);
                        }
                    }
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #14
0
        public MQChannelDefinition GetChannelDefinition(string qmname, ref int pos)
        {
            uint method = 0x2f;

            this.TrEntry(method, new object[] { qmname, (int)pos });
            MQChannelDefinition definition = null;

            try
            {
                if (this.tableStream == null)
                {
                    this.GetStream();
                }
                else
                {
                    this.tableStream.Seek(0L, SeekOrigin.Begin);
                }
                if (this.Readuint(this.tableStream) != 0x52514d41)
                {
                    throw new IOException();
                }
                qmname     = qmname.PadRight(0x30);
                definition = this.FindChannel(this.tableStream, qmname, ref pos);
            }
            catch (MQException)
            {
                throw;
            }
            catch (IOException exception)
            {
                base.TrException(method, exception, 1);
                MQManagedClientException exception2 = new MQManagedClientException(0x20009555, 0, 0, this.mqfile, null, null, 2, 0x8a0);
                throw exception2;
            }
            finally
            {
                base.TrExit(method);
            }
            return(definition);
        }
コード例 #15
0
ファイル: MQSession.cs プロジェクト: halfsilvered/TestCodes
        internal void InitSendReceiveExits(bool firstConv)
        {
            uint method = 0x628;

            this.TrEntry(method, new object[] { firstConv });
            try
            {
                MQFAPConnection     conn              = this.Connection;
                MQChannelDefinition clientConn        = conn.ClientConn;
                MQChannelDefinition negotiatedChannel = conn.NegotiatedChannel;
                if (this.exits == null)
                {
                    this.exits = new MQChannelExitHandler(conn);
                }
                if ((clientConn.SendExit != null) && (clientConn.SendExit != ""))
                {
                    this.exits.LoadExits(13);
                    this.exits.InitializeExits(13, firstConv);
                    clientConn.SendExitsDefined        = 1;
                    negotiatedChannel.SendExitsDefined = 1;
                    this.exitsActive = true;
                }
                if ((clientConn.ReceiveExit != null) && (clientConn.ReceiveExit != ""))
                {
                    this.exits.LoadExits(14);
                    this.exits.InitializeExits(14, firstConv);
                    clientConn.ReceiveExitsDefined        = 1;
                    negotiatedChannel.ReceiveExitsDefined = 1;
                    this.exitsActive = true;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #16
0
        public MQSession GetSession(int connectOptions, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQChannelDefinition mqcd, string qMgrName, int nmqiFlags, string uidFlowUserid, string uidFlowPassword, int ccsid, int maxFapLevel)
        {
            uint method = 0x5e7;

            this.TrEntry(method, new object[] { connectOptions, mqcsp, mqcd, qMgrName, nmqiFlags, uidFlowUserid, (uidFlowPassword == null) ? uidFlowPassword : "******", ccsid, maxFapLevel });
            MQSession session = null;

            try
            {
                MQConnectionSpecification specification = new MQConnectionSpecification(base.env, this, mqcd, sslConfigOptions, nmqiFlags, uidFlowUserid, uidFlowPassword, ccsid);
                try
                {
                    this.callSync.Acquire();
                    object obj2 = null;
                    foreach (object obj3 in this.allConnectionSpecs.Keys)
                    {
                        MQConnectionSpecification specification2 = (MQConnectionSpecification)obj3;
                        if (specification2.Equals(specification))
                        {
                            specification = specification2;
                            obj2          = specification2;
                            base.TrText(method, "Found a matching connection spec..");
                            break;
                        }
                    }
                    if (obj2 == null)
                    {
                        base.TrText(method, "Couldnt find a matching connection spec. Adding new one into table");
                        this.allConnectionSpecs.Add(specification, specification);
                    }
                }
                finally
                {
                    this.callSync.Release();
                }
                session = specification.GetSession(mqcd, sslConfigOptions, mqcsp, this.fap, qMgrName, connectOptions, maxFapLevel);
                try
                {
                    this.callSync.Acquire();
                    if (!this.allConnectionSpecs.ContainsKey(specification))
                    {
                        this.allConnectionSpecs.Add(specification, specification);
                    }
                }
                finally
                {
                    this.callSync.Release();
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(session);
        }
コード例 #17
0
 internal MQChannelExitHandler(MQFAPConnection conn)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { conn });
     this.fapConnection = conn;
     this.cd            = this.fapConnection.NegotiatedChannel;
 }
コード例 #18
0
        public void CreateChannelEntryLists(MQChannelListEntry nameList)
        {
            uint method = 0x31;

            this.TrEntry(method, new object[] { nameList });
            try
            {
                if (this.tableStream == null)
                {
                    this.GetStream();
                }
                else
                {
                    this.tableStream.Seek(0L, SeekOrigin.Begin);
                }
                if (this.Readuint(this.tableStream) != 0x52514d41)
                {
                    base.throwNewMQException(2, 0x8e6);
                }
                MQChannelDefinition channel = null;
                bool   flag   = false;
                byte[] buffer = null;
                int    num6   = this.FindFirstChannel(this.tableStream);
                while (!flag)
                {
                    this.tableStream.Seek((long)num6, SeekOrigin.Begin);
                    if (this.Readuint(this.tableStream) == 0)
                    {
                        flag = true;
                        break;
                    }
                    uint num4 = this.Readuint(this.tableStream);
                    this.Readuint(this.tableStream);
                    this.Readuint(this.tableStream);
                    uint num5 = this.Readuint(this.tableStream);
                    if (num5 != 0)
                    {
                        num6 = (int)num5;
                    }
                    else
                    {
                        flag = true;
                    }
                    if ((buffer == null) || (num4 > buffer.Length))
                    {
                        buffer = new byte[num4];
                    }
                    int length = this.tableStream.Read(buffer, 0, (int)num4);
                    channel = new MQChannelDefinition(buffer, 0, length);
                    bool   flag2 = true;
                    string name  = null;
                    base.TrText(method, "Qmgr name suppled " + nameList.Name);
                    if (((nameList.Name != null) && (nameList.Name != "*")) && (nameList.Name != string.Empty))
                    {
                        base.TrText(method, "Qmgr name suppled " + nameList.Name);
                        name = nameList.Name;
                    }
                    if (name != null)
                    {
                        Encoding.ASCII.GetString(channel.QMgrName).Trim();
                        if (name.StartsWith("*") && (name.Length > 1))
                        {
                            name = name.Substring(1);
                            base.TrText(method, "Qmgr name being used by nmqi : " + name);
                        }
                        byte[] buffer2 = new byte[0x30];
                        base.GetBytesRightPad(name, ref buffer2);
                        for (int i = 0; i < 0x30; i++)
                        {
                            if (buffer2[i] != channel.QMgrName[i])
                            {
                                flag2 = false;
                                break;
                            }
                        }
                    }
                    base.TrText(method, "Did we find a matching channel definition from ccdt ? " + flag2);
                    if (flag2)
                    {
                        if ((nameList.Name != null) && nameList.Name.StartsWith("*"))
                        {
                            base.TrText(method, "Qmgr name suppled has * in it.. Found the cd having it. Setting qmgr name as blank in it.");
                            byte[] qMgrName = channel.QMgrName;
                            base.GetBytesRightPad(string.Empty, ref qMgrName);
                            channel.QMgrName = qMgrName;
                        }
                        if (channel.Version < 9)
                        {
                            channel.SharingConversations  = 0;
                            channel.PropertyControl       = 0;
                            channel.MaxInstances          = 0x3b9ac9ff;
                            channel.MaxInstancesPerClient = 0x3b9ac9ff;
                            channel.ClientChannelWeight   = 0;
                            channel.ConnectionAffinity    = 0;
                            nameList.AddChannelEntry(channel);
                            break;
                        }
                        nameList.AddChannelEntry(channel);
                    }
                }
                if (nameList.WeightedEntry != null)
                {
                    nameList.OrderWeightedChannelEntry();
                }
                nameList.ThisAlphaEntry    = nameList.AlphaEntry;
                nameList.ThisWeightedEntry = nameList.WeightedEntry;
            }
            catch (MQException)
            {
                throw;
            }
            catch (IOException exception)
            {
                base.TrException(method, exception, 1);
                throw exception;
            }
            catch (Exception exception2)
            {
                base.TrException(method, exception2, 2);
                base.TrException(method, exception2);
                base.throwNewMQException(2, 0x8e6);
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #19
0
        private MQChannelDefinition FindChannel(Stream f, string qmname, ref int pos)
        {
            uint method = 0x2e;

            this.TrEntry(method, new object[] { f, qmname, (int)pos });
            MQChannelDefinition definition = null;

            byte[] bytes  = new byte[0x30];
            byte[] buffer = null;
            Encoding.ASCII.GetBytes(qmname, 0, qmname.Length, bytes, 0);
            try
            {
                if (pos == 0)
                {
                    pos = this.FindFirstChannel(f);
                }
                while (pos >= 0)
                {
                    f.Seek((long)pos, SeekOrigin.Begin);
                    if (this.Readuint(f) == 0)
                    {
                        return(definition);
                    }
                    uint num3 = this.Readuint(f);
                    this.Readuint(f);
                    this.Readuint(f);
                    uint num4 = this.Readuint(f);
                    if (num4 != 0)
                    {
                        pos = (int)num4;
                    }
                    else
                    {
                        pos = -1;
                    }
                    if ((buffer == null) || (num3 > buffer.Length))
                    {
                        buffer = new byte[num3];
                    }
                    int  length = f.Read(buffer, 0, (int)num3);
                    bool flag   = true;
                    for (int i = 0; i < 0x30; i++)
                    {
                        if (bytes[i] != buffer[0x60 + i])
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        return(new MQChannelDefinition(buffer, 0, length));
                    }
                }
                return(definition);
            }
            catch (MQException)
            {
                throw;
            }
            catch (Exception exception)
            {
                base.TrException(method, exception, 1);
                throw new IOException();
            }
            finally
            {
                base.TrExit(method);
            }
            return(definition);
        }
コード例 #20
0
        public void InitializeExits(int exitType, bool firstConv)
        {
            uint method = 0x1f;

            this.TrEntry(method, new object[] { exitType, firstConv });
            byte[]        inb              = null;
            int           bufferOffset     = 0;
            int           bufferLength     = 0;
            int           bufferMaxLength  = 0;
            bool          securityRequired = false;
            MQChannelExit ep = new MQChannelExit();

            if (firstConv)
            {
                ep.SharingConversations = false;
            }
            else
            {
                ep.SharingConversations = true;
            }
            try
            {
                string[] sendExits;
                string   securityExit;
                int      num5;
                if (this.negotiateCD == null)
                {
                    this.negotiateCD = this.fapConnection.NegotiatedChannel;
                }
                switch (exitType)
                {
                case 11:
                    securityExit = this.negotiateCD.SecurityExit;
                    if ((securityExit != null) && (securityExit.Length != 0))
                    {
                        this.SecurityExit[0].userData = this.negotiateCD.SecurityUserData;
                        this.LoadExit(ref this.SecurityExit[0]);
                        this.InvokeExits(11, ep, this.SecurityExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                    }
                    return;

                case 13:
                    sendExits    = this.negotiateCD.SendExits;
                    securityExit = this.negotiateCD.SendExit;
                    if ((sendExits == null) || (sendExits.Length == 0))
                    {
                        goto Label_0160;
                    }
                    num5 = 0;
                    goto Label_0157;

                case 14:
                    sendExits    = this.negotiateCD.ReceiveExits;
                    securityExit = this.negotiateCD.ReceiveExit;
                    if ((sendExits == null) || (sendExits.Length == 0))
                    {
                        goto Label_0256;
                    }
                    num5 = 0;
                    goto Label_024D;

                default:
                    throw new MQManagedClientException("Unsupported exit type " + exitType, 2, 0x893);
                }
Label_0118:
                if ((this.negotiateCD.SendUserDatas != null) && (this.negotiateCD.SendUserDatas.Length > 1))
                {
                    this.SendExit[num5].userData = this.negotiateCD.SendUserDatas[num5];
                }
                num5++;
Label_0157:
                if (num5 < sendExits.Length)
                {
                    goto Label_0118;
                }
                goto Label_01AC;
Label_0160:
                if (((securityExit != null) && (securityExit != "")) && ((this.negotiateCD.SendUserData != null) && (this.negotiateCD.SendUserData != "")))
                {
                    this.SendExit[0].userData = this.negotiateCD.SendUserData;
                }
Label_01AC:
                if (((sendExits != null) && (sendExits.Length != 0)) || ((securityExit != null) && (securityExit != "")))
                {
                    this.InvokeExits(11, ep, this.SendExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
                return;

Label_020E:
                if ((this.negotiateCD.ReceiveUserDatas != null) && (this.negotiateCD.ReceiveUserDatas.Length > 1))
                {
                    this.ReceiveExit[num5].userData = this.negotiateCD.ReceiveUserDatas[num5];
                }
                num5++;
Label_024D:
                if (num5 < sendExits.Length)
                {
                    goto Label_020E;
                }
                goto Label_029D;
Label_0256:
                if (((securityExit != null) && (securityExit.Length != 0)) && ((this.negotiateCD.ReceiveUserData != null) && (this.negotiateCD.ReceiveUserData != "")))
                {
                    this.ReceiveExit[0].userData = this.negotiateCD.ReceiveUserData;
                }
Label_029D:
                if (((sendExits != null) && (sendExits.Length != 0)) || ((securityExit != null) && (securityExit != "")))
                {
                    this.InvokeExits(11, ep, this.ReceiveExit, inb, ref bufferOffset, ref bufferLength, ref bufferMaxLength, ref securityRequired);
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
コード例 #21
0
 internal MQChannelEntry(MQChannelDefinition cd, MQChannelEntry chlEntry)
 {
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { cd, chlEntry });
     this.channel = cd;
     this.next    = chlEntry;
 }
コード例 #22
0
        private MQFAPConnection CreateAndConnectConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            MQFAPConnection connection;
            uint            method = 0x59a;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            try
            {
                if (mqcd == null)
                {
                    CommonServices.SetValidInserts();
                    CommonServices.CommentInsert1 = "No Channel Definition to establish connection";
                    base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009519, 0);
                    NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null);
                    throw exception;
                }
                if (mqcd.TransportType == 2)
                {
                    connection = new MQTCPConnection(base.env, this, fap, mqcd, sslConfigOptions, this.GetConnectOptions(connectOptions));
                }
                else
                {
                    string[] inserts = new string[3];
                    inserts[2] = mqcd.TransportType.ToString();
                    NmqiException exception2 = new NmqiException(base.env, 0x26bb, inserts, 2, 0x80b, null);
                    throw exception2;
                }
                this.connectionsLock.Acquire();
                this.connectingConnections++;
                try
                {
                    MQChannelDefinition definition = connection.ClientConn.Clone();
                    definition.Version           = 11;
                    connection.NegotiatedChannel = definition;
                }
                catch (Exception exception3)
                {
                    base.TrException(method, exception3, 1);
                    NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x8e5, null);
                    throw exception4;
                }
                connection.InitSecurityExits();
                try
                {
                    connection.Connect(mqcsp);
                }
                catch (Exception exception5)
                {
                    base.TrException(method, exception5, 2);
                    connection = null;
                    throw exception5;
                }
            }
            finally
            {
                this.connectingConnections--;
                this.connectionsLock.Release();
                this.connectionsLock.PulseAll();
                base.TrExit(method);
            }
            return(connection);
        }
コード例 #23
0
 public MQEncryptedSocket(NmqiEnvironment env, MQTCPConnection conn, Socket socket, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions) : base(env)
 {
     this.keyStore    = "*SYSTEM";
     this.sslProtocol = SslProtocols.Tls;
     try
     {
         base.TrConstructor("%Z% %W%  %I% %E% %U%");
         this.env = env;
         this.owningConnection = conn;
         this.clientCertName   = "ibmwebspheremq" + Environment.UserName.ToLower();
         this.RetrieveAndValidateSSLParams(mqcd, sslConfigOptions);
         this.client        = new TcpClient();
         this.client.Client = socket;
         this.MakeSecuredConnection();
     }
     catch (Exception)
     {
         throw;
     }
 }