Commit ea3cbb5f authored by Dafydd Harries's avatar Dafydd Harries

generate random usernames/passwords for local candidates

darcs-hash:20070131161113-c9803-550a9fd4d61c6aa696bd046336e0e14dae2e71cf.gz
parent 87cde178
AM_CFLAGS = -Wall -Werror \
-I $(top_srcdir)/random \
-I $(top_srcdir)/udp \
-I $(top_srcdir)/stun \
$(GLIB_CFLAGS)
......@@ -17,6 +18,7 @@ libagent_la_SOURCES = \
agent.c
libagent_la_LIBADD = \
$(top_builddir)/random/librandom.la \
$(top_builddir)/udp/libudp.la \
$(top_builddir)/stun/libstun.la
......
......@@ -10,7 +10,8 @@
#include <stun.h>
#include <udp.h>
#include <agent.h>
#include "agent.h"
#include "random.h"
/*** component ***/
......@@ -214,6 +215,7 @@ nice_agent_add_local_host_candidate (
guint component_id,
NiceAddress *address)
{
NiceRNG *rng;
NiceCandidate *candidate;
struct sockaddr_in sin;
......@@ -226,6 +228,12 @@ nice_agent_add_local_host_candidate (
agent->local_candidates = g_slist_append (agent->local_candidates,
candidate);
/* generate username/password */
rng = nice_rng_new ();
nice_rng_generate_bytes_print (rng, 8, candidate->username);
nice_rng_generate_bytes_print (rng, 8, candidate->password);
nice_rng_free (rng);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = htonl (address->addr_ipv4);
sin.sin_port = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment