Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/smbd/seal.c

    r414 r745  
    1919
    2020#include "includes.h"
     21#include "smbd/smbd.h"
    2122#include "smbd/globals.h"
    2223#include "../libcli/auth/spnego.h"
     24#include "../libcli/auth/ntlmssp.h"
     25#include "ntlmssp_wrap.h"
     26#include "smb_crypt.h"
     27#include "../lib/util/asn1.h"
     28#include "auth.h"
     29#include "libsmb/libsmb.h"
    2330
    2431/******************************************************************************
     
    3239struct smb_srv_trans_enc_ctx {
    3340        struct smb_trans_enc_state *es;
    34         AUTH_NTLMSSP_STATE *auth_ntlmssp_state; /* Must be kept in sync with pointer in ec->ntlmssp_state. */
     41        struct auth_ntlmssp_state *auth_ntlmssp_state; /* Must be kept in sync with pointer in ec->ntlmssp_state. */
    3542};
    3643
     
    5461
    5562        /* Ignore non-session messages or non 0xFF'E' messages. */
    56         if(CVAL(inbuf,0) || !(inbuf[4] == 0xFF && inbuf[5] == 'E')) {
     63        if(CVAL(inbuf,0)
     64           || (smb_len(inbuf) < 8)
     65           || !(inbuf[4] == 0xFF && inbuf[5] == 'E')) {
    5766                return false;
    5867        }
     
    8594         * functions after any auth_ntlmssp_start/auth_ntlmssp_end.
    8695         */
    87         ec->es->s.ntlmssp_state = ec->auth_ntlmssp_state->ntlmssp_state;
     96        ec->es->s.ntlmssp_state = auth_ntlmssp_get_ntlmssp_state(ec->auth_ntlmssp_state);
    8897        return status;
    8998}
     
    101110
    102111        if (ec->auth_ntlmssp_state) {
    103                 auth_ntlmssp_end(&ec->auth_ntlmssp_state);
     112                TALLOC_FREE(ec->auth_ntlmssp_state);
    104113                /* The auth_ntlmssp_end killed this already. */
    105114                ec->es->s.ntlmssp_state = NULL;
     
    421430
    422431        /* Wrap in SPNEGO. */
    423         response = spnego_gen_auth_response(&auth_reply, status, OID_KERBEROS5);
     432        response = spnego_gen_auth_response(talloc_tos(), &auth_reply, status, OID_KERBEROS5);
    424433        data_blob_free(&auth_reply);
    425434
     
    459468
    460469        if (spnego_wrap) {
    461                 response = spnego_gen_auth_response(&chal, status, OID_NTLMSSP);
     470                response = spnego_gen_auth_response(talloc_tos(), &chal, status, OID_NTLMSSP);
    462471                data_blob_free(&chal);
    463472        } else {
     
    496505        blob = data_blob_const(*ppdata, *p_data_size);
    497506
    498         status = parse_spnego_mechanisms(blob, &secblob, &kerb_mech);
     507        status = parse_spnego_mechanisms(talloc_tos(), blob, &secblob, &kerb_mech);
    499508        if (!NT_STATUS_IS_OK(status)) {
    500509                return nt_status_squash(status);
     
    506515
    507516        if (kerb_mech) {
    508                 SAFE_FREE(kerb_mech);
     517                TALLOC_FREE(kerb_mech);
    509518
    510519#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
     
    564573
    565574        blob = data_blob_const(*ppdata, *p_data_size);
    566         if (!spnego_parse_auth(blob, &auth)) {
     575        if (!spnego_parse_auth(talloc_tos(), blob, &auth)) {
    567576                srv_free_encryption_context(&partial_srv_trans_enc_ctx);
    568577                return NT_STATUS_INVALID_PARAMETER;
     
    581590         */
    582591
    583         response = spnego_gen_auth_response(&auth_reply, status, NULL);
     592        response = spnego_gen_auth_response(talloc_tos(), &auth_reply, status, NULL);
    584593        data_blob_free(&auth_reply);
    585594
     
    710719
    711720        if (ec->es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
    712                 if ((ec->es->s.ntlmssp_state->neg_flags & (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) !=
    713                                 (NTLMSSP_NEGOTIATE_SIGN|NTLMSSP_NEGOTIATE_SEAL)) {
     721                if (!auth_ntlmssp_negotiated_sign((ec->auth_ntlmssp_state))) {
     722                        return NT_STATUS_INVALID_PARAMETER;
     723                }
     724
     725                if (!auth_ntlmssp_negotiated_seal((ec->auth_ntlmssp_state))) {
    714726                        return NT_STATUS_INVALID_PARAMETER;
    715727                }
Note: See TracChangeset for help on using the changeset viewer.