summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/attr.c2
-rw-r--r--lib/debug.c6
-rw-r--r--lib/debug.h2
-rw-r--r--lib/include/radsec/radsec-impl.h7
-rw-r--r--lib/include/radsec/radsec.h17
-rw-r--r--lib/packet.c33
7 files changed, 18 insertions, 50 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d4d9b78..e81ee77 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,6 @@ AM_CFLAGS = -Wall -g
lib_LTLIBRARIES = libradsec.la
libradsec_la_SOURCES = \
- attr.c \
compat.c \
conf.c \
conn.c \
diff --git a/lib/attr.c b/lib/attr.c
index 2face5f..16a6d39 100644
--- a/lib/attr.c
+++ b/lib/attr.c
@@ -1,6 +1,8 @@
/* Copyright 2010, 2011 NORDUnet A/S. All rights reserved.
See the file COPYING for licensing information. */
+/* NOTE: This file is not in use at the moment (libradsec-0.0.1). */
+
#if defined HAVE_CONFIG_H
#include <config.h>
#endif
diff --git a/lib/debug.c b/lib/debug.c
index 59f25c1..3d3a2b9 100644
--- a/lib/debug.c
+++ b/lib/debug.c
@@ -28,12 +28,6 @@ rs_dump_packet (const struct rs_packet *pkt)
fflush (stderr);
}
-void
-rs_dump_attr (const struct rs_attr *attr)
-{
- vp_printlist (stderr, attr->vp);
-}
-
#if defined DEBUG
int
_rs_debug (const char *fmt, ...)
diff --git a/lib/debug.h b/lib/debug.h
index a8d8632..0bf6129 100644
--- a/lib/debug.h
+++ b/lib/debug.h
@@ -13,9 +13,7 @@ extern "C" {
#endif
struct rs_packet;
-struct rs_attr;
void rs_dump_packet (const struct rs_packet *pkt);
-void rs_dump_attr (const struct rs_attr *attr);
int _rs_debug (const char *fmt, ...);
#if defined (DEBUG)
diff --git a/lib/include/radsec/radsec-impl.h b/lib/include/radsec/radsec-impl.h
index 9bcd208..3c1c53c 100644
--- a/lib/include/radsec/radsec-impl.h
+++ b/lib/include/radsec/radsec-impl.h
@@ -104,15 +104,10 @@ struct rs_packet {
struct rs_connection *conn;
unsigned int flags;
uint8_t hdr[RS_HEADER_LEN];
- RADIUS_PACKET *rpkt;
+ RADIUS_PACKET *rpkt; /* FreeRADIUS object. */
struct rs_packet *next; /* Used for UDP output queue. */
};
-struct rs_attr {
- struct rs_packet *pkt;
- VALUE_PAIR *vp;
-};
-
/* Nonpublic functions (in radsec.c -- FIXME: move?). */
struct rs_error *rs_resolv (struct evutil_addrinfo **addr,
rs_conn_type_t type,
diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h
index 66c55f3..6b0a69c 100644
--- a/lib/include/radsec/radsec.h
+++ b/lib/include/radsec/radsec.h
@@ -49,7 +49,6 @@ struct rs_context; /* radsec-impl.h */
struct rs_connection; /* radsec-impl.h */
struct rs_packet; /* radsec-impl.h */
struct rs_conn; /* radsec-impl.h */
-struct rs_attr; /* radsec-impl.h */
struct rs_error; /* radsec-impl.h */
struct rs_peer; /* radsec-impl.h */
struct radius_packet; /* <freeradius/libradius.h> */
@@ -222,9 +221,6 @@ int rs_packet_create(struct rs_connection *conn, struct rs_packet **pkt_out);
/** Free all memory allocated for packet \a pkt. */
void rs_packet_destroy(struct rs_packet *pkt);
-/** Add attribute \a attr to packet \a pkt. */
-void rs_packet_add_attr(struct rs_packet *pkt, struct rs_attr *attr);
-
/** Send packet \a pkt on the connection associated with \a pkt. \a
user_data is sent to the \a rs_conn_packet_received_cb callback
registered with the connection. If no callback is registered with
@@ -249,19 +245,6 @@ int rs_packet_create_authn_request(struct rs_connection *conn,
const char *user_name,
const char *user_pw);
-/***************/
-/* Attribute. */
-/***************/
-/* FIXME: Replace (or complement) with a wrapper for paircreate(). */
-/** Create a RADIUS attribute of type \a type and with the value \a
- val. */
-int rs_attr_create(struct rs_connection *conn,
- struct rs_attr **attr,
- const char *type,
- const char *val);
-/** Free memory for RADIUS attribute \a attr. */
-void rs_attr_destroy(struct rs_attr *attr);
-
/************/
/* Config. */
/************/
diff --git a/lib/packet.c b/lib/packet.c
index 48fb55e..3519c1c 100644
--- a/lib/packet.c
+++ b/lib/packet.c
@@ -150,7 +150,7 @@ rs_packet_create_authn_request (struct rs_connection *conn,
const char *user_name, const char *user_pw)
{
struct rs_packet *pkt;
- struct rs_attr *attr;
+ VALUE_PAIR *vp = NULL;
if (rs_packet_create (conn, pkt_out))
return -1;
@@ -159,26 +159,23 @@ rs_packet_create_authn_request (struct rs_connection *conn,
if (user_name)
{
- if (rs_attr_create (conn, &attr, "User-Name", user_name))
- return -1;
- rs_packet_add_attr (pkt, attr);
-
- if (user_pw)
- {
- if (rs_attr_create (conn, &attr, "User-Password", user_pw))
- return -1;
- rs_packet_add_attr (pkt, attr);
- }
+ vp = pairmake ("User-Name", user_name, T_OP_EQ);
+ if (vp == NULL)
+ return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
+ "pairmake: %s", fr_strerror ());
+ pairadd (&pkt->rpkt->vps, vp);
}
- return RSE_OK;
-}
+ if (user_pw)
+ {
+ vp = pairmake ("User-Password", user_pw, T_OP_EQ);
+ if (vp == NULL)
+ return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
+ "pairmake: %s", fr_strerror ());
+ pairadd (&pkt->rpkt->vps, vp);
+ }
-void
-rs_packet_add_attr (struct rs_packet *pkt, struct rs_attr *attr)
-{
- pairadd (&pkt->rpkt->vps, attr->vp);
- attr->pkt = pkt;
+ return RSE_OK;
}
struct radius_packet *