summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2012-04-26 10:10:33 +0200
committerLinus Nordberg <linus@nordu.net>2012-04-26 10:10:33 +0200
commit4e81d5cf94e408fcc1398359abeea9a7afc7fdb9 (patch)
tree5390cb3e9f627bbd9bcd8f71db21fbd845495e29 /lib
parent7edb35d951207383be47f91ec6b32f7ee9bbcfb4 (diff)
Don't resolve DNS names in rs_peer_set_address().
It simply stores (a copy of) hostname and service name in PEER.
Diffstat (limited to 'lib')
-rw-r--r--lib/peer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/peer.c b/lib/peer.c
index e4f76a2..6e06424 100644
--- a/lib/peer.c
+++ b/lib/peer.c
@@ -10,6 +10,7 @@
#include <radsec/radsec-impl.h>
#include "err.h"
#include "peer.h"
+#include "util.h"
struct rs_peer *
peer_pick_peer (struct rs_connection *conn)
@@ -68,14 +69,15 @@ int
rs_peer_set_address (struct rs_peer *peer, const char *hostname,
const char *service)
{
- struct rs_error *err;
-
assert (peer);
- assert (peer->realm);
+ assert (peer->conn);
+ assert (peer->conn->ctx);
+
+ peer->hostname = rs_strdup (peer->conn->ctx, hostname);
+ peer->service = rs_strdup (peer->conn->ctx, service);
+ if (peer->hostname == NULL || peer->service == NULL)
+ return RSE_NOMEM;
- err = rs_resolve (&peer->addr, peer->realm->type, hostname, service);
- if (err)
- return err_conn_push_err (peer->conn, err);
return RSE_OK;
}