Exemplo n.º 1
0
		internal DcerpcBind(DcerpcBinding binding, DcerpcHandle handle)
		{
			this.Binding = binding;
			MaxXmit = handle.MaxXmit;
			MaxRecv = handle.MaxRecv;
			Ptype = 11;
            Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag;
		}
Exemplo n.º 2
0
 internal DcerpcBind(DcerpcBinding binding, DcerpcHandle handle)
 {
     this.Binding = binding;
     MaxXmit      = handle.MaxXmit;
     MaxRecv      = handle.MaxRecv;
     Ptype        = 11;
     Flags        = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag;
 }
Exemplo n.º 3
0
		/// <exception cref="SharpCifs.Dcerpc.DcerpcException"></exception>
		protected internal static DcerpcBinding ParseBinding(string str)
		{
			int state;
			int mark;
			int si;
			char[] arr = str.ToCharArray();
			string proto = null;
			string key = null;
			DcerpcBinding binding = null;
			state = mark = si = 0;
			do
			{
				char ch = arr[si];
				switch (state)
				{
					case 0:
					{
						if (ch == ':')
						{
							proto = Runtime.Substring(str, mark, si);
							mark = si + 1;
							state = 1;
						}
						break;
					}

					case 1:
					{
						if (ch == '\\')
						{
							mark = si + 1;
							break;
						}
						state = 2;
						goto case 2;
					}

					case 2:
					{
						if (ch == '[')
						{
							string server = Runtime.Substring(str, mark, si).Trim();
							if (server.Length == 0)
							{
								server = "127.0.0.1";
							}
							binding = new DcerpcBinding(proto, Runtime.Substring(str, mark, si));
							mark = si + 1;
							state = 5;
						}
						break;
					}

					case 5:
					{
						if (ch == '=')
						{
							key = Runtime.Substring(str, mark, si).Trim();
							mark = si + 1;
						}
						else
						{
							if (ch == ',' || ch == ']')
							{
								string val = Runtime.Substring(str, mark, si).Trim();
								if (key == null)
								{
									key = "endpoint";
								}
								binding.SetOption(key, val);
								key = null;
							}
						}
						break;
					}

					default:
					{
						si = arr.Length;
						break;
					}
				}
				si++;
			}
			while (si < arr.Length);
			if (binding == null || binding.Endpoint == null)
			{
				throw new DcerpcException("Invalid binding URL: " + str);
			}
			return binding;
		}
Exemplo n.º 4
0
        /// <exception cref="SharpCifs.Dcerpc.DcerpcException"></exception>
        protected internal static DcerpcBinding ParseBinding(string str)
        {
            int state;
            int mark;
            int si;

            char[]        arr     = str.ToCharArray();
            string        proto   = null;
            string        key     = null;
            DcerpcBinding binding = null;

            state = mark = si = 0;
            do
            {
                char ch = arr[si];
                switch (state)
                {
                case 0:
                {
                    if (ch == ':')
                    {
                        proto = Runtime.Substring(str, mark, si);
                        mark  = si + 1;
                        state = 1;
                    }
                    break;
                }

                case 1:
                {
                    if (ch == '\\')
                    {
                        mark = si + 1;
                        break;
                    }
                    state = 2;
                    goto case 2;
                }

                case 2:
                {
                    if (ch == '[')
                    {
                        string server = Runtime.Substring(str, mark, si).Trim();
                        if (server.Length == 0)
                        {
                            server = "127.0.0.1";
                        }
                        binding = new DcerpcBinding(proto, Runtime.Substring(str, mark, si));
                        mark    = si + 1;
                        state   = 5;
                    }
                    break;
                }

                case 5:
                {
                    if (ch == '=')
                    {
                        key  = Runtime.Substring(str, mark, si).Trim();
                        mark = si + 1;
                    }
                    else
                    {
                        if (ch == ',' || ch == ']')
                        {
                            string val = Runtime.Substring(str, mark, si).Trim();
                            if (key == null)
                            {
                                key = "endpoint";
                            }
                            binding.SetOption(key, val);
                            key = null;
                        }
                    }
                    break;
                }

                default:
                {
                    si = arr.Length;
                    break;
                }
                }
                si++;
            }while (si < arr.Length);
            if (binding == null || binding.Endpoint == null)
            {
                throw new DcerpcException("Invalid binding URL: " + str);
            }
            return(binding);
        }