blob: 628772b1bdd6b233e5a31675a22191a7eead7878 [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersen1c43d0c1999-11-18 07:58:07 +00002/*
3 * nfsmount.c -- Linux NFS mount
4 * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * Wed Feb 8 12:51:48 1995, biro@yggdrasil.com (Ross Biro): allow all port
17 * numbers to be specified on the command line.
18 *
19 * Fri, 8 Mar 1996 18:01:39, Swen Thuemmler <swen@uni-paderborn.de>:
20 * Omit the call to connect() for Linux version 1.3.11 or later.
21 *
22 * Wed Oct 1 23:55:28 1997: Dick Streefland <dick_streefland@tasking.com>
23 * Implemented the "bg", "fg" and "retry" mount options for NFS.
24 *
25 * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
26 * - added Native Language Support
27 *
Eric Andersenda1d1e72000-07-10 23:39:44 +000028 * Modified by Olaf Kirch and Trond Myklebust for new NFS code,
29 * plus NFSv3 stuff.
Eric Andersen1c43d0c1999-11-18 07:58:07 +000030 */
31
32/*
33 * nfsmount.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
34 */
35
Eric Andersene7413a92000-07-14 06:19:41 +000036#include "internal.h"
37#undef FALSE
38#undef TRUE
Eric Andersen1c43d0c1999-11-18 07:58:07 +000039#include <unistd.h>
40#include <stdio.h>
41#include <string.h>
42#include <errno.h>
43#include <netdb.h>
44#include <rpc/rpc.h>
45#include <rpc/pmap_prot.h>
46#include <rpc/pmap_clnt.h>
47#include <sys/socket.h>
48#include <sys/time.h>
49#include <sys/utsname.h>
Eric Andersen1c43d0c1999-11-18 07:58:07 +000050#include <netinet/in.h>
51#include <arpa/inet.h>
52
53#include "nfsmount.h"
Eric Andersenda1d1e72000-07-10 23:39:44 +000054#include <linux/nfs.h> /* For the kernels nfs stuff */
Eric Andersen1c43d0c1999-11-18 07:58:07 +000055
Eric Andersen1c43d0c1999-11-18 07:58:07 +000056
Eric Andersenda1d1e72000-07-10 23:39:44 +000057/* Disable the nls stuff */
58# undef bindtextdomain
59# define bindtextdomain(Domain, Directory) /* empty */
60# undef textdomain
61# define textdomain(Domain) /* empty */
62# define _(Text) (Text)
63# define N_(Text) (Text)
64
65#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */
66#define MS_RDONLY 1 /* Mount read-only */
67#define MS_NOSUID 2 /* Ignore suid and sgid bits */
68#define MS_NODEV 4 /* Disallow access to device special files */
69#define MS_NOEXEC 8 /* Disallow program execution */
70#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
71#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
72#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
73#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */
74#define S_APPEND 256 /* Append-only file */
75#define S_IMMUTABLE 512 /* Immutable file */
76#define MS_NOATIME 1024 /* Do not update access times. */
77#define MS_NODIRATIME 2048 /* Do not update directory access times */
78
79
80/*
81 * We want to be able to compile mount on old kernels in such a way
82 * that the binary will work well on more recent kernels.
83 * Thus, if necessary we teach nfsmount.c the structure of new fields
84 * that will come later.
85 *
86 * Moreover, the new kernel includes conflict with glibc includes
87 * so it is easiest to ignore the kernel altogether (at compile time).
88 */
89
90#define NFS_MOUNT_VERSION 4
91
92struct nfs2_fh {
93 char data[32];
94};
95struct nfs3_fh {
96 unsigned short size;
97 unsigned char data[64];
98};
99
100struct nfs_mount_data {
101 int version; /* 1 */
102 int fd; /* 1 */
103 struct nfs2_fh old_root; /* 1 */
104 int flags; /* 1 */
105 int rsize; /* 1 */
106 int wsize; /* 1 */
107 int timeo; /* 1 */
108 int retrans; /* 1 */
109 int acregmin; /* 1 */
110 int acregmax; /* 1 */
111 int acdirmin; /* 1 */
112 int acdirmax; /* 1 */
113 struct sockaddr_in addr; /* 1 */
114 char hostname[256]; /* 1 */
115 int namlen; /* 2 */
116 unsigned int bsize; /* 3 */
117 struct nfs3_fh root; /* 4 */
118};
119
120/* bits in the flags field */
121
122#define NFS_MOUNT_SOFT 0x0001 /* 1 */
123#define NFS_MOUNT_INTR 0x0002 /* 1 */
124#define NFS_MOUNT_SECURE 0x0004 /* 1 */
125#define NFS_MOUNT_POSIX 0x0008 /* 1 */
126#define NFS_MOUNT_NOCTO 0x0010 /* 1 */
127#define NFS_MOUNT_NOAC 0x0020 /* 1 */
128#define NFS_MOUNT_TCP 0x0040 /* 2 */
129#define NFS_MOUNT_VER3 0x0080 /* 3 */
130#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */
131#define NFS_MOUNT_NONLM 0x0200 /* 3 */
132
133
134#define UTIL_LINUX_VERSION "2.10m"
135#define util_linux_version "util-linux-2.10m"
136
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000137#define HAVE_inet_aton
Eric Andersenda1d1e72000-07-10 23:39:44 +0000138#define HAVE_scsi_h
139#define HAVE_blkpg_h
140#define HAVE_kd_h
141#define HAVE_termcap
142#define HAVE_locale_h
143#define HAVE_libintl_h
144#define ENABLE_NLS
145#define HAVE_langinfo_h
146#define HAVE_progname
147#define HAVE_openpty
148#define HAVE_nanosleep
149#define HAVE_personality
150#define HAVE_tm_gmtoff
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000151
Eric Andersenda1d1e72000-07-10 23:39:44 +0000152extern char *xstrdup (const char *s);
153extern char *xstrndup (const char *s, int n);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000154static char *nfs_strerror(int stat);
155
156#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000157#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000158
Eric Andersenda1d1e72000-07-10 23:39:44 +0000159#define EX_FAIL 32 /* mount failure */
160#define EX_BG 256 /* retry in background (internal only) */
161
162
163static int
164linux_version_code(void) {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000165 struct utsname my_utsname;
166 int p, q, r;
167
168 if (uname(&my_utsname) == 0) {
169 p = atoi(strtok(my_utsname.release, "."));
170 q = atoi(strtok(NULL, "."));
171 r = atoi(strtok(NULL, "."));
Eric Andersenda1d1e72000-07-10 23:39:44 +0000172 return MAKE_VERSION(p,q,r);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000173 }
174 return 0;
175}
176
177/*
Eric Andersenda1d1e72000-07-10 23:39:44 +0000178 * nfs_mount_version according to the sources seen at compile time.
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000179 */
Eric Andersenda1d1e72000-07-10 23:39:44 +0000180int nfs_mount_version = NFS_MOUNT_VERSION;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000181
182/*
183 * Unfortunately, the kernel prints annoying console messages
184 * in case of an unexpected nfs mount version (instead of
185 * just returning some error). Therefore we'll have to try
186 * and figure out what version the kernel expects.
187 *
188 * Variables:
189 * KERNEL_NFS_MOUNT_VERSION: kernel sources at compile time
190 * NFS_MOUNT_VERSION: these nfsmount sources at compile time
191 * nfs_mount_version: version this source and running kernel can handle
192 */
Eric Andersenda1d1e72000-07-10 23:39:44 +0000193static void
194find_kernel_nfs_mount_version(void) {
195 static int kernel_version = 0;
196
197 if (kernel_version)
198 return;
199
200 kernel_version = linux_version_code();
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000201
202 if (kernel_version) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000203 if (kernel_version < MAKE_VERSION(2,1,32))
204 nfs_mount_version = 1;
205 else if (kernel_version < MAKE_VERSION(2,3,99))
206 nfs_mount_version = 3;
207 else
208 nfs_mount_version = 4; /* since 2.3.99pre4 */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000209 }
210 if (nfs_mount_version > NFS_MOUNT_VERSION)
Eric Andersenda1d1e72000-07-10 23:39:44 +0000211 nfs_mount_version = NFS_MOUNT_VERSION;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000212}
213
Eric Andersenda1d1e72000-07-10 23:39:44 +0000214static struct pmap *
215get_mountport(struct sockaddr_in *server_addr,
216 long unsigned prog,
217 long unsigned version,
218 long unsigned proto,
219 long unsigned port)
220{
221struct pmaplist *pmap;
222static struct pmap p = {0, 0, 0, 0};
223
224server_addr->sin_port = PMAPPORT;
225pmap = pmap_getmaps(server_addr);
226
227if (version > MAX_NFSPROT)
228 version = MAX_NFSPROT;
229if (!prog)
230 prog = MOUNTPROG;
231p.pm_prog = prog;
232p.pm_vers = version;
233p.pm_prot = proto;
234p.pm_port = port;
235
236while (pmap) {
237 if (pmap->pml_map.pm_prog != prog)
238 goto next;
239 if (!version && p.pm_vers > pmap->pml_map.pm_vers)
240 goto next;
241 if (version > 2 && pmap->pml_map.pm_vers != version)
242 goto next;
243 if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
244 goto next;
245 if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
246 (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
247 (port && pmap->pml_map.pm_port != port))
248 goto next;
249 memcpy(&p, &pmap->pml_map, sizeof(p));
250next:
251 pmap = pmap->pml_next;
252}
253if (!p.pm_vers)
254 p.pm_vers = MOUNTVERS;
255if (!p.pm_port)
256 p.pm_port = MOUNTPORT;
257if (!p.pm_prot)
258 p.pm_prot = IPPROTO_TCP;
259return &p;
260}
261
262int nfsmount(const char *spec, const char *node, int *flags,
263 char **extra_opts, char **mount_opts, int running_bg)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000264{
265 static char *prev_bg_host;
266 char hostdir[1024];
267 CLIENT *mclient;
268 char *hostname;
269 char *dirname;
270 char *old_opts;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000271 char *mounthost=NULL;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000272 char new_opts[1024];
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000273 struct timeval total_timeout;
274 enum clnt_stat clnt_stat;
275 static struct nfs_mount_data data;
276 char *opt, *opteq;
277 int val;
278 struct hostent *hp;
279 struct sockaddr_in server_addr;
280 struct sockaddr_in mount_server_addr;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000281 struct pmap* pm_mnt;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000282 int msock, fsock;
283 struct timeval retry_timeout;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000284 union {
285 struct fhstatus nfsv2;
286 struct mountres3 nfsv3;
287 } status;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000288 struct stat statbuf;
289 char *s;
290 int port;
291 int mountport;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000292 int proto;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000293 int bg;
294 int soft;
295 int intr;
296 int posix;
297 int nocto;
298 int noac;
299 int nolock;
300 int retry;
301 int tcp;
302 int mountprog;
303 int mountvers;
304 int nfsprog;
305 int nfsvers;
306 int retval;
307 time_t t;
308 time_t prevt;
309 time_t timeout;
310
311 find_kernel_nfs_mount_version();
312
313 retval = EX_FAIL;
314 msock = fsock = -1;
315 mclient = NULL;
316 if (strlen(spec) >= sizeof(hostdir)) {
Matt Kraaid537a952000-07-14 01:51:25 +0000317 errorMsg("excessively long host:dir argument\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000318 goto fail;
319 }
320 strcpy(hostdir, spec);
321 if ((s = strchr(hostdir, ':'))) {
322 hostname = hostdir;
323 dirname = s + 1;
324 *s = '\0';
325 /* Ignore all but first hostname in replicated mounts
326 until they can be fully supported. (mack@sgi.com) */
327 if ((s = strchr(hostdir, ','))) {
328 *s = '\0';
Matt Kraaid537a952000-07-14 01:51:25 +0000329 errorMsg("warning: multiple hostnames not supported\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000330 }
331 } else {
Matt Kraaid537a952000-07-14 01:51:25 +0000332 errorMsg("directory to mount not in host:dir format\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000333 goto fail;
334 }
335
336 server_addr.sin_family = AF_INET;
337#ifdef HAVE_inet_aton
338 if (!inet_aton(hostname, &server_addr.sin_addr))
339#endif
340 {
341 if ((hp = gethostbyname(hostname)) == NULL) {
Matt Kraaid537a952000-07-14 01:51:25 +0000342 errorMsg("can't get address for %s\n", hostname);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000343 goto fail;
344 } else {
345 if (hp->h_length > sizeof(struct in_addr)) {
Matt Kraaid537a952000-07-14 01:51:25 +0000346 errorMsg("got bad hp->h_length\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000347 hp->h_length = sizeof(struct in_addr);
348 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000349 memcpy(&server_addr.sin_addr,
350 hp->h_addr, hp->h_length);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000351 }
352 }
353
Eric Andersenda1d1e72000-07-10 23:39:44 +0000354 memcpy (&mount_server_addr, &server_addr, sizeof (mount_server_addr));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000355
356 /* add IP address to mtab options for use when unmounting */
357
358 s = inet_ntoa(server_addr.sin_addr);
359 old_opts = *extra_opts;
360 if (!old_opts)
361 old_opts = "";
362 if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
Matt Kraaid537a952000-07-14 01:51:25 +0000363 errorMsg("excessively long option argument\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000364 goto fail;
365 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000366 sprintf(new_opts, "%s%saddr=%s",
367 old_opts, *old_opts ? "," : "", s);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000368 *extra_opts = xstrdup(new_opts);
369
370 /* Set default options.
371 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
372 * let the kernel decide.
373 * timeo is filled in after we know whether it'll be TCP or UDP. */
374 memset(&data, 0, sizeof(data));
Eric Andersenda1d1e72000-07-10 23:39:44 +0000375 data.retrans = 3;
376 data.acregmin = 3;
377 data.acregmax = 60;
378 data.acdirmin = 30;
379 data.acdirmax = 60;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000380#if NFS_MOUNT_VERSION >= 2
Eric Andersenda1d1e72000-07-10 23:39:44 +0000381 data.namlen = NAME_MAX;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000382#endif
383
384 bg = 0;
385 soft = 0;
386 intr = 0;
387 posix = 0;
388 nocto = 0;
389 nolock = 0;
390 noac = 0;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000391 retry = 10000; /* 10000 minutes ~ 1 week */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000392 tcp = 0;
393
394 mountprog = MOUNTPROG;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000395 mountvers = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000396 port = 0;
397 mountport = 0;
398 nfsprog = NFS_PROGRAM;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000399 nfsvers = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000400
401 /* parse options */
402
403 for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
404 if ((opteq = strchr(opt, '='))) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000405 val = atoi(opteq + 1);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000406 *opteq = '\0';
407 if (!strcmp(opt, "rsize"))
408 data.rsize = val;
409 else if (!strcmp(opt, "wsize"))
410 data.wsize = val;
411 else if (!strcmp(opt, "timeo"))
412 data.timeo = val;
413 else if (!strcmp(opt, "retrans"))
414 data.retrans = val;
415 else if (!strcmp(opt, "acregmin"))
416 data.acregmin = val;
417 else if (!strcmp(opt, "acregmax"))
418 data.acregmax = val;
419 else if (!strcmp(opt, "acdirmin"))
420 data.acdirmin = val;
421 else if (!strcmp(opt, "acdirmax"))
422 data.acdirmax = val;
423 else if (!strcmp(opt, "actimeo")) {
424 data.acregmin = val;
425 data.acregmax = val;
426 data.acdirmin = val;
427 data.acdirmax = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000428 }
429 else if (!strcmp(opt, "retry"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000430 retry = val;
431 else if (!strcmp(opt, "port"))
432 port = val;
433 else if (!strcmp(opt, "mountport"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000434 mountport = val;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000435 else if (!strcmp(opt, "mounthost"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000436 mounthost=xstrndup(opteq+1,
437 strcspn(opteq+1," \t\n\r,"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000438 else if (!strcmp(opt, "mountprog"))
439 mountprog = val;
440 else if (!strcmp(opt, "mountvers"))
441 mountvers = val;
442 else if (!strcmp(opt, "nfsprog"))
443 nfsprog = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000444 else if (!strcmp(opt, "nfsvers") ||
445 !strcmp(opt, "vers"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000446 nfsvers = val;
447 else if (!strcmp(opt, "proto")) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000448 if (!strncmp(opteq+1, "tcp", 3))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000449 tcp = 1;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000450 else if (!strncmp(opteq+1, "udp", 3))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000451 tcp = 0;
452 else
453 printf(_("Warning: Unrecognized proto= option.\n"));
454 } else if (!strcmp(opt, "namlen")) {
455#if NFS_MOUNT_VERSION >= 2
456 if (nfs_mount_version >= 2)
457 data.namlen = val;
458 else
459#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000460 printf(_("Warning: Option namlen is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000461 } else if (!strcmp(opt, "addr"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000462 /* ignore */;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000463 else {
464 printf(_("unknown nfs mount parameter: "
Eric Andersenda1d1e72000-07-10 23:39:44 +0000465 "%s=%d\n"), opt, val);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000466 goto fail;
467 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000468 }
469 else {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000470 val = 1;
471 if (!strncmp(opt, "no", 2)) {
472 val = 0;
473 opt += 2;
474 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000475 if (!strcmp(opt, "bg"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000476 bg = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000477 else if (!strcmp(opt, "fg"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000478 bg = !val;
479 else if (!strcmp(opt, "soft"))
480 soft = val;
481 else if (!strcmp(opt, "hard"))
482 soft = !val;
483 else if (!strcmp(opt, "intr"))
484 intr = val;
485 else if (!strcmp(opt, "posix"))
486 posix = val;
487 else if (!strcmp(opt, "cto"))
488 nocto = !val;
489 else if (!strcmp(opt, "ac"))
490 noac = !val;
491 else if (!strcmp(opt, "tcp"))
492 tcp = val;
493 else if (!strcmp(opt, "udp"))
494 tcp = !val;
495 else if (!strcmp(opt, "lock")) {
496 if (nfs_mount_version >= 3)
497 nolock = !val;
498 else
Eric Andersenda1d1e72000-07-10 23:39:44 +0000499 printf(_("Warning: option nolock is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000500 } else {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000501 printf(_("unknown nfs mount option: "
502 "%s%s\n"), val ? "" : "no", opt);
503 goto fail;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000504 }
505 }
506 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000507 proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP;
508
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000509 data.flags = (soft ? NFS_MOUNT_SOFT : 0)
510 | (intr ? NFS_MOUNT_INTR : 0)
511 | (posix ? NFS_MOUNT_POSIX : 0)
512 | (nocto ? NFS_MOUNT_NOCTO : 0)
513 | (noac ? NFS_MOUNT_NOAC : 0);
514#if NFS_MOUNT_VERSION >= 2
515 if (nfs_mount_version >= 2)
516 data.flags |= (tcp ? NFS_MOUNT_TCP : 0);
517#endif
518#if NFS_MOUNT_VERSION >= 3
519 if (nfs_mount_version >= 3)
520 data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
521#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000522 if (nfsvers > MAX_NFSPROT) {
Matt Kraaid537a952000-07-14 01:51:25 +0000523 errorMsg("NFSv%d not supported!\n", nfsvers);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000524 return 0;
525 }
526 if (mountvers > MAX_NFSPROT) {
Matt Kraaid537a952000-07-14 01:51:25 +0000527 errorMsg("NFSv%d not supported!\n", nfsvers);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000528 return 0;
529 }
530 if (nfsvers && !mountvers)
531 mountvers = (nfsvers < 3) ? 1 : nfsvers;
532 if (nfsvers && nfsvers < mountvers) {
533 mountvers = nfsvers;
534 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000535
536 /* Adjust options if none specified */
537 if (!data.timeo)
538 data.timeo = tcp ? 70 : 7;
539
540#ifdef NFS_MOUNT_DEBUG
541 printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000542 data.rsize, data.wsize, data.timeo, data.retrans);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000543 printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000544 data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000545 printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000546 port, bg, retry, data.flags);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000547 printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000548 mountprog, mountvers, nfsprog, nfsvers);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000549 printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000550 (data.flags & NFS_MOUNT_SOFT) != 0,
551 (data.flags & NFS_MOUNT_INTR) != 0,
552 (data.flags & NFS_MOUNT_POSIX) != 0,
553 (data.flags & NFS_MOUNT_NOCTO) != 0,
554 (data.flags & NFS_MOUNT_NOAC) != 0);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000555#if NFS_MOUNT_VERSION >= 2
Eric Andersenda1d1e72000-07-10 23:39:44 +0000556 printf("tcp = %d\n",
557 (data.flags & NFS_MOUNT_TCP) != 0);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000558#endif
559#endif
560
561 data.version = nfs_mount_version;
562 *mount_opts = (char *) &data;
563
564 if (*flags & MS_REMOUNT)
565 return 0;
566
567 /*
568 * If the previous mount operation on the same host was
569 * backgrounded, and the "bg" for this mount is also set,
570 * give up immediately, to avoid the initial timeout.
571 */
572 if (bg && !running_bg &&
Eric Andersenda1d1e72000-07-10 23:39:44 +0000573 prev_bg_host && strcmp(hostname, prev_bg_host) == 0) {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000574 if (retry > 0)
575 retval = EX_BG;
576 return retval;
577 }
578
579 /* create mount deamon client */
580 /* See if the nfs host = mount host. */
581 if (mounthost) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000582 if (mounthost[0] >= '0' && mounthost[0] <= '9') {
583 mount_server_addr.sin_family = AF_INET;
584 mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
585 } else {
586 if ((hp = gethostbyname(mounthost)) == NULL) {
Matt Kraaid537a952000-07-14 01:51:25 +0000587 errorMsg("can't get address for %s\n", hostname);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000588 goto fail;
589 } else {
590 if (hp->h_length > sizeof(struct in_addr)) {
Matt Kraaid537a952000-07-14 01:51:25 +0000591 errorMsg("got bad hp->h_length?\n");
Eric Andersenda1d1e72000-07-10 23:39:44 +0000592 hp->h_length = sizeof(struct in_addr);
593 }
594 mount_server_addr.sin_family = AF_INET;
595 memcpy(&mount_server_addr.sin_addr,
596 hp->h_addr, hp->h_length);
597 }
598 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000599 }
600
601 /*
602 * The following loop implements the mount retries. On the first
603 * call, "running_bg" is 0. When the mount times out, and the
604 * "bg" option is set, the exit status EX_BG will be returned.
605 * For a backgrounded mount, there will be a second call by the
606 * child process with "running_bg" set to 1.
607 *
608 * The case where the mount point is not present and the "bg"
609 * option is set, is treated as a timeout. This is done to
610 * support nested mounts.
611 *
612 * The "retry" count specified by the user is the number of
613 * minutes to retry before giving up.
614 *
615 * Only the first error message will be displayed.
616 */
617 retry_timeout.tv_sec = 3;
618 retry_timeout.tv_usec = 0;
619 total_timeout.tv_sec = 20;
620 total_timeout.tv_usec = 0;
621 timeout = time(NULL) + 60 * retry;
622 prevt = 0;
623 t = 30;
624 val = 1;
625 for (;;) {
626 if (bg && stat(node, &statbuf) == -1) {
627 if (running_bg) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000628 sleep(val); /* 1, 2, 4, 8, 16, 30, ... */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000629 val *= 2;
630 if (val > 30)
631 val = 30;
632 }
633 } else {
634 /* be careful not to use too many CPU cycles */
635 if (t - prevt < 30)
636 sleep(30);
637
Eric Andersenda1d1e72000-07-10 23:39:44 +0000638 pm_mnt = get_mountport(&mount_server_addr,
639 mountprog,
640 mountvers,
641 proto,
642 mountport);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000643
Eric Andersenda1d1e72000-07-10 23:39:44 +0000644 /* contact the mount daemon via TCP */
645 mount_server_addr.sin_port = htons(pm_mnt->pm_port);
646 msock = RPC_ANYSOCK;
647
648 switch (pm_mnt->pm_prot) {
649 case IPPROTO_UDP:
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000650 mclient = clntudp_create(&mount_server_addr,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000651 pm_mnt->pm_prog,
652 pm_mnt->pm_vers,
653 retry_timeout,
654 &msock);
655 if (mclient)
656 break;
657 mount_server_addr.sin_port = htons(pm_mnt->pm_port);
658 msock = RPC_ANYSOCK;
659 case IPPROTO_TCP:
660 mclient = clnttcp_create(&mount_server_addr,
661 pm_mnt->pm_prog,
662 pm_mnt->pm_vers,
663 &msock, 0, 0);
664 break;
665 default:
666 mclient = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000667 }
668 if (mclient) {
669 /* try to mount hostname:dirname */
670 mclient->cl_auth = authunix_create_default();
Eric Andersenda1d1e72000-07-10 23:39:44 +0000671
672 /* make pointers in xdr_mountres3 NULL so
673 * that xdr_array allocates memory for us
674 */
675 memset(&status, 0, sizeof(status));
676
677 if (pm_mnt->pm_vers == 3)
678 clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT,
679 (xdrproc_t) xdr_dirpath,
680 (caddr_t) &dirname,
681 (xdrproc_t) xdr_mountres3,
682 (caddr_t) &status,
683 total_timeout);
684 else
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000685 clnt_stat = clnt_call(mclient, MOUNTPROC_MNT,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000686 (xdrproc_t) xdr_dirpath,
687 (caddr_t) &dirname,
688 (xdrproc_t) xdr_fhstatus,
689 (caddr_t) &status,
690 total_timeout);
691
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000692 if (clnt_stat == RPC_SUCCESS)
693 break; /* we're done */
694 if (errno != ECONNREFUSED) {
695 clnt_perror(mclient, "mount");
696 goto fail; /* don't retry */
697 }
698 if (!running_bg && prevt == 0)
699 clnt_perror(mclient, "mount");
700 auth_destroy(mclient->cl_auth);
701 clnt_destroy(mclient);
702 mclient = 0;
703 close(msock);
704 } else {
705 if (!running_bg && prevt == 0)
706 clnt_pcreateerror("mount");
707 }
708 prevt = t;
709 }
710 if (!bg)
Eric Andersenda1d1e72000-07-10 23:39:44 +0000711 goto fail;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000712 if (!running_bg) {
713 prev_bg_host = xstrdup(hostname);
714 if (retry > 0)
715 retval = EX_BG;
716 goto fail;
717 }
718 t = time(NULL);
719 if (t >= timeout)
720 goto fail;
721 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000722 nfsvers = (pm_mnt->pm_vers < 2) ? 2 : pm_mnt->pm_vers;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000723
Eric Andersenda1d1e72000-07-10 23:39:44 +0000724 if (nfsvers == 2) {
725 if (status.nfsv2.fhs_status != 0) {
Matt Kraaid537a952000-07-14 01:51:25 +0000726 errorMsg("%s:%s failed, reason given by server: %s\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000727 hostname, dirname,
728 nfs_strerror(status.nfsv2.fhs_status));
729 goto fail;
730 }
731 memcpy(data.root.data,
732 (char *) status.nfsv2.fhstatus_u.fhs_fhandle,
733 NFS_FHSIZE);
734#if NFS_MOUNT_VERSION >= 4
735 data.root.size = NFS_FHSIZE;
736 memcpy(data.old_root.data,
737 (char *) status.nfsv2.fhstatus_u.fhs_fhandle,
738 NFS_FHSIZE);
739#endif
740 } else {
741#if NFS_MOUNT_VERSION >= 4
742 fhandle3 *fhandle;
743 if (status.nfsv3.fhs_status != 0) {
Matt Kraaid537a952000-07-14 01:51:25 +0000744 errorMsg("%s:%s failed, reason given by server: %s\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000745 hostname, dirname,
746 nfs_strerror(status.nfsv3.fhs_status));
747 goto fail;
748 }
749 fhandle = &status.nfsv3.mountres3_u.mountinfo.fhandle;
750 memset(data.old_root.data, 0, NFS_FHSIZE);
751 memset(&data.root, 0, sizeof(data.root));
752 data.root.size = fhandle->fhandle3_len;
753 memcpy(data.root.data,
754 (char *) fhandle->fhandle3_val,
755 fhandle->fhandle3_len);
756
757 data.flags |= NFS_MOUNT_VER3;
758#endif
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000759 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000760
761 /* create nfs socket for kernel */
762
763 if (tcp) {
764 if (nfs_mount_version < 3) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000765 printf(_("NFS over TCP is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000766 goto fail;
767 }
768 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
769 } else
770 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
771 if (fsock < 0) {
772 perror(_("nfs socket"));
773 goto fail;
774 }
775 if (bindresvport(fsock, 0) < 0) {
776 perror(_("nfs bindresvport"));
777 goto fail;
778 }
779 if (port == 0) {
780 server_addr.sin_port = PMAPPORT;
781 port = pmap_getport(&server_addr, nfsprog, nfsvers,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000782 tcp ? IPPROTO_TCP : IPPROTO_UDP);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000783 if (port == 0)
784 port = NFS_PORT;
785#ifdef NFS_MOUNT_DEBUG
786 else
787 printf(_("used portmapper to find NFS port\n"));
788#endif
789 }
790#ifdef NFS_MOUNT_DEBUG
791 printf(_("using port %d for nfs deamon\n"), port);
792#endif
793 server_addr.sin_port = htons(port);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000794 /*
795 * connect() the socket for kernels 1.3.10 and below only,
796 * to avoid problems with multihomed hosts.
797 * --Swen
798 */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000799 if (linux_version_code() <= 66314
Eric Andersenda1d1e72000-07-10 23:39:44 +0000800 && connect(fsock, (struct sockaddr *) &server_addr,
801 sizeof (server_addr)) < 0) {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000802 perror(_("nfs connect"));
803 goto fail;
804 }
805
806 /* prepare data structure for kernel */
807
808 data.fd = fsock;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000809 memcpy((char *) &data.addr, (char *) &server_addr, sizeof(data.addr));
810 strncpy(data.hostname, hostname, sizeof(data.hostname));
811
812 /* clean up */
813
814 auth_destroy(mclient->cl_auth);
815 clnt_destroy(mclient);
816 close(msock);
817 return 0;
818
819 /* abort */
820
Eric Andersenda1d1e72000-07-10 23:39:44 +0000821fail:
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000822 if (msock != -1) {
823 if (mclient) {
824 auth_destroy(mclient->cl_auth);
825 clnt_destroy(mclient);
826 }
827 close(msock);
828 }
829 if (fsock != -1)
830 close(fsock);
831 return retval;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000832}
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000833
834/*
835 * We need to translate between nfs status return values and
836 * the local errno values which may not be the same.
837 *
838 * Andreas Schwab <schwab@LS5.informatik.uni-dortmund.de>: change errno:
839 * "after #include <errno.h> the symbol errno is reserved for any use,
840 * it cannot even be used as a struct tag or field name".
841 */
842
843#ifndef EDQUOT
844#define EDQUOT ENOSPC
845#endif
846
847static struct {
848 enum nfs_stat stat;
849 int errnum;
850} nfs_errtbl[] = {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000851 { NFS_OK, 0 },
852 { NFSERR_PERM, EPERM },
853 { NFSERR_NOENT, ENOENT },
854 { NFSERR_IO, EIO },
855 { NFSERR_NXIO, ENXIO },
856 { NFSERR_ACCES, EACCES },
857 { NFSERR_EXIST, EEXIST },
858 { NFSERR_NODEV, ENODEV },
859 { NFSERR_NOTDIR, ENOTDIR },
860 { NFSERR_ISDIR, EISDIR },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000861#ifdef NFSERR_INVAL
Eric Andersenda1d1e72000-07-10 23:39:44 +0000862 { NFSERR_INVAL, EINVAL }, /* that Sun forgot */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000863#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000864 { NFSERR_FBIG, EFBIG },
865 { NFSERR_NOSPC, ENOSPC },
866 { NFSERR_ROFS, EROFS },
867 { NFSERR_NAMETOOLONG, ENAMETOOLONG },
868 { NFSERR_NOTEMPTY, ENOTEMPTY },
869 { NFSERR_DQUOT, EDQUOT },
870 { NFSERR_STALE, ESTALE },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000871#ifdef EWFLUSH
Eric Andersenda1d1e72000-07-10 23:39:44 +0000872 { NFSERR_WFLUSH, EWFLUSH },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000873#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000874 /* Throw in some NFSv3 values for even more fun (HP returns these) */
875 { 71, EREMOTE },
876
877 { -1, EIO }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000878};
879
880static char *nfs_strerror(int stat)
881{
882 int i;
883 static char buf[256];
884
885 for (i = 0; nfs_errtbl[i].stat != -1; i++) {
886 if (nfs_errtbl[i].stat == stat)
887 return strerror(nfs_errtbl[i].errnum);
888 }
889 sprintf(buf, _("unknown nfs status return value: %d"), stat);
890 return buf;
891}
892
Eric Andersenda1d1e72000-07-10 23:39:44 +0000893bool_t
894xdr_fhandle (XDR *xdrs, fhandle objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000895{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000896 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000897
Eric Andersenda1d1e72000-07-10 23:39:44 +0000898 if (!xdr_opaque (xdrs, objp, FHSIZE))
899 return FALSE;
900 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000901}
902
Eric Andersenda1d1e72000-07-10 23:39:44 +0000903bool_t
904xdr_fhstatus (XDR *xdrs, fhstatus *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000905{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000906 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000907
Eric Andersenda1d1e72000-07-10 23:39:44 +0000908 if (!xdr_u_int (xdrs, &objp->fhs_status))
909 return FALSE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000910 switch (objp->fhs_status) {
911 case 0:
Eric Andersenda1d1e72000-07-10 23:39:44 +0000912 if (!xdr_fhandle (xdrs, objp->fhstatus_u.fhs_fhandle))
913 return FALSE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000914 break;
915 default:
916 break;
917 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000918 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000919}
920
Eric Andersenda1d1e72000-07-10 23:39:44 +0000921bool_t
922xdr_dirpath (XDR *xdrs, dirpath *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000923{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000924 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000925
Eric Andersenda1d1e72000-07-10 23:39:44 +0000926 if (!xdr_string (xdrs, objp, MNTPATHLEN))
927 return FALSE;
928 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000929}
930
Eric Andersenda1d1e72000-07-10 23:39:44 +0000931bool_t
932xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000933{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000934 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000935
Eric Andersenda1d1e72000-07-10 23:39:44 +0000936 if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3))
937 return FALSE;
938 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000939}
940
Eric Andersenda1d1e72000-07-10 23:39:44 +0000941bool_t
942xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000943{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000944 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000945
Eric Andersenda1d1e72000-07-10 23:39:44 +0000946 if (!xdr_fhandle3 (xdrs, &objp->fhandle))
947 return FALSE;
948 if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0,
949 sizeof (int), (xdrproc_t) xdr_int))
950 return FALSE;
951 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000952}
953
Eric Andersenda1d1e72000-07-10 23:39:44 +0000954bool_t
955xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000956{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000957 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000958
Eric Andersenda1d1e72000-07-10 23:39:44 +0000959 if (!xdr_enum (xdrs, (enum_t *) objp))
960 return FALSE;
961 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000962}
963
Eric Andersenda1d1e72000-07-10 23:39:44 +0000964bool_t
965xdr_mountres3 (XDR *xdrs, mountres3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000966{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000967 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000968
Eric Andersenda1d1e72000-07-10 23:39:44 +0000969 if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
970 return FALSE;
971 switch (objp->fhs_status) {
972 case MNT_OK:
973 if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
974 return FALSE;
975 break;
976 default:
977 break;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000978 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000979 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000980}
981