From: Erez Zadok Date: Fri, 24 Nov 2000 21:29:14 +0000 (+0000) Subject: * amd/srvr_nfs.c: comment on NFS proto search order. X-Git-Tag: am-utils-6_0_5s4~7 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=ec5dc249b6a4164a614af1ea1baf94fd2bc59f74;p=am-utils-6.0.git * amd/srvr_nfs.c: comment on NFS proto search order. * libamu/xutil.c (real_plog): don't try to write the last byte of the fmt buf. security suggtion from NetBSD: Thomas Klausner * libamu/mount_fs.c (mount_fs): avoid using extra limited-size buf (security) --- diff --git a/ChangeLog b/ChangeLog index d1294d0..d739f02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-11-24 Erez Zadok + + * amd/srvr_nfs.c: comment on NFS proto search order. + + * libamu/xutil.c (real_plog): don't try to write the last byte of + the fmt buf. security suggtion from NetBSD: Thomas Klausner + + 2000-11-22 Ion Badulescu * amd/amfs_auto.c (amfs_auto_bgmount), @@ -10,6 +18,9 @@ 2000-11-22 Thomas Klausner + * libamu/mount_fs.c (mount_fs): avoid using extra limited-size buf + (security) + * libamu/xutil.c, fsinfo/fsinfo.h, include/am_utils.h: use __attribute__, __format__, and __printf__ for GCC string auditing. diff --git a/amd/srvr_nfs.c b/amd/srvr_nfs.c index 1ea045a..5c10d67 100644 --- a/amd/srvr_nfs.c +++ b/amd/srvr_nfs.c @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: srvr_nfs.c,v 1.7 2000/02/16 13:52:57 ezk Exp $ + * $Id: srvr_nfs.c,v 1.7.2.1 2000/11/24 21:29:15 ezk Exp $ * */ @@ -93,7 +93,13 @@ static int ping_len; static char ping_buf[sizeof(struct rpc_msg) + 32]; #if defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) -/* protocols we know about, in order of preference */ +/* + * Protocols we know about, in order of preference. + * + * Note that Solaris 8 and newer NetBSD systems are switching to UDP first, + * so this order may have to be adjusted for Amd in the future once more + * vendors make that change. -Erez 11/24/2000 + */ static char *protocols[] = { "tcp", "udp", NULL }; #endif /* defined(MNTTAB_OPT_PROTO) || defined(HAVE_FS_NFS3) */ diff --git a/libamu/mount_fs.c b/libamu/mount_fs.c index 620e142..9f1735a 100644 --- a/libamu/mount_fs.c +++ b/libamu/mount_fs.c @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: mount_fs.c,v 1.11.2.1 2000/11/22 10:13:43 ezk Exp $ + * $Id: mount_fs.c,v 1.11.2.2 2000/11/24 21:29:15 ezk Exp $ * */ @@ -181,14 +181,10 @@ mount_fs(mntent_t *mnt, int flags, caddr_t mnt_data, int retry, MTYPE_TYPE type, char optsbuf[48]; # endif /* defined(MNTTAB_OPT_DEV) || (defined(HAVE_FS_NFS3) && defined(MNTTAB_OPT_VERS)) || defined(MNTTAB_OPT_PROTO) */ #endif /* MOUNT_TABLE_ON_FILE */ -#ifdef DEBUG - char buf[80]; /* buffer for sprintf */ -#endif /* DEBUG */ #ifdef DEBUG - sprintf(buf, "%s%s%s", - "%s fstype ", MTYPE_PRINTF_TYPE, " (%s) flags %#x (%s)"); - dlog(buf, mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts); + dlog("%s fstype " MTYPE_PRINTF_TYPE " (%s) flags %#x (%s)", + mnt->mnt_dir, type, mnt->mnt_type, flags, mnt->mnt_opts); #endif /* DEBUG */ again: diff --git a/libamu/xutil.c b/libamu/xutil.c index f7e1f7f..9427fd8 100644 --- a/libamu/xutil.c +++ b/libamu/xutil.c @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: xutil.c,v 1.11.2.4 2000/11/22 10:13:44 ezk Exp $ + * $Id: xutil.c,v 1.11.2.5 2000/11/24 21:29:16 ezk Exp $ * */ @@ -293,6 +293,12 @@ static const char * expand_error(const char *f, char *e, int maxlen) { #ifndef HAVE_STRERROR + /* + * XXX: we are assuming that if a system doesn't has strerror, + * then it has sys_nerr. If this assumption turns out to be wrong on + * some systems, we'll have to write a separate test to detect if + * a system has sys_nerr. -Erez + */ extern int sys_nerr; #endif /* not HAVE_STRERROR */ const char *p; @@ -472,7 +478,7 @@ real_plog(int lvl, const char *fmt, va_list vargs) * more than 1024 bytes, if efmt is already large, and vargs expand * as well. This is not as safe as using vsnprintf(). */ - vsprintf(ptr, expand_error(fmt, efmt, 1024), vargs); + vsprintf(ptr, expand_error(fmt, efmt, 1023), vargs); msg[1023] = '\0'; /* null terminate, to be sure */ #endif /* not HAVE_VSNPRINTF */