s4:libcli: remember operating system and lan manager strings from session setup
authorStefan Metzmacher <metze@samba.org>
Fri, 1 May 2009 13:03:33 +0000 (15:03 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 May 2009 13:46:08 +0000 (15:46 +0200)
metze

source4/libcli/raw/libcliraw.h
source4/libcli/smb_composite/sesssetup.c

index a9fcdab9ccdc81daf99d8f3bc2f035ad64d0c656..37e158a465d3a851ee223008780817e348432b8b 100644 (file)
@@ -196,6 +196,9 @@ struct smbcli_session {
                uint_t ntlmv2_auth:1;
                uint_t plaintext_auth:1;
        } options;
+
+       const char *os;
+       const char *lanman;
 };
 
 /* 
index 83d15e98eb3834022343b54551a53e9a8792ba14..e1159a4cd22582d938ea5d78b9d7e18ce4f780b2 100644 (file)
@@ -87,6 +87,8 @@ static void request_handler(struct smbcli_request *req)
        DATA_BLOB null_data_blob = data_blob(NULL, 0);
        NTSTATUS session_key_err, nt_status;
        struct smbcli_request *check_req = NULL;
+       const char *os = NULL;
+       const char *lanman = NULL;
 
        if (req->sign_caller_checks) {
                req->do_not_free = true;
@@ -126,6 +128,8 @@ static void request_handler(struct smbcli_request *req)
                                }
                        }
                }
+               os = state->setup.old.out.os;
+               lanman = state->setup.old.out.lanman;
                break;
 
        case RAW_SESSSETUP_NT1:
@@ -145,6 +149,8 @@ static void request_handler(struct smbcli_request *req)
                                }
                        }
                }
+               os = state->setup.nt1.out.os;
+               lanman = state->setup.nt1.out.lanman;
                break;
 
        case RAW_SESSSETUP_SPNEGO:
@@ -216,6 +222,8 @@ static void request_handler(struct smbcli_request *req)
                        composite_continue_smb(c, state->req, request_handler, c);
                        return;
                }
+               os = state->setup.spnego.out.os;
+               lanman = state->setup.spnego.out.lanman;
                break;
 
        case RAW_SESSSETUP_SMB2:
@@ -246,6 +254,19 @@ static void request_handler(struct smbcli_request *req)
                return;
        }
 
+       if (os) {
+               session->os = talloc_strdup(session, os);
+               if (composite_nomem(session->os, c)) return;
+       } else {
+               session->os = NULL;
+       }
+       if (lanman) {
+               session->lanman = talloc_strdup(session, lanman);
+               if (composite_nomem(session->lanman, c)) return;
+       } else {
+               session->lanman = NULL;
+       }
+
        composite_done(c);
 }