From: Greg Banks Date: Mon, 3 Jul 2006 04:21:48 +0000 (+1000) Subject: Merge branch 'master' of git://linux-nfs.org/nfs-utils X-Git-Tag: nfs-utils-1-0-9~30 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=940c7c304d4a43c00c27529cdddc7c87db6eef87;hp=a503848d423fe1681879936da7b526b15f7eca23 Merge branch 'master' of git://linux-nfs.org/nfs-utils --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..537967c --- /dev/null +++ b/.gitignore @@ -0,0 +1,56 @@ +# files generated by autoconf, automake, autoheader and libtoolize +aclocal.m4 +autom4te.cache +compile +config.guess +config.log +config.sub +configure +depcomp +install-sh +libtool +ltmain.sh +Makefile.in +missing +support/include/config.h.in +# files generated by configure +confdefs.h +config.status +conftest +conftest.c +conftest.cpp +conftest.er1 +conftest.err +.deps +Makefile +support/include/config.h +support/include/stamp-h1 +# file generated during compilation +*.o +.libs +lib*.a +tools/rpcgen/rpcgen +tools/rpcdebug/rpcdebug +utils/exportfs/exportfs +utils/idmapd/idmapd +utils/lockd/lockd +utils/mountd/mountd +utils/nfsd/nfsd +utils/nfsstat/nfsstat +utils/nhfsstone/nhfsstone +utils/rquotad/rquotad +utils/showmount/showmount +utils/statd/statd +tools/locktest/testlk +tools/getiversion/getiversion +tools/getkversion/getkversion +support/export/mount.h +support/export/mount_clnt.c +support/export/mount_xdr.c +support/include/mount.h +utils/statd/sm_inter.h +utils/statd/sm_inter_clnt.c +utils/statd/sm_inter_svc.c +utils/statd/sm_inter_xdr.c +# generic editor backup et al +*~ diff --git a/configure.in b/configure.in index ded529f..6f9ab40 100644 --- a/configure.in +++ b/configure.in @@ -151,20 +151,20 @@ AC_CHECK_LIB(socket, main, [LIBSOCKET="-lnsl"]) AC_CHECK_LIB(nsl, main, [LIBNSL="-lnsl"]) AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"]) if test "$enable_nfsv4" = yes; then - AC_CHECK_LIB(event, event_dispatch, [libevent=1], [AC_MSG_ERROR(libevent needed for nfsv4 support)]) - AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], [AC_MSG_ERROR(libnfsidmap needed for nfsv4 support)]) - AC_CHECK_HEADERS(event.h, ,[AC_MSG_ERROR(libevent needed for nfsv4 support)]) - AC_CHECK_HEADERS(nfsidmap.h, ,[AC_MSG_ERROR(libnfsidmap needed for nfsv4 support)]) + AC_CHECK_LIB(event, event_dispatch, [libevent=1], AC_MSG_ERROR([libevent needed for nfsv4 support])) + AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], AC_MSG_ERROR([libnfsidmap needed for nfsv4 support])) + AC_CHECK_HEADERS(event.h, ,AC_MSG_ERROR([libevent needed for nfsv4 support])) + AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for nfsv4 support])) dnl librpcsecgss already has a dependency on libgssapi, dnl but we need to make sure we get the right version if test "$enable_gss" = yes; then - PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.10], [], - [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss. - If you have pkgconfig installed, you might try setting environment - variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig]) + PKG_CHECK_MODULES(RPCSECGSS, librpcsecgss >= 0.10, , + [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.]) + AC_MSG_ERROR([If you have pkgconfig installed, you might try setting environment]) + AC_MSG_ERROR([variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig]) ] ) - PKG_CHECK_MODULES([GSSAPI], [libgssapi >= 0.9]) + PKG_CHECK_MODULES(GSSAPI, libgssapi >= 0.9) fi fi @@ -178,15 +178,19 @@ AC_SUBST(LIBBSD) if test "$enable_gss" = yes; then dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c - AC_CHECK_HEADERS(nfsidmap.h, ,[AC_MSG_ERROR(libnfsidmap needed for gss support)]) - AC_CHECK_HEADERS(spkm3.h, ,[AC_MSG_WARN(could not locate SPKM3 header; will not have SPKM3 support)]) + AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for gss support])) + AC_CHECK_HEADERS(spkm3.h, ,AC_MSG_WARN([could not locate SPKM3 header; will not have SPKM3 support])) + dnl the nfs4_set_debug function doesn't appear in all version of the library + AC_CHECK_LIB(nfsidmap, nfs4_set_debug, + AC_DEFINE(HAVE_NFS4_SET_DEBUG,1, + [Whether nfs4_set_debug() is present in libnfsidmap]),) dnl Check for Kerberos V5 AC_KERBEROS_V5 dnl This is not done until here because we need to have KRBLIBS set dnl ("librpcsecgss=1" is so that it doesn't get added to LIBS) - AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], [AC_MSG_ERROR(librpcsecgss needed for nfsv4 support)], $KRBLIBS) + AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], AC_MSG_ERROR([librpcsecgss needed for nfsv4 support]), $KRBLIBS) AC_CHECK_LIB(rpcsecgss, authgss_set_debug_level, AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, $KRBLIBS) @@ -238,7 +242,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \ gethostbyaddr gethostbyname gethostname getmntent \ gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \ realpath rmdir select socket strcasecmp strchr strdup \ - strerror strrchr strtol strtoul]) + strerror strrchr strtol strtoul sigprocmask]) dnl ************************************************************* @@ -248,6 +252,8 @@ AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(socklen_t) + dnl ************************************************************* dnl Export some path names to config.h diff --git a/support/export/client.c b/support/export/client.c index c09e762..33dfdb0 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "xmalloc.h" #include "misc.h" diff --git a/support/misc/from_local.c b/support/misc/from_local.c index 56478d7..f6f944c 100644 --- a/support/misc/from_local.c +++ b/support/misc/from_local.c @@ -35,7 +35,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#) from_local.c 1.3 96/05/31 15:52:57"; #endif diff --git a/support/nfs/conn.c b/support/nfs/conn.c index 5160c8b..733bf24 100644 --- a/support/nfs/conn.c +++ b/support/nfs/conn.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index c7bff40..5b0a88f 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -34,6 +34,10 @@ #include #include "nfslib.h" +#if SIZEOF_SOCKLEN_T - 0 == 0 +#define socklen_t int +#endif + static void closedown(int sig); int makesock(int port, int proto); @@ -48,13 +52,13 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport) struct sockaddr_in saddr; SVCXPRT *transp; int sock; - int asize; + socklen_t asize; asize = sizeof(saddr); sock = 0; if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0 && saddr.sin_family == AF_INET) { - int ssize = sizeof (int); + socklen_t ssize = sizeof (int); int fdtype = 0; if (getsockopt(0, SOL_SOCKET, SO_TYPE, (char *)&fdtype, &ssize) == -1) @@ -228,10 +232,12 @@ rpc_logcall(struct svc_req *rqstp, char *xname, char *arg) break; case AUTH_UNIX: { struct authunix_parms *unix_cred; + time_t time; struct tm *tm; unix_cred = (struct authunix_parms *) rqstp->rq_clntcred; - tm = localtime(&unix_cred->aup_time); + time = unix_cred->aup_time; + tm = localtime(&time); snprintf(sp, buflen, "UNIX %d/%d/%d %02d:%02d:%02d %s %d.%d", tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, diff --git a/tools/rpcgen/rpc_clntout.c b/tools/rpcgen/rpc_clntout.c index 3ea267a..0d3179f 100644 --- a/tools/rpcgen/rpc_clntout.c +++ b/tools/rpcgen/rpc_clntout.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_cout.c b/tools/rpcgen/rpc_cout.c index af9288d..cae8717 100644 --- a/tools/rpcgen/rpc_cout.c +++ b/tools/rpcgen/rpc_cout.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_hout.c b/tools/rpcgen/rpc_hout.c index 27ed4d5..bbb13eb 100644 --- a/tools/rpcgen/rpc_hout.c +++ b/tools/rpcgen/rpc_hout.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_main.c b/tools/rpcgen/rpc_main.c index 2651060..6866f3c 100644 --- a/tools/rpcgen/rpc_main.c +++ b/tools/rpcgen/rpc_main.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_parse.c b/tools/rpcgen/rpc_parse.c index 70d1260..52300a4 100644 --- a/tools/rpcgen/rpc_parse.c +++ b/tools/rpcgen/rpc_parse.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_sample.c b/tools/rpcgen/rpc_sample.c index 97b2cd0..ca12039 100644 --- a/tools/rpcgen/rpc_sample.c +++ b/tools/rpcgen/rpc_sample.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_sample.c 1.1 90/08/30 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_scan.c b/tools/rpcgen/rpc_scan.c index 51eecfe..a6f442c 100644 --- a/tools/rpcgen/rpc_scan.c +++ b/tools/rpcgen/rpc_scan.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_svcout.c b/tools/rpcgen/rpc_svcout.c index fa5fb60..6b33aab 100644 --- a/tools/rpcgen/rpc_svcout.c +++ b/tools/rpcgen/rpc_svcout.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI"; #endif diff --git a/tools/rpcgen/rpc_tblout.c b/tools/rpcgen/rpc_tblout.c index 5ce4015..8d0baa5 100644 --- a/tools/rpcgen/rpc_tblout.c +++ b/tools/rpcgen/rpc_tblout.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_tblout.c 1.4 89/02/22 (C) 1988 SMI"; #endif diff --git a/tools/rpcgen/rpc_util.c b/tools/rpcgen/rpc_util.c index 252b181..404966e 100644 --- a/tools/rpcgen/rpc_util.c +++ b/tools/rpcgen/rpc_util.c @@ -28,7 +28,7 @@ * Mountain View, California 94043 */ -#ifndef lint +#if 0 static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI"; #endif diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 5fc7811..21a1916 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -345,7 +345,9 @@ main(int argc, char **argv) errx(1, "Could not find group \"%s\"", nobodygroup); nobodygid = gr->gr_gid; +#ifdef HAVE_NFS4_SET_DEBUG nfs4_set_debug(verbose, idmapd_warnx); +#endif if (conf_path == NULL) conf_path = _PATH_IDMAPDCONF; if (nfs4_init_name_mapping(conf_path)) @@ -539,7 +541,8 @@ nfsdcb(int fd, short which, void *data) struct idmap_client *ic = data; struct idmap_msg im; u_char buf[IDMAP_MAXMSGSZ + 1]; - size_t len, bsiz; + size_t len; + ssize_t bsiz; char *bp, typebuf[IDMAP_MAXMSGSZ], buf1[IDMAP_MAXMSGSZ], authbuf[IDMAP_MAXMSGSZ], *p; unsigned long tmp; @@ -556,7 +559,7 @@ nfsdcb(int fd, short which, void *data) /* Get rid of newline and terminate buffer*/ buf[len - 1] = '\0'; - bp = buf; + bp = (char *)buf; memset(&im, 0, sizeof(im)); @@ -606,7 +609,7 @@ nfsdcb(int fd, short which, void *data) imconv(ic, &im); buf[0] = '\0'; - bp = buf; + bp = (char *)buf; bsiz = sizeof(buf); /* Authentication name */ diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 5285e10..c57d3b0 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -429,7 +429,7 @@ cache_get_filehandle(nfs_export *exp, int len, char *p) if (failed) return NULL; memset(fh.fh_handle, 0, sizeof(fh.fh_handle)); - fh.fh_size = qword_get(&bp, fh.fh_handle, NFS3_FHSIZE); + fh.fh_size = qword_get(&bp, (char *)fh.fh_handle, NFS3_FHSIZE); return &fh; } diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index e402bf8..c1d18d4 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -35,7 +35,7 @@ extern void my_svc_run(void); static void usage(const char *, int exitcode); static exports get_exportlist(void); -static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, int *, int v3); +static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, mountstat3 *, int v3); int new_cache = 0; @@ -346,11 +346,11 @@ mount_mnt_3_svc(struct svc_req *rqstp, dirpath *path, mountres3 *res) struct nfs_fh_len *fh; xlog(D_CALL, "MNT3(%s) called", *path); - if ((fh = get_rootfh(rqstp, path, (int *) &res->fhs_status, 1)) != NULL) { + if ((fh = get_rootfh(rqstp, path, &res->fhs_status, 1)) != NULL) { struct mountres3_ok *ok = &res->mountres3_u.mountinfo; ok->fhandle.fhandle3_len = fh->fh_size; - ok->fhandle.fhandle3_val = fh->fh_handle; + ok->fhandle.fhandle3_val = (char *)fh->fh_handle; ok->auth_flavors.auth_flavors_len = sizeof(flavors)/sizeof(flavors[0]); ok->auth_flavors.auth_flavors_val = flavors; @@ -359,7 +359,7 @@ mount_mnt_3_svc(struct svc_req *rqstp, dirpath *path, mountres3 *res) } static struct nfs_fh_len * -get_rootfh(struct svc_req *rqstp, dirpath *path, int *error, int v3) +get_rootfh(struct svc_req *rqstp, dirpath *path, mountstat3 *error, int v3) { struct sockaddr_in *sin = (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt); diff --git a/utils/nhfsstone/nhfsstone.c b/utils/nhfsstone/nhfsstone.c index 034ba79..463bcb5 100644 --- a/utils/nhfsstone/nhfsstone.c +++ b/utils/nhfsstone/nhfsstone.c @@ -1,4 +1,4 @@ -#ifndef lint +#if 0 static char sccsid[] = "@(#)nhfsstone.c 1.22 90/05/08 Copyright (c) 1990, Legato Systems Inc"; #endif @@ -10,6 +10,7 @@ static char sccsid[] = "@(#)nhfsstone.c 1.22 90/05/08 Copyright (c) 1990, Legato * Ported to Linux by Olaf Kirch */ +#include "config.h" #include #include #include @@ -312,7 +313,11 @@ main(int argc, char **argv) int pid; /* process id */ int delay; /* msecs since last checked current time */ int randnum; /* a random number */ +#if HAVE_SIGPROCMASK + sigset_t oldmask; /* saved signal mask */ +#else int oldmask; /* saved signal mask */ +#endif int sampletime; /* secs between reading kernel stats */ char *opts; /* option parsing */ int pct; @@ -478,7 +483,20 @@ main(int argc, char **argv) (void) signal(SIGINT, cleanup); (void) signal(SIGUSR1, startup); +#if HAVE_SIGPROCMASK + { + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + sigprocmask(SIG_BLOCK, &mask, &oldmask); + } +#else + /* + * sigblock() is marked deprecated in modern + * glibc and hence generates a warning. + */ oldmask = sigblock(sigmask(SIGUSR1)); +#endif if (ncalls == 0) { if (runtime == 0) { @@ -630,7 +648,11 @@ main(int argc, char **argv) exit(1); } +#if HAVE_SIGPROCMASK + sigsuspend(&oldmask); +#else sigpause(oldmask); +#endif /* * Initialize counters diff --git a/utils/statd/log.c b/utils/statd/log.c index 408807e..bf2a926 100644 --- a/utils/statd/log.c +++ b/utils/statd/log.c @@ -29,7 +29,9 @@ static pid_t mypid; /* Turns on logging to console/stderr. */ +#if 0 static int opt_debug = 0; /* Will be command-line option, eventually */ +#endif void log_init() { diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c index 8348473..98cbf4a 100644 --- a/utils/statd/monitor.c +++ b/utils/statd/monitor.c @@ -268,7 +268,9 @@ sm_unmon_1_svc(struct mon_id *argp, struct svc_req *rqstp) clnt = NL_NEXT(clnt); } +#ifdef RESTRICTED_STATD failure: +#endif note(N_WARNING, "Received erroneous SM_UNMON request from %s for %s", my_name, mon_name); return (&result); @@ -336,6 +338,8 @@ sm_unmon_all_1_svc(struct my_id *argp, struct svc_req *rqstp) dprintf(N_DEBUG, "SM_UNMON_ALL request from %s with no " "SM_MON requests from it.", my_name); } +#ifdef RESTRICTED_STATD failure: +#endif return (&result); } diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c index 7684b3b..35cbccb 100644 --- a/utils/statd/rmtcall.c +++ b/utils/statd/rmtcall.c @@ -46,6 +46,10 @@ #include "log.h" #include "ha-callout.h" +#if SIZEOF_SOCKLEN_T - 0 == 0 +#define socklen_t int +#endif + #define MAXMSGSIZE (2048 / sizeof(unsigned int)) static unsigned long xid = 0; /* RPC XID counter */ @@ -278,7 +282,7 @@ recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp) struct rpc_msg mesg; notify_list *lp = NULL; XDR xdr, *xdrs = &xdr; - int alen = sizeof(*sin); + socklen_t alen = sizeof(*sin); /* Receive message */ if ((msglen = recvfrom(sockfd, msgbuf, sizeof(msgbuf), 0, diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 8ebb808..c92e12f 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -51,7 +51,7 @@ int run_mode = 0; /* foreground logging mode */ * two copies of each - one in main(), one static in log.c... * It also eliminates the 256-char static in log.c */ char *name_p = NULL; -char *version_p = NULL; +const char *version_p = NULL; /* PRC: a high-availability callout program can be specified with -H * When this is done, the program will receive callouts whenever clients @@ -374,7 +374,7 @@ int main (int argc, char **argv) #endif if (!(run_mode & MODE_NODAEMON)) { - int filedes, fdmax, tempfd; + int tempfd; if (pipe(pipefds)<0) { perror("statd: unable to create pipe"); diff --git a/utils/statd/statd.h b/utils/statd/statd.h index 225cc8b..ace2ce5 100644 --- a/utils/statd/statd.h +++ b/utils/statd/statd.h @@ -88,6 +88,6 @@ extern int run_mode; * as to why they're global. */ extern char *name_p; /* program basename */ -extern char *version_p; /* program version */ +extern const char *version_p; /* program version */ extern int re_notify; /* time to re-read notify list */ diff --git a/utils/statd/state.c b/utils/statd/state.c index a6a4077..f46dae5 100644 --- a/utils/statd/state.c +++ b/utils/statd/state.c @@ -28,7 +28,6 @@ void change_state (void) { int fd, size; - extern short int restart; if ((fd = open (SM_STAT_PATH, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR)) == -1) die ("open (%s): %s", SM_STAT_PATH, strerror (errno));