- added support for empty traffic selectors and empty sa payload in
[strongswan.git] / Source / charon / encoding / payloads / ts_payload.c
index 0e6ed99..59b7322 100644 (file)
@@ -128,7 +128,7 @@ encoding_rule_t ts_payload_encodings[] = {
 static status_t verify(private_ts_payload_t *this)
 {
        iterator_t *iterator;
-       status_t status;
+       status_t status = SUCCESS;
        
        if (this->critical)
        {
@@ -142,7 +142,6 @@ static status_t verify(private_ts_payload_t *this)
        }
        
        iterator = this->traffic_selectors->create_iterator(this->traffic_selectors,TRUE);
-       
        while(iterator->has_next(iterator))
        {
                payload_t *current_traffic_selector;
@@ -154,10 +153,8 @@ static status_t verify(private_ts_payload_t *this)
                        break;
                }
        }
-       
        iterator->destroy(iterator);
        
-       
        return status;
 }
 
@@ -175,7 +172,14 @@ static void get_encoding_rules(private_ts_payload_t *this, encoding_rule_t **rul
  */
 static payload_type_t get_payload_type(private_ts_payload_t *this)
 {
-       return ((this->is_initiator) ? TRAFFIC_SELECTOR_INITIATOR : TRAFFIC_SELECTOR_RESPONDER);
+       if (this->is_initiator)
+       {
+               return TRAFFIC_SELECTOR_INITIATOR;
+       }
+       else
+       {
+               return TRAFFIC_SELECTOR_RESPONDER;
+       }
 }
 
 /**
@@ -336,7 +340,7 @@ ts_payload_t *ts_payload_create(bool is_initiator)
        this->next_payload = NO_PAYLOAD;
        this->payload_length =TS_PAYLOAD_HEADER_LENGTH;
        this->is_initiator = is_initiator;
-       this->number_of_traffic_selectors=0;
+       this->number_of_traffic_selectors = 0;
        this->traffic_selectors = linked_list_create();  
 
        return &(this->public);