o Digital UNIX needs to check for *snprintf() before -ldb is added to LIBS
since -ldb includes a bogus snprintf(). o Add forward refs for struct mbuf and struct rtentry for Digital UNIX. o Reorder some functions in snprintf.c to fix -Wall o Add missing includes to fix more -Wall
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sudo.h"
|
||||
#include "sudo_auth.h"
|
||||
|
@@ -1187,6 +1187,9 @@ case "$host" in
|
||||
|
||||
if test -n "$SECUREWARE"; then
|
||||
AC_DEFINE(HAVE_GETPRPWNAM)
|
||||
# -ldb includes bogus versions of snprintf/vsnprintf
|
||||
AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF), NEED_SNPRINTF=1)
|
||||
AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF), NEED_SNPRINTF=1)
|
||||
# 4.x and higher need -ldb too...
|
||||
AC_CHECK_LIB(db, dbopen, [SUDO_LIBS="${SUDO_LIBS} -lsecurity -ldb -laud -lm"; LIBS="${LIBS} -lsecurity -ldb -laud -lm"], [SUDO_LIBS="${SUDO_LIBS} -lsecurity -ldb -laud -lm"; LIBS="${LIBS} -lsecurity -ldb -laud -lm"])
|
||||
AC_CHECK_FUNCS(dispcrypt)
|
||||
|
@@ -32,6 +32,15 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Supress a warning w/ gcc on Digital UN*X.
|
||||
* The system headers should really do this....
|
||||
*/
|
||||
#if defined(__osf__) && !defined(__cplusplus)
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
80
snprintf.c
80
snprintf.c
@@ -75,7 +75,6 @@ enum format_flags {
|
||||
/*
|
||||
* Common state
|
||||
*/
|
||||
|
||||
struct state {
|
||||
unsigned char *str;
|
||||
unsigned char *s;
|
||||
@@ -504,6 +503,34 @@ xyzprintf (state, char_format, ap)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int
|
||||
vsnprintf (str, sz, format, args)
|
||||
char *str;
|
||||
size_t sz;
|
||||
const char *format;
|
||||
va_list args;
|
||||
{
|
||||
struct state state;
|
||||
int ret;
|
||||
|
||||
state.max_sz = 0;
|
||||
state.sz = sz;
|
||||
state.str = (unsigned char *) str;
|
||||
state.s = (unsigned char *) str;
|
||||
state.theend = (unsigned char *) str + sz - 1;
|
||||
state.append_char = sn_append_char;
|
||||
state.reserve = sn_reserve;
|
||||
|
||||
ret = xyzprintf (&state, format, args);
|
||||
*state.s = '\0';
|
||||
if (ret)
|
||||
return sz;
|
||||
else
|
||||
return state.s - state.str;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
int
|
||||
#ifdef __STDC__
|
||||
@@ -597,6 +624,17 @@ vasnprintf (ret, max_sz, format, args)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int
|
||||
vasprintf (ret, format, args)
|
||||
char **ret;
|
||||
const char *format;
|
||||
va_list args;
|
||||
{
|
||||
return vasnprintf (ret, 0, format, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int
|
||||
#ifdef __STDC__
|
||||
@@ -686,43 +724,3 @@ asnprintf (va_alist)
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int
|
||||
vasprintf (ret, format, args)
|
||||
char **ret;
|
||||
const char *format;
|
||||
va_list args;
|
||||
{
|
||||
return vasnprintf (ret, 0, format, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int
|
||||
vsnprintf (str, sz, format, args)
|
||||
char *str;
|
||||
size_t sz;
|
||||
const char *format;
|
||||
va_list args;
|
||||
{
|
||||
struct state state;
|
||||
int ret;
|
||||
|
||||
state.max_sz = 0;
|
||||
state.sz = sz;
|
||||
state.str = (unsigned char *) str;
|
||||
state.s = (unsigned char *) str;
|
||||
state.theend = (unsigned char *) str + sz - 1;
|
||||
state.append_char = sn_append_char;
|
||||
state.reserve = sn_reserve;
|
||||
|
||||
ret = xyzprintf (&state, format, args);
|
||||
*state.s = '\0';
|
||||
if (ret)
|
||||
return sz;
|
||||
else
|
||||
return state.s - state.str;
|
||||
}
|
||||
#endif
|
||||
|
6
sudo.c
6
sudo.c
@@ -57,11 +57,15 @@
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <grp.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS)
|
||||
#include <prot.h>
|
||||
#endif /* HAVE_GETPRPWNAM && HAVE_SET_AUTH_PARAMETERS */
|
||||
|
||||
#include "sudo.h"
|
||||
#include "interfaces.h"
|
||||
@@ -1025,7 +1029,7 @@ usage(exit_val)
|
||||
{
|
||||
(void) fprintf(stderr,
|
||||
"usage: %s -V | -h | -l | -v | -k | -K | -H | [-b] [-p prompt]\n%*s",
|
||||
Argv[0], strlen(Argv[0]) + 8, " ");
|
||||
Argv[0], (int) strlen(Argv[0]) + 8, " ");
|
||||
#ifdef HAVE_KERB5
|
||||
(void) fprintf(stderr, "[-r realm] ");
|
||||
#endif /* HAVE_KERB5 */
|
||||
|
12
sudo.h
12
sudo.h
@@ -151,6 +151,18 @@ char *getcwd __P((char *, size_t size));
|
||||
#if !defined(HAVE_PUTENV) && !defined(HAVE_SETENV)
|
||||
int putenv __P((const char *));
|
||||
#endif
|
||||
#ifndef HAVE_SNPRINTF
|
||||
int snprintf __P((char *, size_t, const char *, ...));
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int vsnprintf __P((char *, size_t, const char *, va_list));
|
||||
#endif
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int asprintf __P((char **, const char *, ...));
|
||||
#endif
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int vasprintf __P((char **, const char *, va_list));
|
||||
#endif
|
||||
char *sudo_goodpath __P((const char *));
|
||||
int sudo_setenv __P((char *, char *));
|
||||
char *tgetpass __P((const char *, int, int));
|
||||
|
Reference in New Issue
Block a user