diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 5 | ||||
-rw-r--r-- | lib/util.c | 19 | ||||
-rw-r--r-- | lib/util.h | 4 |
3 files changed, 26 insertions, 2 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 294f04e..6b31435 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -37,7 +37,8 @@ libradsec_la_SOURCES = \ request.c \ send.c \ tcp.c \ - udp.c + udp.c \ + util.c libradsec_la_SOURCES += \ rsp_debug.c \ @@ -52,4 +53,4 @@ libradsec_la_SOURCES += \ endif libradsec_la_LDFLAGS = -version-info 0:0:0 -export-symbols radsec.sym -libradsec_la_CFLAGS = $(AM_CFLAGS) -Werror # -DDEBUG -DDEBUG_LEVENT +libradsec_la_CFLAGS = $(AM_CFLAGS) -DDEBUG -DDEBUG_LEVENT diff --git a/lib/util.c b/lib/util.c new file mode 100644 index 0000000..3c9fef6 --- /dev/null +++ b/lib/util.c @@ -0,0 +1,19 @@ +/* Copyright 2012 NORDUnet A/S. All rights reserved. + See the file COPYING for licensing information. */ + +#include <string.h> +#include <radsec/radsec.h> +#include <radsec/radsec-impl.h> +#include "util.h" + +char * +rs_strdup (struct rs_context *ctx, const char *s) +{ + char *buf = rs_calloc (ctx, 1, strlen (s) + 1); + + if (buf != NULL) + return strcpy (buf, s); + + rs_err_ctx_push (ctx, RSE_NOMEM, NULL); + return NULL; +} diff --git a/lib/util.h b/lib/util.h new file mode 100644 index 0000000..90c55d8 --- /dev/null +++ b/lib/util.h @@ -0,0 +1,4 @@ +/* Copyright 2012 NORDUnet A/S. All rights reserved. + See the file COPYING for licensing information. */ + +char *rs_strdup (struct rs_context *ctx, const char *s); |