How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Nagendra008
Hi All,

The fields  [ server_type, server_os ] are getting filled when connection establishment with ms-servers. But there was a check saying that don't send details if the max_protocol was greater than "NT1" which means SMB1. So is there a way to get these fields in string format or an API call by using  max_protocol = SMB2.

- I checked few API's but there are giving the server_type as uint.
- I want the data from ms_server as server_type = "Windows Server 2012".

Any help will be so helpful.


struct cli_state {
         /* The following strings are the
         * ones returned by the server if
         * the protocol > NT1.
         */
        char *server_type;
        char *server_os;
        char *server_domain;  ....... }
 
cli_start_connection_send: This where will get the min and max protocol
 
        if (signing_state == SMB_SIGNING_IPC_DEFAULT) {
                state->min_protocol = lp_client_ipc_min_protocol();
                state->max_protocol = lp_client_ipc_max_protocol();
        } else {
                state->min_protocol = lp_client_min_protocol();
                state->max_protocol = lp_client_max_protocol();
        }

Regards,
Nag
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Samba - samba-technical mailing list
Hi Nag,

> The fields  *[ server_type, server_os ] *are getting filled when connection
> establishment with ms-servers. But there was a check saying that don't send
> details if the max_protocol was greater than "NT1" which means SMB1. *So is
> there a way to get these fields in string format* or an API call by using
> max_protocol = SMB2.
>
> - I checked few API's but there are giving the server_type as uint.
> - I want the data from ms_server as *server_type = "Windows Server 2012". *
>
> Any help will be so helpful.
>
>
> struct cli_state {
>          /* The following strings are the
>          * ones returned by the server if
>          * the protocol > NT1.
>          */
>         char *server_type;
>         char *server_os;
>         char *server_domain;  ....... }
>  
That information is not available with SMB2.
The server domain might be retrieved using wkssvc_NetWkstaGetInfo(),
but that's currently not used.

I already thought about filling the server_os or server_type with
the protocol string, e.g. "SMB3_11 Server".

There's also a bug in 4.6 and master where we fail to fill in this
fields even with NT1 and older protocols (I'll post patches for this soon).

metze


signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Sasi Bhushan
This post has NOT been accepted by the mailing list yet.
In reply to this post by Nagendra008
Can we have some quick temp patch for this as we don't have an RPC call to fetch the info?

/Sasi
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Nagendra008
In reply to this post by Samba - samba-technical mailing list
Hi metze,

Thanks for the information, Can we have some quick temp patch for this as we don't have an RPC call to fetch the info "server_os" && "server_type" in string format with highest protocol negotiation(SMB3_11)?.

Regards,
Nag
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Nagendra008
In reply to this post by Samba - samba-technical mailing list
Hi metze,

Do we have any patch release for "server_os" && "server_type" which give the os type in string format  with SMB2/3 in latest samba-4.6.3.

Because we have multiple dependencies on those strings.

Please do needful :)

Regards,
Nag
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Samba - samba-technical mailing list
Hi Nag,

> Do we have any patch release for *"server_os" && "server_type" which give
> the os type in string format  with SMB2/3 in latest samba-4.6.3.*
>
> Because we have multiple dependencies on those strings.

I've filled https://bugzilla.samba.org/show_bug.cgi?id=12779 to fix
the strings with SMB1.

Doing some changes for SMB2/3 might be a separate thing for future versions.

metze


signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Nagendra008
Thanks metze for update :)

Regards,
Nag
Reply | Threaded
Open this post in threaded view
|

Re: How to retrieve "server_os" , "server_type" in string format if i am using SMB2 and higher protocol ??

Nagendra008
In reply to this post by Samba - samba-technical mailing list
Hi metze,

Regarding the bug https://bugzilla.samba.org/show_bug.cgi?id=12779
 
"server_os" and "server_type" filling as empty string . Above bug marked as duplicate https://bugzilla.samba.org/show_bug.cgi?id=12824 and resolved providing two patches below.

https://attachments.samba.org/attachment.cgi?id=13261
https://attachments.samba.org/attachment.cgi?id=13269

Applied two patches on samba-4.6.6 and build the source code but i am still seeing sever_os and server_type as NULL fileds with SMB2 and higher protocols.

Tested the patch with rpcclient binary, Please look into the attached gdb trace of rpcclient.
gdb_trace_after_patch.txt

Please let me know if there is anything have to do to retrive the "sever_os" and "server_type" with SMB2 protocol.

Thanks,
Nag