The complete set of CITI util-linux patches combined into one jumbo patch. Changes since 2.12-CITI_NFS4_ALL-2: * remove redhat-specific warnings from redhat-nfs-mount.dif --- util-linux-2.12-bfields/MCONFIG | 11 util-linux-2.12-bfields/configure | 25 util-linux-2.12-bfields/debian/README.Debian.hwclock | 65 util-linux-2.12-bfields/debian/README.script | 38 util-linux-2.12-bfields/debian/bsdutils.postinst | 1 util-linux-2.12-bfields/debian/bsdutils.prerm | 5 util-linux-2.12-bfields/debian/changelog | 1240 +++++++++++ util-linux-2.12-bfields/debian/changelog.Debian-mount.old | 168 + util-linux-2.12-bfields/debian/conffiles | 2 util-linux-2.12-bfields/debian/control | 62 util-linux-2.12-bfields/debian/copyright | 25 util-linux-2.12-bfields/debian/fdformat | 9 util-linux-2.12-bfields/debian/fstab.example2 | 39 util-linux-2.12-bfields/debian/hwclock.sh | 129 + util-linux-2.12-bfields/debian/hwclockfirst.sh | 102 util-linux-2.12-bfields/debian/lintian-override | 3 util-linux-2.12-bfields/debian/mime.util-linux | 2 util-linux-2.12-bfields/debian/mount.fstab | 39 util-linux-2.12-bfields/debian/mount.postinst | 1 util-linux-2.12-bfields/debian/mount.prerm | 5 util-linux-2.12-bfields/debian/postinst | 35 util-linux-2.12-bfields/debian/postrm | 17 util-linux-2.12-bfields/debian/preinst | 13 util-linux-2.12-bfields/debian/prerm | 14 util-linux-2.12-bfields/debian/rejected-upstream | 76 util-linux-2.12-bfields/debian/rules | 344 +++ util-linux-2.12-bfields/debian/util-linux-locales.postinst | 1 util-linux-2.12-bfields/debian/util-linux-locales.prerm | 15 util-linux-2.12-bfields/disk-utils/Makefile | 22 util-linux-2.12-bfields/disk-utils/blockdev.c | 4 util-linux-2.12-bfields/disk-utils/elvtune.c | 4 util-linux-2.12-bfields/disk-utils/fsck.minix.c | 4 util-linux-2.12-bfields/disk-utils/mkfs.bfs.c | 17 util-linux-2.12-bfields/disk-utils/mkfs.c | 9 util-linux-2.12-bfields/disk-utils/mkfs.minix.c | 51 util-linux-2.12-bfields/disk-utils/mkswap.8 | 2 util-linux-2.12-bfields/disk-utils/mkswap.c | 63 util-linux-2.12-bfields/fdisk/Makefile | 6 util-linux-2.12-bfields/fdisk/cfdisk.c | 39 util-linux-2.12-bfields/fdisk/fdisk.c | 26 util-linux-2.12-bfields/fdisk/fdiskaixlabel.h | 1 util-linux-2.12-bfields/fdisk/fdiskbsdlabel.c | 20 util-linux-2.12-bfields/fdisk/fdiskbsdlabel.h | 72 util-linux-2.12-bfields/fdisk/fdisksgilabel.c | 16 util-linux-2.12-bfields/fdisk/fdisksgilabel.h | 6 util-linux-2.12-bfields/fdisk/fdisksunlabel.c | 16 util-linux-2.12-bfields/fdisk/fdisksunlabel.h | 10 util-linux-2.12-bfields/fdisk/sfdisk.c | 53 util-linux-2.12-bfields/getopt/getopt.1 | 5 util-linux-2.12-bfields/hwclock/Makefile | 2 util-linux-2.12-bfields/hwclock/cmos.c | 1 util-linux-2.12-bfields/hwclock/hwclock.8 | 9 util-linux-2.12-bfields/hwclock/kd.c | 1 util-linux-2.12-bfields/hwclock/rtc.c | 1 util-linux-2.12-bfields/lib/Makefile | 9 util-linux-2.12-bfields/lib/README.xgethostname | 76 util-linux-2.12-bfields/lib/get_blocks.c | 98 util-linux-2.12-bfields/lib/get_blocks.h | 7 util-linux-2.12-bfields/lib/xgethostname.2 | 37 util-linux-2.12-bfields/lib/xgethostname.c | 126 + util-linux-2.12-bfields/lib/xgethostname.h | 48 util-linux-2.12-bfields/login-utils/Makefile | 30 util-linux-2.12-bfields/login-utils/agetty.c | 232 +- util-linux-2.12-bfields/login-utils/checktty.c | 2 util-linux-2.12-bfields/login-utils/last.c | 7 util-linux-2.12-bfields/login-utils/login.c | 72 util-linux-2.12-bfields/login-utils/simpleinit.c | 2 util-linux-2.12-bfields/login-utils/simpleinit.h | 2 util-linux-2.12-bfields/login-utils/wall.1 | 6 util-linux-2.12-bfields/login-utils/wall.c | 53 util-linux-2.12-bfields/misc-utils/Makefile | 4 util-linux-2.12-bfields/misc-utils/cal.c | 49 util-linux-2.12-bfields/misc-utils/ddate.1 | 2 util-linux-2.12-bfields/misc-utils/mcookie.c | 14 util-linux-2.12-bfields/misc-utils/namei.c | 26 util-linux-2.12-bfields/misc-utils/script.c | 2 util-linux-2.12-bfields/misc-utils/setterm.c | 53 util-linux-2.12-bfields/misc-utils/write.c | 52 util-linux-2.12-bfields/mount/Makefile | 10 util-linux-2.12-bfields/mount/README.mount | 1 util-linux-2.12-bfields/mount/fstab.5 | 1 util-linux-2.12-bfields/mount/fstab.c | 2 util-linux-2.12-bfields/mount/lomount.c | 222 +- util-linux-2.12-bfields/mount/lomount.h | 2 util-linux-2.12-bfields/mount/loop.h | 37 util-linux-2.12-bfields/mount/losetup.8 | 18 util-linux-2.12-bfields/mount/mount.8 | 97 util-linux-2.12-bfields/mount/mount.c | 49 util-linux-2.12-bfields/mount/my_dev_t.h | 2 util-linux-2.12-bfields/mount/nfs.5 | 219 ++ util-linux-2.12-bfields/mount/nfs4_mount.h | 82 util-linux-2.12-bfields/mount/nfs4mount.c | 401 +++ util-linux-2.12-bfields/mount/nfs_mount4.h | 22 util-linux-2.12-bfields/mount/nfsmount.c | 1356 ++++++++----- util-linux-2.12-bfields/mount/rmd160.c | 532 +++++ util-linux-2.12-bfields/mount/rmd160.h | 9 util-linux-2.12-bfields/mount/sundries.h | 3 util-linux-2.12-bfields/mount/swapon.c | 5 util-linux-2.12-bfields/mount/umount.c | 7 util-linux-2.12-bfields/po/Makefile | 2 util-linux-2.12-bfields/po/es.po | 8 util-linux-2.12-bfields/sys-utils/Makefile | 28 util-linux-2.12-bfields/sys-utils/dmesg.8 | 2 util-linux-2.12-bfields/sys-utils/ipcrm.c | 2 util-linux-2.12-bfields/sys-utils/ipcs.c | 4 util-linux-2.12-bfields/sys-utils/readprofile.c | 2 util-linux-2.12-bfields/text-utils/more.c | 14 107 files changed, 6122 insertions(+), 972 deletions(-) diff -puN mount/Makefile~CITI_NFS4_ALL mount/Makefile --- util-linux-2.12/mount/Makefile~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/Makefile 2004-12-13 17:42:08.000000000 -0500 @@ -10,10 +10,12 @@ RPCGEN = rpcgen COMPILE = $(CC) -c $(CFLAGS) $(DEFINES) LINK = $(CC) $(LDFLAGS) +ifeq "$(OS)" "linux" SUID_PROGS = mount umount NOSUID_PROGS = swapon losetup MAN5 = fstab.5 nfs.5 MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8 +endif ifeq "$(HAVE_PIVOT_ROOT)" "yes" NOSUID_PROGS := $(NOSUID_PROGS) pivot_root @@ -24,8 +26,8 @@ PROGS = $(SUID_PROGS) $(NOSUID_PROGS) MAYBE = pivot_root swapoff -LO_OBJS = lomount.o $(LIB)/xstrncpy.o -NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o +LO_OBJS = lomount.o $(LIB)/xstrncpy.o rmd160.o +NFS_OBJS = nfsmount.o nfsmount_xdr.o nfs4mount.o GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c all: $(PROGS) @@ -48,7 +50,7 @@ mount: mount.o fstab.o sundries.o realpa $(LINK) $^ -o $@ umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \ - get_label_uuid.o version.o $(LIB)/env.o $(LO_OBJS) + get_label_uuid.o version.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS) $(LINK) $^ -o $@ swapon: swapon.o version.o @@ -57,7 +59,7 @@ swapon: swapon.o version.o main_losetup.o: lomount.c $(COMPILE) -DMAIN lomount.c -o $@ -losetup: main_losetup.o $(LIB)/xstrncpy.o +losetup: main_losetup.o $(LIB)/xstrncpy.o rmd160.o $(LINK) $^ -o $@ mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h diff -puN mount/nfsmount.c~CITI_NFS4_ALL mount/nfsmount.c --- util-linux-2.12/mount/nfsmount.c~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/nfsmount.c 2004-12-13 17:42:04.000000000 -0500 @@ -34,6 +34,7 @@ #include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */ +#include #include #include #include @@ -72,11 +73,121 @@ #define NFS_FHSIZE 32 #endif +#define MNT_SENDBUFSIZE ((u_int)2048) +#define MNT_RECVBUFSIZE ((u_int)1024) + static char *nfs_strerror(int stat); #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) #define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) +#define MAX_MNTPROT ((nfs_mount_version >= 4) ? 3 : 2) +#define HAVE_RELIABLE_TCP (nfs_mount_version >= 4) + +#ifndef HAVE_inet_aton +#define inet_aton(a,b) (0) +#endif + +typedef dirpath mnt2arg_t; +typedef dirpath mnt3arg_t; +typedef dirpath mntarg_t; + +typedef struct fhstatus mnt2res_t; +typedef struct mountres3 mnt3res_t; +typedef union { + mnt2res_t nfsv2; + mnt3res_t nfsv3; +} mntres_t; + +typedef struct { + char **hostname; + struct sockaddr_in saddr; + struct pmap pmap; +} clnt_addr_t; + +/* RPC call timeout values */ +static const struct timeval TIMEOUT = { 20, 0 }; +static const struct timeval RETRY_TIMEOUT = { 3, 0 }; + +static int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp); + +int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int); + +/* Convert RPC errors into strings */ +void rpc_strerror(void) +{ + int cf_stat = rpc_createerr.cf_stat; + int cf_errno = rpc_createerr.cf_error.re_errno; + char *ptr, *estr = clnt_sperrno(cf_stat); + + if (estr) { + if ((ptr = index(estr, ':'))) + estr = ++ptr; + + fprintf(stderr, "RPC Error: %d (%s )\n", cf_stat, estr); + if (cf_stat == RPC_SYSTEMERROR) + fprintf(stderr, "System Error: %d (%s)\n", cf_errno, strerror(cf_errno)); + } +} + +/* Define the order in which to probe for UDP/TCP services */ +static const u_int * +proto_probelist(const int use_tcp) +{ + static const u_int probe_both[] = { IPPROTO_TCP, IPPROTO_UDP, 0 }; + static const u_int probe_udponly[] = { IPPROTO_UDP, 0 }; + if (use_tcp) + return probe_both; + return probe_udponly; +} + +/* Define the order in which NFS versions are probed on portmapper */ +static const u_long * +nfs_probelist(const int vers) +{ + static const u_long nfs2_probe[] = { 2, 0}; + static const u_long nfs3_probe[] = { 3, 2, 0}; + switch (vers) { + case 3: + return nfs3_probe; + default: + return nfs2_probe; + } +} + +/* Define the order in which Mountd versions are probed on portmapper */ +static const u_long * +mnt_probelist(const int vers) +{ + static const u_long mnt1_probe[] = { 1, 2, 0 }; + static const u_long mnt3_probe[] = { 3, 1, 2, 0 }; + switch (vers) { + case 3: + return mnt3_probe; + default: + return mnt1_probe; + } +} + +/* Map an NFS version into the corresponding Mountd version */ +static u_long +nfsvers_to_mnt(const u_long vers) +{ + static const u_long nfs_to_mnt[] = { 0, 0, 1, 3 }; + if (vers <= 3) + return nfs_to_mnt[vers]; + return 0; +} + +/* Map a Mountd version into the corresponding NFS version */ +static u_long +mntvers_to_nfs(const u_long vers) +{ + static const u_long mnt_to_nfs[] = { 0, 2, 2, 3 }; + if (vers <= 3) + return mnt_to_nfs[vers]; + return 0; +} static int linux_version_code(void) { @@ -102,123 +213,627 @@ linux_version_code(void) { * NFS_MOUNT_VERSION: these nfsmount sources at compile time * nfs_mount_version: version this source and running kernel can handle */ +static int nfs_mount_version = NFS_MOUNT_VERSION; + static int find_kernel_nfs_mount_version(void) { static int kernel_version = -1; - int nfs_mount_version = NFS_MOUNT_VERSION; + int mnt_version = NFS_MOUNT_VERSION; if (kernel_version == -1) kernel_version = linux_version_code(); if (kernel_version) { if (kernel_version < MAKE_VERSION(2,1,32)) - nfs_mount_version = 1; + mnt_version = 1; else if (kernel_version < MAKE_VERSION(2,2,18)) - nfs_mount_version = 3; + mnt_version = 3; else if (kernel_version < MAKE_VERSION(2,3,0)) - nfs_mount_version = 4; /* since 2.2.18pre9 */ + mnt_version = 4; /* since 2.2.18pre9 */ else if (kernel_version < MAKE_VERSION(2,3,99)) - nfs_mount_version = 3; + mnt_version = 3; + else if (kernel_version < MAKE_VERSION(2,6,3)) + mnt_version = 4; else - nfs_mount_version = 4; /* since 2.3.99pre4 */ + mnt_version = 6; } - if (nfs_mount_version > NFS_MOUNT_VERSION) - nfs_mount_version = NFS_MOUNT_VERSION; - return nfs_mount_version; -} - -static struct pmap * -get_mountport(struct sockaddr_in *server_addr, - long unsigned prog, - long unsigned version, - long unsigned proto, - long unsigned port, - int nfs_mount_version) -{ - struct pmaplist *pmap; - static struct pmap p = {0, 0, 0, 0}; - - if (version > MAX_NFSPROT) - version = MAX_NFSPROT; - if (!prog) - prog = MOUNTPROG; - p.pm_prog = prog; - p.pm_vers = version; - p.pm_prot = proto; - p.pm_port = port; - - server_addr->sin_port = PMAPPORT; - pmap = pmap_getmaps(server_addr); - - while (pmap) { - if (pmap->pml_map.pm_prog != prog) - goto next; - if (!version && p.pm_vers > pmap->pml_map.pm_vers) - goto next; - if (version > 2 && pmap->pml_map.pm_vers != version) - goto next; - if (version && version <= 2 && pmap->pml_map.pm_vers > 2) - goto next; - if (pmap->pml_map.pm_vers > MAX_NFSPROT || - (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) || - (port && pmap->pml_map.pm_port != port)) - goto next; - memcpy(&p, &pmap->pml_map, sizeof(p)); - next: - pmap = pmap->pml_next; - } - if (!p.pm_vers) - p.pm_vers = MOUNTVERS; - if (!p.pm_prot) - p.pm_prot = IPPROTO_TCP; -#if 0 - if (!p.pm_port) { - p.pm_port = pmap_getport(server_addr, p.pm_prog, p.pm_vers, - p.pm_prot); + if (mnt_version > NFS_MOUNT_VERSION) + mnt_version = NFS_MOUNT_VERSION; + return mnt_version; +} + +static int +nfs_gethostbyname(const char *hostname, struct sockaddr_in *saddr) +{ + struct hostent *hp; + + saddr->sin_family = AF_INET; + if (!inet_aton(hostname, &saddr->sin_addr)) { + if ((hp = gethostbyname(hostname)) == NULL) { + fprintf(stderr, _("mount: can't get address for %s\n"), + hostname); + return 0; + } else { + if (hp->h_length > sizeof(*saddr)) { + fprintf(stderr, + _("mount: got bad hp->h_length\n")); + hp->h_length = sizeof(*saddr); + } + memcpy(&saddr->sin_addr, hp->h_addr, hp->h_length); + } + } + return 1; +} + +/* + * Sigh... pmap_getport() doesn't actually check the version number. + * In order to make sure that the server actually supports the service + * we're requesting, we open and RPC client, and fire off a NULL + * RPC call. + */ +int +clnt_ping(struct sockaddr_in *saddr, const u_long prog, const u_long vers, + const u_int prot) +{ + CLIENT *clnt=NULL; + int sock, stat; + static char clnt_res; + + rpc_createerr.cf_stat = stat = 0; + sock = RPC_ANYSOCK; + switch(prot) { + case IPPROTO_UDP: + clnt = clntudp_bufcreate(saddr, prog, vers, + RETRY_TIMEOUT, &sock, + RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + break; + case IPPROTO_TCP: + clnt = clnttcp_create(saddr, prog, vers, &sock, + RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + break; + default: + goto out_bad; + } + if (!clnt) + goto out_bad; + memset(&clnt_res, 0, sizeof(clnt_res)); + stat = clnt_call(clnt, NULLPROC, + (xdrproc_t)xdr_void, (caddr_t)NULL, + (xdrproc_t)xdr_void, (caddr_t)&clnt_res, + TIMEOUT); + clnt_destroy(clnt); + close(sock); + if (stat != RPC_PROGVERSMISMATCH) + return 1; + + out_bad: + return 0; +} + +/* + * Use the portmapper to discover whether or not the service we want is + * available. The lists 'versions' and 'protos' define ordered sequences + * of service versions and udp/tcp protocols to probe for. + */ +static int +probe_port(clnt_addr_t *server, + const u_long *versions, + const u_int *protos) +{ + struct sockaddr_in *saddr = &server->saddr; + struct pmap *pmap = &server->pmap; + const u_long prog = pmap->pm_prog, + vers = pmap->pm_vers, + *p_vers; + const u_int prot = (u_int)pmap->pm_prot, + *p_prot; + const u_short port = (u_short) pmap->pm_port; + u_short p_port; + p_prot = prot ? &prot : protos; + p_vers = vers ? &vers : versions; + rpc_createerr.cf_stat = 0; + for (;;) { + saddr->sin_port = htons(PMAPPORT); + p_port = pmap_getport(saddr, prog, *p_vers, *p_prot); + if (p_port) { + if (!port || port == p_port) { + saddr->sin_port = htons(port); + if (clnt_ping(saddr, prog, *p_vers, *p_prot)) + goto out_ok; + } + } else if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) + break; + if (!prot) { + if (*++p_prot) + continue; + p_prot = protos; + } + if (vers || !*++p_vers) + break; + } + return 0; + out_ok: + if (!vers) + pmap->pm_vers = *p_vers; + if (!prot) + pmap->pm_prot = *p_prot; + if (!port) + pmap->pm_port = p_port; + rpc_createerr.cf_stat = 0; + return 1; +} + +static int +probe_nfsport(clnt_addr_t *nfs_server) +{ + const struct pmap *pmap = &nfs_server->pmap; + const u_long *probe_vers; + const u_int *probe_prot; + + if (pmap->pm_vers && pmap->pm_prot && pmap->pm_port) + return 1; + probe_vers = nfs_probelist(MAX_NFSPROT); + probe_prot = proto_probelist(HAVE_RELIABLE_TCP); + return probe_port(nfs_server, probe_vers, probe_prot); +} + +static int +probe_mntport(clnt_addr_t *mnt_server) +{ + const struct pmap *pmap = &mnt_server->pmap; + const u_long *probe_vers; + const u_int *probe_prot; + + if (pmap->pm_vers && pmap->pm_prot && pmap->pm_port) + return 1; + probe_vers = mnt_probelist(MAX_MNTPROT); + probe_prot = proto_probelist(HAVE_RELIABLE_TCP); + return probe_port(mnt_server, probe_vers, probe_prot); +} + +static int +probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server) +{ + struct pmap *nfs_pmap = &nfs_server->pmap; + struct pmap *mnt_pmap = &mnt_server->pmap; + struct pmap save_nfs, save_mnt; + int res; + const u_long *probe_vers; + + if (mnt_pmap->pm_vers && !nfs_pmap->pm_vers) + nfs_pmap->pm_vers = mntvers_to_nfs(mnt_pmap->pm_vers); + else if (nfs_pmap->pm_vers && !mnt_pmap->pm_vers) + mnt_pmap->pm_vers = nfsvers_to_mnt(nfs_pmap->pm_vers); + if (nfs_pmap->pm_vers) + goto version_fixed; + memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs)); + memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt)); + for (probe_vers = mnt_probelist(MAX_MNTPROT); *probe_vers; probe_vers++) { + nfs_pmap->pm_vers = mntvers_to_nfs(*probe_vers); + if ((res = probe_nfsport(nfs_server) != 0)) { + mnt_pmap->pm_vers = *probe_vers; + if ((res = probe_mntport(mnt_server)) != 0) + return 1; + memcpy(mnt_pmap, &save_mnt, sizeof(*mnt_pmap)); + } + if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) + break; + memcpy(nfs_pmap, &save_nfs, sizeof(*nfs_pmap)); + } + out_bad: + return 0; + version_fixed: + if (!probe_nfsport(nfs_server)) + goto out_bad; + return probe_mntport(mnt_server); +} + +static CLIENT * +mnt_openclnt(clnt_addr_t *mnt_server, int *msock, const int report_errs) +{ + struct sockaddr_in *mnt_saddr = &mnt_server->saddr; + struct pmap *mnt_pmap = &mnt_server->pmap; + CLIENT *clnt; + + /* contact the mount daemon via TCP */ + mnt_saddr->sin_port = htons((u_short)mnt_pmap->pm_port); + *msock = RPC_ANYSOCK; + + switch (mnt_pmap->pm_prot) { + case IPPROTO_UDP: + clnt = clntudp_bufcreate(mnt_saddr, + mnt_pmap->pm_prog, mnt_pmap->pm_vers, + RETRY_TIMEOUT, msock, + MNT_SENDBUFSIZE, MNT_RECVBUFSIZE); + break; + case IPPROTO_TCP: + clnt = clnttcp_create(mnt_saddr, + mnt_pmap->pm_prog, mnt_pmap->pm_vers, + msock, + MNT_SENDBUFSIZE, MNT_RECVBUFSIZE); + break; + default: + goto out_bad; + } + if (!clnt) + goto report_err; + /* try to mount hostname:dirname */ + clnt->cl_auth = authunix_create_default(); + return clnt; + report_err: + if (report_errs) + clnt_pcreateerror("mount"); + out_bad: + return NULL; +} + +static inline void +mnt_closeclnt(CLIENT *clnt, int msock) +{ + auth_destroy(clnt->cl_auth); + clnt_destroy(clnt); + close(msock); +} + +static inline enum clnt_stat +nfs3_mount(CLIENT *clnt, mnt3arg_t *mnt3arg, mnt3res_t *mnt3res) +{ + return clnt_call(clnt, MOUNTPROC3_MNT, + (xdrproc_t) xdr_dirpath, (caddr_t) mnt3arg, + (xdrproc_t) xdr_mountres3, (caddr_t) mnt3res, + TIMEOUT); +} + +static inline enum clnt_stat +nfs2_mount(CLIENT *clnt, mnt2arg_t *mnt2arg, mnt2res_t *mnt2res) +{ + return clnt_call(clnt, MOUNTPROC_MNT, + (xdrproc_t) xdr_dirpath, (caddr_t) mnt2arg, + (xdrproc_t) xdr_fhstatus, (caddr_t) mnt2res, + TIMEOUT); +} + +static int +nfs_call_mount(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server, + mntarg_t *mntarg, mntres_t *mntres, const int report_errs) +{ + CLIENT *clnt; + enum clnt_stat stat; + int msock; + + if (!probe_bothports(mnt_server, nfs_server)) { + if (report_errs) { + fprintf(stderr, "mount to NFS server '%s' failed", + *nfs_server->hostname); + if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) { + fprintf(stderr, ": server is down.\n"); + } else if (nfs_server->pmap.pm_prot) { + fprintf(stderr, ": possible invalid protocol.\n"); + } else if (nfs_server->pmap.pm_port) { + fprintf(stderr, ": possible invalid port.\n"); + } else { + fprintf(stderr, ".\n"); + } + if (verbose) { + rpc_strerror(); + } + } + goto out_bad; } + + clnt = mnt_openclnt(mnt_server, &msock, report_errs); + if (!clnt) + goto out_bad; + /* make pointers in xdr_mountres3 NULL so + * that xdr_array allocates memory for us + */ + memset(mntres, 0, sizeof(*mntres)); + switch (mnt_server->pmap.pm_vers) { + case 3: + stat = nfs3_mount(clnt, mntarg, &mntres->nfsv3); + break; + case 2: + case 1: + stat = nfs2_mount(clnt, mntarg, &mntres->nfsv2); + break; + default: + goto out_bad; + } + if (stat != RPC_SUCCESS && report_errs) + clnt_perror(clnt, "mount"); + mnt_closeclnt(clnt, msock); + if (stat == RPC_SUCCESS) + return 1; + out_bad: + return 0; +} + +static int +parse_options(char *old_opts, struct nfs_mount_data *data, + int *bg, int *retry, clnt_addr_t *mnt_server, + clnt_addr_t *nfs_server, char *new_opts, const int opt_size) +{ + struct sockaddr_in *mnt_saddr = &mnt_server->saddr; + struct pmap *mnt_pmap = &mnt_server->pmap; + struct pmap *nfs_pmap = &nfs_server->pmap; + int len; + char *opt, *opteq; + char *mounthost = NULL; + char cbuf[128]; + + data->flags = 0; + *bg = 0; + + len = strlen(new_opts); + for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) { + if (strlen(opt) >= sizeof(cbuf)) + goto bad_parameter; + if ((opteq = strchr(opt, '=')) && isdigit(opteq[1])) { + int val = atoi(opteq + 1); + *opteq = '\0'; + if (!strcmp(opt, "rsize")) + data->rsize = val; + else if (!strcmp(opt, "wsize")) + data->wsize = val; + else if (!strcmp(opt, "timeo")) + data->timeo = val; + else if (!strcmp(opt, "retrans")) + data->retrans = val; + else if (!strcmp(opt, "acregmin")) + data->acregmin = val; + else if (!strcmp(opt, "acregmax")) + data->acregmax = val; + else if (!strcmp(opt, "acdirmin")) + data->acdirmin = val; + else if (!strcmp(opt, "acdirmax")) + data->acdirmax = val; + else if (!strcmp(opt, "actimeo")) { + data->acregmin = val; + data->acregmax = val; + data->acdirmin = val; + data->acdirmax = val; + } + else if (!strcmp(opt, "retry")) + *retry = val; + else if (!strcmp(opt, "port")) + nfs_pmap->pm_port = val; + else if (!strcmp(opt, "mountport")) + mnt_pmap->pm_port = val; + else if (!strcmp(opt, "mountprog")) + mnt_pmap->pm_prog = val; + else if (!strcmp(opt, "mountvers")) + mnt_pmap->pm_vers = val; + else if (!strcmp(opt, "nfsprog")) + nfs_pmap->pm_prog = val; + else if (!strcmp(opt, "nfsvers") || + !strcmp(opt, "vers")) { + nfs_pmap->pm_vers = val; + opt = "nfsvers"; +#if NFS_MOUNT_VERSION >= 2 + } else if (!strcmp(opt, "namlen")) { + if (nfs_mount_version >= 2) + data->namlen = val; + else if (!sloppy) + goto bad_parameter; #endif -#if 0 -#define MOUNTPORT 635 - /* HJLu wants to remove all traces of the old default port. - Are there still people running a mount RPC service on this - port without having a portmapper? */ - if (!p.pm_port) - p.pm_port = MOUNTPORT; -#endif - return &p; + } else if (!strcmp(opt, "addr")) { + /* ignore */; + continue; + } else if (!sloppy) + goto bad_parameter; + sprintf(cbuf, "%s=%s,", opt, opteq+1); + } else if (opteq) { + *opteq = '\0'; + if (!strcmp(opt, "proto")) { + if (!strcmp(opteq+1, "udp")) { + nfs_pmap->pm_prot = IPPROTO_UDP; +#if NFS_MOUNT_VERSION >= 2 + data->flags &= ~NFS_MOUNT_TCP; + } else if (!strcmp(opteq+1, "tcp") && + nfs_mount_version >= 2) { + nfs_pmap->pm_prot = IPPROTO_TCP; + data->flags |= NFS_MOUNT_TCP; +#endif + } else if (!sloppy) + goto bad_parameter; +#if NFS_MOUNT_VERSION >= 5 + } else if (!strcmp(opt, "sec")) { + char *secflavor = opteq+1; + /* see RFC 2623 */ + if (nfs_mount_version < 5) { + printf(_("Warning: ignoring sec=%s option\n"), secflavor); + continue; + } else if (!strcmp(secflavor, "sys")) + data->pseudoflavor = AUTH_SYS; + else if (!strcmp(secflavor, "krb5")) + data->pseudoflavor = AUTH_GSS_KRB5; + else if (!strcmp(secflavor, "krb5i")) + data->pseudoflavor = AUTH_GSS_KRB5I; + else if (!strcmp(secflavor, "krb5p")) + data->pseudoflavor = AUTH_GSS_KRB5P; + else if (!strcmp(secflavor, "lipkey")) + data->pseudoflavor = AUTH_GSS_LKEY; + else if (!strcmp(secflavor, "lipkey-i")) + data->pseudoflavor = AUTH_GSS_LKEYI; + else if (!strcmp(secflavor, "lipkey-p")) + data->pseudoflavor = AUTH_GSS_LKEYP; + else if (!strcmp(secflavor, "spkm3")) + data->pseudoflavor = AUTH_GSS_SPKM; + else if (!strcmp(secflavor, "spkm3i")) + data->pseudoflavor = AUTH_GSS_SPKMI; + else if (!strcmp(secflavor, "spkm3p")) + data->pseudoflavor = AUTH_GSS_SPKMP; + else if (!sloppy) { + printf(_("Warning: Unrecognized security flavor %s.\n"), + secflavor); + goto bad_parameter; + } + data->flags |= NFS_MOUNT_SECFLAVOUR; +#endif + } else if (!strcmp(opt, "mounthost")) + mounthost=xstrndup(opteq+1, + strcspn(opteq+1," \t\n\r,")); + else if (!strcmp(opt, "context")) { + char *context = opteq + 1; + + if (strlen(context) > NFS_MAX_CONTEXT_LEN) { + printf(_("context parameter exceeds limit of %d\n"), + NFS_MAX_CONTEXT_LEN); + goto bad_parameter; + } + strncpy(data->context, context, NFS_MAX_CONTEXT_LEN); + } else if (!sloppy) + goto bad_parameter; + sprintf(cbuf, "%s=%s,", opt, opteq+1); + } else { + int val = 1; + if (!strncmp(opt, "no", 2)) { + val = 0; + opt += 2; + } + if (!strcmp(opt, "bg")) + *bg = val; + else if (!strcmp(opt, "fg")) + *bg = !val; + else if (!strcmp(opt, "soft")) { + data->flags &= ~NFS_MOUNT_SOFT; + if (val) + data->flags |= NFS_MOUNT_SOFT; + } else if (!strcmp(opt, "hard")) { + data->flags &= ~NFS_MOUNT_SOFT; + if (!val) + data->flags |= NFS_MOUNT_SOFT; + } else if (!strcmp(opt, "intr")) { + data->flags &= ~NFS_MOUNT_INTR; + if (val) + data->flags |= NFS_MOUNT_INTR; + } else if (!strcmp(opt, "posix")) { + data->flags &= ~NFS_MOUNT_POSIX; + if (val) + data->flags |= NFS_MOUNT_POSIX; + } else if (!strcmp(opt, "cto")) { + data->flags &= ~NFS_MOUNT_NOCTO; + if (!val) + data->flags |= NFS_MOUNT_NOCTO; + } else if (!strcmp(opt, "ac")) { + data->flags &= ~NFS_MOUNT_NOAC; + if (!val) + data->flags |= NFS_MOUNT_NOAC; +#if NFS_MOUNT_VERSION >= 2 + } else if (!strcmp(opt, "tcp")) { + data->flags &= ~NFS_MOUNT_TCP; + if (val) { + if (nfs_mount_version < 2) + goto bad_option; + nfs_pmap->pm_prot = IPPROTO_TCP; + data->flags |= NFS_MOUNT_TCP; + } else + nfs_pmap->pm_prot = IPPROTO_UDP; + } else if (!strcmp(opt, "udp")) { + data->flags &= ~NFS_MOUNT_TCP; + if (!val) { + if (nfs_mount_version < 2) + goto bad_option; + nfs_pmap->pm_prot = IPPROTO_TCP; + data->flags |= NFS_MOUNT_TCP; + } else + nfs_pmap->pm_prot = IPPROTO_UDP; +#endif +#if NFS_MOUNT_VERSION >= 3 + } else if (!strcmp(opt, "lock")) { + data->flags &= ~NFS_MOUNT_NONLM; + if (!val) { + if (nfs_mount_version < 3) + goto bad_option; + data->flags |= NFS_MOUNT_NONLM; + } +#endif +#if NFS_MOUNT_VERSION >= 4 + } else if (!strcmp(opt, "broken_suid")) { + data->flags &= ~NFS_MOUNT_BROKEN_SUID; + if (val) { + if (nfs_mount_version < 4) + goto bad_option; + data->flags |= NFS_MOUNT_BROKEN_SUID; + } +#endif + } else if (!sloppy) { + bad_option: + printf(_("Unsupported nfs mount option: " + "%s%s\n"), val ? "" : "no", opt); + goto out_bad; + } + sprintf(cbuf, val ? "%s,":"no%s,", opt); + } + len += strlen(cbuf); + if (len >= opt_size) { + printf(_("mount: excessively long option argument\n")); + goto out_bad; + } + strcat(new_opts, cbuf); + } + /* See if the nfs host = mount host. */ + if (mounthost) { + if (!nfs_gethostbyname(mounthost, mnt_saddr)) + goto out_bad; + *mnt_server->hostname = mounthost; + } + return 1; + bad_parameter: + printf(_("Bad nfs mount parameter: %s\n"), opt); + out_bad: + return 0; +} + +static inline int +nfsmnt_check_compat(const struct pmap *nfs_pmap, const struct pmap *mnt_pmap) +{ + if (nfs_pmap->pm_vers && + (nfs_pmap->pm_vers > MAX_NFSPROT || nfs_pmap->pm_vers < 2)) { + if (nfs_pmap->pm_vers == 4) + fprintf(stderr, _("'vers=4' is not supported. " + "Use '-t nfs4' instead.\n")); + else + fprintf(stderr, _("NFS version %ld is not supported.\n"), + nfs_pmap->pm_vers); + goto out_bad; + } + if (mnt_pmap->pm_vers > MAX_MNTPROT) { + fprintf(stderr, _("NFS mount version %ld s not supported.\n"), + mnt_pmap->pm_vers); + goto out_bad; + } + return 1; + out_bad: + return 0; } -int nfsmount(const char *spec, const char *node, int *flags, - char **extra_opts, char **mount_opts, int *nfs_mount_vers, - int running_bg) +int +nfsmount(const char *spec, const char *node, int *flags, + char **extra_opts, char **mount_opts, int *nfs_mount_vers, + int running_bg) { static char *prev_bg_host; char hostdir[1024]; - CLIENT *mclient; char *hostname, *dirname, *old_opts, *mounthost = NULL; - char new_opts[1024]; - struct timeval total_timeout; - enum clnt_stat clnt_stat; + char new_opts[1024], cbuf[20]; static struct nfs_mount_data data; - char *opt, *opteq; - int nfs_mount_version; int val; - struct hostent *hp; - struct sockaddr_in server_addr; - struct sockaddr_in mount_server_addr; - struct pmap *pm_mnt; - int msock, fsock; - struct timeval retry_timeout; - union { - struct fhstatus nfsv2; - struct mountres3 nfsv3; - } status; + + clnt_addr_t mnt_server = { &mounthost, }; + clnt_addr_t nfs_server = { &hostname, }; + struct sockaddr_in *nfs_saddr = &nfs_server.saddr; + struct pmap *mnt_pmap = &mnt_server.pmap, + *nfs_pmap = &nfs_server.pmap; + struct pmap save_mnt, save_nfs; + + int fsock; + + mntres_t mntres; + struct stat statbuf; char *s; - int port, mountport, proto, bg, soft, intr; - int posix, nocto, noac, nolock, broken_suid; - int retry, tcp; - int mountprog, mountvers, nfsprog, nfsvers; + int bg, retry; int retval; time_t t; time_t prevt; @@ -231,8 +846,7 @@ int nfsmount(const char *spec, const cha nfs_mount_version = *nfs_mount_vers; retval = EX_FAIL; - msock = fsock = -1; - mclient = NULL; + fsock = -1; if (strlen(spec) >= sizeof(hostdir)) { fprintf(stderr, _("mount: " "excessively long host:dir argument\n")); @@ -258,49 +872,23 @@ int nfsmount(const char *spec, const cha goto fail; } - server_addr.sin_family = AF_INET; -#ifdef HAVE_inet_aton - if (!inet_aton(hostname, &server_addr.sin_addr)) -#endif - { - if ((hp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, _("mount: can't get address for %s\n"), - hostname); - goto fail; - } else { - if (hp->h_length > sizeof(struct in_addr)) { - fprintf(stderr, - _("mount: got bad hp->h_length\n")); - hp->h_length = sizeof(struct in_addr); - } - memcpy(&server_addr.sin_addr, - hp->h_addr, hp->h_length); - } - } - - memcpy (&mount_server_addr, &server_addr, sizeof (mount_server_addr)); + if (!nfs_gethostbyname(hostname, nfs_saddr)) + goto fail; + mounthost = hostname; + memcpy (&mnt_server.saddr, nfs_saddr, sizeof (mnt_server.saddr)); /* add IP address to mtab options for use when unmounting */ - s = inet_ntoa(server_addr.sin_addr); + s = inet_ntoa(nfs_saddr->sin_addr); old_opts = *extra_opts; if (!old_opts) old_opts = ""; - if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { - fprintf(stderr, _("mount: " - "excessively long option argument\n")); - goto fail; - } - sprintf(new_opts, "%s%saddr=%s", - old_opts, *old_opts ? "," : "", s); - *extra_opts = xstrdup(new_opts); /* Set default options. * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to * let the kernel decide. * timeo is filled in after we know whether it'll be TCP or UDP. */ memset(&data, 0, sizeof(data)); - data.retrans = 3; data.acregmin = 3; data.acregmax = 60; data.acdirmin = 30; @@ -308,169 +896,24 @@ int nfsmount(const char *spec, const cha #if NFS_MOUNT_VERSION >= 2 data.namlen = NAME_MAX; #endif + data.pseudoflavor = AUTH_SYS; bg = 0; - soft = 0; - intr = 0; - posix = 0; - nocto = 0; - nolock = 0; - broken_suid = 0; - noac = 0; retry = 10000; /* 10000 minutes ~ 1 week */ - tcp = 0; - mountprog = MOUNTPROG; - mountvers = 0; - port = 0; - mountport = 0; - nfsprog = NFS_PROGRAM; - nfsvers = 0; + memset(mnt_pmap, 0, sizeof(*mnt_pmap)); + mnt_pmap->pm_prog = MOUNTPROG; + memset(nfs_pmap, 0, sizeof(*nfs_pmap)); + nfs_pmap->pm_prog = NFS_PROGRAM; /* parse options */ + new_opts[0] = 0; + if (!parse_options(old_opts, &data, &bg, &retry, &mnt_server, &nfs_server, + new_opts, sizeof(new_opts))) + goto fail; + if (!nfsmnt_check_compat(nfs_pmap, mnt_pmap)) + goto fail; - for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) { - if ((opteq = strchr(opt, '='))) { - val = atoi(opteq + 1); - *opteq = '\0'; - if (!strcmp(opt, "rsize")) - data.rsize = val; - else if (!strcmp(opt, "wsize")) - data.wsize = val; - else if (!strcmp(opt, "timeo")) - data.timeo = val; - else if (!strcmp(opt, "retrans")) - data.retrans = val; - else if (!strcmp(opt, "acregmin")) - data.acregmin = val; - else if (!strcmp(opt, "acregmax")) - data.acregmax = val; - else if (!strcmp(opt, "acdirmin")) - data.acdirmin = val; - else if (!strcmp(opt, "acdirmax")) - data.acdirmax = val; - else if (!strcmp(opt, "actimeo")) { - data.acregmin = val; - data.acregmax = val; - data.acdirmin = val; - data.acdirmax = val; - } - else if (!strcmp(opt, "retry")) - retry = val; - else if (!strcmp(opt, "port")) - port = val; - else if (!strcmp(opt, "mountport")) - mountport = val; - else if (!strcmp(opt, "mounthost")) - mounthost=xstrndup(opteq+1, - strcspn(opteq+1," \t\n\r,")); - else if (!strcmp(opt, "mountprog")) - mountprog = val; - else if (!strcmp(opt, "mountvers")) - mountvers = val; - else if (!strcmp(opt, "nfsprog")) - nfsprog = val; - else if (!strcmp(opt, "nfsvers") || - !strcmp(opt, "vers")) - nfsvers = val; - else if (!strcmp(opt, "proto")) { - if (!strncmp(opteq+1, "tcp", 3)) - tcp = 1; - else if (!strncmp(opteq+1, "udp", 3)) - tcp = 0; - else - printf(_("Warning: Unrecognized proto= option.\n")); - } else if (!strcmp(opt, "namlen")) { -#if NFS_MOUNT_VERSION >= 2 - if (nfs_mount_version >= 2) - data.namlen = val; - else -#endif - printf(_("Warning: Option namlen is not supported.\n")); - } else if (!strcmp(opt, "addr")) { - /* ignore */; - } else { - printf(_("unknown nfs mount parameter: " - "%s=%d\n"), opt, val); - goto fail; - } - } else { - val = 1; - if (!strncmp(opt, "no", 2)) { - val = 0; - opt += 2; - } - if (!strcmp(opt, "bg")) - bg = val; - else if (!strcmp(opt, "fg")) - bg = !val; - else if (!strcmp(opt, "soft")) - soft = val; - else if (!strcmp(opt, "hard")) - soft = !val; - else if (!strcmp(opt, "intr")) - intr = val; - else if (!strcmp(opt, "posix")) - posix = val; - else if (!strcmp(opt, "cto")) - nocto = !val; - else if (!strcmp(opt, "ac")) - noac = !val; - else if (!strcmp(opt, "tcp")) - tcp = val; - else if (!strcmp(opt, "udp")) - tcp = !val; - else if (!strcmp(opt, "lock")) { - if (nfs_mount_version >= 3) - nolock = !val; - else - printf(_("Warning: option nolock is not supported.\n")); - } else if (!strcmp(opt, "broken_suid")) { - broken_suid = val; - } else { - if (!sloppy) { - printf(_("unknown nfs mount option: " - "%s%s\n"), val ? "" : "no", opt); - goto fail; - } - } - } - } - proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP; - - data.flags = (soft ? NFS_MOUNT_SOFT : 0) - | (intr ? NFS_MOUNT_INTR : 0) - | (posix ? NFS_MOUNT_POSIX : 0) - | (nocto ? NFS_MOUNT_NOCTO : 0) - | (noac ? NFS_MOUNT_NOAC : 0); -#if NFS_MOUNT_VERSION >= 2 - if (nfs_mount_version >= 2) - data.flags |= (tcp ? NFS_MOUNT_TCP : 0); -#endif -#if NFS_MOUNT_VERSION >= 3 - if (nfs_mount_version >= 3) - data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); -#endif -#if NFS_MOUNT_VERSION >= 4 - if (nfs_mount_version >= 4) - data.flags |= (broken_suid ? NFS_MOUNT_BROKEN_SUID : 0); -#endif - if (nfsvers > MAX_NFSPROT) { - fprintf(stderr, "NFSv%d not supported!\n", nfsvers); - return 0; - } - if (mountvers > MAX_NFSPROT) { - fprintf(stderr, "NFSv%d not supported!\n", nfsvers); - return 0; - } - if (nfsvers && !mountvers) - mountvers = (nfsvers < 3) ? 1 : nfsvers; - if (nfsvers && nfsvers < mountvers) - mountvers = nfsvers; - - /* Adjust options if none specified */ - if (!data.timeo) - data.timeo = tcp ? 70 : 7; #ifdef NFS_MOUNT_DEBUG printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", @@ -478,9 +921,10 @@ int nfsmount(const char *spec, const cha printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n", data.acregmin, data.acregmax, data.acdirmin, data.acdirmax); printf("port = %d, bg = %d, retry = %d, flags = %.8x\n", - port, bg, retry, data.flags); + nfs_pmap->pm_port, bg, retry, data.flags); printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n", - mountprog, mountvers, nfsprog, nfsvers); + mnt_pmap->pm_prog, mnt_pmap->pm_vers, + nfs_pmap->pm_prog, nfs_pmap->pm_vers); printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n", (data.flags & NFS_MOUNT_SOFT) != 0, (data.flags & NFS_MOUNT_INTR) != 0, @@ -491,13 +935,16 @@ int nfsmount(const char *spec, const cha printf("tcp = %d\n", (data.flags & NFS_MOUNT_TCP) != 0); #endif +#if NFS_MOUNT_VERSION >= 5 + printf("sec = %u\n", data.pseudoflavor); +#endif #endif data.version = nfs_mount_version; *mount_opts = (char *) &data; if (*flags & MS_REMOUNT) - return 0; + goto out_ok; /* * If the previous mount operation on the same host was @@ -512,28 +959,6 @@ int nfsmount(const char *spec, const cha } /* create mount deamon client */ - /* See if the nfs host = mount host. */ - if (mounthost) { - if (mounthost[0] >= '0' && mounthost[0] <= '9') { - mount_server_addr.sin_family = AF_INET; - mount_server_addr.sin_addr.s_addr = inet_addr(hostname); - } else { - if ((hp = gethostbyname(mounthost)) == NULL) { - fprintf(stderr, _("mount: can't get address for %s\n"), - mounthost); - goto fail; - } else { - if (hp->h_length > sizeof(struct in_addr)) { - fprintf(stderr, - _("mount: got bad hp->h_length?\n")); - hp->h_length = sizeof(struct in_addr); - } - mount_server_addr.sin_family = AF_INET; - memcpy(&mount_server_addr.sin_addr, - hp->h_addr, hp->h_length); - } - } - } /* * The following loop implements the mount retries. On the first @@ -551,15 +976,13 @@ int nfsmount(const char *spec, const cha * * Only the first error message will be displayed. */ - retry_timeout.tv_sec = 3; - retry_timeout.tv_usec = 0; - total_timeout.tv_sec = 20; - total_timeout.tv_usec = 0; timeout = time(NULL) + 60 * retry; prevt = 0; t = 30; val = 1; + memcpy(&save_nfs, nfs_pmap, sizeof(save_nfs)); + memcpy(&save_mnt, mnt_pmap, sizeof(save_mnt)); for (;;) { if (bg && stat(node, &statbuf) == -1) { /* no mount point yet - sleep */ @@ -570,89 +993,18 @@ int nfsmount(const char *spec, const cha val = 30; } } else { + int stat; /* be careful not to use too many CPU cycles */ if (t - prevt < 30) sleep(30); - pm_mnt = get_mountport(&mount_server_addr, - mountprog, - mountvers, - proto, - mountport, - nfs_mount_version); - - /* contact the mount daemon via TCP */ - mount_server_addr.sin_port = htons(pm_mnt->pm_port); - msock = RPC_ANYSOCK; - - switch (pm_mnt->pm_prot) { - case IPPROTO_UDP: - mclient = clntudp_create(&mount_server_addr, - pm_mnt->pm_prog, - pm_mnt->pm_vers, - retry_timeout, - &msock); - if (mclient) - break; - mount_server_addr.sin_port = - htons(pm_mnt->pm_port); - msock = RPC_ANYSOCK; - case IPPROTO_TCP: - mclient = clnttcp_create(&mount_server_addr, - pm_mnt->pm_prog, - pm_mnt->pm_vers, - &msock, 0, 0); + stat = nfs_call_mount(&mnt_server, &nfs_server, + &dirname, &mntres, + !running_bg && prevt == 0); + if (stat) break; - default: - mclient = 0; - } - - if (mclient) { - /* try to mount hostname:dirname */ - mclient->cl_auth = authunix_create_default(); - - /* make pointers in xdr_mountres3 NULL so - * that xdr_array allocates memory for us - */ - memset(&status, 0, sizeof(status)); - - if (pm_mnt->pm_vers == 3) - clnt_stat = clnt_call(mclient, - MOUNTPROC3_MNT, - (xdrproc_t) xdr_dirpath, - (caddr_t) &dirname, - (xdrproc_t) xdr_mountres3, - (caddr_t) &status, - total_timeout); - else - clnt_stat = clnt_call(mclient, - MOUNTPROC_MNT, - (xdrproc_t) xdr_dirpath, - (caddr_t) &dirname, - (xdrproc_t) xdr_fhstatus, - (caddr_t) &status, - total_timeout); - - if (clnt_stat == RPC_SUCCESS) - break; /* we're done */ -#if 0 - /* errno? who sets errno? */ - /* this fragment breaks bg mounting */ - if (errno != ECONNREFUSED) { - clnt_perror(mclient, "mount"); - goto fail; /* don't retry */ - } -#endif - if (!running_bg && prevt == 0) - clnt_perror(mclient, "mount"); - auth_destroy(mclient->cl_auth); - clnt_destroy(mclient); - mclient = 0; - close(msock); - } else { - if (!running_bg && prevt == 0) - clnt_pcreateerror("mount"); - } + memcpy(nfs_pmap, &save_nfs, sizeof(*nfs_pmap)); + memcpy(mnt_pmap, &save_mnt, sizeof(*mnt_pmap)); prevt = t; } @@ -668,36 +1020,63 @@ int nfsmount(const char *spec, const cha if (t >= timeout) goto fail; } - nfsvers = (pm_mnt->pm_vers < 2) ? 2 : pm_mnt->pm_vers; - if (nfsvers == 2) { - if (status.nfsv2.fhs_status != 0) { + if (nfs_pmap->pm_vers == 2) { + if (mntres.nfsv2.fhs_status != 0) { fprintf(stderr, - "mount: %s:%s failed, reason given by server: %s\n", + _("mount: %s:%s failed, reason given by server: %s\n"), hostname, dirname, - nfs_strerror(status.nfsv2.fhs_status)); + nfs_strerror(mntres.nfsv2.fhs_status)); goto fail; } memcpy(data.root.data, - (char *) status.nfsv2.fhstatus_u.fhs_fhandle, + (char *) mntres.nfsv2.fhstatus_u.fhs_fhandle, NFS_FHSIZE); #if NFS_MOUNT_VERSION >= 4 data.root.size = NFS_FHSIZE; memcpy(data.old_root.data, - (char *) status.nfsv2.fhstatus_u.fhs_fhandle, + (char *) mntres.nfsv2.fhstatus_u.fhs_fhandle, NFS_FHSIZE); #endif } else { #if NFS_MOUNT_VERSION >= 4 + mountres3_ok *mountres; fhandle3 *fhandle; - if (status.nfsv3.fhs_status != 0) { + int i, *flavor, yum = 0; + if (mntres.nfsv3.fhs_status != 0) { fprintf(stderr, - "mount: %s:%s failed, reason given by server: %s\n", + _("mount: %s:%s failed, reason given by server: %s\n"), hostname, dirname, - nfs_strerror(status.nfsv3.fhs_status)); + nfs_strerror(mntres.nfsv3.fhs_status)); goto fail; } - fhandle = &status.nfsv3.mountres3_u.mountinfo.fhandle; +#if NFS_MOUNT_VERSION >= 5 + mountres = &mntres.nfsv3.mountres3_u.mountinfo; + i = mountres->auth_flavours.auth_flavours_len; + if (i <= 0) + goto noauth_flavours; + + flavor = mountres->auth_flavours.auth_flavours_val; + while (--i >= 0) { + if (flavor[i] == data.pseudoflavor) + yum = 1; +#ifdef NFS_MOUNT_DEBUG + printf("auth flavor %d: %d\n", + i, flavor[i]); +#endif + } + if (!yum) { + fprintf(stderr, + "mount: %s:%s failed, " + "security flavor not supported\n", + hostname, dirname); + /* server has registered us in mtab, send umount */ + nfs_call_umount(&mnt_server, &dirname); + goto fail; + } +noauth_flavours: +#endif + fhandle = &mntres.nfsv3.mountres3_u.mountinfo.fhandle; memset(data.old_root.data, 0, NFS_FHSIZE); memset(&data.root, 0, sizeof(data.root)); data.root.size = fhandle->fhandle3_len; @@ -711,13 +1090,9 @@ int nfsmount(const char *spec, const cha /* create nfs socket for kernel */ - if (tcp) { - if (nfs_mount_version < 3) { - printf(_("NFS over TCP is not supported.\n")); - goto fail; - } + if (nfs_pmap->pm_prot == IPPROTO_TCP) fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - } else + else fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fsock < 0) { perror(_("nfs socket")); @@ -727,72 +1102,163 @@ int nfsmount(const char *spec, const cha perror(_("nfs bindresvport")); goto fail; } - if (port == 0) { - server_addr.sin_port = PMAPPORT; - port = pmap_getport(&server_addr, nfsprog, nfsvers, - tcp ? IPPROTO_TCP : IPPROTO_UDP); -#if 1 - /* Here we check to see if user is mounting with the - * tcp option. If so, and if the portmap returns a - * '0' for port (service unavailable), we then exit, - * notifying the user, rather than hanging up mount. - */ - if (port == 0 && tcp == 1) { - perror(_("nfs server reported service unavailable")); - goto fail; - } -#endif - - if (port == 0) - port = NFS_PORT; -#ifdef NFS_MOUNT_DEBUG - else - printf(_("used portmapper to find NFS port\n")); -#endif - } #ifdef NFS_MOUNT_DEBUG - printf(_("using port %d for nfs deamon\n"), port); + printf(_("using port %d for nfs deamon\n"), nfs_pmap->pm_port); #endif - server_addr.sin_port = htons(port); + nfs_saddr->sin_port = htons(nfs_pmap->pm_port); /* * connect() the socket for kernels 1.3.10 and below only, * to avoid problems with multihomed hosts. * --Swen */ if (linux_version_code() <= 66314 - && connect(fsock, (struct sockaddr *) &server_addr, - sizeof (server_addr)) < 0) { + && connect(fsock, (struct sockaddr *) nfs_saddr, + sizeof (*nfs_saddr)) < 0) { perror(_("nfs connect")); goto fail; } +#if NFS_MOUNT_VERSION >= 2 + if (nfs_pmap->pm_prot == IPPROTO_TCP) + data.flags |= NFS_MOUNT_TCP; + else + data.flags &= ~NFS_MOUNT_TCP; +#endif + /* prepare data structure for kernel */ data.fd = fsock; - memcpy((char *) &data.addr, (char *) &server_addr, sizeof(data.addr)); + memcpy((char *) &data.addr, (char *) nfs_saddr, sizeof(data.addr)); strncpy(data.hostname, hostname, sizeof(data.hostname)); - /* clean up */ + out_ok: + /* Ensure we have enough padding for the following strcat()s */ + if (strlen(new_opts) + strlen(s) + 30 >= sizeof(new_opts)) { + fprintf(stderr, _("mount: " + "excessively long option argument\n")); + goto fail; + } + + sprintf(cbuf, "addr=%s", s); + strcat(new_opts, cbuf); - auth_destroy(mclient->cl_auth); - clnt_destroy(mclient); - close(msock); + *extra_opts = xstrdup(new_opts); return 0; /* abort */ - fail: - if (msock != -1) { - if (mclient) { - auth_destroy(mclient->cl_auth); - clnt_destroy(mclient); - } - close(msock); - } if (fsock != -1) close(fsock); return retval; -} +} + +static inline enum clnt_stat +nfs3_umount(dirpath *argp, CLIENT *clnt) +{ + static char clnt_res; + memset (&clnt_res, 0, sizeof(clnt_res)); + return clnt_call(clnt, MOUNTPROC_UMNT, + (xdrproc_t) xdr_dirpath, (caddr_t)argp, + (xdrproc_t) xdr_void, (caddr_t) &clnt_res, + TIMEOUT); +} + +static inline enum clnt_stat +nfs2_umount(dirpath *argp, CLIENT *clnt) +{ + static char clnt_res; + memset (&clnt_res, 0, sizeof(clnt_res)); + return clnt_call(clnt, MOUNTPROC_UMNT, + (xdrproc_t) xdr_dirpath, (caddr_t)argp, + (xdrproc_t) xdr_void, (caddr_t) &clnt_res, + TIMEOUT); +} + +static int +nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp) +{ + CLIENT *clnt; + enum clnt_stat res = 0; + int msock; + + clnt = mnt_openclnt(mnt_server, &msock, 1); + if (!clnt) + goto out_bad; + switch (mnt_server->pmap.pm_vers) { + case 3: + res = nfs3_umount(argp, clnt); + break; + case 2: + case 1: + res = nfs2_umount(argp, clnt); + break; + default: + break; + } + mnt_closeclnt(clnt, msock); + if (res == RPC_SUCCESS) + return 1; + out_bad: + return 0; +} + +int +nfsumount(const char *spec, const char *opts) +{ + char *hostname; + char *dirname; + clnt_addr_t mnt_server = { &hostname, }; + struct pmap *pmap = &mnt_server.pmap; + char *p; + + nfs_mount_version = find_kernel_nfs_mount_version(); + if (spec == NULL || (p = strchr(spec,':')) == NULL) + goto out_bad; + hostname = xstrndup(spec, p-spec); + dirname = xstrdup(p+1); +#ifdef NFS_MOUNT_DEBUG + printf(_("host: %s, directory: %s\n"), hostname, dirname); +#endif + + if (opts && (p = strstr(opts, "addr="))) { + char *q; + + free(hostname); + p += 5; + q = p; + while (*q && *q != ',') q++; + hostname = xstrndup(p,q-p); + } + + if (opts && (p = strstr(opts, "mounthost="))) { + char *q; + + free(hostname); + p += 10; + q = p; + while (*q && *q != ',') q++; + hostname = xstrndup(p,q-p); + } + + pmap->pm_prog = MOUNTPROG; + pmap->pm_vers = MOUNTVERS; + if (opts && (p = strstr(opts, "mountprog=")) && isdigit(*(p+10))) + pmap->pm_prog = atoi(p+10); + if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10))) + pmap->pm_port = atoi(p+10); + if (opts && (p = strstr(opts, "nfsvers=")) && isdigit(*(p+8))) + pmap->pm_vers = nfsvers_to_mnt(atoi(p+8)); + if (opts && (p = strstr(opts, "mountvers=")) && isdigit(*(p+10))) + pmap->pm_vers = atoi(p+10); + + if (!nfs_gethostbyname(hostname, &mnt_server.saddr)) + goto out_bad; + if (!probe_mntport(&mnt_server)) + goto out_bad; + return nfs_call_umount(&mnt_server, &dirname); + out_bad: + return 0; +} /* * We need to translate between nfs status return values and diff -puN mount/sundries.h~CITI_NFS4_ALL mount/sundries.h --- util-linux-2.12/mount/sundries.h~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/sundries.h 2004-12-13 17:42:03.000000000 -0500 @@ -37,6 +37,9 @@ void die (int errcode, const char *fmt, #ifdef HAVE_NFS int nfsmount (const char *spec, const char *node, int *flags, char **orig_opts, char **opt_args, int *version, int running_bg); +int nfs4mount (const char *spec, const char *node, int *flags, + char **orig_opts, char **opt_args, int running_bg); +int nfsumount(const char *spec, const char *opts); #endif /* exit status - bits below are ORed */ diff -puN mount/umount.c~CITI_NFS4_ALL mount/umount.c --- util-linux-2.12/mount/umount.c~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/umount.c 2004-12-13 17:42:03.000000000 -0500 @@ -112,6 +112,9 @@ int verbose = 0; /* True if ruid != euid. */ int suid = 0; +/* Needed by nfs4mount.c */ +int sloppy = 0; + #ifdef USE_SPECIAL_UMOUNTPROG /* unimplemented so far */ static int @@ -122,7 +125,7 @@ check_special_umountprog() { } #endif -#ifdef HAVE_NFS +#if 0 static int xdr_dir(XDR *xdrsp, char *dirp) { return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); @@ -265,7 +268,7 @@ umount_one (const char *spec, const char /* Ignore any RPC errors, so that you can umount the filesystem if the server is down. */ if (strcasecmp(type, "nfs") == 0) - nfs_umount_rpc_call(spec, opts); + nfsumount(spec, opts); #endif umnt_err = umnt_err2 = 0; diff -puN mount/fstab.5~CITI_NFS4_ALL mount/fstab.5 --- util-linux-2.12/mount/fstab.5~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/fstab.5 2004-12-13 17:42:03.000000000 -0500 @@ -115,6 +115,7 @@ of filesystem types, such as .IR msdos , .IR ncpfs , .IR nfs , +.IR nfs4 , .IR ntfs , .IR proc , .IR qnx4 , diff -puN mount/mount.8~CITI_NFS4_ALL mount/mount.8 --- util-linux-2.12/mount/mount.8~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/mount.8 2004-12-13 17:42:08.000000000 -0500 @@ -270,6 +270,12 @@ Print a help message. .B \-v Verbose mode. .TP +.B \-p "\fInum\fP" +If the mount requires a passphrase to be entered, read it from file +descriptor +.IR num\fP +instead of from the terminal. +.TP .B \-a Mount all filesystems (of the given types) mentioned in .IR fstab . @@ -370,6 +376,7 @@ currently supported are: .IR msdos , .IR ncpfs , .IR nfs , +.IR nfs4 , .IR ntfs , .IR proc , .IR qnx4 , @@ -403,7 +410,7 @@ For most types all the program has to do is issue a simple .IR mount (2) system call, and no detailed knowledge of the filesystem type is required. -For a few types however (like nfs, smbfs, ncpfs) ad hoc code is +For a few types however (like nfs, nfs4, smbfs, ncpfs) ad hoc code is necessary. The nfs ad hoc code is built in, but smbfs and ncpfs have a separate mount program. In order to make it possible to treat all types in a uniform way, mount will execute the program @@ -451,9 +458,10 @@ or, if that does not exist, All of the filesystem types listed there will be tried, except for those that are labeled "nodev" (e.g., .IR devpts , -.I proc +.IR proc , +.IR nfs , and -.IR nfs ). +.IR nfs4 ). If .I /etc/filesystems ends in a line with a single * only, mount will read @@ -633,6 +641,15 @@ This option implies the options .BR noexec ", " nosuid ", and " nodev (unless overridden by subsequent options, as in the option line .BR users,exec,dev,suid ). +.TP +.B encryption +Specifies an encryption algorithm to use. Used in conjunction with the +.BR loop " option." +.TP +.B keybits +Specifies the key size to use for an encryption algorithm. Used in conjunction +with the +.BR loop " and " encryption " options." .RE .TP .B \-\-bind @@ -1243,6 +1260,73 @@ Usually it just causes lots of trouble. .B nolock Do not use locking. Do not start lockd. +.SH "Mount options for nfs4" +Instead of a textual option string, parsed by the kernel, the +.I nfs4 +file system expects a binary argument of type +.IR "struct nfs4_mount_data" . +The program +.B mount +itself parses the following options of the form `tag=value', +and puts them in the structure mentioned: +.BI rsize= n, +.BI wsize= n, +.BI timeo= n, +.BI retrans= n, +.BI acregmin= n, +.BI acregmax= n, +.BI acdirmin= n, +.BI acdirmax= n, +.BI actimeo= n, +.BI retry= n, +.BI port= n, +.BI proto= n, +.BI clientaddr= n, +.BI sec= n. +The option +.BI addr= n +is accepted but ignored. +Also the following Boolean options, possibly preceded by +.B no +are recognized: +.BR bg , +.BR fg , +.BR soft , +.BR hard , +.BR intr , +.BR cto , +.BR ac , +For details, see +.BR nfs (5). + +Especially useful options include +.TP +.B rsize=32768,wsize=32768 +This will make your NFS connection faster than with the default +buffer size of 4096. +.TP +.B hard +The program accessing a file on a NFS mounted file system will hang +when the server crashes. The process cannot be interrupted or +killed unless you also specify +.BR intr . +When the NFS server is back online the program will continue undisturbed +from where it was. This is probably what you want. +.TP +.B soft +This option allows the kernel to time out if the NFS server is not +responding for some time. The time can be +specified with +.BR timeo=time . +This timeout value is expressed in tenths of a second. +The +.BR soft +option might be useful if your NFS server sometimes doesn't respond +or will be rebooted while some process tries to get a file from the server. +Avoid using this option with +.BR proto=udp +or with a short timeout. + .SH "Mount options for ntfs" .TP .BI iocharset= name @@ -1696,7 +1780,10 @@ This type of mount knows about three opt .BR loop ", " offset " and " encryption , that are really options to .BR losetup (8). -If no explicit loop device is mentioned +If the mount requires a passphrase, you will be prompted for one unless +you specify a file descriptor to read from instead with the +.BR \-\-pass-fd +option. If no explicit loop device is mentioned (but just an option `\fB\-o loop\fP' is given), then .B mount will try to find some unused loop device and use that. @@ -1767,7 +1854,7 @@ temporary file .BR e2label (8), .BR xfs_admin (8), .BR mountd (8), -.BR nfsd (8), +.BR rpc.nfsd (8), .BR mke2fs (8), .BR tune2fs (8), .BR losetup (8) diff -puN mount/mount.c~CITI_NFS4_ALL mount/mount.c --- util-linux-2.12/mount/mount.c~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/mount.c 2004-12-13 17:42:08.000000000 -0500 @@ -92,6 +92,9 @@ static int readonly = 0; /* Nonzero for chatty (-v). */ int verbose = 0; +/* Do we hash the password or not */ +int hash_password = 1; + /* Nonzero for sloppy (-s). */ int sloppy = 0; @@ -116,6 +119,9 @@ static int suid = 0; /* Contains the fd to read the passphrase from, if any. */ static int pfd = -1; +/* Contains the preferred keysize in bits we want to use */ +static int keysz = 0; + /* Map from -o and fstab option strings to the flag argument to mount(2). */ struct opt_map { const char *opt; /* option name */ @@ -195,7 +201,7 @@ static const struct opt_map opt_map[] = }; static char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption, - *opt_speed; + *opt_keybits, *opt_nohashpass, *opt_speed; static struct string_opt_map { char *tag; @@ -206,6 +212,8 @@ static struct string_opt_map { { "vfs=", 1, &opt_vfstype }, { "offset=", 0, &opt_offset }, { "encryption=", 0, &opt_encryption }, + { "keybits=", 0, &opt_keybits }, + { "nohashpass", 0, &opt_nohashpass }, { "speed=", 0, &opt_speed }, { NULL, 0, NULL } }; @@ -586,7 +594,8 @@ loop_check(char **spec, char **type, int *type = opt_vfstype; } - *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_encryption); + *loop = ((*flags & MS_LOOP) || *loopdev || opt_offset || opt_encryption || + opt_keybits); *loopfile = *spec; if (*loop) { @@ -604,8 +613,12 @@ loop_check(char **spec, char **type, int if (verbose) printf(_("mount: going to use the loop device %s\n"), *loopdev); offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0; - if (set_loop(*loopdev, *loopfile, offset, - opt_encryption, pfd, &loopro)) { + if (!keysz && opt_keybits) + keysz = strtoul(opt_keybits, NULL, 0); + if (opt_nohashpass) + hash_password=0; + if (set_loop (*loopdev, *loopfile, offset, opt_encryption, pfd, + keysz, &loopro, hash_password)) { if (verbose) printf(_("mount: failed setting up loop device\n")); return EX_FAIL; @@ -821,8 +834,23 @@ retry_nfs: "without support for the type `nfs'")); #endif } +#ifdef HAVE_NFS + /* + * NFSv4 support + */ + if (!fake && types && streq (types, "nfs4")) { + mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg); + if (mnt_err) + return mnt_err; + goto nosigblock; +#else + die (EX_SOFTWARE, _("mount: this version was compiled " + "without support for the type `nfs4'")); +#endif + } block_signals (SIG_BLOCK); +nosigblock: if (!fake) mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS, @@ -1371,6 +1399,7 @@ static struct option longopts[] = { { "options", 1, 0, 'o' }, { "test-opts", 1, 0, 'O' }, { "pass-fd", 1, 0, 'p' }, + { "keybits", 1, 0, 'k' }, { "types", 1, 0, 't' }, { "bind", 0, 0, 128 }, { "replace", 0, 0, 129 }, @@ -1424,6 +1453,8 @@ main (int argc, char *argv[]) { int c, result = 0, specseen; char *options = NULL, *test_opts = NULL, *spec, *node; char *volumelabel = NULL; + char *passfd = NULL; + char *keysize = NULL; char *uuid = NULL; char *types = NULL; struct mntentchn *mc; @@ -1447,7 +1478,7 @@ main (int argc, char *argv[]) { initproctitle(argc, argv); #endif - while ((c = getopt_long (argc, argv, "afFhilL:no:O:p:rsU:vVwt:", + while ((c = getopt_long (argc, argv, "afFhilL:k:no:O:p:rsU:vVwt:", longopts, NULL)) != -1) { switch (c) { case 'a': /* mount everything in fstab */ @@ -1471,6 +1502,9 @@ main (int argc, char *argv[]) { case 'L': volumelabel = optarg; break; + case 'k': + keysize = optarg; + break; case 'n': /* do not write /etc/mtab */ ++nomtab; break; @@ -1598,6 +1632,11 @@ main (int argc, char *argv[]) { } else spec = NULL; /* just for gcc */ + if (passfd && sscanf(passfd,"%d",&pfd) != 1) + die (EX_USAGE, _("mount: argument to --pass-fd or -p must be a number")); + if (keysize && sscanf(keysize,"%d",&keysz) != 1) + die (EX_USAGE, _("mount: argument to --keybits or -k must be a number")); + switch (argc+specseen) { case 0: /* mount -a */ diff -puN /dev/null mount/nfs4mount.c --- /dev/null 2004-08-19 17:44:20.000000000 -0400 +++ util-linux-2.12-bfields/mount/nfs4mount.c 2004-12-13 17:42:03.000000000 -0500 @@ -0,0 +1,401 @@ +/* + * nfs4mount.c -- Linux NFS mount + * Copyright (C) 2002 Trond Myklebust + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Note: this file based on the original nfsmount.c + */ + +#include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */ + +#include +#include +#undef __FD_CLR +#undef __FD_SET +#undef __FD_ISSET +#undef __FD_ZERO + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_rpcsvc_nfs_prot_h +#include +#else +#include +#define nfsstat nfs_stat +#endif + +#include "sundries.h" + +#include "mount_constants.h" +#include "nfs4_mount.h" + +#include "nls.h" + +#ifndef NFS_PORT +#define NFS_PORT 2049 +#endif + +extern int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int); +extern void rpc_strerror(void); + +struct { + char *flavour; + int fnum; +} flav_map[] = { + { "krb5", RPC_AUTH_GSS_KRB5 }, + { "krb5i", RPC_AUTH_GSS_KRB5I }, + { "krb5p", RPC_AUTH_GSS_KRB5P }, + { "lipkey", RPC_AUTH_GSS_LKEY }, + { "lipkey-i", RPC_AUTH_GSS_LKEYI }, + { "lipkey-p", RPC_AUTH_GSS_LKEYP }, + { "spkm3", RPC_AUTH_GSS_SPKM }, + { "spkm3i", RPC_AUTH_GSS_SPKMI }, + { "spkm3p", RPC_AUTH_GSS_SPKMP }, + { "unix", AUTH_UNIX }, + { "sys", AUTH_SYS }, + { "null", AUTH_NULL }, + { "none", AUTH_NONE }, +}; + +#define FMAPSIZE (sizeof(flav_map)/sizeof(flav_map[0])) +#define MAX_USER_FLAVOUR 16 + +static int parse_sec(char *sec, int *pseudoflavour) +{ + int i, num_flavour = 0; + + for (sec = strtok(sec, ":"); sec; sec = strtok(NULL, ":")) { + if (num_flavour >= MAX_USER_FLAVOUR) { + fprintf(stderr, + _("mount: maximum number of security flavors " + "exceeded\n")); + return 0; + } + for (i = 0; i < FMAPSIZE; i++) { + if (strcmp(sec, flav_map[i].flavour) == 0) { + pseudoflavour[num_flavour++] = flav_map[i].fnum; + break; + } + } + if (i == FMAPSIZE) { + fprintf(stderr, + _("mount: unknown security type %s\n"), sec); + return 0; + } + } + if (!num_flavour) + fprintf(stderr, + _("mount: no security flavors passed to sec= option\n")); + return num_flavour; +} + +static int parse_devname(char *hostdir, char **hostname, char **dirname) +{ + char *s; + + if (!(s = strchr(hostdir, ':'))) { + fprintf(stderr, + _("mount: " + "directory to mount not in host:dir format\n")); + return -1; + } + *hostname = hostdir; + *dirname = s + 1; + *s = '\0'; + /* Ignore all but first hostname in replicated mounts + until they can be fully supported. (mack@sgi.com) */ + if ((s = strchr(hostdir, ','))) { + *s = '\0'; + fprintf(stderr, + _("mount: warning: " + "multiple hostnames not supported\n")); + } + return 0; +} + +static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr) +{ + struct hostent *hp; + addr->sin_family = AF_INET; + + if (inet_aton(hostname, &addr->sin_addr)) + return 0; + if ((hp = gethostbyname(hostname)) == NULL) { + fprintf(stderr, _("mount: can't get address for %s\n"), + hostname); + return -1; + } + if (hp->h_length > sizeof(struct in_addr)) { + fprintf(stderr, + _("mount: got bad hp->h_length\n")); + hp->h_length = sizeof(struct in_addr); + } + memcpy(&addr->sin_addr, hp->h_addr, hp->h_length); + return 0; +} + +static int get_my_ipv4addr(char *ip_addr, int len) +{ + char myname[1024]; + struct sockaddr_in myaddr; + + if (gethostname(myname, sizeof(myname))) { + fprintf(stderr, _("mount: can't determine client address\n")); + return -1; + } + if (fill_ipv4_sockaddr(myname, &myaddr)) + return -1; + snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr)); + ip_addr[len-1] = '\0'; + return 0; +} + +int nfs4mount(const char *spec, const char *node, int *flags, + char **extra_opts, char **mount_opts, + int running_bg) +{ + static struct nfs4_mount_data data; + static char hostdir[1024]; + static char ip_addr[16] = "127.0.0.1"; + static struct sockaddr_in server_addr; + static int pseudoflavour[MAX_USER_FLAVOUR]; + int num_flavour = 0; + + char *hostname, *dirname, *old_opts; + char new_opts[1024]; + char *opt, *opteq; + char *s; + int val; + int bg, soft, intr; + int nocto, noac; + int retry; + int retval; + + retval = EX_FAIL; + if (strlen(spec) >= sizeof(hostdir)) { + fprintf(stderr, _("mount: " + "excessively long host:dir argument\n")); + goto fail; + } + strcpy(hostdir, spec); + if (parse_devname(hostdir, &hostname, &dirname)) + goto fail; + + if (fill_ipv4_sockaddr(hostname, &server_addr)) + goto fail; + if (get_my_ipv4addr(ip_addr, sizeof(ip_addr))) + goto fail; + + /* add IP address to mtab options for use when unmounting */ + s = inet_ntoa(server_addr.sin_addr); + old_opts = *extra_opts; + if (!old_opts) + old_opts = ""; + if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { + fprintf(stderr, _("mount: " + "excessively long option argument\n")); + goto fail; + } + snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s", + old_opts, *old_opts ? "," : "", s); + *extra_opts = xstrdup(new_opts); + + /* Set default options. + * rsize/wsize and timeo are left 0 in order to + * let the kernel decide. + */ + memset(&data, 0, sizeof(data)); + data.retrans = 3; + data.acregmin = 3; + data.acregmax = 60; + data.acdirmin = 30; + data.acdirmax = 60; + data.proto = IPPROTO_TCP; + + bg = 0; + soft = 0; + intr = NFS4_MOUNT_INTR; + nocto = 0; + noac = 0; + retry = 10000; /* 10000 minutes ~ 1 week */ + + /* + * NFSv4 specifies that the default port should be 2049 + */ + server_addr.sin_port = htons(NFS_PORT); + + /* parse options */ + + for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) { + if ((opteq = strchr(opt, '='))) { + val = atoi(opteq + 1); + *opteq = '\0'; + if (!strcmp(opt, "rsize")) + data.rsize = val; + else if (!strcmp(opt, "wsize")) + data.wsize = val; + else if (!strcmp(opt, "timeo")) + data.timeo = val; + else if (!strcmp(opt, "retrans")) + data.retrans = val; + else if (!strcmp(opt, "acregmin")) + data.acregmin = val; + else if (!strcmp(opt, "acregmax")) + data.acregmax = val; + else if (!strcmp(opt, "acdirmin")) + data.acdirmin = val; + else if (!strcmp(opt, "acdirmax")) + data.acdirmax = val; + else if (!strcmp(opt, "actimeo")) { + data.acregmin = val; + data.acregmax = val; + data.acdirmin = val; + data.acdirmax = val; + } + else if (!strcmp(opt, "retry")) + retry = val; + else if (!strcmp(opt, "port")) + server_addr.sin_port = htons(val); + else if (!strcmp(opt, "proto")) { + if (!strncmp(opteq+1, "tcp", 3)) + data.proto = IPPROTO_TCP; + else if (!strncmp(opteq+1, "udp", 3)) + data.proto = IPPROTO_UDP; + else + printf(_("Warning: Unrecognized proto= option.\n")); + } else if (!strcmp(opt, "clientaddr")) { + if (strlen(opteq+1) >= sizeof(ip_addr)) + printf(_("Invalid client address %s"), + opteq+1); + strncpy(ip_addr,opteq+1, sizeof(ip_addr)); + ip_addr[sizeof(ip_addr)-1] = '\0'; + } else if (!strcmp(opt, "sec")) { + num_flavour = parse_sec(opteq+1, pseudoflavour); + if (!num_flavour) + goto fail; + } else if (!strcmp(opt, "addr")) { + /* ignore */; + } else { + printf(_("unknown nfs mount parameter: " + "%s=%d\n"), opt, val); + goto fail; + } + } else { + val = 1; + if (!strncmp(opt, "no", 2)) { + val = 0; + opt += 2; + } + if (!strcmp(opt, "bg")) + bg = val; + else if (!strcmp(opt, "fg")) + bg = !val; + else if (!strcmp(opt, "soft")) + soft = val; + else if (!strcmp(opt, "hard")) + soft = !val; + else if (!strcmp(opt, "intr")) + intr = val; + else if (!strcmp(opt, "cto")) + nocto = !val; + else if (!strcmp(opt, "ac")) + noac = !val; + else { + if (!sloppy) { + printf(_("unknown nfs mount option: " + "%s%s\n"), val ? "" : "no", opt); + goto fail; + } + } + } + } + + data.flags = (soft ? NFS4_MOUNT_SOFT : 0) + | (intr ? NFS4_MOUNT_INTR : 0) + | (nocto ? NFS4_MOUNT_NOCTO : 0) + | (noac ? NFS4_MOUNT_NOAC : 0); + + if (num_flavour == 0) + pseudoflavour[num_flavour++] = AUTH_UNIX; + data.auth_flavourlen = num_flavour; + data.auth_flavours = pseudoflavour; + + data.client_addr.data = ip_addr; + data.client_addr.len = strlen(ip_addr); + + data.mnt_path.data = dirname; + data.mnt_path.len = strlen(dirname); + + data.hostname.data = hostname; + data.hostname.len = strlen(hostname); + data.host_addr = (struct sockaddr *)&server_addr; + data.host_addrlen = sizeof(server_addr); + +#ifdef NFS_MOUNT_DEBUG + printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", + data.rsize, data.wsize, data.timeo, data.retrans); + printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n", + data.acregmin, data.acregmax, data.acdirmin, data.acdirmax); + printf("port = %d, bg = %d, retry = %d, flags = %.8x\n", + ntohs(server_addr.sin_port), bg, retry, data.flags); + printf("soft = %d, intr = %d, nocto = %d, noac = %d\n", + (data.flags & NFS4_MOUNT_SOFT) != 0, + (data.flags & NFS4_MOUNT_INTR) != 0, + (data.flags & NFS4_MOUNT_NOCTO) != 0, + (data.flags & NFS4_MOUNT_NOAC) != 0); + + if (num_flavour > 0) { + int pf_cnt, i; + + printf("sec = "); + for (pf_cnt = 0; pf_cnt < num_flavour; pf_cnt++) { + for (i = 0; i < FMAPSIZE; i++) { + if (flav_map[i].fnum == pseudoflavour[pf_cnt]) { + printf("%s", flav_map[i].flavour); + break; + } + } + printf("%s", (pf_cnt < num_flavour-1) ? ":" : "\n"); + } + } + printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp"); +#endif + + data.version = NFS4_MOUNT_VERSION; + + clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto); + if (rpc_createerr.cf_stat) { + fprintf(stderr, "mount to NFS server '%s' failed.\n", data.hostname.data); + goto fail; + } + + *mount_opts = (char *) &data; + /* clean up */ + return 0; + +fail: + if (verbose) { + rpc_strerror(); + } + return retval; +} diff -puN /dev/null mount/nfs4_mount.h --- /dev/null 2004-08-19 17:44:20.000000000 -0400 +++ util-linux-2.12-bfields/mount/nfs4_mount.h 2004-12-13 17:42:03.000000000 -0500 @@ -0,0 +1,82 @@ +#ifndef _LINUX_NFS4_MOUNT_H +#define _LINUX_NFS4_MOUNT_H + +/* + * linux/include/linux/nfs4_mount.h + * + * Copyright (C) 2002 Trond Myklebust + * + * structure passed from user-space to kernel-space during an nfsv4 mount + */ + +/* + * WARNING! Do not delete or change the order of these fields. If + * a new field is required then add it to the end. The version field + * tracks which fields are present. This will ensure some measure of + * mount-to-kernel version compatibility. Some of these aren't used yet + * but here they are anyway. + */ +#define NFS4_MOUNT_VERSION 1 + +struct nfs_string { + unsigned int len; + const char* data; +}; + +struct nfs4_mount_data { + int version; /* 1 */ + int flags; /* 1 */ + int rsize; /* 1 */ + int wsize; /* 1 */ + int timeo; /* 1 */ + int retrans; /* 1 */ + int acregmin; /* 1 */ + int acregmax; /* 1 */ + int acdirmin; /* 1 */ + int acdirmax; /* 1 */ + + /* see the definition of 'struct clientaddr4' in RFC3010 */ + struct nfs_string client_addr; /* 1 */ + + /* Mount path */ + struct nfs_string mnt_path; /* 1 */ + + /* Server details */ + struct nfs_string hostname; /* 1 */ + /* Server IP address */ + unsigned int host_addrlen; /* 1 */ + struct sockaddr* host_addr; /* 1 */ + + /* Transport protocol to use */ + int proto; /* 1 */ + + /* Pseudo-flavours to use for authentication. See RFC2623 */ + int auth_flavourlen; /* 1 */ + int *auth_flavours; /* 1 */ +}; + +/* bits in the flags field */ +/* Note: the fields that correspond to existing NFSv2/v3 mount options + * should mirror the values from include/linux/nfs_mount.h + */ + +#define NFS4_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS4_MOUNT_INTR 0x0002 /* 1 */ +#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS4_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ +#define NFS4_MOUNT_FLAGMASK 0xFFFF + +/* pseudoflavors: */ + +#define RPC_AUTH_GSS_KRB5 390003 +#define RPC_AUTH_GSS_KRB5I 390004 +#define RPC_AUTH_GSS_KRB5P 390005 +#define RPC_AUTH_GSS_LKEY 390006 +#define RPC_AUTH_GSS_LKEYI 390007 +#define RPC_AUTH_GSS_LKEYP 390008 +#define RPC_AUTH_GSS_SPKM 390009 +#define RPC_AUTH_GSS_SPKMI 390010 +#define RPC_AUTH_GSS_SPKMP 390011 + +#endif diff -puN mount/nfs.5~CITI_NFS4_ALL mount/nfs.5 --- util-linux-2.12/mount/nfs.5~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/nfs.5 2004-12-13 17:42:03.000000000 -0500 @@ -3,7 +3,7 @@ .\" patches. " .TH NFS 5 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual" .SH NAME -nfs \- nfs fstab format and options +nfs \- nfs and nfs4 fstab format and options .SH SYNOPSIS .B /etc/fstab .SH DESCRIPTION @@ -17,14 +17,51 @@ the local directory that is the mount po and the NFS specific options that control the way the filesystem is mounted. .P -Here is an example from an \fI/etc/fstab\fP file from an NFS mount. +Three different versions of the NFS protocol are +supported by the Linux NFS client: +NFS version 2, NFS version 3, and NFS version 4. +To mount via NFS version 2, use the +.BR nfs +file system type and specify +.BR nfsvers=2 . +Version 2 is the default protocol version for the +.BR nfs +file system type when +.BR nfsvers= +is not specified on the mount command. +To mount via NFS version 3, use the +.BR nfs +file system type and specify +.BR nfsvers=3 . +To mount via NFS version 4, use the +.BR nfs4 +file system type. +The +.BR nfsvers= +keyword is not supported for the +.BR nfs4 +file system type. +.P +These file system types share similar mount options; +the differences are listed below. +.P +Here is an example from an \fI/etc/fstab\fP file for an NFSv2 mount +over UDP. .sp .nf .ta 2.5i +0.75i +0.75i +1.0i server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr .fi +.P +Here is an example for an NFSv4 mount over TCP using Kerberos +5 mutual authentication. +.sp +.nf +.ta 2.5i +0.75i +0.75i +1.0i +server:/usr/local/pub /pub nfs4 proto=tcp,sec=krb5,hard,intr +.fi .DT -.SS Options +.SS Options for the nfs file system type .TP 1.5i .I rsize=n The number of bytes NFS uses when reading files from an NFS server. @@ -128,7 +165,7 @@ mount daemon program number. Use an alternate RPC version number to contact the mount daemon on the remote host. This option is useful for hosts that can run multiple NFS servers. -The default value is version 1. +The default value depends on which kernel you are using. .TP 1.5i .I nfsprog=n Use an alternate RPC program number to contact the @@ -141,7 +178,7 @@ NFS daemon program number. Use an alternate RPC version number to contact the NFS daemon on the remote host. This option is useful for hosts that can run multiple NFS servers. -The default value is version 2. +The default value depends on which kernel you are using. .TP 1.5i .I nolock Disable NFS locking. Do not start lockd. @@ -193,9 +230,25 @@ Suppress the retrieval of new attributes .TP 1.5i .I noac Disable all forms of attribute caching entirely. This extracts a -server performance penalty but it allows two different NFS clients -to get reasonable good results when both clients are actively -writing to common filesystem on the server. +significant performance penalty but it allows two different NFS clients +to get reasonable results when both clients are actively +writing to a common export on the server. +.TP 1.5i +.I sec=mode +Set the security flavor for this mount to "mode". +The default setting is \f3sec=sys\f1, which uses local +unix uids and gids to authenticate NFS operations (AUTH_SYS). +Other currently supported settings are: +\f3sec=krb5\f1, which uses Kerberos V5 instead of local unix uids +and gids to authenticate users; +\f3sec=krb5i\f1, which uses Kerberos V5 for user authentication +and performs integrity checking of NFS operations using secure +checksums to prevent data tampering; and +\f3sec=krb5p\f1, which uses Kerberos V5 for user authentication +and integrity checking, and encrypts NFS traffic to prevent +traffic sniffing (this is the most secure setting). +Note that there is a performance penalty when using integrity +or privacy. .TP 1.5i .I tcp Mount the NFS filesystem using the TCP protocol instead of the @@ -208,6 +261,156 @@ is the default. All of the non-value options have corresponding nooption forms. For example, nointr means don't allow file operations to be interrupted. +.SS Options for the nfs4 file system type +.TP 1.5i +.I rsize=n +The number of bytes NFS uses when reading files from an NFS server. +The default value is dependent on the kernel, currently 4096 bytes. +(However, throughput is improved greatly by asking for +.IR rsize=32768 .) +This value is negotiated with the server. +.TP 1.5i +.I wsize=n +The number of bytes NFS uses when writing files to an NFS server. +The default value is dependent on the kernel, currently 4096 bytes. +(However, throughput is improved greatly by asking for +.IR wsize=32768 .) +This value is negotiated with the server. +.TP 1.5i +.I timeo=n +The value in tenths of a second before sending the +first retransmission after an RPC timeout. +The default value depends on whether +.IR proto=udp +or +.IR proto=tcp +is in effect (see below). +The default value for UDP is 7 tenths of a second. +The default value for TCP is 60 seconds. +After the first timeout, +the timeout is doubled after each successive timeout until a maximum +timeout of 60 seconds is reached or the enough retransmissions +have occured to cause a major timeout. Then, if the filesystem +is hard mounted, each new timeout cascade restarts at twice the +initial value of the previous cascade, again doubling at each +retransmission. The maximum timeout is always 60 seconds. +.TP 1.5i +.I retrans=n +The number of minor timeouts and retransmissions that must occur before +a major timeout occurs. The default is 5 timeouts for +.IR proto=udp +and 2 timeouts for +.IR proto=tcp . +When a major timeout +occurs, the file operation is either aborted or a "server not responding" +message is printed on the console. +.TP 1.5i +.I acregmin=n +The minimum time in seconds that attributes of a regular file should +be cached before requesting fresh information from a server. +The default is 3 seconds. +.TP 1.5i +.I acregmax=n +The maximum time in seconds that attributes of a regular file can +be cached before requesting fresh information from a server. +The default is 60 seconds. +.TP 1.5i +.I acdirmin=n +The minimum time in seconds that attributes of a directory should +be cached before requesting fresh information from a server. +The default is 30 seconds. +.TP 1.5i +.I acdirmax=n +The maximum time in seconds that attributes of a directory can +be cached before requesting fresh information from a server. +The default is 60 seconds. +.TP 1.5i +.I actimeo=n +Using actimeo sets all of +.I acregmin, +.I acregmax, +.I acdirmin, +and +.I acdirmax +to the same value. +There is no default value. +.TP 1.5i +.I retry=n +The number of minutes to retry an NFS mount operation +in the foreground or background before giving up. +The default value is 10000 minutes, which is roughly one week. +.TP 1.5i +.I port=n +The numeric value of the port to connect to the NFS server on. +If the port number is 0 (the default) then query the +remote host's portmapper for the port number to use. +If the remote host's NFS daemon is not registered with +its portmapper, the standard NFS port number 2049 is +used instead. +.TP 1.5i +.I proto=n +Mount the NFS filesystem using a specific network protocol +instead of the default UDP protocol. +Many NFS version 4 servers only support TCP. +Valid protocol types are +.IR udp +and +.IR tcp . +.TP 1.5i +.I clientaddr=n +On a multi-homed client, this +causes the client to use a specific callback address when +communicating with an NFS version 4 server. +This option is currently ignored. +.TP 1.5i +.I sec=mode +Same as \f3sec=mode\f1 for the nfs filesystem type (see above). +.TP 1.5i +.I bg +If an NFS mount attempt times out, retry the mount +in the background. +After a mount operation is backgrounded, all subsequent mounts +on the same NFS server will be backgrounded immediately, without +first attempting the mount. +A missing mount point is treated as a timeout, +to allow for nested NFS mounts. +.TP 1.5i +.I fg +If the first NFS mount attempt times out, retry the mount +in the foreground. +This is the complement of the +.I bg +option, and also the default behavior. +.TP 1.5i +.I soft +If an NFS file operation has a major timeout then report an I/O error to +the calling program. +The default is to continue retrying NFS file operations indefinitely. +.TP 1.5i +.I hard +If an NFS file operation has a major timeout then report +"server not responding" on the console and continue retrying indefinitely. +This is the default. +.TP 1.5i +.I intr +If an NFS file operation has a major timeout and it is hard mounted, +then allow signals to interupt the file operation and cause it to +return EINTR to the calling program. The default is to not +allow file operations to be interrupted. +.TP 1.5i +.I nocto +Suppress the retrieval of new attributes when creating a file. +.TP 1.5i +.I noac +Disable attribute caching, and force synchronous writes. +This extracts a +server performance penalty but it allows two different NFS clients +to get reasonable good results when both clients are actively +writing to common filesystem on the server. +.P +All of the non-value options have corresponding nooption forms. +For example, nointr means don't allow file operations to be +interrupted. .SH FILES .I /etc/fstab .SH "SEE ALSO" diff -puN mount/nfs_mount4.h~CITI_NFS4_ALL mount/nfs_mount4.h --- util-linux-2.12/mount/nfs_mount4.h~CITI_NFS4_ALL 2004-12-13 17:42:03.000000000 -0500 +++ util-linux-2.12-bfields/mount/nfs_mount4.h 2004-12-13 17:42:04.000000000 -0500 @@ -8,7 +8,9 @@ * so it is easiest to ignore the kernel altogether (at compile time). */ -#define NFS_MOUNT_VERSION 4 +#define NFS_MOUNT_VERSION 6 +#define NFS_MAX_CONTEXT_LEN 256 + struct nfs2_fh { char data[32]; @@ -36,6 +38,9 @@ struct nfs_mount_data { int namlen; /* 2 */ unsigned int bsize; /* 3 */ struct nfs3_fh root; /* 4 */ + int pseudoflavor; /* 5 */ + char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ + }; /* bits in the flags field */ @@ -51,4 +56,19 @@ struct nfs_mount_data { #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ +#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ + +/* security pseudoflavors */ + +#ifndef AUTH_GSS_KRB5 +#define AUTH_GSS_KRB5 390003 +#define AUTH_GSS_KRB5I 390004 +#define AUTH_GSS_KRB5P 390005 +#define AUTH_GSS_LKEY 390006 +#define AUTH_GSS_LKEYI 390007 +#define AUTH_GSS_LKEYP 390008 +#define AUTH_GSS_SPKM 390009 +#define AUTH_GSS_SPKMI 390010 +#define AUTH_GSS_SPKMP 390011 +#endif diff -puN configure~CITI_NFS4_ALL configure --- util-linux-2.12/configure~CITI_NFS4_ALL 2004-12-13 17:42:04.000000000 -0500 +++ util-linux-2.12-bfields/configure 2004-12-13 17:42:08.000000000 -0500 @@ -274,6 +274,7 @@ rm -f conftest conftest.c # # F6. For agetty.c: is updwtmp() available? +# F7. For mcookie.c: is gettimeofday() available? # echo ' #include @@ -490,7 +491,7 @@ echo ' #include int main(int a, char **v){ if (a == -1) /* false */ - gettext("There is no gettext man page\n"); + gettext("There is no gettext man page"); exit(0); } ' > conftest.c @@ -506,6 +507,28 @@ else fi rm -f conftest conftest.c +# +# F7. For mcookie.c: is gettimeofday() available? +# +echo ' +#include +#include +main(int a, char **v){ + struct timeval tv; + struct timezone tz; + gettimeofday( &tv, &tz ); + exit(0); +} +' > conftest.c +eval $compile +if test -s conftest && ./conftest 2>/dev/null; then + echo "#define HAVE_gettimeofday" >> defines.h + echo "You have gettimeofday()" +else + echo "You don't have gettimeofday()" +fi +rm -f conftest conftest.c + # # 7. Does xgettext exist and take the option --foreign-user? diff -puN debian/bsdutils.postinst~CITI_NFS4_ALL debian/bsdutils.postinst --- util-linux-2.12/debian/bsdutils.postinst~CITI_NFS4_ALL 2004-12-13 17:42:04.000000000 -0500 +++ util-linux-2.12-bfields/debian/bsdutils.postinst 2004-12-13 17:42:08.000000000 -0500 @@ -0,0 +1 @@ +#!/bin/sh -e diff -puN debian/bsdutils.prerm~CITI_NFS4_ALL debian/bsdutils.prerm --- util-linux-2.12/debian/bsdutils.prerm~CITI_NFS4_ALL 2004-12-13 17:42:04.000000000 -0500 +++ util-linux-2.12-bfields/debian/bsdutils.prerm 2004-12-13 17:42:08.000000000 -0500 @@ -0,0 +1,5 @@ +#!/bin/sh -e + +if [ -L /usr/doc/bsdutils ] ; then + rm -f /usr/doc/bsdutils +fi diff -puN debian/changelog~CITI_NFS4_ALL debian/changelog --- util-linux-2.12/debian/changelog~CITI_NFS4_ALL 2004-12-13 17:42:04.000000000 -0500 +++ util-linux-2.12-bfields/debian/changelog 2004-12-13 17:42:08.000000000 -0500 @@ -0,0 +1,1240 @@ +util-linux (2.12.nfsv4-11) unstable; urgency=low + + * Remove redhat-specific mount warnings + + -- J. Bruce Fields Mon, 13 Dec 2004 12:41:37 -0500 + +util-linux (2.12.nfsv4-10) unstable; urgency=low + * Miscellaneous nfs mount fixes + * Add support for NFSv4 and krb5 + + -- J. Bruce Fields Tue, 12 Oct 2004 12:58:22 -0400 + +util-linux (2.12-10) unstable; urgency=low + + * The "SO WHY IS LETTING TWO PROCESSES OPEN THE SAME TTY FOR READ A + _GOOD_ THING" Release. + * Admit that the kernel API doesn't provide what we need, and turn the code + back off. Discussions will follow on how to deal with this post-sarge. + Closes: #272689, Reopens: #216658 + + -- LaMont Jones Thu, 23 Sep 2004 22:29:09 -0600 + +util-linux (2.12-9) unstable; urgency=high + + * The I-HATE-LINUX-TTY-HANDLING Release + * New and improved tty-in-use check, that actually works. Closes: #272689 + + -- LaMont Jones Wed, 22 Sep 2004 12:30:01 -0600 + +util-linux (2.12-8) unstable; urgency=high + + * Fix tty-in-use check. Many thanks to Samuel Thibault for tracking this + down and providing a patch. Closes: #226443 + + -- LaMont Jones Mon, 20 Sep 2004 08:53:42 -0600 + +util-linux (2.12-7) unstable; urgency=low + + * Have pri= only affect that entry in swapon -a. Closes: #214407 + * Mention the freshmeat site. Closes: #225605 + * fix disk sun label creation in fdisk. Closes: #228747 + * Use a more general form for uname. Closes: #231477 + * Provide fdisk-udeb for sparc. Closes: #228444 + * Cleanup vty code in getty. Closes: #224028, #224067, #226443, #229788 + * Changes from Javier Fernandez-Sanguino Pen~a + - Added amd64 architecture (Closes: #241855) + - Fixed manpage to avoid pointing to non existant files (Closes: #234875) + - Fixed Theodore Tso's address to the new one in dmesg (Closes: #222106) + - Modified cfdisk's es.po in order to not ask for an accented character + since it will not be shown in cfdisk and causes confusion amongst + users, this change could be reverted when upstream manages + 8-bit characters better (Closes: #210363, #204162) + - mkswap manpage now mentiones --sparece=never option to cp + (Closes: #184492) + - Added upstream maintainers to debian/copyright (Closes: #130858) + + -- LaMont Jones Fri, 6 Feb 2004 14:50:09 -0700 + +util-linux (2.12-6) unstable; urgency=low + + * Clean up FTBFS isses. Closes: #223149 + * Deal with hwclock.sh on s390x. Closes: #216567 + * Have getty check before opening a device. Closes: #216658 + + -- LaMont Jones Sat, 6 Dec 2003 18:42:20 -0700 + +util-linux (2.12-5) unstable; urgency=low + + * Fix compile error in get_blocks.c. Closes: #218894 + * Help out fdisk-udeb. Closes: #218920 + + -- LaMont Jones Mon, 3 Nov 2003 15:02:04 -0700 + +util-linux (2.12-4) unstable; urgency=low + + * Version the build-depends on slang1-utf8-dev to make life clearer for + woody backporters... Closes: #211974 + * Deliver pg. Closes: #217310 + + -- LaMont Jones Fri, 24 Oct 2003 19:54:10 -0600 + +util-linux (2.12-3) unstable; urgency=low + + * Re-add support for kerneli (if cryptoapi is there, we use it. If not, we assume + that -e refers to kerneli). Closes: #65068, #131044, #163639, #211534. + + -- LaMont Jones Fri, 19 Sep 2003 20:42:08 -0600 + +util-linux (2.12-2) unstable; urgency=low + + * release to unstable. Closes: #206396,#180353 + + -- LaMont Jones Tue, 16 Sep 2003 23:07:27 -0600 + +util-linux (2.12-1) experimental; urgency=low + + * Fix package priorities. + * Cleanup cryptoapi patch. (Really just needed the keybits patch.) + + -- LaMont Jones Sun, 14 Sep 2003 20:40:56 -0600 + +util-linux (2.12-0) experimental; urgency=low + + * New upstream release. + * cryptoapi patch (sort of) migrated forward, along with code inspired by + the patch in #206396. Still fighting with 2.4.22 crypto api, patches + welcome. + + -- LaMont Jones Sun, 14 Sep 2003 11:30:17 -0600 + +util-linux (2.11z-5) unstable; urgency=low + + * Fix mount -p (to make -p an accepted option), and add back in okeybits= + to make the natives happy. Closes: #131863, #197211, #157843 + * Merge in dependency change from -4.1, and cleanup the dirty diff that + brought. Closes: #200327, #205382, #206621 + * Was creating invalid swap files. Closes: #196149, #203528 + * Fix LSB failures in cal. Closes: #184885 + * Fix wall copyright, patch from Shaul Karl. Closes: #196850 + * Fix HURD patch. Closes: #198026 + * Include cramfs support. Closes: #207207 + * Fix configure bug. Closes: #207227 + * Create /etc/mtab mode 0600. Closes: #208860 + * Fix man page ref to rpc.nfsd(8). Closes: #165381 + + -- LaMont Jones Sat, 6 Sep 2003 16:43:20 -0600 + +util-linux (2.11z-4.1) unstable; urgency=low + + * Non-maintainer upload. + * Correct build-depend from slang1-dev to slang1-utf8-dev to get cfdisk in + fdisk-udeb to link with the same slang library as the other d-i modules. + Patch from Joe Nahmias. (Closes: #200327, #205382) + + -- Petter Reinholdtsen Fri, 5 Sep 2003 22:18:21 +0200 + +util-linux (2.11z-4) unstable; urgency=low + + * Put ddate back in, just to keep the natives quiet. + + -- LaMont Jones Wed, 21 May 2003 14:36:14 -0600 + +util-linux (2.11z-3) unstable; urgency=low + + * Fix bashism in postinst from hurd port. Closes: #194149 + * Drop ddate. Closes: #149321, #174459, #180737 + * Clean up messages in hwclock.sh. Closes: #167484 + * Some package description changes. Closes: #139953 + * properly install changelog. Closes: #148714 + * Fix hwclock man page reference to /usr/local/timezone. Closes: #149996 + + -- LaMont Jones Wed, 21 May 2003 07:47:41 -0600 + +util-linux (2.11z-2) unstable; urgency=low + + * add in hurd patch. Closes: #153410 + * Actually fixed in 2.11z-1 (or earlier)... Closes: #81531, #138215, #138388, #185430 + * Install line. Closes: #141498 + * Suggest dosfstools (home of mkfs.vfat). Closes: #175369 + + -- LaMont Jones Mon, 19 May 2003 21:17:22 -0600 + +util-linux (2.11z-1) unstable; urgency=low + + * New upstream version. Closes: #167967, #127086, #122288 + + -- LaMont Jones Fri, 21 Mar 2003 14:02:39 -0700 + +util-linux (2.11y-2) unstable; urgency=low + + * Fix sparc build. sigh. + + -- LaMont Jones Thu, 30 Jan 2003 01:00:28 -0700 + +util-linux (2.11y-1) unstable; urgency=low + + * New upstream version + * don't build fdisk on m68k. Closes: #170669 + * Honor HWCLOCKACCESS in hwcolockfirst.sh. Closes: #127972 + + -- LaMont Jones Fri, 3 Jan 2003 22:05:53 -0700 + +util-linux (2.11x-1) unstable; urgency=low + + * New upstream version. Closes: #163851 + * Include errno.h where needed. Closes: #168539 + + -- LaMont Jones Sun, 24 Nov 2002 12:12:23 -0700 + +util-linux (2.11u-2) unstable; urgency=low + + * Fix changelog. + + -- LaMont Jones Mon, 7 Oct 2002 09:42:22 -0600 + +util-linux (2.11u-1) unstable; urgency=low + + * New upstream release + * Incorporate udeb fix from Tollef Fog Heen. Closes: #156648 + * Build fdisk-udeb only where we built fdisk... Closes: #163461 + + -- LaMont Jones Sun, 6 Oct 2002 23:31:42 -0600 + +util-linux (2.11n-4.1) unstable; urgency=low + + * NMU with maintainer's permission + * Generate udeb with *fdisk in it. Closes: 156648 + + -- Tollef Fog Heen Sun, 22 Sep 2002 14:44:24 +0200 + +util-linux (2.11n-4) unstable; urgency=low + + * New maintainer. Closes: #130842 + * Fix Standards-Version. Closes: #97040 + * Loosen dependency of util-linux-locales to match upstream version. + + -- LaMont Jones Sat, 26 Jan 2002 11:21:41 -0700 + +util-linux (2.11n-3) unstable; urgency=low + + * Orphaned this package. + + -- Adrian Bunk Fri, 25 Jan 2002 14:36:06 +0100 + +util-linux (2.11n-2) unstable; urgency=high + + * Applied a patch to hwclock/cmos.c that should fix the + compilation on alpha. (closes: #123357) + + -- Adrian Bunk Tue, 11 Dec 2001 12:13:30 +0100 + +util-linux (2.11n-1) unstable; urgency=high + + * New upstream release. + - It's now possible to build pivot_root on all architectures. + - The confusing error message in mount is fixed. + (closes: #109483) + - minix v2 filesystems are now autodetected by mount. + (closes: #118092) + - tmpfs is now documented in mount (8). (closes: #120930) + - s/top/Top/g in ipc.texi. (closes: #117438) + + -- Adrian Bunk Mon, 10 Dec 2001 19:46:36 +0100 + +util-linux (2.11m-1) unstable; urgency=high + + * New upstream release. + The following bugs are fixed in this release: + - "setterm -foreground default" does work now. + (closes: #115447) + - "more" on empty files does no longer print junk on powerpc. + (closes: #114973) + - The entry in the expert menu the option to create a + SGI disklabel is now called + "create an IRIX (SGI) partition table". (closes: #110277) + * debian/rules: "raw" does now compile on m68k. + * Remove the special handling for PowerPC/PReP machines from + the postinst. (closes: #118367) + + -- Adrian Bunk Thu, 8 Nov 2001 22:46:55 +0100 + +util-linux (2.11l-4) unstable; urgency=high + + * Corrected the bug introduced in the last upload that did let + the installation of util-linux fail on powerpc. + (closes: 117393) + * s/"uname -m"/`uname -m`/ in the postinst of util-linux. + + -- Adrian Bunk Sun, 28 Oct 2001 20:11:11 +0100 + +util-linux (2.11l-3) unstable; urgency=low + + * Don't install debian/tmp/DEBIAN/conffiles on s390 (since + there's no longer a hwclock on s390). + + -- Adrian Bunk Tue, 23 Oct 2001 20:39:06 +0200 + +util-linux (2.11l-2) unstable; urgency=low + + * Don't install hwclock on s390. (closes: #115019) + * Make the warning in hwclockfirst.sh that occurs when the + timezone couldn't be determined more silent. + (closes: #116003) + + -- Adrian Bunk Sun, 21 Oct 2001 12:50:40 +0200 + +util-linux (2.11l-1) unstable; urgency=high + + * New upstream release that consists of bug fixes and several + security fixes. (closes: #112271) + - renice does no longer incorrectly report a priority of 20. + (closes: #37348) + - Upstream has included the "replay" script written by + Joey Hess . (closes: #68556) + * Added a hwclockfirst.sh script that runs before S20modutils. + (closes: #50572) + + -- Adrian Bunk Tue, 9 Oct 2001 02:15:34 +0200 + +util-linux (2.11h-1) unstable; urgency=high + + * New upstream release. + - This release contains some fixes in more (1). + (closes: #46590) + * Don't build pivot_root on ia64 (ia64 has broken kernel + headers). + + -- Adrian Bunk Fri, 27 Jul 2001 19:20:25 +0200 + +util-linux (2.11g-4) unstable; urgency=low + + * m68k doesn't has pivot_root, too. (closes: #103812) + + -- Adrian Bunk Mon, 9 Jul 2001 23:20:36 +0200 + +util-linux (2.11g-3) unstable; urgency=low + + * Don't build "raw" on m68k because it doesn't compile. + (closes: #103812) + + -- Adrian Bunk Sat, 7 Jul 2001 16:48:23 +0200 + +util-linux (2.11g-2) unstable; urgency=low + + * hwclock.sh does now check $HWCLOCKACCESS. (closes: #87187) + + -- Adrian Bunk Fri, 6 Jul 2001 19:35:04 +0200 + +util-linux (2.11g-1) unstable; urgency=low + + * New upstream release. + * fdisk does now know about the partition type of the + Linux/PA-RISC boot loader. (closes: #101853) + + -- Adrian Bunk Wed, 27 Jun 2001 18:56:34 +0200 + +util-linux (2.11f-1) unstable; urgency=low + + * New upstream release. Bugs fixed in this release: + - Fix for big endian architectures in disk-utils/raw.c. + (closes: #100462) + - Support for SuperH in mount. (closes: #99804) + - The alpha options in hwclock do now work as documented. + (closes: #84346) + - mount (8) does now mention that the quota utilities do use + the *quota options in /etc/fstab. (closes: #98485) + + -- Adrian Bunk Sun, 24 Jun 2001 22:11:23 +0200 + +util-linux (2.11d-1) unstable; urgency=low + + * New upstream release. This release contains fixes for the + following bugs: + - Different fix for the problems with the "user" option in + umount. (closes: #98129) + - Support x86 RTC on UltraSPARC III's. (closes: #91774) + - An error message in mount is now proper english. + (closes: #92198) + * Install more.help in /usr/share/util-linux. (closes: #96375) + * Updated README.Debian.hwclock.gz. (closes: #76618) + + -- Adrian Bunk Thu, 24 May 2001 10:57:43 +0200 + +util-linux (2.11b-6) unstable; urgency=low + + * Corrected the "charset" in po/nl.po . + * Standards-Version: 526.7.8.9.13-Foo.6 + + -- Adrian Bunk Wed, 9 May 2001 15:54:51 +0200 + +util-linux (2.11b-5) unstable; urgency=low + + * Made util-linux-locales binary-all. + + -- Adrian Bunk Thu, 26 Apr 2001 23:57:45 +0200 + +util-linux (2.11b-4) unstable; urgency=low + + * Applied a fdisk patch for hppa and added hppa to fdisk_arch in + debian/rules. (closes: #92912) + + -- Adrian Bunk Sun, 15 Apr 2001 03:01:40 +0200 + +util-linux (2.11b-3) unstable; urgency=high + + * Fixed the bug in umount that did let a user umount a file system + mounted by root when the "user" option is set in /etc/fstab. + (closes: #44749) + * Corrected a build error on powerpc in debian/rules. + * Corrected in util-linux-locales: + Section : base -> utils + Priority: required -> optional + * Added the crypto patch again. (closes: #36939) + Fixed in the new crypto patch: + - It's now the complete crypto patch. (closes: #55435) + - "losetup" no longer lists the available ciphers. + (closes: #61425) + - It already includes the patch from #68804. (closes: #68804) + * Added blockdev to util-linux. (closes: #61488) + + -- Adrian Bunk Thu, 12 Apr 2001 19:41:14 +0200 + +util-linux (2.11b-2) unstable; urgency=low + + * Include pivot_root in util-linux. (closes: #91215) + * Added a lintian override for mount and umount. + + -- Adrian Bunk Sun, 25 Mar 2001 20:16:39 +0200 + +util-linux (2.11b-1) unstable; urgency=high + + * New upstream release. This release fixes the following bugs: + - the problem with extended partitions when using the "o" command + in fdisk is fixed (closes: #45827) + - adfs options are now documentated in mount (8) (closes: #79181) + - missing .TP in mount (8) was added (closes: #56230) + * The locales are now in a seperate util-linux-locales package that + is not essential. (closes: #62651) + * util-linux "Suggests: kbd | console-tools" to help people to + find where "kbdrate" is. + * Added support for devfs in rdev. (closes: #74962) + * Include the "raw" program in util-linux. (closes: #85695) + * Include fdformat again. (closes: #81362) + * Moved the "install-info" call from the postrm to the prerm. + (closes: #90883) + * Install "HOSTORY" as "changelog.gz" in all packages. + * Removed the "swapdev" link to "rdev". Upstream says about swapdev: + Nevertheless, all this is ancient junk. I just checked swapdev + and found that it was last used in kernel 0.12 but that swapdev + (or rdev -s) has not done anything in any kernel later than 0.12. + + -- Adrian Bunk Fri, 23 Mar 2001 15:50:23 +0100 + +util-linux (2.11a-2) unstable; urgency=low + + * Corrected the location of the examples in getopt (1). + (closes: #63036) + * Added the missing build dependency on gettext. + * Added mips, mipsel and ia64 to fdisk_arch in debian/rules. + + -- Adrian Bunk Mon, 12 Mar 2001 23:10:03 +0100 + +util-linux (2.11a-1) unstable; urgency=low + + * New upstream release. + * This release contains a fix for an overrun sprintf in mount. + (closes: #85739) + * A message of cfdisk is less confusing in this release. + (closes: #76664) + * Don't include a group writable /usr/share/locale/da . + + -- Adrian Bunk Sat, 10 Mar 2001 01:41:51 +0100 + +util-linux (2.11-1) unstable; urgency=low + + * New upstream release. + * Upstream removed "kbdrate" from util-linux (it's now in the + packages kbd and console-tools). + Let util-linux conflict with kbd (<< 1.05-3) and + console-tools (<< 1:0.2.3-21) to avoid that a user of these + packages has a system without "kbdrate". + + -- Adrian Bunk Fri, 9 Mar 2001 19:40:53 +0100 + +util-linux (2.10s-2) unstable; urgency=low + + * New maintainer. (closes: #86872) + + -- Adrian Bunk Wed, 21 Feb 2001 18:21:03 +0100 + +util-linux (2.10s-1) unstable; urgency=low + + * New upstream release, Closes: #85492 + * login-utils/wall now checks whether the devices has a colon in it and skips + it if it does. This prevents wall from trying to send to X connectiosn. + Closes: #34217 + * added joeyh's script patch for handling SIGWINCH, Closes: #42497 + * debian has long been modifying the man page to point at proper file + locations, these two bugs were merged with two other bugs that are actually + bugs in docs v. reality and so were not getting closed. unmerged and are + now being closed. Closes: #55500. + * DEB_HOST_ARCH is set if not run from within dpkg-buildpackage, + Closes: #71978 + * devfs code now in the upstream, Closes: #72241 + * upstream fixed the wrong NAME, Closes: #79794 + * umount knows that mips does not support umount2, Closes: #80386 + * removed calls to suidregister + * orphaning package + + -- Sean 'Shaleh' Perry Mon, 12 Feb 2001 14:43:32 -0800 + +util-linux (2.10q-1) unstable; urgency=low + + * New upstream release + * New maintainer (possibly temporarily) + * I left out the alpha fdisk patch and the crypto patch. Debian needs to + line up with the upstream. If there is demand, will see what I can do. + Closes: #77259, #69717 + * has patch for autofs from #31251, Closes: #31251 + * loop mounts leaking seems to have been fixed long ago, Closes: #37063 + * nfs(5) updated to mention (no)lock option, Closes: #50300 + * umount sigsegv'ing when user lacks permisions seems to have been fixed + long ago, Closes: #54757 + * FHS transition started in last upload forgot to, Closes: #61287, #66322 + * umount -f is now documented and tries to be functional, Closes: #62625 + * for all of those "please update this package" bugs, Closes: #64927, #64416 + * umount -f seems to work now, I believe it was a kernel issue, Closes: #70484 + * bsdutils description cleaned, no longer refers to missing binaries, + Closes: #63617 + * Patch rejected by upstream, Closes: #25832 + * problems with alpha and bsd partitions believed fixed in 2.9w, + Closes: #34572 + * /dev/vcsa patch accepted, Closes: #54204 + * msglevel fixed by upstream, Closes: #54213 + * update-mime call seems to have been fixed in previous release, + Closes: #55140 + * looks like user error, Closes: #57757, #58833, #70651 + * does not look valid any more, Closes: #64226, #67815, #60197 + * LVM supported in current release, Closes: #67297 + * forgot to Closes: #69442, when I put elvtune's manpage where it belongs + * prerm typo, oops, Closes: #77300 + * fdformat is just a wrapper, no more confusing messages, + Closes: #52364, #53037 + * hwclock.sh supports a BADYEAR argument from etc/default/rcS. + * no longer include example.files, they do not readily apply to debian + Closes: #59711 + + -- Sean 'Shaleh' Perry Thu, 16 Nov 2000 14:25:50 -0800 + +util-linux (2.10p-1.0) unstable; urgency=low + + * New upstream release + * NMU with maintainer's permission + * added Build-Depends, Closes: #75713 + * upstream added the patch from #36340, so Closes: #36340 + * upstream put '--More--' back to reverse video, Closes: #55165 + * hwclock man page points at /usr/share/zoneinfo, not usr/lib + * all created packages' postints now sets usr/doc/ symlink, its prerm removes + said link + * copyright file now points to usr/share/common-licenses and the typo in the + URL was fixed (it is misc, not Misc) + * update hwclock.sh to reflect FHS changes + * debian/rules file brought up to date for FHS + * elvtune man page put with the binary + * The above changes allow Closes: #69698 + * edited fr.po, fixed "Nombre de partitions" to "Numéro de partition", + Closes: #71743 + * whereis knows that /usr/share/man/* is valid, Closes: #72097 + * debian/rules now sets SHELL to bash, so it can use bashisms, Closes: #74095 + * upstream HISTORY file included as changelog.gz, Closes: #63175 + * removed /etc/fdprm, Closes: #62955 + * made fdformat a sh script instead of a bash script (the bash was unneeded) + + -- Sean 'Shaleh' Perry Thu, 9 Nov 2000 17:55:10 -0800 + +util-linux (2.10o-1) unstable; urgency=low + + * New upstream code. Add elvtune. + closes: #69166: util-linux package not complete. + + -- Vincent Renardias Thu, 17 Aug 2000 18:17:34 +0200 + +util-linux (2.10n-1) unstable; urgency=low + + * New upstream code. + closes: #68976 util-linux needs new upstream version. + closes: #64536 util-linux: [PATCH] mkswap refuses to create big swap partitions. + closes: #63747 Option parsing bug of 'mkswap' command Debian Package util-linux. + closes: #62935 mkswap BUG of option parsing in Debian Package util-linux. + closes: #59264 util-linux: mkswap: erroneous option parsing, documentation outdated. + closes: #64079 util-linux: mkswap's -v[01] option is broken. + + -- Vincent Renardias Sun, 13 Aug 2000 00:54:51 +0200 + +util-linux (2.10f-5.1) frozen unstable; urgency=low + + * Non-Maintainer Upload + * Patch from Ben Collins to fix the -v[01] option in mkswap + (closes: #64079) + * Patch from Chris Butler to fix hwclock's handling of RTC + (closes: #62688) + * Change to line 879 of fdiskbsdlabel.c to allow building on sparc + (patch sent to maintainer) + + -- Stephen R. Gore Sun, 25 Jun 2000 22:18:47 +0500 + +util-linux (2.10f-5) frozen unstable; urgency=low + + * Patch from David Huggins-Daines + which is required to get a working fdisk on alpha. + + -- Vincent Renardias Mon, 1 May 2000 22:40:17 +0200 + +util-linux (2.10f-4) unstable; urgency=low + + * Patch for mips support from Florian Lohoff . + closes: #62247: patch for mips/mipsel and bsddisklabel. + + -- Vincent Renardias Wed, 12 Apr 2000 17:26:24 +0200 + +util-linux (2.10f-3) frozen unstable; urgency=low + + * included patch from David Huggins-Daines so + that fdisk behaves correctly with OSF/1 disklabels. + closes: #59385: Fixes for BSD disklabel support (for Alpha) + (Important bug) + + -- Vincent Renardias Thu, 2 Mar 2000 13:21:40 +0100 + +util-linux (2.10f-2) frozen unstable; urgency=low + + * Now that 2.10f-1 has been tested in unstable, re-upload it to frozen. + closes: #54252: cfdisk fails to detect DAC960 partitions. (CRITICAL) + + -- Vincent Renardias Sat, 5 Feb 2000 19:05:29 +0100 + +util-linux (2.10f-1) unstable; urgency=low + + * New upstream release: + * Security fix for mount (okir) + * Avoid infinite loop in namei (Brett Wuth) + closes: #56761: namei segment faults on circular links. + * added clock-ppc.c (from Matsuura Takanori), not merged yet + * deleted clockB subdirectory + * recognize mkdosfs string (Michal Svec) + * New: rename + * Added option to mkswap so that user can override pagesize + * fdisk -l now reads /proc/partitions when no device was given + closes: #55614: util-linux: 'fdisk -l' no longer works?. + * Fixed fdisk.8 (James Manning) + * Added devpts info to mount.8 (Elrond) + * Newline fix for logger output to stdout (Henri Spencer) + + -- Vincent Renardias Thu, 3 Feb 2000 14:19:33 +0100 + +util-linux (2.10d-7) frozen unstable; urgency=low + + * There is no real concensus about what we should do about the + hwclock issue. Now at least the problem is enough documented + to let the user decide. (Thanks to Henrique M Holschuh + for the patch). + When this package is installed, I'll examine one by one which BR can + be closed. + + -- Vincent Renardias Mon, 31 Jan 2000 14:34:03 +0100 + +util-linux (2.10d-6) frozen unstable; urgency=low + + * kbdrate isn't suid anymore. + closes: #54978: ordinary user can change keyboard repeat vor all users. + + -- Vincent Renardias Fri, 28 Jan 2000 16:52:27 +0100 + +util-linux (2.10d-5) unstable; urgency=low + + * Included patch from "J.H.M. Dassen (Ray)" : + - Restored enhanced losetup(8) manpage. + - Restored encrypted filesystem support, by applying util-linux-2.9w from + patch-int-2.2.13.3.gz as found on ftp.kerneli.org (modified to work with + Debian's kernel-patch-int's crypto.h). + (closes: #54657) + * Recompiled with ncurses5. + + -- Vincent Renardias Wed, 12 Jan 2000 12:24:12 +0100 + +util-linux (2.10d-4) unstable; urgency=low + + * ipcrm now accepts multiple ids thanks to a patch from Topi Miettinen. + closes: #15110: ipcrm doesn't work with xargs. + * fix postinst script: + closes: #53254: util-linux: ppc chunk of postinst script has syntactical error. + + -- Vincent Renardias Wed, 22 Dec 1999 17:24:46 +0100 + +util-linux (2.10d-3) unstable; urgency=low + + * Disabled 'hwclock --adjust' on boot. + closes: #37657: util-linux: hwclock --systohc dangerous. + closes: #40283: util-linux: hwclock --systohc dangerous. + closes: #41263: hwclock --adjust doesn't work (temporary fix included). + closes: #51805: /etc/adjtime. + closes: #35432: "/etc/init.d/hwclock.sh" possible bug. + closes: #43228: Clock taking advance in potato. + + -- Vincent Renardias Mon, 20 Dec 1999 13:55:21 +0100 + +util-linux (2.10d-2) unstable; urgency=low + + * cfdisk must be build with slang; not ncurses. + closes: #52559: cfdisk linked against libncurses instead of slang. + + -- Vincent Renardias Fri, 10 Dec 1999 11:21:36 +0100 + +util-linux (2.10d-1) unstable; urgency=low + + * New upstream release. + closes: #52151: mount: mount/umount infinite loop on stale lockfiles. + * Put renice manpage in section 1 instead of 8. + closes: #52370: bsdutils: wrong section for renice manpage. + * kbdrate's PAM now uses pam_unix.so by default. + closes: #51273: util-linux: uses pam_pwdb for kbdrate. + * already fixed in 2.10-5: + closes: #49823: name conflict. + + -- Vincent Renardias Fri, 10 Dec 1999 11:21:36 +0100 + +util-linux (2.10-6) unstable; urgency=low + + * Patch by Topi Miettinen to a longstanding + bug in logger. closes: #19666. + + -- Vincent Renardias Mon, 6 Dec 1999 11:49:10 +0100 + +util-linux (2.10-5) unstable; urgency=low + + * replace fdformat by a notice asking to use superformat instead. + * remove setfdprm; closes: #44941. + + -- Vincent Renardias Mon, 6 Dec 1999 11:49:10 +0100 + +util-linux (2.10-4) unstable; urgency=low + + * conflict/replace with fdisk on sparc. + closes: #50254: please conflict and replace fdisk on sparc. + + -- Vincent Renardias Mon, 15 Nov 1999 17:28:00 +0100 + +util-linux (2.10-3) unstable; urgency=low + + * re-introduce missing c?fdisk... (oops ;) + closes: #49406, #49457, #49337, #49313, #46732. + + -- Vincent Renardias Mon, 8 Nov 1999 13:01:12 +0100 + +util-linux (2.10-2) unstable; urgency=low + + * Do TheRightThing(tm) for bug #47219. + * from NMU prepared by Torsten Landschoff : + * Fixed case expression in hwclock.sh + (closes: #42431, #42435, #42856). + * Added usage information to hwclock (closes: #23184). + * Upstream has long changed mount.c to handle nouser properly + (closes: #24954, #24956). + * Excluded clock.8 link from powerpc build (closes: #46010). + * Replaced "$(shell dpkg --print-architecture)" with + "$DEB_HOST_ARCH" in debian/rules. + + -- Vincent Renardias Thu, 4 Nov 1999 10:53:37 +0100 + +util-linux (2.10-1) unstable; urgency=low + + * New upstream release. + * make /etc/rc{0,6}.d/*hwclock.sh correctly. + closes: #47111: util-linux: hwclock.sh: wrong names on rc*.d links. + closes: #47373: hwclock.sh links are wrong. + * Correct kdbrate pam entry. + closes: #45674: kbdrate PAM config references missing pam_console.so. + * Fix fdiskdsblabel.h. + closes: #47219: util-linux: errors compiling on sparc. + * Use jgg's patch for hwclock.sh + closes: #43793: Support for both GMT and UTC default/rc.S setting is wrong. + * Really link kbdrate with pam. + closes: #48425: pam support for kbdrate useless. + + -- Vincent Renardias Wed, 3 Nov 1999 11:41:44 +0100 + +util-linux (2.9x-1) unstable; urgency=low + + * New upstream release. + closes: #32916: hwclock freezes m68k system. + closes: #44986: util-linux: PAM support for kbdrate. + closes: #44821: util-linux: pam.d entry contains a path. + closes: #44727: util-linux: sfdisk examples are present twice in the package. + closes: #45565: removed /bin/kill. this is now provided by procps. + closes: #36332: problems with our /bin/kill. + closes: #41171: wall should be sgid tty, not root. + + -- Vincent Renardias Tue, 21 Sep 1999 17:54:47 +0200 + +util-linux (2.9w-3) unstable; urgency=low + + * Include PowerPC patch from Matt Porter . + * Should be 100% PAMified(tm). Please report anomalies. + + -- Vincent Renardias Tue, 7 Sep 1999 18:53:37 +0200 + +util-linux (2.9w-2) unstable; urgency=low + + * updated losetup.8 from "J.H.M. Dassen (Ray)" . + + -- Vincent Renardias Tue, 24 Aug 1999 17:44:06 +0200 + +util-linux (2.9w-1) unstable; urgency=low + + * Upstream upgrade: + util-linux 2.9w: + * Updated mount.8 (Yann Droneaud) + * Improved makefiles + * Fixed flaw in fdisk + util-linux 2.9v: + * cfdisk no longer believes the kernel's HDGETGEO + (and may be able to partition a 2 TB disk) + util-linux 2.9u: + * Czech more.help and messages (Jiří Pavlovský) + * Japanese messages (Daisuke Yamashita) + * fdisk fix (Klaus G. Wagner) + * mount fix (Hirokazu Takahashi) + * agetty: enable hardware flow control (Thorsten Kranzkowski) + * minor cfdisk improvements + * fdisk no longer accepts a default device + * Makefile fix + * now uses the script(1) supplied with util-linux instead + of the one from the old bsdutils package. + * remove alpha specific build patch: + closes: #41256. + * remove useless warning in preinst. + + -- Vincent Renardias Tue, 24 Aug 1999 17:44:06 +0200 + +util-linux (2.9t-3) unstable; urgency=low + + * include missing fdformat, setfdprm. (How comes nobody noticed yet?!) + * recompile against slang1-dev 1.2.2-3. + + -- Vincent Renardias Tue, 24 Aug 1999 09:23:59 +0200 + +util-linux (2.9t-2) unstable; urgency=low + + * correct hwclock.sh; + closes: #35429 sysvinit: bad comments in /etc/defaults/rcS. + + -- Vincent Renardias Wed, 28 Jul 1999 18:43:05 +0200 + +util-linux (2.9t-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Applied util-linux-2.9s.patch from patch-int-2.2.10.4.gz as found on + ftp.kerneli.org to enable support for mounting encrypted filesystems + through the loopback devices when using an international kernel. + (Fixes: Bug#36939, #38371) + * Include and in the source, so as not to + rely on source outside main. + * Updated the losetup(8) manpage. + + -- J.H.M. Dassen (Ray) Thu, 22 Jul 1999 18:32:16 +0200 + +util-linux (2.9t-1) unstable; urgency=low + + * Upstream upgrade: + * national language support for hwclock + * Japanese messages (both by Daisuke Yamashita) + * German messages and some misc i18n fixes (Elrond) + * Czech messages (Jiří Pavlovský) + * wall fixed for /dev/pts/xx ttys + * make last and wall use getutent() (Sascha Schumann) + [Maybe this is bad: last reading all of wtmp may be too slow. + Revert in case people complain.] + * documented UUID= and LABEL= in fstab.5 + * added some partition types + * swapon: warn only if verbose + closes: #37008: de.po file integrated upstream. + closes: #37380: it.po file integrated upstream. + closes: #38232: patch integrated upstream. + closes: #36124: examples included. + closes: #36848, #37153, #38101, #38416: pts bug fixed upstream. + closes: #40868: use suidregister /usr/bin/wall. + closes: #34728: patch integrated upstream. + closes: #38219: typo. fixed; patch sent upstream. + closes: #37585: bug corrected upstream. + closes: #37002: CRLF fstab isn't a problem anymore. + * changed hwclock.sh to get rid of a lintian error. + + -- Vincent Renardias Fri, 9 Jul 1999 16:15:01 +0200 + +util-linux (2.9r-3) unstable; urgency=low + + * Added missing *.gmo files + * Re-add Harmut's powerpc patch that somehow got left out (closes: #37973). + + -- Vincent Renardias Wed, 19 May 1999 12:45:09 +0200 + +util-linux (2.9r-2) unstable; urgency=low + + * Fix stupid bug #37916. + + -- Vincent Renardias Tue, 18 May 1999 15:51:08 +0200 + +util-linux (2.9r-1) unstable; urgency=low + + * Upstream upgrade. + * Now compiled with PAM=yes. + * initial .it localisation. + * Improved .fr translation. + * corrected hwclock.sh (reassigned #35429 back to sysvinit). + * put rev into /usr/bin instead of /usr/sbin (Fix #34188,#35421). + * include getopt examples (Fix #34705). + + -- Vincent Renardias Fri, 14 May 1999 16:21:44 +0200 + +util-linux (2.9i-1) unstable; urgency=low + + * Upstream upgrade. + * This source package now also provides the 'bsdutils' binary + package. + * Included patch for logger.1 from and1000@debian.org. + * Included patch to logger.c from Joey (closes: #32109). + * renice.c: include (closes: #31288). + * re-use script(1) from the 'old' bsdutils package as well + as README.script (closes: #988). + * Now umount is compiled with '-f' support (closes: #33147). + * Re-add suidregister support for mount (closes: #32495). + + -- Vincent Renardias Sun, 21 Feb 1999 20:16:20 +0100 + +util-linux (2.9g-6) frozen unstable; urgency=low + + * modify mount.8 manpage to warn that nosuid is useless + if something like suidperl is installed. + (doesn't fix the critical bug #31980 reported on suidperl, + but at least warn about its existance) + * add missing manpages (ramsize,rootflags,swapdev) + * #32414: changed a 'rm' into 'rm -f' so the source + package builds cleanly. + * also target the upload for frozen since this is the only missing + package to be able to safely use kernels 2.2.x: + To the FTP/Release maintainers: + util-linux_2.9g has been introduced in unstable on Dec, 31st 98; + so far I received no bug reports about it except for the missing + manpages. Also compared to the 2.7.1 version from frozen, this + package fixes _57_ bugs. (see www.debian.org/Bugs/db/pa/lutil-linux.html) + + -- Vincent Renardias Tue, 26 Jan 1999 23:51:57 +0100 + +util-linux (2.9g-5) unstable; urgency=low + + * Fix bug #31981. + * Localised cfdisk + provided initial French translation. + New translations welcome; you can get the potfile at + http://www.ldsol.com/~vincent/util-linux.pot + + -- Vincent Renardias Sat, 23 Jan 1999 21:55:06 +0100 + +util-linux (2.9g-4) unstable; urgency=low + + * Add rev and readprofile commands. + * Updated fstab.5 regarding spaces in mount points names. + * Fix bugs #32235,#31997 (missing hwclock.8 manpage). + * Fix bug #32097 (missing mkswap.8 manpage). + * Improve somewhat cfdisk regarding exit codes thanks to + Enrique's patch (#31607). + + -- Vincent Renardias Fri, 22 Jan 1999 19:13:25 +0100 + +util-linux (2.9g-3) unstable; urgency=low + + * Include patch from Hartmut Koptein for better powerpc support. + + -- Vincent Renardias Wed, 13 Jan 1999 22:46:04 +0100 + +util-linux (2.9g-2) unstable; urgency=high + + * Patch from Topi Miettinen (Thanks Topi ;) to fix + bug #31554,#31573. + + -- Vincent Renardias Mon, 11 Jan 1999 03:59:19 +0100 + +util-linux (2.9g-1) unstable; urgency=high + + * Adopting the package from Guy Maor. + * Re-add hwclock & kbdrate which had been lost + (Fix bug #31476). + + -- Vincent Renardias Fri, 1 Jan 1999 19:53:33 +0100 + +util-linux (2.9g-0.3) unstable; urgency=high + + * YA NMU. + * Split mount out into separate package so as not to + force the dangerous replacement of an essential package. + + -- Joel Klecker Sun, 3 Jan 1999 19:00:31 -0800 + +util-linux (2.9g-0.2) unstable; urgency=low + + * NMU (Part II): Fix more problems in 'mount'. + * swapon now warn if swap device has insecure mode; + Patch from Topi Miettinen + (Fix bug #23249). + * mount can now handle multiple hostnames for NFS mounts + in fstab (Fix bug #29309). + * Do'h; add missing /sbin/swapoff ;). + + -- Vincent Renardias Fri, 1 Jan 1999 19:53:33 +0100 + +util-linux (2.9g-0.1) unstable; urgency=low + + * NMU. + * This package now provides /bin/mount & co. and thus + obsoletes the mount package. + * provides the ddate command (Fix bugs #30015 & #19820). + * Move wtmp lockfile from /etc to /var/lock + (Fix bug #29128). + * Set bug #28885 to 'fixed' (this-is-not-a-bug,-but-a-feature(tm)). + * Set bug #27931 to 'fixed' (works again since version 2.8). + * Set bug #27723 to 'fixed' (been fixed by the ARM NMU). + * Set bug #25831 to 'fixed' (hwclock now works as advertised). + * Set buffering off on the output channel in chkdupexe.pl + (Fix bug #22839). + * Include patch for powerpc build by Joel Klecker + (Fix bug #21374). + * Removed the confusing references to agetty (Fix bug #20668). + * Check the result for the malloc()s added in the code to chown + vcsa to root.sys (Fix bug #18696). + * Include patch for sparc build by + Eric Delaunay (Fix bug #17784). + * Set bug #17752 to 'fixed' (Appear to work with current versions + of xvt and /bin/more). + * Include patch for alpha build by + Christopher C Chimelis + (Fix bug #17661). + * Patch mkfs.minix doesn't go into infinate loop any more depending + on the argument passed to -i (Fix bug #17648). + * Set bug #17483 to 'fixed' (now that util-linux is compiled with + libc6 > =2.0.6 it should be fixed). + * Set bug #26625 to 'fixed' (this patch has already been applied). + * Applied patch from Bcwhite to get mime support + (Fix bug #26715). + * Applied patch from Topi Miettinen : + POSIX etc fixes: + - ioctl(.., TCSETSF,..) -> tcsetattr() + - ioctl(.., TCGETS,..) -> tcgetattr() + - ioctl(.., TIOCGPGRP,..) -> tcgetpgprp() + - gcc -Wall warning fixes + - write(2, ..) -> write(fileno(stderr), ..) + - vi -> sensible-editor + - added setlocale(LC_ALL, "") + - use perror, isdigit, isprint, iscntrl where applicable + - execv -> execvp + - added simple ELF detection + OpenBSD fixes: + - UCB fix + - POSIX: rindex -> strrchr + - obsolete fseek flag L_SET -> SEEK_SET + - control-F == f + - $EDITOR support + (Fix bug #27635). + * Link clock.8.gz to hwclock.8.gz (Fix bug #25852). + + -- Vincent Renardias Thu, 31 Dec 1998 23:48:42 +0100 + +util-linux (2.9e-0.4) unstable; urgency=high + + * Non-maintainer upload. + * Recompiled with slang1. + + -- James Troup Sat, 19 Dec 1998 20:42:52 +0000 + +util-linux (2.9e-0.3) unstable; urgency=low + + * Non-maintainer upload + * Include /etc/init.d/hwclock.sh + * Fix some of the (pre|post)(inst|rm) script wrt $1 processing + Fixes: + #18007: sysvinit: hwclock.sh uses GMT env variable - but how? + #26904: hwclock.sh doe