Include stdlib.h everywhere we call (m|c)alloc.
[radsecproxy.git] / lib / packet.c
index a3f571f..bfa82df 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright 2010, 2011 NORDUnet A/S. All rights reserved.
-   See the file COPYING for licensing information.  */
+/* Copyright 2010-2013 NORDUnet A/S. All rights reserved.
+   See LICENSE for licensing information.  */
 
 #if defined HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <assert.h>
 #include <radius/client.h>
 #include <event2/bufferevent.h>
@@ -137,16 +138,6 @@ rs_packet_create (struct rs_connection *conn, struct rs_packet **pkt_out)
   if (rpkt == NULL)
     return rs_err_conn_push (conn, RSE_NOMEM, __func__);
 
-  /*
-   * This doesn't make sense; the packet identifier is constant for
-   * an entire conversation. A separate API should be provided to
-   * allow the application to set the packet ID, or a conversation
-   * object should group related packets together.
-   */
-#if 0
-  rpkt->id = conn->nextid++
-#endif
-
   err = nr_packet_init (rpkt, NULL, NULL,
                        PW_ACCESS_REQUEST,
                        rpkt + 1, RS_MAX_PACKET_LEN);
@@ -169,9 +160,7 @@ rs_packet_create (struct rs_connection *conn, struct rs_packet **pkt_out)
 int
 rs_packet_create_authn_request (struct rs_connection *conn,
                                struct rs_packet **pkt_out,
-                               const char *user_name,
-                                const char *user_pw,
-                                const char *secret)
+                               const char *user_name, const char *user_pw)
 {
   struct rs_packet *pkt;
   int err;
@@ -191,7 +180,6 @@ rs_packet_create_authn_request (struct rs_connection *conn,
 
   if (user_pw)
     {
-      pkt->rpkt->secret = secret;
       err = rs_packet_append_avp (pkt, PW_USER_PASSWORD, 0, user_pw, 0);
       if (err)
        return err;
@@ -224,7 +212,7 @@ rs_packet_append_avp (struct rs_packet *pkt,
 
   da = nr_dict_attr_byvalue (attr, vendor);
   if (da == NULL)
-    return RSE_ATTR_TYPE_UNKNOWN;
+    return rs_err_conn_push (pkt->conn, RSE_ATTR_TYPE_UNKNOWN, __func__);
 
   err = nr_packet_attr_append (pkt->rpkt, NULL, da, data, data_len);
   if (err < 0)