Example #1
0
        /// <summary>
        /// Returns the default flags for a Type-2 message created in response
        /// to the given Type-1 message in the current environment.
        /// </summary>
        /// <remarks>
        /// Returns the default flags for a Type-2 message created in response
        /// to the given Type-1 message in the current environment.
        /// </remarks>
        /// <returns>An <code>int</code> containing the default flags.</returns>
        public static int GetDefaultFlags(Type1Message type1)
        {
            if (type1 == null)
            {
                return(DefaultFlags);
            }
            int flags      = NtlmsspNegotiateNtlm;
            int type1Flags = type1.GetFlags();

            flags |= ((type1Flags & NtlmsspNegotiateUnicode) != 0) ? NtlmsspNegotiateUnicode
                                 : NtlmsspNegotiateOem;
            if ((type1Flags & NtlmsspRequestTarget) != 0)
            {
                string domain = GetDefaultDomain();
                if (domain != null)
                {
                    flags |= NtlmsspRequestTarget | NtlmsspTargetTypeDomain;
                }
            }
            return(flags);
        }
Example #2
0
 /// <summary>Creates a Type-2 message in response to the given Type-1 message.</summary>
 /// <remarks>Creates a Type-2 message in response to the given Type-1 message.</remarks>
 /// <param name="type1">The Type-1 message which this represents a response to.</param>
 /// <param name="challenge">The challenge from the domain controller/server.</param>
 /// <param name="target">The authentication target.</param>
 public Type2Message(Type1Message type1, byte[] challenge, string target) : this(GetDefaultFlags
                                                                                     (type1), challenge, (type1 != null && target == null && type1.GetFlag(NtlmsspRequestTarget
                                                                                                                                                           )) ? GetDefaultDomain() : target)
 {
 }
Example #3
0
 /// <summary>
 /// Creates a Type-2 message in response to the given Type-1 message
 /// using default values from the current environment.
 /// </summary>
 /// <remarks>
 /// Creates a Type-2 message in response to the given Type-1 message
 /// using default values from the current environment.
 /// </remarks>
 /// <param name="type1">The Type-1 message which this represents a response to.</param>
 public Type2Message(Type1Message type1) : this(type1, null, null)
 {
 }