Enable tls psk
[radsecproxy.git] / util.c
1 /* Copyright 2012-2013 NORDUnet A/S. All rights reserved.
2    See LICENSE for licensing information. */
3
4 #include <stdlib.h>
5 #include <string.h>
6 #include <radsec/radsec.h>
7 #include <radsec/radsec-impl.h>
8 #include "util.h"
9
10 char *
11 rs_strdup (struct rs_context *ctx, const char *s)
12 {
13   size_t len;
14   char *buf;
15
16   len = strlen (s);
17   buf = rs_malloc (ctx, len + 1);
18
19   if (buf != NULL)
20     memcpy (buf, s, len + 1);
21   else
22     rs_err_ctx_push (ctx, RSE_NOMEM, __func__);
23
24   return buf;
25 }