summaryrefslogtreecommitdiff
path: root/lib/peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/peer.c')
-rw-r--r--lib/peer.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/peer.c b/lib/peer.c
index 256ff76..01dc243 100644
--- a/lib/peer.c
+++ b/lib/peer.c
@@ -13,6 +13,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)
@@ -69,16 +70,17 @@ rs_peer_create (struct rs_connection *conn, struct rs_peer **peer_out)
int
rs_peer_set_address (struct rs_peer *peer, const char *hostname,
- const char *service)
+ 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_resolv (&peer->addr, peer->realm->type, hostname, service);
- if (err)
- return err_conn_push_err (peer->conn, err);
return RSE_OK;
}