blob: ae9b99552ff9fdabc0e68d5d87b8df78d54fffc1 [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 Andersen3570a342000-09-25 21:45:58 +000036#include "busybox.h"
Eric Andersene7413a92000-07-14 06:19:41 +000037#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
Glenn L McGrathc52a97d2000-12-09 23:59:04 +000056#ifndef NFS_FHSIZE
57#define NFS_FHSIZE 32
58#endif
59#ifndef NFS_PORT
60#define NFS_PORT 2049
61#endif
Eric Andersen1c43d0c1999-11-18 07:58:07 +000062
Eric Andersenda1d1e72000-07-10 23:39:44 +000063/* Disable the nls stuff */
64# undef bindtextdomain
65# define bindtextdomain(Domain, Directory) /* empty */
66# undef textdomain
67# define textdomain(Domain) /* empty */
68# define _(Text) (Text)
69# define N_(Text) (Text)
70
71#define MS_MGC_VAL 0xc0ed0000 /* Magic number indicatng "new" flags */
72#define MS_RDONLY 1 /* Mount read-only */
73#define MS_NOSUID 2 /* Ignore suid and sgid bits */
74#define MS_NODEV 4 /* Disallow access to device special files */
75#define MS_NOEXEC 8 /* Disallow program execution */
76#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
77#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
78#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
79#define S_QUOTA 128 /* Quota initialized for file/directory/symlink */
80#define S_APPEND 256 /* Append-only file */
81#define S_IMMUTABLE 512 /* Immutable file */
82#define MS_NOATIME 1024 /* Do not update access times. */
83#define MS_NODIRATIME 2048 /* Do not update directory access times */
84
85
86/*
87 * We want to be able to compile mount on old kernels in such a way
88 * that the binary will work well on more recent kernels.
89 * Thus, if necessary we teach nfsmount.c the structure of new fields
90 * that will come later.
91 *
92 * Moreover, the new kernel includes conflict with glibc includes
93 * so it is easiest to ignore the kernel altogether (at compile time).
94 */
95
96#define NFS_MOUNT_VERSION 4
97
98struct nfs2_fh {
99 char data[32];
100};
101struct nfs3_fh {
102 unsigned short size;
103 unsigned char data[64];
104};
105
106struct nfs_mount_data {
107 int version; /* 1 */
108 int fd; /* 1 */
109 struct nfs2_fh old_root; /* 1 */
110 int flags; /* 1 */
111 int rsize; /* 1 */
112 int wsize; /* 1 */
113 int timeo; /* 1 */
114 int retrans; /* 1 */
115 int acregmin; /* 1 */
116 int acregmax; /* 1 */
117 int acdirmin; /* 1 */
118 int acdirmax; /* 1 */
119 struct sockaddr_in addr; /* 1 */
120 char hostname[256]; /* 1 */
121 int namlen; /* 2 */
122 unsigned int bsize; /* 3 */
123 struct nfs3_fh root; /* 4 */
124};
125
126/* bits in the flags field */
127
128#define NFS_MOUNT_SOFT 0x0001 /* 1 */
129#define NFS_MOUNT_INTR 0x0002 /* 1 */
130#define NFS_MOUNT_SECURE 0x0004 /* 1 */
131#define NFS_MOUNT_POSIX 0x0008 /* 1 */
132#define NFS_MOUNT_NOCTO 0x0010 /* 1 */
133#define NFS_MOUNT_NOAC 0x0020 /* 1 */
134#define NFS_MOUNT_TCP 0x0040 /* 2 */
135#define NFS_MOUNT_VER3 0x0080 /* 3 */
136#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */
137#define NFS_MOUNT_NONLM 0x0200 /* 3 */
138
139
140#define UTIL_LINUX_VERSION "2.10m"
141#define util_linux_version "util-linux-2.10m"
142
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000143#define HAVE_inet_aton
Eric Andersenda1d1e72000-07-10 23:39:44 +0000144#define HAVE_scsi_h
145#define HAVE_blkpg_h
146#define HAVE_kd_h
147#define HAVE_termcap
148#define HAVE_locale_h
149#define HAVE_libintl_h
150#define ENABLE_NLS
151#define HAVE_langinfo_h
152#define HAVE_progname
153#define HAVE_openpty
154#define HAVE_nanosleep
155#define HAVE_personality
156#define HAVE_tm_gmtoff
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000157
Eric Andersenda1d1e72000-07-10 23:39:44 +0000158extern char *xstrdup (const char *s);
159extern char *xstrndup (const char *s, int n);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000160static char *nfs_strerror(int stat);
161
162#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000163#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000164
Eric Andersenda1d1e72000-07-10 23:39:44 +0000165#define EX_FAIL 32 /* mount failure */
166#define EX_BG 256 /* retry in background (internal only) */
167
168
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000169/*
Eric Andersenda1d1e72000-07-10 23:39:44 +0000170 * nfs_mount_version according to the sources seen at compile time.
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000171 */
Eric Andersenda1d1e72000-07-10 23:39:44 +0000172int nfs_mount_version = NFS_MOUNT_VERSION;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000173
174/*
175 * Unfortunately, the kernel prints annoying console messages
176 * in case of an unexpected nfs mount version (instead of
177 * just returning some error). Therefore we'll have to try
178 * and figure out what version the kernel expects.
179 *
180 * Variables:
181 * KERNEL_NFS_MOUNT_VERSION: kernel sources at compile time
182 * NFS_MOUNT_VERSION: these nfsmount sources at compile time
183 * nfs_mount_version: version this source and running kernel can handle
184 */
Eric Andersenda1d1e72000-07-10 23:39:44 +0000185static void
186find_kernel_nfs_mount_version(void) {
187 static int kernel_version = 0;
188
189 if (kernel_version)
190 return;
191
Eric Andersenef936da2000-10-30 17:22:04 +0000192 kernel_version = get_kernel_revision();
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000193
194 if (kernel_version) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000195 if (kernel_version < MAKE_VERSION(2,1,32))
196 nfs_mount_version = 1;
197 else if (kernel_version < MAKE_VERSION(2,3,99))
198 nfs_mount_version = 3;
199 else
200 nfs_mount_version = 4; /* since 2.3.99pre4 */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000201 }
202 if (nfs_mount_version > NFS_MOUNT_VERSION)
Eric Andersenda1d1e72000-07-10 23:39:44 +0000203 nfs_mount_version = NFS_MOUNT_VERSION;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000204}
205
Eric Andersenda1d1e72000-07-10 23:39:44 +0000206static struct pmap *
207get_mountport(struct sockaddr_in *server_addr,
208 long unsigned prog,
209 long unsigned version,
210 long unsigned proto,
211 long unsigned port)
212{
213struct pmaplist *pmap;
214static struct pmap p = {0, 0, 0, 0};
215
216server_addr->sin_port = PMAPPORT;
217pmap = pmap_getmaps(server_addr);
218
219if (version > MAX_NFSPROT)
220 version = MAX_NFSPROT;
221if (!prog)
222 prog = MOUNTPROG;
223p.pm_prog = prog;
224p.pm_vers = version;
225p.pm_prot = proto;
226p.pm_port = port;
227
228while (pmap) {
229 if (pmap->pml_map.pm_prog != prog)
230 goto next;
231 if (!version && p.pm_vers > pmap->pml_map.pm_vers)
232 goto next;
233 if (version > 2 && pmap->pml_map.pm_vers != version)
234 goto next;
235 if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
236 goto next;
237 if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
238 (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
239 (port && pmap->pml_map.pm_port != port))
240 goto next;
241 memcpy(&p, &pmap->pml_map, sizeof(p));
242next:
243 pmap = pmap->pml_next;
244}
245if (!p.pm_vers)
246 p.pm_vers = MOUNTVERS;
247if (!p.pm_port)
248 p.pm_port = MOUNTPORT;
249if (!p.pm_prot)
250 p.pm_prot = IPPROTO_TCP;
251return &p;
252}
253
254int nfsmount(const char *spec, const char *node, int *flags,
255 char **extra_opts, char **mount_opts, int running_bg)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000256{
257 static char *prev_bg_host;
258 char hostdir[1024];
259 CLIENT *mclient;
260 char *hostname;
261 char *dirname;
262 char *old_opts;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000263 char *mounthost=NULL;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000264 char new_opts[1024];
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000265 struct timeval total_timeout;
266 enum clnt_stat clnt_stat;
267 static struct nfs_mount_data data;
268 char *opt, *opteq;
269 int val;
270 struct hostent *hp;
271 struct sockaddr_in server_addr;
272 struct sockaddr_in mount_server_addr;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000273 struct pmap* pm_mnt;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000274 int msock, fsock;
275 struct timeval retry_timeout;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000276 union {
277 struct fhstatus nfsv2;
278 struct mountres3 nfsv3;
279 } status;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000280 struct stat statbuf;
281 char *s;
282 int port;
283 int mountport;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000284 int proto;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000285 int bg;
286 int soft;
287 int intr;
288 int posix;
289 int nocto;
290 int noac;
291 int nolock;
292 int retry;
293 int tcp;
294 int mountprog;
295 int mountvers;
296 int nfsprog;
297 int nfsvers;
298 int retval;
299 time_t t;
300 time_t prevt;
301 time_t timeout;
302
303 find_kernel_nfs_mount_version();
304
305 retval = EX_FAIL;
306 msock = fsock = -1;
307 mclient = NULL;
308 if (strlen(spec) >= sizeof(hostdir)) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000309 error_msg("excessively long host:dir argument\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000310 goto fail;
311 }
312 strcpy(hostdir, spec);
313 if ((s = strchr(hostdir, ':'))) {
314 hostname = hostdir;
315 dirname = s + 1;
316 *s = '\0';
317 /* Ignore all but first hostname in replicated mounts
318 until they can be fully supported. (mack@sgi.com) */
319 if ((s = strchr(hostdir, ','))) {
320 *s = '\0';
Mark Whitleyf57c9442000-12-07 19:56:48 +0000321 error_msg("warning: multiple hostnames not supported\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000322 }
323 } else {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000324 error_msg("directory to mount not in host:dir format\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000325 goto fail;
326 }
327
328 server_addr.sin_family = AF_INET;
329#ifdef HAVE_inet_aton
330 if (!inet_aton(hostname, &server_addr.sin_addr))
331#endif
332 {
333 if ((hp = gethostbyname(hostname)) == NULL) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000334 error_msg("can't get address for %s\n", hostname);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000335 goto fail;
336 } else {
337 if (hp->h_length > sizeof(struct in_addr)) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000338 error_msg("got bad hp->h_length\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000339 hp->h_length = sizeof(struct in_addr);
340 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000341 memcpy(&server_addr.sin_addr,
342 hp->h_addr, hp->h_length);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000343 }
344 }
345
Eric Andersenda1d1e72000-07-10 23:39:44 +0000346 memcpy (&mount_server_addr, &server_addr, sizeof (mount_server_addr));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000347
348 /* add IP address to mtab options for use when unmounting */
349
350 s = inet_ntoa(server_addr.sin_addr);
351 old_opts = *extra_opts;
352 if (!old_opts)
353 old_opts = "";
354 if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000355 error_msg("excessively long option argument\n");
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000356 goto fail;
357 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000358 sprintf(new_opts, "%s%saddr=%s",
359 old_opts, *old_opts ? "," : "", s);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000360 *extra_opts = xstrdup(new_opts);
361
362 /* Set default options.
363 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
364 * let the kernel decide.
365 * timeo is filled in after we know whether it'll be TCP or UDP. */
366 memset(&data, 0, sizeof(data));
Eric Andersenda1d1e72000-07-10 23:39:44 +0000367 data.retrans = 3;
368 data.acregmin = 3;
369 data.acregmax = 60;
370 data.acdirmin = 30;
371 data.acdirmax = 60;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000372#if NFS_MOUNT_VERSION >= 2
Eric Andersenda1d1e72000-07-10 23:39:44 +0000373 data.namlen = NAME_MAX;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000374#endif
375
376 bg = 0;
377 soft = 0;
378 intr = 0;
379 posix = 0;
380 nocto = 0;
381 nolock = 0;
382 noac = 0;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000383 retry = 10000; /* 10000 minutes ~ 1 week */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000384 tcp = 0;
385
386 mountprog = MOUNTPROG;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000387 mountvers = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000388 port = 0;
389 mountport = 0;
390 nfsprog = NFS_PROGRAM;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000391 nfsvers = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000392
393 /* parse options */
394
395 for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
396 if ((opteq = strchr(opt, '='))) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000397 val = atoi(opteq + 1);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000398 *opteq = '\0';
399 if (!strcmp(opt, "rsize"))
400 data.rsize = val;
401 else if (!strcmp(opt, "wsize"))
402 data.wsize = val;
403 else if (!strcmp(opt, "timeo"))
404 data.timeo = val;
405 else if (!strcmp(opt, "retrans"))
406 data.retrans = val;
407 else if (!strcmp(opt, "acregmin"))
408 data.acregmin = val;
409 else if (!strcmp(opt, "acregmax"))
410 data.acregmax = val;
411 else if (!strcmp(opt, "acdirmin"))
412 data.acdirmin = val;
413 else if (!strcmp(opt, "acdirmax"))
414 data.acdirmax = val;
415 else if (!strcmp(opt, "actimeo")) {
416 data.acregmin = val;
417 data.acregmax = val;
418 data.acdirmin = val;
419 data.acdirmax = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000420 }
421 else if (!strcmp(opt, "retry"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000422 retry = val;
423 else if (!strcmp(opt, "port"))
424 port = val;
425 else if (!strcmp(opt, "mountport"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000426 mountport = val;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000427 else if (!strcmp(opt, "mounthost"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000428 mounthost=xstrndup(opteq+1,
429 strcspn(opteq+1," \t\n\r,"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000430 else if (!strcmp(opt, "mountprog"))
431 mountprog = val;
432 else if (!strcmp(opt, "mountvers"))
433 mountvers = val;
434 else if (!strcmp(opt, "nfsprog"))
435 nfsprog = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000436 else if (!strcmp(opt, "nfsvers") ||
437 !strcmp(opt, "vers"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000438 nfsvers = val;
439 else if (!strcmp(opt, "proto")) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000440 if (!strncmp(opteq+1, "tcp", 3))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000441 tcp = 1;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000442 else if (!strncmp(opteq+1, "udp", 3))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000443 tcp = 0;
444 else
445 printf(_("Warning: Unrecognized proto= option.\n"));
446 } else if (!strcmp(opt, "namlen")) {
447#if NFS_MOUNT_VERSION >= 2
448 if (nfs_mount_version >= 2)
449 data.namlen = val;
450 else
451#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000452 printf(_("Warning: Option namlen is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000453 } else if (!strcmp(opt, "addr"))
Eric Andersenda1d1e72000-07-10 23:39:44 +0000454 /* ignore */;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000455 else {
456 printf(_("unknown nfs mount parameter: "
Eric Andersenda1d1e72000-07-10 23:39:44 +0000457 "%s=%d\n"), opt, val);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000458 goto fail;
459 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000460 }
461 else {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000462 val = 1;
463 if (!strncmp(opt, "no", 2)) {
464 val = 0;
465 opt += 2;
466 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000467 if (!strcmp(opt, "bg"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000468 bg = val;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000469 else if (!strcmp(opt, "fg"))
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000470 bg = !val;
471 else if (!strcmp(opt, "soft"))
472 soft = val;
473 else if (!strcmp(opt, "hard"))
474 soft = !val;
475 else if (!strcmp(opt, "intr"))
476 intr = val;
477 else if (!strcmp(opt, "posix"))
478 posix = val;
479 else if (!strcmp(opt, "cto"))
480 nocto = !val;
481 else if (!strcmp(opt, "ac"))
482 noac = !val;
483 else if (!strcmp(opt, "tcp"))
484 tcp = val;
485 else if (!strcmp(opt, "udp"))
486 tcp = !val;
487 else if (!strcmp(opt, "lock")) {
488 if (nfs_mount_version >= 3)
489 nolock = !val;
490 else
Eric Andersenda1d1e72000-07-10 23:39:44 +0000491 printf(_("Warning: option nolock is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000492 } else {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000493 printf(_("unknown nfs mount option: "
494 "%s%s\n"), val ? "" : "no", opt);
495 goto fail;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000496 }
497 }
498 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000499 proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP;
500
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000501 data.flags = (soft ? NFS_MOUNT_SOFT : 0)
502 | (intr ? NFS_MOUNT_INTR : 0)
503 | (posix ? NFS_MOUNT_POSIX : 0)
504 | (nocto ? NFS_MOUNT_NOCTO : 0)
505 | (noac ? NFS_MOUNT_NOAC : 0);
506#if NFS_MOUNT_VERSION >= 2
507 if (nfs_mount_version >= 2)
508 data.flags |= (tcp ? NFS_MOUNT_TCP : 0);
509#endif
510#if NFS_MOUNT_VERSION >= 3
511 if (nfs_mount_version >= 3)
512 data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
513#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000514 if (nfsvers > MAX_NFSPROT) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000515 error_msg("NFSv%d not supported!\n", nfsvers);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000516 return 0;
517 }
518 if (mountvers > MAX_NFSPROT) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000519 error_msg("NFSv%d not supported!\n", nfsvers);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000520 return 0;
521 }
522 if (nfsvers && !mountvers)
523 mountvers = (nfsvers < 3) ? 1 : nfsvers;
524 if (nfsvers && nfsvers < mountvers) {
525 mountvers = nfsvers;
526 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000527
528 /* Adjust options if none specified */
529 if (!data.timeo)
530 data.timeo = tcp ? 70 : 7;
531
532#ifdef NFS_MOUNT_DEBUG
533 printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000534 data.rsize, data.wsize, data.timeo, data.retrans);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000535 printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000536 data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000537 printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000538 port, bg, retry, data.flags);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000539 printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000540 mountprog, mountvers, nfsprog, nfsvers);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000541 printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000542 (data.flags & NFS_MOUNT_SOFT) != 0,
543 (data.flags & NFS_MOUNT_INTR) != 0,
544 (data.flags & NFS_MOUNT_POSIX) != 0,
545 (data.flags & NFS_MOUNT_NOCTO) != 0,
546 (data.flags & NFS_MOUNT_NOAC) != 0);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000547#if NFS_MOUNT_VERSION >= 2
Eric Andersenda1d1e72000-07-10 23:39:44 +0000548 printf("tcp = %d\n",
549 (data.flags & NFS_MOUNT_TCP) != 0);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000550#endif
551#endif
552
553 data.version = nfs_mount_version;
554 *mount_opts = (char *) &data;
555
556 if (*flags & MS_REMOUNT)
557 return 0;
558
559 /*
560 * If the previous mount operation on the same host was
561 * backgrounded, and the "bg" for this mount is also set,
562 * give up immediately, to avoid the initial timeout.
563 */
564 if (bg && !running_bg &&
Eric Andersenda1d1e72000-07-10 23:39:44 +0000565 prev_bg_host && strcmp(hostname, prev_bg_host) == 0) {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000566 if (retry > 0)
567 retval = EX_BG;
568 return retval;
569 }
570
571 /* create mount deamon client */
572 /* See if the nfs host = mount host. */
573 if (mounthost) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000574 if (mounthost[0] >= '0' && mounthost[0] <= '9') {
575 mount_server_addr.sin_family = AF_INET;
576 mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
577 } else {
578 if ((hp = gethostbyname(mounthost)) == NULL) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000579 error_msg("can't get address for %s\n", hostname);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000580 goto fail;
581 } else {
582 if (hp->h_length > sizeof(struct in_addr)) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000583 error_msg("got bad hp->h_length?\n");
Eric Andersenda1d1e72000-07-10 23:39:44 +0000584 hp->h_length = sizeof(struct in_addr);
585 }
586 mount_server_addr.sin_family = AF_INET;
587 memcpy(&mount_server_addr.sin_addr,
588 hp->h_addr, hp->h_length);
589 }
590 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000591 }
592
593 /*
594 * The following loop implements the mount retries. On the first
595 * call, "running_bg" is 0. When the mount times out, and the
596 * "bg" option is set, the exit status EX_BG will be returned.
597 * For a backgrounded mount, there will be a second call by the
598 * child process with "running_bg" set to 1.
599 *
600 * The case where the mount point is not present and the "bg"
601 * option is set, is treated as a timeout. This is done to
602 * support nested mounts.
603 *
604 * The "retry" count specified by the user is the number of
605 * minutes to retry before giving up.
606 *
607 * Only the first error message will be displayed.
608 */
609 retry_timeout.tv_sec = 3;
610 retry_timeout.tv_usec = 0;
611 total_timeout.tv_sec = 20;
612 total_timeout.tv_usec = 0;
613 timeout = time(NULL) + 60 * retry;
614 prevt = 0;
615 t = 30;
616 val = 1;
617 for (;;) {
618 if (bg && stat(node, &statbuf) == -1) {
619 if (running_bg) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000620 sleep(val); /* 1, 2, 4, 8, 16, 30, ... */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000621 val *= 2;
622 if (val > 30)
623 val = 30;
624 }
625 } else {
626 /* be careful not to use too many CPU cycles */
627 if (t - prevt < 30)
628 sleep(30);
629
Eric Andersenda1d1e72000-07-10 23:39:44 +0000630 pm_mnt = get_mountport(&mount_server_addr,
631 mountprog,
632 mountvers,
633 proto,
634 mountport);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000635
Eric Andersenda1d1e72000-07-10 23:39:44 +0000636 /* contact the mount daemon via TCP */
637 mount_server_addr.sin_port = htons(pm_mnt->pm_port);
638 msock = RPC_ANYSOCK;
639
640 switch (pm_mnt->pm_prot) {
641 case IPPROTO_UDP:
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000642 mclient = clntudp_create(&mount_server_addr,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000643 pm_mnt->pm_prog,
644 pm_mnt->pm_vers,
645 retry_timeout,
646 &msock);
647 if (mclient)
648 break;
649 mount_server_addr.sin_port = htons(pm_mnt->pm_port);
650 msock = RPC_ANYSOCK;
651 case IPPROTO_TCP:
652 mclient = clnttcp_create(&mount_server_addr,
653 pm_mnt->pm_prog,
654 pm_mnt->pm_vers,
655 &msock, 0, 0);
656 break;
657 default:
658 mclient = 0;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000659 }
660 if (mclient) {
661 /* try to mount hostname:dirname */
662 mclient->cl_auth = authunix_create_default();
Eric Andersenda1d1e72000-07-10 23:39:44 +0000663
664 /* make pointers in xdr_mountres3 NULL so
665 * that xdr_array allocates memory for us
666 */
667 memset(&status, 0, sizeof(status));
668
669 if (pm_mnt->pm_vers == 3)
670 clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT,
671 (xdrproc_t) xdr_dirpath,
672 (caddr_t) &dirname,
673 (xdrproc_t) xdr_mountres3,
674 (caddr_t) &status,
675 total_timeout);
676 else
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000677 clnt_stat = clnt_call(mclient, MOUNTPROC_MNT,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000678 (xdrproc_t) xdr_dirpath,
679 (caddr_t) &dirname,
680 (xdrproc_t) xdr_fhstatus,
681 (caddr_t) &status,
682 total_timeout);
683
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000684 if (clnt_stat == RPC_SUCCESS)
685 break; /* we're done */
686 if (errno != ECONNREFUSED) {
687 clnt_perror(mclient, "mount");
688 goto fail; /* don't retry */
689 }
690 if (!running_bg && prevt == 0)
691 clnt_perror(mclient, "mount");
692 auth_destroy(mclient->cl_auth);
693 clnt_destroy(mclient);
694 mclient = 0;
695 close(msock);
696 } else {
697 if (!running_bg && prevt == 0)
698 clnt_pcreateerror("mount");
699 }
700 prevt = t;
701 }
702 if (!bg)
Eric Andersenda1d1e72000-07-10 23:39:44 +0000703 goto fail;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000704 if (!running_bg) {
705 prev_bg_host = xstrdup(hostname);
706 if (retry > 0)
707 retval = EX_BG;
708 goto fail;
709 }
710 t = time(NULL);
711 if (t >= timeout)
712 goto fail;
713 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000714 nfsvers = (pm_mnt->pm_vers < 2) ? 2 : pm_mnt->pm_vers;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000715
Eric Andersenda1d1e72000-07-10 23:39:44 +0000716 if (nfsvers == 2) {
717 if (status.nfsv2.fhs_status != 0) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000718 error_msg("%s:%s failed, reason given by server: %s\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000719 hostname, dirname,
720 nfs_strerror(status.nfsv2.fhs_status));
721 goto fail;
722 }
723 memcpy(data.root.data,
724 (char *) status.nfsv2.fhstatus_u.fhs_fhandle,
725 NFS_FHSIZE);
726#if NFS_MOUNT_VERSION >= 4
727 data.root.size = NFS_FHSIZE;
728 memcpy(data.old_root.data,
729 (char *) status.nfsv2.fhstatus_u.fhs_fhandle,
730 NFS_FHSIZE);
731#endif
732 } else {
733#if NFS_MOUNT_VERSION >= 4
734 fhandle3 *fhandle;
735 if (status.nfsv3.fhs_status != 0) {
Mark Whitleyf57c9442000-12-07 19:56:48 +0000736 error_msg("%s:%s failed, reason given by server: %s\n",
Eric Andersenda1d1e72000-07-10 23:39:44 +0000737 hostname, dirname,
738 nfs_strerror(status.nfsv3.fhs_status));
739 goto fail;
740 }
741 fhandle = &status.nfsv3.mountres3_u.mountinfo.fhandle;
742 memset(data.old_root.data, 0, NFS_FHSIZE);
743 memset(&data.root, 0, sizeof(data.root));
744 data.root.size = fhandle->fhandle3_len;
745 memcpy(data.root.data,
746 (char *) fhandle->fhandle3_val,
747 fhandle->fhandle3_len);
748
749 data.flags |= NFS_MOUNT_VER3;
750#endif
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000751 }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000752
753 /* create nfs socket for kernel */
754
755 if (tcp) {
756 if (nfs_mount_version < 3) {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000757 printf(_("NFS over TCP is not supported.\n"));
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000758 goto fail;
759 }
760 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
761 } else
762 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
763 if (fsock < 0) {
764 perror(_("nfs socket"));
765 goto fail;
766 }
767 if (bindresvport(fsock, 0) < 0) {
768 perror(_("nfs bindresvport"));
769 goto fail;
770 }
771 if (port == 0) {
772 server_addr.sin_port = PMAPPORT;
773 port = pmap_getport(&server_addr, nfsprog, nfsvers,
Eric Andersenda1d1e72000-07-10 23:39:44 +0000774 tcp ? IPPROTO_TCP : IPPROTO_UDP);
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000775 if (port == 0)
776 port = NFS_PORT;
777#ifdef NFS_MOUNT_DEBUG
778 else
779 printf(_("used portmapper to find NFS port\n"));
780#endif
781 }
782#ifdef NFS_MOUNT_DEBUG
783 printf(_("using port %d for nfs deamon\n"), port);
784#endif
785 server_addr.sin_port = htons(port);
Eric Andersenda1d1e72000-07-10 23:39:44 +0000786 /*
787 * connect() the socket for kernels 1.3.10 and below only,
788 * to avoid problems with multihomed hosts.
789 * --Swen
790 */
Eric Andersenef936da2000-10-30 17:22:04 +0000791 if (get_kernel_revision() <= 66314
Eric Andersenda1d1e72000-07-10 23:39:44 +0000792 && connect(fsock, (struct sockaddr *) &server_addr,
793 sizeof (server_addr)) < 0) {
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000794 perror(_("nfs connect"));
795 goto fail;
796 }
797
798 /* prepare data structure for kernel */
799
800 data.fd = fsock;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000801 memcpy((char *) &data.addr, (char *) &server_addr, sizeof(data.addr));
802 strncpy(data.hostname, hostname, sizeof(data.hostname));
803
804 /* clean up */
805
806 auth_destroy(mclient->cl_auth);
807 clnt_destroy(mclient);
808 close(msock);
809 return 0;
810
811 /* abort */
812
Eric Andersenda1d1e72000-07-10 23:39:44 +0000813fail:
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000814 if (msock != -1) {
815 if (mclient) {
816 auth_destroy(mclient->cl_auth);
817 clnt_destroy(mclient);
818 }
819 close(msock);
820 }
821 if (fsock != -1)
822 close(fsock);
823 return retval;
Eric Andersenda1d1e72000-07-10 23:39:44 +0000824}
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000825
826/*
827 * We need to translate between nfs status return values and
828 * the local errno values which may not be the same.
829 *
830 * Andreas Schwab <schwab@LS5.informatik.uni-dortmund.de>: change errno:
831 * "after #include <errno.h> the symbol errno is reserved for any use,
832 * it cannot even be used as a struct tag or field name".
833 */
834
835#ifndef EDQUOT
836#define EDQUOT ENOSPC
837#endif
838
839static struct {
840 enum nfs_stat stat;
841 int errnum;
842} nfs_errtbl[] = {
Eric Andersenda1d1e72000-07-10 23:39:44 +0000843 { NFS_OK, 0 },
844 { NFSERR_PERM, EPERM },
845 { NFSERR_NOENT, ENOENT },
846 { NFSERR_IO, EIO },
847 { NFSERR_NXIO, ENXIO },
848 { NFSERR_ACCES, EACCES },
849 { NFSERR_EXIST, EEXIST },
850 { NFSERR_NODEV, ENODEV },
851 { NFSERR_NOTDIR, ENOTDIR },
852 { NFSERR_ISDIR, EISDIR },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000853#ifdef NFSERR_INVAL
Eric Andersenda1d1e72000-07-10 23:39:44 +0000854 { NFSERR_INVAL, EINVAL }, /* that Sun forgot */
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000855#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000856 { NFSERR_FBIG, EFBIG },
857 { NFSERR_NOSPC, ENOSPC },
858 { NFSERR_ROFS, EROFS },
859 { NFSERR_NAMETOOLONG, ENAMETOOLONG },
860 { NFSERR_NOTEMPTY, ENOTEMPTY },
861 { NFSERR_DQUOT, EDQUOT },
862 { NFSERR_STALE, ESTALE },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000863#ifdef EWFLUSH
Eric Andersenda1d1e72000-07-10 23:39:44 +0000864 { NFSERR_WFLUSH, EWFLUSH },
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000865#endif
Eric Andersenda1d1e72000-07-10 23:39:44 +0000866 /* Throw in some NFSv3 values for even more fun (HP returns these) */
867 { 71, EREMOTE },
868
869 { -1, EIO }
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000870};
871
872static char *nfs_strerror(int stat)
873{
874 int i;
875 static char buf[256];
876
877 for (i = 0; nfs_errtbl[i].stat != -1; i++) {
878 if (nfs_errtbl[i].stat == stat)
879 return strerror(nfs_errtbl[i].errnum);
880 }
881 sprintf(buf, _("unknown nfs status return value: %d"), stat);
882 return buf;
883}
884
Eric Andersenda1d1e72000-07-10 23:39:44 +0000885bool_t
886xdr_fhandle (XDR *xdrs, fhandle objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000887{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000888 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000889
Eric Andersenda1d1e72000-07-10 23:39:44 +0000890 if (!xdr_opaque (xdrs, objp, FHSIZE))
891 return FALSE;
892 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000893}
894
Eric Andersenda1d1e72000-07-10 23:39:44 +0000895bool_t
896xdr_fhstatus (XDR *xdrs, fhstatus *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000897{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000898 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000899
Eric Andersenda1d1e72000-07-10 23:39:44 +0000900 if (!xdr_u_int (xdrs, &objp->fhs_status))
901 return FALSE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000902 switch (objp->fhs_status) {
903 case 0:
Eric Andersenda1d1e72000-07-10 23:39:44 +0000904 if (!xdr_fhandle (xdrs, objp->fhstatus_u.fhs_fhandle))
905 return FALSE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000906 break;
907 default:
908 break;
909 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000910 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000911}
912
Eric Andersenda1d1e72000-07-10 23:39:44 +0000913bool_t
914xdr_dirpath (XDR *xdrs, dirpath *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000915{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000916 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000917
Eric Andersenda1d1e72000-07-10 23:39:44 +0000918 if (!xdr_string (xdrs, objp, MNTPATHLEN))
919 return FALSE;
920 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000921}
922
Eric Andersenda1d1e72000-07-10 23:39:44 +0000923bool_t
924xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000925{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000926 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000927
Eric Andersenda1d1e72000-07-10 23:39:44 +0000928 if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, FHSIZE3))
929 return FALSE;
930 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000931}
932
Eric Andersenda1d1e72000-07-10 23:39:44 +0000933bool_t
934xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000935{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000936 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000937
Eric Andersenda1d1e72000-07-10 23:39:44 +0000938 if (!xdr_fhandle3 (xdrs, &objp->fhandle))
939 return FALSE;
940 if (!xdr_array (xdrs, (char **)&objp->auth_flavours.auth_flavours_val, (u_int *) &objp->auth_flavours.auth_flavours_len, ~0,
941 sizeof (int), (xdrproc_t) xdr_int))
942 return FALSE;
943 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000944}
945
Eric Andersenda1d1e72000-07-10 23:39:44 +0000946bool_t
947xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000948{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000949 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000950
Eric Andersenda1d1e72000-07-10 23:39:44 +0000951 if (!xdr_enum (xdrs, (enum_t *) objp))
952 return FALSE;
953 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000954}
955
Eric Andersenda1d1e72000-07-10 23:39:44 +0000956bool_t
957xdr_mountres3 (XDR *xdrs, mountres3 *objp)
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000958{
Eric Andersenda1d1e72000-07-10 23:39:44 +0000959 //register int32_t *buf;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000960
Eric Andersenda1d1e72000-07-10 23:39:44 +0000961 if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
962 return FALSE;
963 switch (objp->fhs_status) {
964 case MNT_OK:
965 if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
966 return FALSE;
967 break;
968 default:
969 break;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000970 }
Eric Andersenda1d1e72000-07-10 23:39:44 +0000971 return TRUE;
Eric Andersen1c43d0c1999-11-18 07:58:07 +0000972}
973