diff --git a/configure.ac b/configure.ac index fb3e22373..01bf32032 100644 --- a/configure.ac +++ b/configure.ac @@ -465,6 +465,8 @@ AC_CHECK_FUNCS([ \ backtrace \ fcntl \ fork \ + fseeko \ + ftello \ getpeereid \ getpeerucred \ getresgid \ diff --git a/include/config.h.w32 b/include/config.h.w32 index 993268def..d52eb6b67 100644 --- a/include/config.h.w32 +++ b/include/config.h.w32 @@ -1,5 +1,5 @@ /*********************************************************************** - * Copyright (c) 2009-2016, Secure Endpoints Inc. + * Copyright (c) 2009-2017, Secure Endpoints Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -355,6 +355,18 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define to 1 if you have the header file. */ /* #undef HAVE_FNMATCH_H */ +/* Define if you have the function `fseeko'. */ +/* #undef HAVE_FSEEKO */ + +/* Define if you have the function `ftello'. */ +/* #undef HAVE_FTELLO */ + +/* Define if you have the function `_fseeki64'. */ +#define HAVE__FSEEKI64 1 + +/* Define if you have the function `_ftelli64'. */ +#define HAVE__FTELLI64 1 + /* Define if el_init takes four arguments. */ /* #undef HAVE_FOUR_VALUED_EL_INIT */ diff --git a/lib/roken/Makefile.am b/lib/roken/Makefile.am index 92b890324..e6fd25691 100644 --- a/lib/roken/Makefile.am +++ b/lib/roken/Makefile.am @@ -89,6 +89,8 @@ libroken_la_SOURCES = \ eread.c \ esetenv.c \ ewrite.c \ + fseeko.c \ + ftello.c \ getaddrinfo_hostspec.c \ get_default_username.c \ get_window_size.c \ diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index a14a7ee51..c0f837ed0 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -1,6 +1,6 @@ ######################################################################## # -# Copyright (c) 2009, Secure Endpoints Inc. +# Copyright (c) 2009 - 2017, Secure Endpoints Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -55,6 +55,8 @@ libroken_la_OBJS = \ $(OBJ)\ewrite.obj \ $(OBJ)\flock.obj \ $(OBJ)\fnmatch.obj \ + $(OBJ)\fseeko.obj \ + $(OBJ)\ftello.obj \ $(OBJ)\getauxval.obj \ $(OBJ)\getaddrinfo_hostspec.obj \ $(OBJ)\get_default_username.obj \ diff --git a/lib/roken/fseeko.c b/lib/roken/fseeko.c new file mode 100644 index 000000000..b6ffaa2ba --- /dev/null +++ b/lib/roken/fseeko.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "roken.h" + +#ifndef HAVE_FSEEKO +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +fseeko(FILE *f, off_t o, int w) +{ +#ifdef HAVE__FSEEKI64 + return _fseeki64(f, o, w); +#else + return fseek(f, o, w); +#endif +} +#endif diff --git a/lib/roken/ftello.c b/lib/roken/ftello.c new file mode 100644 index 000000000..cd3b84b80 --- /dev/null +++ b/lib/roken/ftello.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "roken.h" + +#ifndef HAVE_FTELLO +ROKEN_LIB_FUNCTION off_t ROKEN_LIB_CALL +ftello(FILE *f) +{ +#ifdef HAVE__FTELLI64 + return _ftelli64(f); +#else + return ftell(f); +#endif +} +#endif diff --git a/lib/roken/version-script.map b/lib/roken/version-script.map index 4cb011118..7c1a01735 100644 --- a/lib/roken/version-script.map +++ b/lib/roken/version-script.map @@ -12,6 +12,8 @@ HEIMDAL_ROKEN_1.0 { err; errx; free_getarg_strings; + fseeko; + ftello; get_default_username; get_window_size; getarg;