summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-01-16 14:04:27 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-01-16 14:04:27 +0000
commit234912c553f7808f25064b1a3980eb3651bb313e (patch)
treea590d3f313cd7bb472816bd4d1e1f89fe8a65d04 /util.c
parent10b6ffd2053e96df55c3f7693980aa9dbe68ba16 (diff)
added code for reading main config and restructured tls init code
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@39 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'util.c')
-rw-r--r--util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/util.c b/util.c
index 7ca29c7..e4372a3 100644
--- a/util.c
+++ b/util.c
@@ -45,6 +45,18 @@ void err(char *format, ...) {
fprintf(stderr, "\n");
}
+char *stringcopy(char *s, int len) {
+ char *r;
+ if (!len)
+ len = strlen(s);
+ r = malloc(len + 1);
+ if (!r)
+ errx("stringcopy: malloc failed");
+ memcpy(r, s, len);
+ r[len] = '\0';
+ return r;
+}
+
char *addr2string(struct sockaddr *addr, socklen_t len) {
struct sockaddr_in6 *sa6;
struct sockaddr_in sa4;