summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/roken
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-08-01 07:08:51 +0200
committerStefan Metzmacher <metze@samba.org>2008-08-01 16:11:00 +0200
commita925f039ee382df0f3be434108416bab0d17e8c0 (patch)
tree6055ac5d6e81435bb5a8fa88959535e99c850a55 /source4/heimdal/lib/roken
parentcf875a562173d5ae99080cea594e79c6a5555307 (diff)
downloadsamba-a925f039ee382df0f3be434108416bab0d17e8c0.tar.gz
samba-a925f039ee382df0f3be434108416bab0d17e8c0.tar.bz2
samba-a925f039ee382df0f3be434108416bab0d17e8c0.zip
heimdal: update to lorikeet-heimdal rev 801
metze (This used to be commit d6c54a66fb23c784ef221a3c1cf766b72bdb5a0b)
Diffstat (limited to 'source4/heimdal/lib/roken')
-rw-r--r--source4/heimdal/lib/roken/dumpdata.c44
-rw-r--r--source4/heimdal/lib/roken/err.hin2
-rw-r--r--source4/heimdal/lib/roken/resolve.c5
-rw-r--r--source4/heimdal/lib/roken/roken-common.h15
-rw-r--r--source4/heimdal/lib/roken/roken.h.in2
-rw-r--r--source4/heimdal/lib/roken/vis.hin2
6 files changed, 63 insertions, 7 deletions
diff --git a/source4/heimdal/lib/roken/dumpdata.c b/source4/heimdal/lib/roken/dumpdata.c
index c445bfa361..81fd127296 100644
--- a/source4/heimdal/lib/roken/dumpdata.c
+++ b/source4/heimdal/lib/roken/dumpdata.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: dumpdata.c 21005 2007-06-08 01:54:35Z lha $");
+RCSID("$Id: dumpdata.c 23412 2008-07-26 18:34:23Z lha $");
#endif
#include <unistd.h>
@@ -55,3 +55,45 @@ rk_dumpdata (const char *filename, const void *buf, size_t size)
net_write(fd, buf, size);
close(fd);
}
+
+/*
+ * Read all data from a filename, care about errors.
+ */
+
+int ROKEN_LIB_FUNCTION
+rk_undumpdata(const char *filename, void **buf, size_t *size)
+{
+ struct stat sb;
+ int fd, ret;
+ ssize_t sret;
+
+ *buf = NULL;
+
+ fd = open(filename, O_RDONLY, 0);
+ if (fd < 0)
+ return errno;
+ if (fstat(fd, &sb) != 0){
+ ret = errno;
+ goto out;
+ }
+ *buf = malloc(sb.st_size);
+ if (*buf == NULL) {
+ ret = ENOMEM;
+ goto out;
+ }
+ *size = sb.st_size;
+
+ sret = net_read(fd, *buf, *size);
+ if (sret < 0)
+ ret = errno;
+ else if (sret != *size) {
+ ret = EINVAL;
+ free(*buf);
+ *buf = NULL;
+ } else
+ ret = 0;
+
+ out:
+ close(fd);
+ return ret;
+}
diff --git a/source4/heimdal/lib/roken/err.hin b/source4/heimdal/lib/roken/err.hin
index fcae879279..2f1232d3e7 100644
--- a/source4/heimdal/lib/roken/err.hin
+++ b/source4/heimdal/lib/roken/err.hin
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: err.hin,v 1.18 2005/04/12 11:28:38 lha Exp $ */
+/* $Id: err.hin 14773 2005-04-12 11:29:18Z lha $ */
#ifndef __ERR_H__
#define __ERR_H__
diff --git a/source4/heimdal/lib/roken/resolve.c b/source4/heimdal/lib/roken/resolve.c
index a8778fda57..bf064e8aae 100644
--- a/source4/heimdal/lib/roken/resolve.c
+++ b/source4/heimdal/lib/roken/resolve.c
@@ -45,7 +45,7 @@
#include <assert.h>
-RCSID("$Id: resolve.c 19869 2007-01-12 16:03:14Z lha $");
+RCSID("$Id: resolve.c 22873 2008-04-07 18:50:39Z lha $");
#ifdef _AIX /* AIX have broken res_nsearch() in 5.1 (5.0 also ?) */
#undef HAVE_RES_NSEARCH
@@ -128,7 +128,8 @@ parse_record(const unsigned char *data, const unsigned char *end_data,
const unsigned char **pp, struct resource_record **ret_rr)
{
struct resource_record *rr;
- int type, class, ttl, size;
+ int type, class, ttl;
+ unsigned size;
int status;
char host[MAXDNAME];
const unsigned char *p = *pp;
diff --git a/source4/heimdal/lib/roken/roken-common.h b/source4/heimdal/lib/roken/roken-common.h
index b835e880a2..f943202c45 100644
--- a/source4/heimdal/lib/roken/roken-common.h
+++ b/source4/heimdal/lib/roken/roken-common.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: roken-common.h 20867 2007-06-03 21:00:45Z lha $ */
+/* $Id: roken-common.h 23468 2008-07-27 12:16:56Z lha $ */
#ifndef __ROKEN_COMMON_H__
#define __ROKEN_COMMON_H__
@@ -400,6 +400,19 @@ rk_strpoolfree(struct rk_strpool *);
void ROKEN_LIB_FUNCTION
rk_dumpdata (const char *, const void *, size_t);
+int ROKEN_LIB_FUNCTION
+rk_undumpdata (const char *, void **, size_t *);
+
+void ROKEN_LIB_FUNCTION
+rk_xfree (void *);
+
+void ROKEN_LIB_FUNCTION
+rk_cloexec(int);
+
+void ROKEN_LIB_FUNCTION
+rk_cloexec_file(FILE *);
+
+
ROKEN_CPP_END
#endif /* __ROKEN_COMMON_H__ */
diff --git a/source4/heimdal/lib/roken/roken.h.in b/source4/heimdal/lib/roken/roken.h.in
index 82473d7053..cf2ee9ed7b 100644
--- a/source4/heimdal/lib/roken/roken.h.in
+++ b/source4/heimdal/lib/roken/roken.h.in
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*/
-/* $Id: roken.h.in,v 1.182 2006/10/19 16:35:16 lha Exp $ */
+/* $Id: roken.h.in 18612 2006-10-19 16:35:16Z lha $ */
#include <stdio.h>
#include <stdlib.h>
diff --git a/source4/heimdal/lib/roken/vis.hin b/source4/heimdal/lib/roken/vis.hin
index b7a6f3ceff..224870b00a 100644
--- a/source4/heimdal/lib/roken/vis.hin
+++ b/source4/heimdal/lib/roken/vis.hin
@@ -1,5 +1,5 @@
/* $NetBSD: vis.h,v 1.11 1999/11/25 16:55:50 wennmach Exp $ */
-/* $Id: vis.hin,v 1.7 2006/12/15 11:53:09 lha Exp $ */
+/* $Id: vis.hin 19341 2006-12-15 11:53:09Z lha $ */
/*-
* Copyright (c) 1990, 1993