diff options
-rw-r--r-- | lib/peer.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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; } |