Include stdlib.h everywhere we call (m|c)alloc.
[libradsec.git] / lib / packet.c
index 8073945..bfa82df 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright 2010, 2011 NORDUnet A/S. All rights reserved.
+/* 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>
@@ -159,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;
@@ -181,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;
@@ -214,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)