SMB поля pId, Uid, Mid?

Тема в разделе "WASM.NETWORKS", создана пользователем Aids, 1 июн 2009.

  1. Aids

    Aids New Member

    Публикаций:
    0
    Регистрация:
    30 ноя 2007
    Сообщения:
    275
    Посылаю такой пакет
    Код (Text):
    1.     IP
    2.         Version:4
    3.         Header len.:20
    4.         Total len.:144
    5.         ID:$83F
    6.         fragmentation
    7.             DF=0
    8.             MF=0
    9.         TTL:128
    10.         Protocol:$06 (TCP)
    11.         Checksum:$5FBC
    12.         Source IP:172.25.33.33
    13.         Dest. IP:172.25.25.25
    14.     TCP
    15.         src_port:1723
    16.         dest_port:445
    17.         seq_number:2304250942
    18.         ack_number:3004036051
    19.         data_offset:5
    20.         flags (PUSH)
    21.             urgent :0
    22.             ack :1
    23.             push :1
    24.             reset :0
    25.             syn :0
    26.             fin :0
    27.         window:65001
    28.         checksum:$A129
    29.         urgent_pointer:$00
    30.     Netbios Session Service
    31.         MSG_YPE:$0
    32.         FLAGS:$0
    33.         LENGTH:100
    34.         SESSION MESSAGE
    35.     SMB
    36.         Command:$A2
    37.         ProcessID:620
    38.         UserID:2049    
    39.         MultiplexID:4802
    40.         Request
    Должен прийти такой:
    Код (Text):
    1.     IP
    2.         Version:4
    3.         Header len.:20
    4.         Total len.:179
    5.         ID:$3BF2
    6.         fragmentation
    7.             DF=0
    8.             MF=0
    9.         TTL:128
    10.         Protocol:$06 (TCP)
    11.         Checksum:$2BE6
    12.         Source IP:172.25.25.25
    13.         Dest. IP:172.25.33.33
    14.     TCP
    15.         src_port:445
    16.         dest_port:1723
    17.         seq_number:3004036051
    18.         ack_number:2304251046
    19.         data_offset:5
    20.         flags (PUSH)
    21.             urgent :0
    22.             ack :1
    23.             push :1
    24.             reset :0
    25.             syn :0
    26.             fin :0
    27.         window:65535
    28.         checksum:$EC62
    29.         urgent_pointer:$00
    30.     Netbios Session Service
    31.         MSG_YPE:$0
    32.         FLAGS:$0
    33.         LENGTH:135
    34.         SESSION MESSAGE
    35.     SMB
    36.         Command:$A2
    37.         ProcessID:620
    38.         UserID:2049
    39.         MultiplexID:4802
    40.         Response
    Но в ответ приходит не то что нужно. Как я понимаю надо в посылаемом пакете заполнить поля ProcessID, UserID, MultiplexID
    ProcessID заполнил GetCurrentProcessID, а чем заполнить оставшиеся два поля?
     
  2. punxer

    punxer Андрей

    Публикаций:
    0
    Регистрация:
    16 окт 2006
    Сообщения:
    1.327
    Адрес:
    Ржев
    Uid-user unique ID =UID
    MultiplexID хз чем и чо эт.
     
  3. punxer

    punxer Андрей

    Публикаций:
    0
    Регистрация:
    16 окт 2006
    Сообщения:
    1.327
    Адрес:
    Ржев
    NIX:
    int uid; /* номер */
    uid = getuid();

    :тратата
    The UID field in an SMB packet is an ID that refers to an authentication
    that occured previously on the transport. The only way to know which
    user that ID refers to is to know which user the authentication the ID
    refers to. And the only way to know which user an authentication refers
    to is to decode the authentication and extract the user's name (which
    could be rather difficult if the authentication method is Kerberos).
     
  4. Aids

    Aids New Member

    Публикаций:
    0
    Регистрация:
    30 ноя 2007
    Сообщения:
    275
    Код (Text):
    1. 3.1.4        Pid Field
    2.  
    3. Pid uniquely identifies a client process.  Clients inform servers of the
    4. creation of a new process by simply introducing a new Pid value into the
    5. dialogue for new processes.
    6.  
    7. In the core protocol, the SMB_COM_PROCESS_EXIT SMB was used to indicate
    8. the catastrophic termination of a process on the client.  In the single
    9. tasking DOS system, it was possible for hard errors to occur causing the
    10. destruction of the process with files remaining open.  Thus a
    11. SMB_COM_PROCESS_EXIT SMB was sent for this occurrence to allow the
    12. server to close all files opened by that process.
    13.  
    14. In the LANMAN 1.0 and newer dialects, no SMB_COM_PROCESS_EXIT SMB is
    15. sent.  The client operating system must ensure that the appropriate
    16. close and cleanup SMBs will be sent when the last process referencing
    17. the file closes it.  From the server's point of view, there is no
    18. concept of FIDs "belonging to" processes.  A FID returned by the server
    19. to one process may be used by any other process using the same transport
    20. connection and Tid.  There is no process creation SMB sent to the
    21. server; it is up to the client to ensure only valid client processes
    22. gain access to Fids (and Tids).  On SMB_COM_TREE_DISCONNECT (or when the
    23. client and server session is terminated) the server will invalidate any
    24. files opened by any process on that client.
    25.  
    26.  
    27. 3.1.5        Mid Field
    28.  
    29. Clients using the LANMAN 1.0 and newer dialects will typically be
    30. multitasked and allow multiple asynchronous input/output requests per
    31. task.  Therefore a multiplex ID (Mid) is used along with Pid to allow
    32. multiplexing the single client and server connection among the client's
    33. multiple processes, threads, and requests per thread.
    34.  
    35. Regardless of negotiated dialect, the server is responsible for ensuring
    36. that every response contains the same Mid and Pid values as its request.
    37. The client may then use the Mid and Pid values for associating requests
    38.  
    39.  
    40. Leach, Naik       expires September, 1997         [Page 25]
    41.  
    42.  
    43. INTERNET-DRAFT            CIFS/1.0                  03/19/97
    44.  
    45.  
    46. and responses and may have up to the negotiated number of requests
    47. outstanding at any time to a particular server.
    Это я нарил в спецификации. Вот только мне оно ничего не дало
     
  5. Aids

    Aids New Member

    Публикаций:
    0
    Регистрация:
    30 ноя 2007
    Сообщения:
    275
    Mid это может что то идентификатора группы?