two small fixes
[strongswan.git] / src / charon / sa / connect_manager.c
index 06755fa..fa5be96 100644 (file)
@@ -1,12 +1,5 @@
-/**
- * @file connect_manager.c
- *
- * @brief Implementation of connect_manager_t.
- *
- */
-
 /*
- * Copyright (C) 2007 Tobias Brunner
+ * Copyright (C) 2007-2008 Tobias Brunner
  * Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -18,6 +11,8 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
+ *
+ * $Id$
  */
 
 #include "connect_manager.h"
@@ -865,7 +860,7 @@ static status_t process_payloads(message_t *message, check_t *check)
                                        break;
                                }
                                check->session_id = chunk_clone(notify->get_notification_data(notify));
-                               DBG3(DBG_IKE, "received p2p_sessionid %B", &check->session_id);
+                               DBG2(DBG_IKE, "received P2P_SESSIONID %#B", &check->session_id);
                                break;
                        }
                        case COOKIE:
@@ -876,7 +871,7 @@ static status_t process_payloads(message_t *message, check_t *check)
                                        break;
                                }
                                check->cookie = chunk_clone(notify->get_notification_data(notify));
-                               DBG3(DBG_IKE, "received cookie %B", &check->cookie);
+                               DBG2(DBG_IKE, "received COOKIE %#B", &check->cookie);
                                break;
                        }
                        default:
@@ -1012,13 +1007,16 @@ static void send_check(private_connect_manager_t *this, check_list_t *checklist,
        message->set_ike_sa_id(message, ike_sa_id_create(0, 0, request));
 
        message->add_notify(message, FALSE, P2P_SESSIONID, check->session_id);
+       DBG2(DBG_IKE, "send P2P_SESSIONID %#B", &check->session_id);
        
        notify_payload_t *endpoint = check->endpoint->build_notify(check->endpoint);
        check->endpoint_raw = chunk_clone(endpoint->get_notification_data(endpoint));
        message->add_payload(message, (payload_t*)endpoint);
+       DBG2(DBG_IKE, "send P2P_ENDPOINT notify");
        
        check->cookie = build_signature(this, checklist, check, TRUE);
        message->add_notify(message, FALSE, COOKIE, check->cookie);
+       DBG2(DBG_IKE, "send COOKIE %#B", &check->cookie);
        
        packet_t *packet;
        if (message->generate(message, NULL, NULL, &packet) == SUCCESS)
@@ -1513,7 +1511,14 @@ connect_manager_t *connect_manager_create()
        this->public.set_responder_data = (status_t(*)(connect_manager_t*,chunk_t,chunk_t,linked_list_t*))set_responder_data;
        this->public.process_check = (void(*)(connect_manager_t*,message_t*))process_check;
        
-       this->hasher = hasher_create(HASH_SHA1);
+       this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
+       if (this->hasher == NULL)
+       {
+               DBG1(DBG_IKE, "unable to create connect manager, SHA1 not supported");
+               free(this);
+               return NULL;
+       }
+       
        this->checklists = linked_list_create();
        this->initiated = linked_list_create();