Merge branch 'merge-luke' into libradsec
authorLinus Nordberg <linus@nordu.net>
Mon, 11 Oct 2010 17:06:06 +0000 (19:06 +0200)
committerLinus Nordberg <linus@nordu.net>
Mon, 11 Oct 2010 17:06:06 +0000 (19:06 +0200)
8a676ab Robustness fixes (and some callback invocation) by Luke Howard.
ff55882 Request object implementation and bug fixes by Luke Howard.
06936d1 Have rad_decode() verify responses.

1  2 
lib/include/radsec/radsec.h
lib/packet.c

Simple merge
diff --cc lib/packet.c
@@@ -162,7 -190,31 +190,31 @@@ _read_cb (struct bufferevent *bev, voi
  #if defined (DEBUG)
        fprintf (stderr, "%s: complete packet read\n", __func__);
  #endif
-       rad_decode (pkt->rpkt, NULL, pkt->conn->active_peer->secret);
+       if (!rad_packet_ok (pkt->rpkt, 0) != 0)
+       return;
+       assert (pkt->original);
+       /* Verify header and message authenticator.  */
+       if (rad_verify (pkt->rpkt, pkt->original->rpkt,
+                     pkt->conn->active_peer->secret))
+       {
+         rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
+                              "rad_verify: %s", fr_strerror ());
+         return;
+       }
 -      /* decode and decrypt */
++      /* Decode and decrypt.  */
+       if (rad_decode (pkt->rpkt, pkt->original->rpkt,
+                     pkt->conn->active_peer->secret))
+       {
+         rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
+                              "rad_decode: %s", fr_strerror ());
+         return;
+       }
+       if (pkt->conn->callbacks.received_cb)
+       pkt->conn->callbacks.received_cb (pkt, pkt->conn->user_data);
        if (event_base_loopbreak (pkt->conn->evb) < 0)
        abort ();               /* FIXME */
      }