Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/libsmb/smb_signing.c

    r124 r134  
    2727        uint16 mid;
    2828        uint32 reply_seq_num;
     29        BOOL can_delete; /* Set to False in trans state. */
    2930};
    3031
     
    4344        for (t = *list; t; t = t->next) {
    4445                if (t->mid == mid) {
    45                         DLIST_REMOVE(*list, t);
    46                         SAFE_FREE(t);
    47                         break;
     46                        return False;
    4847                }
    4948        }
     
    5453        t->mid = mid;
    5554        t->reply_seq_num = reply_seq_num;
     55        t->can_delete = True;
    5656
    5757        /*
     
    8080                        DEBUG(10,("get_sequence_for_reply: found seq = %u mid = %u\n",
    8181                                (unsigned int)t->reply_seq_num, (unsigned int)t->mid ));
    82                         DLIST_REMOVE(*list, t);
    83                         SAFE_FREE(t);
     82                        if (t->can_delete) {
     83                                DLIST_REMOVE(*list, t);
     84                                SAFE_FREE(t);
     85                        }
     86                        return True;
     87                }
     88        }
     89        return False;
     90}
     91
     92static BOOL set_sequence_can_delete_flag(struct outstanding_packet_lookup **list, uint16 mid, BOOL can_delete_entry)
     93{
     94        struct outstanding_packet_lookup *t;
     95
     96        for (t = *list; t; t = t->next) {
     97                if (t->mid == mid) {
     98                        t->can_delete = can_delete_entry;
    8499                        return True;
    85100                }
     
    590605
    591606/***********************************************************
     607 Enter trans/trans2/nttrans state.
     608************************************************************/
     609
     610BOOL client_set_trans_sign_state_on(struct cli_state *cli, uint16 mid)
     611{
     612        struct smb_sign_info *si = &cli->sign_info;
     613        struct smb_basic_signing_context *data = (struct smb_basic_signing_context *)si->signing_context;
     614
     615        if (!si->doing_signing) {
     616                return True;
     617        }
     618
     619        if (!data) {
     620                return False;
     621        }
     622
     623        if (!set_sequence_can_delete_flag(&data->outstanding_packet_list, mid, False)) {
     624                return False;
     625        }
     626
     627        return True;
     628}
     629
     630/***********************************************************
     631 Leave trans/trans2/nttrans state.
     632************************************************************/
     633
     634BOOL client_set_trans_sign_state_off(struct cli_state *cli, uint16 mid)
     635{
     636        uint32 reply_seq_num;
     637        struct smb_sign_info *si = &cli->sign_info;
     638        struct smb_basic_signing_context *data = (struct smb_basic_signing_context *)si->signing_context;
     639
     640        if (!si->doing_signing) {
     641                return True;
     642        }
     643
     644        if (!data) {
     645                return False;
     646        }
     647
     648        if (!set_sequence_can_delete_flag(&data->outstanding_packet_list, mid, True)) {
     649                return False;
     650        }
     651
     652        /* Now delete the stored mid entry. */
     653        if (!get_sequence_for_reply(&data->outstanding_packet_list, mid, &reply_seq_num)) {
     654                return False;
     655        }
     656
     657        return True;
     658}
     659
     660/***********************************************************
    592661 SMB signing - Server implementation - send the MAC.
    593662************************************************************/
Note: See TracChangeset for help on using the changeset viewer.