Prefix all libc replacements with sudo_ and #define the real name

to the sudo_ version.  That way we don't pollute the libc namespace.
This commit is contained in:
Todd C. Miller
2014-06-26 15:51:08 -06:00
parent 4d37a4a162
commit 87c2fe5a31
29 changed files with 173 additions and 127 deletions

View File

@@ -506,9 +506,6 @@
/* Define to 1 if you have the `setauthdb' function. */
#undef HAVE_SETAUTHDB
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `seteuid' function. */
#undef HAVE_SETEUID

3
configure vendored
View File

@@ -17154,7 +17154,7 @@ $as_echo "#define HAVE_GETGROUPS 1" >>confdefs.h
fi
LIBS=$ac_save_LIBS
for ac_func in glob nl_langinfo regcomp setenv strftime strrchr strtoll \
for ac_func in glob nl_langinfo regcomp strftime strrchr strtoll \
sysconf tzset
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -18903,6 +18903,7 @@ fi
ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton"
if test "x$ac_cv_func_inet_pton" = xyes; then :
$as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
else

View File

@@ -2311,7 +2311,7 @@ dnl
dnl Function checks
dnl
AC_FUNC_GETGROUPS
AC_CHECK_FUNCS(glob nl_langinfo regcomp setenv strftime strrchr strtoll \
AC_CHECK_FUNCS(glob nl_langinfo regcomp strftime strrchr strtoll \
sysconf tzset)
AC_CHECK_FUNCS(getgrouplist, [], [
case "$host_os" in
@@ -2578,7 +2578,7 @@ dnl If inet_pton(3) not in libc, check -lnsl and -linet
dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
dnl Some systems may have inet_pton() in libresolv.
dnl
AC_CHECK_FUNC(inet_pton, [], [
AC_CHECK_FUNC(inet_pton, [AC_DEFINE(HAVE_INET_PTON)], [
for libs in "-lsocket" "-linet" "-lsocket -lnsl" "-lresolv"; do
_libs=
for lib in $libs; do

View File

@@ -25,8 +25,8 @@
#define FNM_LEADING_DIR (1 << 3) /* Only match the leading directory */
#define FNM_CASEFOLD (1 << 4) /* Case insensitive matching */
int rpl_fnmatch(const char *pattern, const char *string, int flags);
int sudo_fnmatch(const char *pattern, const char *string, int flags);
#define fnmatch(_a, _b, _c) rpl_fnmatch((_a), (_b), (_c))
#define fnmatch(_a, _b, _c) sudo_fnmatch((_a), (_b), (_c))
#endif /* _FNMATCH_H */

View File

@@ -66,10 +66,18 @@ struct addrinfo {
#define EAI_OVERFLOW 10 /* An argument buffer overflowed */
/* Function prototypes. */
int getaddrinfo(const char *nodename, const char *servname,
int sudo_getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res);
void freeaddrinfo(struct addrinfo *ai);
const char *gai_strerror(int ecode);
void sudo_freeaddrinfo(struct addrinfo *ai);
const char *sudo_gai_strerror(int ecode);
/* Map sudo_* to RFC 3493 names. */
#undef getaddrinfo
#define getaddrinfo(_a, _b, _c, _d) sudo_getaddrinfo((_a), (_b), (_c), (_d))
#undef freeaddrinfo
#define freeaddrinfo(_a) sudo_freeaddrinfo((_a))
#undef gai_strerror
#define gai_strerror(_a) sudo_gai_strerror((_a))
#endif /* !HAVE_GETADDRINFO */
#endif /* _COMPAT_GETADDRINFO_H */

View File

@@ -55,12 +55,21 @@ struct option {
int val;
};
int getopt_long(int, char * const *, const char *,
int sudo_getopt_long(int, char * const *, const char *,
const struct option *, int *);
int getopt_long_only(int, char * const *, const char *,
#undef getopt_long
#define getopt_long(_a, _b, _c, _d, _e) \
sudo_getopt_long((_a), (_b), (_c), (_d), (_e))
int sudo_getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#undef getopt_long_only
#define getopt_long_only(_a, _b, _c, _d, _e) \
sudo_getopt_long_only((_a), (_b), (_c), (_d), (_e))
#if 0
int getopt(int, char * const [], const char *);
int sudo_getopt(int, char * const [], const char *);
#undef getopt
#define getopt(_a, _b, _c) sudo_getopt((_a), (_b), (_c))
#endif
extern char *optarg; /* getopt(3) external variables */

View File

@@ -69,10 +69,10 @@ typedef struct {
#define GLOB_NOSYS (-4) /* Function not supported. */
#define GLOB_ABEND GLOB_ABORTED
int rpl_glob(const char *, int, int (*)(const char *, int), glob_t *);
void rpl_globfree(glob_t *);
int sudo_glob(const char *, int, int (*)(const char *, int), glob_t *);
void sudo_globfree(glob_t *);
#define glob(_a, _b, _c, _d) rpl_glob((_a), (_b), (_c), (_d))
#define globfree(_a) rpl_globfree((_a))
#define glob(_a, _b, _c, _d) sudo_glob((_a), (_b), (_c), (_d))
#define globfree(_a) sudo_globfree((_a))
#endif /* !_GLOB_H_ */

View File

@@ -363,96 +363,127 @@ int innetgr(const char *, const char *, const char *, const char *);
int getdomainname(char *, size_t);
#endif
/* Functions "missing" from libc. */
/*
* Functions "missing" from libc.
* All libc replacements are prefixed with "sudo_" to avoid namespace issues.
*/
struct timeval;
struct timespec;
#ifndef HAVE_CLOSEFROM
void closefrom(int);
#endif
void sudo_closefrom(int);
# undef closefrom
# define closefrom(_a) sudo_closefrom((_a))
#endif /* HAVE_CLOSEFROM */
#ifndef HAVE_GETCWD
char *getcwd(char *, size_t size);
#endif
char *sudo_getcwd(char *, size_t size);
# undef getcwd
# define getcwd(_a, _b) sudo_getcwd((_a), (_b))
#endif /* HAVE_GETCWD */
#ifndef HAVE_GETGROUPLIST
int getgrouplist(const char *, gid_t, gid_t *, int *);
#endif
int sudo_getgrouplist(const char *, gid_t, gid_t *, int *);
# undef getgrouplist
# define getgrouplist(_a, _b, _c, _d) sudo_getgrouplist((_a), (_b), (_c), (_d))
#endif /* GETGROUPLIST */
#ifndef HAVE_GETLINE
ssize_t getline(char **, size_t *, FILE *);
#endif
ssize_t sudo_getline(char **, size_t *, FILE *);
# undef getline
# define getline(_a, _b, _c) sudo_getline((_a), (_b), (_c))
#endif /* HAVE_GETLINE */
#ifndef HAVE_UTIMES
int utimes(const char *, const struct timeval *);
#endif
int sudo_utimes(const char *, const struct timeval *);
# undef utimes
# define utimes(_a, _b) sudo_utimes(((_a), (_b))
#endif /* HAVE_UTIMES */
#ifdef HAVE_FUTIME
int futimes(int, const struct timeval *);
#endif
int sudo_futimes(int, const struct timeval *);
# undef futimes
# define futimes(_a, _b) sudo_futimes(((_a), (_b))
#endif /* HAVE_FUTIME */
#if !defined(HAVE_SNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int rpl_snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
int sudo_snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
# undef snprintf
# define snprintf rpl_snprintf
#endif
# define snprintf sudo_snprintf
#endif /* HAVE_SNPRINTF */
#if !defined(HAVE_VSNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int rpl_vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0);
int sudo_vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0);
# undef vsnprintf
# define vsnprintf rpl_vsnprintf
#endif
# define vsnprintf sudo_vsnprintf
#endif /* HAVE_VSNPRINTF */
#if !defined(HAVE_ASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int rpl_asprintf(char **, const char *, ...) __printflike(2, 3);
int sudo_asprintf(char **, const char *, ...) __printflike(2, 3);
# undef asprintf
# define asprintf rpl_asprintf
#endif
# define asprintf sudo_asprintf
#endif /* HAVE_ASPRINTF */
#if !defined(HAVE_VASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int rpl_vasprintf(char **, const char *, va_list) __printflike(2, 0);
int sudo_vasprintf(char **, const char *, va_list) __printflike(2, 0);
# undef vasprintf
# define vasprintf rpl_vasprintf
#endif
# define vasprintf sudo_vasprintf
#endif /* HAVE_VASPRINTF */
#ifndef HAVE_STRLCAT
size_t strlcat(char *, const char *, size_t);
#endif
size_t sudo_strlcat(char *, const char *, size_t);
# undef strlcat
# define strlcat(_a, _b, _c) sudo_strlcat((_a), (_b), (_c))
#endif /* HAVE_STRLCAT */
#ifndef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
size_t sudo_strlcpy(char *, const char *, size_t);
# undef strlcpy
# define strlcpy(_a, _b, _c) sudo_strlcpy((_a), (_b), (_c))
#endif /* HAVE_STRLCPY */
#ifndef HAVE_MEMRCHR
void *memrchr(const void *, int, size_t);
#endif
void *sudo_memrchr(const void *, int, size_t);
# undef memrchr
# define memrchr(_a, _b, _c) sudo_memrchr((_a), (_b), (_c))
#endif /* HAVE_MEMRCHR */
#ifndef HAVE_MEMSET_S
errno_t memset_s(void *, rsize_t, int, rsize_t);
#endif
errno_t sudo_memset_s(void *, rsize_t, int, rsize_t);
# undef memset_s
# define memset_s(_a, _b, _c, _d) sudo_memset_s((_a), (_b), (_c), (_d))
#endif /* HAVE_MEMSET_S */
#ifndef HAVE_MKDTEMP
char *mkdtemp(char *);
#endif
char *sudo_mkdtemp(char *);
# undef mkdtemp
# define mkdtemp(_a) sudo_mkdtemp((_a))
#endif /* HAVE_MKDTEMP */
#ifndef HAVE_MKSTEMPS
int mkstemps(char *, int);
#endif
# undef mkstemps
# define mkstemps(_a, _b) sudo_mkstemps((_a), (_b))
#endif /* HAVE_MKSTEMPS */
#ifndef HAVE_PW_DUP
struct passwd *pw_dup(const struct passwd *);
#endif
#ifndef HAVE_SETENV
int setenv(const char *, const char *, int);
#endif
#ifndef HAVE_UNSETENV
int unsetenv(const char *);
#endif
struct passwd *sudo_pw_dup(const struct passwd *);
# undef pw_dup
# define pw_dup(_a) sudo_pw_dup((_a))
#endif /* HAVE_PW_DUP */
#ifndef HAVE_STRSIGNAL
char *strsignal(int);
#endif
char *sudo_strsignal(int);
# undef strsignal
# define strsignal(_a) sudo_strsignal((_a))
#endif /* HAVE_STRSIGNAL */
#ifndef HAVE_SIG2STR
int sig2str(int, char *);
#endif
int sudo_sig2str(int, char *);
# undef sig2str
# define sig2str(_a, _b) sudo_sig2str((_a), (_b))
#endif /* HAVE_SIG2STR */
#ifndef HAVE_STRTONUM
long long rpl_strtonum(const char *, long long, long long, const char **);
long long sudo_strtonum(const char *, long long, long long, const char **);
# undef strtonum
# define strtonum rpl_strtonum
#endif
# define strtonum(_a, _b, _c, _d) sudo_strtonum((_a), (_b), (_c), (_d))
#endif /* HAVE_STRTONUM */
#ifndef HAVE_CLOCK_GETTIME
# define CLOCK_REALTIME 0
# ifdef __MACH__
# define CLOCK_MONOTONIC 1
# endif
int clock_gettime(clockid_t clock_id, struct timespec *tp);
#endif
int sudo_clock_gettime(clockid_t clock_id, struct timespec *tp);
# undef clock_gettime
# define clock_gettime(_a, _b) sudo_clock_gettime((_a), (_b))
#endif /* HAVE_CLOCK_GETTIME */
#ifndef HAVE_INET_PTON
int inet_pton(int af, const char *src, void *dst);
#endif
int sudo_inet_pton(int af, const char *src, void *dst);
# undef inet_pton
# define inet_pton(_a, _b, _c) sudo_inet_pton((_a), (_b), (_c))
#endif /* HAVE_INET_PTON */
#endif /* _SUDO_MISSING_H */

View File

@@ -43,7 +43,7 @@
* (and CLOCK_MONOTONIC on Mach).
*/
int
clock_gettime(clockid_t clock_id, struct timespec *ts)
sudo_clock_gettime(clockid_t clock_id, struct timespec *ts)
{
switch (clock_id) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2005, 2007, 2010, 2012-2013
* Copyright (c) 2004-2005, 2007, 2010, 2012-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -57,7 +57,7 @@
#include "missing.h"
#if defined(HAVE_FCNTL_CLOSEM) && !defined(HAVE_DIRFD)
# define closefrom closefrom_fallback
# define sudo_closefrom closefrom_fallback
#endif
/*
@@ -98,14 +98,14 @@ closefrom_fallback(int lowfd)
*/
#if defined(HAVE_FCNTL_CLOSEM)
void
closefrom(int lowfd)
sudo_closefrom(int lowfd)
{
if (fcntl(lowfd, F_CLOSEM, 0) == -1)
closefrom_fallback(lowfd);
}
#elif defined(HAVE_PSTAT_GETPROC)
void
closefrom(int lowfd)
sudo_closefrom(int lowfd)
{
struct pst_status pstat;
int fd;
@@ -119,7 +119,7 @@ closefrom(int lowfd)
}
#elif defined(HAVE_DIRFD)
void
closefrom(int lowfd)
sudo_closefrom(int lowfd)
{
const char *path;
DIR *dirp;

View File

@@ -267,7 +267,7 @@ fnmatch_ch_success:
return result;
}
int rpl_fnmatch(const char *pattern, const char *string, int flags)
int sudo_fnmatch(const char *pattern, const char *string, int flags)
{
static const char dummystring[2] = {' ', 0};
const int escape = !(flags & FNM_NOESCAPE);

View File

@@ -159,7 +159,7 @@ static const char * const gai_errors[] = {
* indicating an unknown error.
*/
const char *
gai_strerror(int ecode)
sudo_gai_strerror(int ecode)
{
if (ecode < 1 || (size_t) ecode > ARRAY_SIZE(gai_errors))
return "Unknown error";
@@ -172,7 +172,7 @@ gai_strerror(int ecode)
* Free a linked list of addrinfo structs.
*/
void
freeaddrinfo(struct addrinfo *ai)
sudo_freeaddrinfo(struct addrinfo *ai)
{
struct addrinfo *next;
@@ -360,7 +360,7 @@ gai_lookup(const char *nodename, int flags, int socktype, unsigned short port,
* The actual getaddrinfo implementation.
*/
int
getaddrinfo(const char *nodename, const char *servname,
sudo_getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
{
struct addrinfo *ai;

View File

@@ -80,7 +80,7 @@
(dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
char *
getcwd(char *pt, size_t size)
sudo_getcwd(char *pt, size_t size)
{
struct dirent *dp;
DIR *dir = NULL;

View File

@@ -54,7 +54,7 @@
* BSD-compatible getgrouplist(3) using AIX getgrset(3)
*/
int
getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
sudo_getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
{
char *cp, *grset = NULL;
int ngroups = 1;
@@ -276,7 +276,7 @@ done:
* BSD-compatible getgrouplist(3) using nss_search(3)
*/
int
getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
sudo_getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
{
struct nss_groupsbymem gbm;
static DEFINE_NSS_DB_ROOT(db_root);
@@ -315,7 +315,7 @@ getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
* BSD-compatible getgrouplist(3) using getgrent(3)
*/
int
getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
sudo_getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp)
{
int i, ngroups = 1;
int grpsize = *ngroupsp;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2010, 2012-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2009-2010, 2012-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -45,7 +45,7 @@
#ifdef HAVE_FGETLN
ssize_t
getline(char **bufp, size_t *bufsizep, FILE *fp)
sudo_getline(char **bufp, size_t *bufsizep, FILE *fp)
{
char *buf, *cp;
size_t bufsize;
@@ -69,7 +69,7 @@ getline(char **bufp, size_t *bufsizep, FILE *fp)
}
#else
ssize_t
getline(char **bufp, size_t *bufsizep, FILE *fp)
sudo_getline(char **bufp, size_t *bufsizep, FILE *fp)
{
char *buf, *cp;
size_t bufsize;

View File

@@ -588,7 +588,7 @@ start:
* Parse argc/argv argument vector.
*/
int
getopt(int nargc, char * const *nargv, const char *options)
sudo_getopt(int nargc, char * const *nargv, const char *options)
{
/*
@@ -608,7 +608,7 @@ getopt(int nargc, char * const *nargv, const char *options)
* Parse argc/argv argument vector.
*/
int
getopt_long(int nargc, char * const *nargv, const char *options,
sudo_getopt_long(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx)
{
@@ -621,7 +621,7 @@ getopt_long(int nargc, char * const *nargv, const char *options,
* Parse argc/argv argument vector.
*/
int
getopt_long_only(int nargc, char * const *nargv, const char *options,
sudo_getopt_long_only(int nargc, char * const *nargv, const char *options,
const struct option *long_options, int *idx)
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2010 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2008-2014 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -176,7 +176,7 @@ static void qprintf(const char *, Char *);
#endif
int
rpl_glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
sudo_glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
glob_t *pglob)
{
const unsigned char *patnext;
@@ -812,7 +812,7 @@ match(Char *name, Char *pat, Char *patend)
/* Free allocated data belonging to a glob_t structure. */
void
rpl_globfree(glob_t *pglob)
sudo_globfree(glob_t *pglob)
{
int i;
char **pp;

View File

@@ -239,7 +239,7 @@ inet_pton6(const char *src, u_char *dst)
* Paul Vixie, 1996.
*/
int
inet_pton(int af, const char *src, void *dst)
sudo_inet_pton(int af, const char *src, void *dst)
{
switch (af) {
case AF_INET:

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2010-2011, 2013
* Copyright (c) 2007, 2010-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -28,7 +28,7 @@
* Find the last occurrence of 'c' in the buffer 's' of size 'n'.
*/
void *
memrchr(const void *s, int c, size_t n)
sudo_memrchr(const void *s, int c, size_t n)
{
const unsigned char *cp;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2013-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -48,7 +48,7 @@
* that it be non-zero. We use EINVAL for all errors.
*/
errno_t
memset_s(void *v, rsize_t smax, int c, rsize_t n)
sudo_memset_s(void *v, rsize_t smax, int c, rsize_t n)
{
errno_t ret = 0;
volatile unsigned char *s = v;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2003, 2004, 2008-2011, 2013
* Copyright (c) 2001, 2003, 2004, 2008-2011, 2013, 2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -144,7 +144,7 @@ mktemp_internal(char *path, int slen, int mode)
#ifndef HAVE_MKSTEMPS
int
mkstemps(char *path, int slen)
sudo_mkstemps(char *path, int slen)
{
return mktemp_internal(path, slen, MKTEMP_FILE);
}
@@ -152,7 +152,7 @@ mkstemps(char *path, int slen)
#ifndef HAVE_MKDTEMP
char *
mkdtemp(char *path)
sudo_mkdtemp(char *path)
{
if (mktemp_internal(path, 0, MKTEMP_DIR) == -1)
return NULL;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2002, 2012-2013
* Copyright (c) 2000, 2002, 2012-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -63,7 +63,7 @@ do { \
} while (0)
struct passwd *
pw_dup(const struct passwd *pw)
sudo_pw_dup(const struct passwd *pw)
{
size_t nsize = 0, psize = 0, gsize = 0, dsize = 0, ssize = 0, total;
#ifdef HAVE_LOGIN_CAP_H

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2012-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -61,7 +61,7 @@ extern const char *const sudo_sys_signame[NSIG];
* Translate signal number to name.
*/
int
sig2str(int signo, char *signame)
sudo_sig2str(int signo, char *signame)
{
#if defined(SIGRTMIN) && defined(SIGRTMAX)
/* Realtime signal support as per Solaris. */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2005, 2008, 2010-2013
* Copyright (c) 1999-2005, 2008, 2010-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -616,7 +616,7 @@ done:
#if !defined(HAVE_VSNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int
rpl_vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
sudo_vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
{
return xxxprintf(&str, n, 0, fmt, ap);
@@ -625,7 +625,7 @@ rpl_vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
#if !defined(HAVE_SNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int
rpl_snprintf(char *str, size_t n, char const *fmt, ...)
sudo_snprintf(char *str, size_t n, char const *fmt, ...)
{
int ret;
va_list ap;
@@ -639,7 +639,7 @@ rpl_snprintf(char *str, size_t n, char const *fmt, ...)
#if !defined(HAVE_VASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int
rpl_vasprintf(char **str, const char *fmt, va_list ap)
sudo_vasprintf(char **str, const char *fmt, va_list ap)
{
return xxxprintf(str, 0, 1, fmt, ap);
@@ -648,7 +648,7 @@ rpl_vasprintf(char **str, const char *fmt, va_list ap)
#if !defined(HAVE_ASPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
int
rpl_asprintf(char **str, char const *fmt, ...)
sudo_asprintf(char **str, char const *fmt, ...)
{
int ret;
va_list ap;

View File

@@ -1,7 +1,7 @@
/* $OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $ */
/*
* Copyright (c) 1998, 2003-2005, 2010-2011, 2013
* Copyright (c) 1998, 2003-2005, 2010-2011, 2013, 2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -34,7 +34,7 @@
* If retval >= siz, truncation occurred.
*/
size_t
strlcat(char *dst, const char *src, size_t siz)
sudo_strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;

View File

@@ -1,7 +1,7 @@
/* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */
/*
* Copyright (c) 1998, 2003-2005, 2010-2011, 2013
* Copyright (c) 1998, 2003-2005, 2010-2011, 2013, 2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -31,7 +31,7 @@
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
strlcpy(char *dst, const char *src, size_t siz)
sudo_strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2009-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -42,7 +42,7 @@ extern const char *const sudo_sys_siglist[NSIG];
* Get signal description string
*/
char *
strsignal(int signo)
sudo_strsignal(int signo)
{
if (signo > 0 && signo < NSIG && sudo_sys_siglist[signo] != NULL)
return (char *)sudo_sys_siglist[signo];

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2013-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -52,7 +52,7 @@
* too small -> value too small
*/
long long
rpl_strtonum(const char *str, long long minval, long long maxval,
sudo_strtonum(const char *str, long long minval, long long maxval,
const char **errstrp)
{
long long retval;
@@ -86,7 +86,7 @@ enum strtonum_err {
* Convert a string to a number in the range [minval, maxval]
*/
long long
rpl_strtonum(const char *str, long long minval, long long maxval,
sudo_strtonum(const char *str, long long minval, long long maxval,
const char **errstrp)
{
const unsigned char *ustr = (const unsigned char *)str;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2005, 2007, 2010-2011, 2013
* Copyright (c) 2004-2005, 2007, 2010-2011, 2013, 2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -39,7 +39,7 @@
* Emulate utimes() via utime()
*/
int
utimes(const char *file, const struct timeval *times)
sudo_utimes(const char *file, const struct timeval *times)
{
if (times != NULL) {
struct utimbuf utb;
@@ -57,7 +57,7 @@ utimes(const char *file, const struct timeval *times)
* Emulate futimes() via futime()
*/
int
futimes(int fd, const struct timeval *times)
sudo_futimes(int fd, const struct timeval *times)
{
if (times != NULL) {
struct utimbuf utb;