Merge lp:~logan/ubuntu/quantal/nfs-utils/debian-merge into lp:ubuntu/quantal/nfs-utils

Proposed by Logan Rosen
Status: Merged
Merged at revision: 59
Proposed branch: lp:~logan/ubuntu/quantal/nfs-utils/debian-merge
Merge into: lp:ubuntu/quantal/nfs-utils
Diff against target: 4328 lines (+58/-3989)
29 files modified
.pc/.quilt_patches (+1/-0)
.pc/.quilt_series (+1/-0)
.pc/01-sm-notify-in-sbin.patch/utils/statd/statd.c (+0/-493)
.pc/02-524255-manpages.patch/utils/exportfs/nfsd.man (+0/-206)
.pc/02-524255-manpages.patch/utils/nfsd/nfsd.man (+0/-105)
.pc/03-handle-mtab-symlink.patch/utils/mount/fstab.c (+0/-649)
.pc/03-handle-mtab-symlink.patch/utils/mount/fstab.h (+0/-31)
.pc/03-handle-mtab-symlink.patch/utils/mount/mount.c (+0/-550)
.pc/11-532048-reduce-verbosity.patch/utils/gssd/gss_util.c (+0/-341)
.pc/11-532048-reduce-verbosity.patch/utils/gssd/gssd_proc.c (+0/-1241)
.pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils/mount/mount.nfs.man (+0/-86)
.pc/17-multiarch-kerberos-paths.patch/aclocal/kerberos5.m4 (+0/-115)
.pc/18-osd_login-sbindir.patch/utils/osd_login/Makefile.am (+0/-12)
.pc/19-iscsiadm-path.patch/utils/osd_login/osd_login (+0/-118)
.pc/applied-patches (+0/-8)
aclocal/kerberos5.m4 (+0/-2)
debian/changelog (+27/-0)
debian/nfs-kernel-server.init (+7/-1)
utils/exportfs/nfsd.man (+0/-1)
utils/gssd/gss_util.c (+1/-1)
utils/gssd/gssd_proc.c (+3/-3)
utils/mount/fstab.c (+1/-1)
utils/mount/fstab.h (+0/-1)
utils/mount/mount.c (+0/-7)
utils/mount/mount.nfs.man (+4/-8)
utils/nfsd/nfsd.man (+0/-1)
utils/osd_login/Makefile.am (+8/-5)
utils/osd_login/osd_login (+4/-2)
utils/statd/statd.c (+1/-1)
To merge this branch: bzr merge lp:~logan/ubuntu/quantal/nfs-utils/debian-merge
Reviewer Review Type Date Requested Status
Luke Yelavich (community) Approve
Ubuntu branches Pending
Review via email: mp+118261@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Luke Yelavich (themuso) wrote :

Thanks for your work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.pc/.quilt_patches'
2--- .pc/.quilt_patches 1970-01-01 00:00:00 +0000
3+++ .pc/.quilt_patches 2012-08-05 05:01:18 +0000
4@@ -0,0 +1,1 @@
5+debian/patches
6
7=== added file '.pc/.quilt_series'
8--- .pc/.quilt_series 1970-01-01 00:00:00 +0000
9+++ .pc/.quilt_series 2012-08-05 05:01:18 +0000
10@@ -0,0 +1,1 @@
11+series
12
13=== removed directory '.pc/01-sm-notify-in-sbin.patch'
14=== removed directory '.pc/01-sm-notify-in-sbin.patch/utils'
15=== removed directory '.pc/01-sm-notify-in-sbin.patch/utils/statd'
16=== removed file '.pc/01-sm-notify-in-sbin.patch/utils/statd/statd.c'
17--- .pc/01-sm-notify-in-sbin.patch/utils/statd/statd.c 2010-04-06 16:11:22 +0000
18+++ .pc/01-sm-notify-in-sbin.patch/utils/statd/statd.c 1970-01-01 00:00:00 +0000
19@@ -1,493 +0,0 @@
20-/*
21- * Copyright (C) 1995, 1997-1999 Jeffrey A. Uphoff
22- * Modified by Olaf Kirch, Oct. 1996.
23- * Modified by H.J. Lu, 1998.
24- * Modified by L. Hohberger of Mission Critical Linux, 2000.
25- *
26- * NSM for Linux.
27- */
28-
29-#ifdef HAVE_CONFIG_H
30-#include <config.h>
31-#endif
32-
33-#include <sys/stat.h>
34-#include <limits.h>
35-#include <signal.h>
36-#include <unistd.h>
37-#include <fcntl.h>
38-#include <errno.h>
39-#include <string.h>
40-#include <getopt.h>
41-#include <rpc/rpc.h>
42-#include <rpc/pmap_clnt.h>
43-#include <rpcmisc.h>
44-#include <sys/resource.h>
45-#include <sys/wait.h>
46-#include <grp.h>
47-
48-#include "statd.h"
49-#include "nfslib.h"
50-#include "nsm.h"
51-
52-/* Socket operations */
53-#include <sys/types.h>
54-#include <sys/socket.h>
55-
56-int run_mode = 0; /* foreground logging mode */
57-
58-/* LH - I had these local to main, but it seemed silly to have
59- * two copies of each - one in main(), one static in log.c...
60- * It also eliminates the 256-char static in log.c */
61-static char *name_p = NULL;
62-
63-/* PRC: a high-availability callout program can be specified with -H
64- * When this is done, the program will receive callouts whenever clients
65- * are added or deleted to the notify list */
66-char *ha_callout_prog = NULL;
67-
68-static struct option longopts[] =
69-{
70- { "foreground", 0, 0, 'F' },
71- { "no-syslog", 0, 0, 'd' },
72- { "help", 0, 0, 'h' },
73- { "version", 0, 0, 'v' },
74- { "outgoing-port", 1, 0, 'o' },
75- { "port", 1, 0, 'p' },
76- { "name", 1, 0, 'n' },
77- { "state-directory-path", 1, 0, 'P' },
78- { "notify-mode", 0, 0, 'N' },
79- { "ha-callout", 1, 0, 'H' },
80- { "no-notify", 0, 0, 'L' },
81- { NULL, 0, 0, 0 }
82-};
83-
84-extern void sm_prog_1 (struct svc_req *, register SVCXPRT *);
85-
86-#ifdef SIMULATIONS
87-extern void simulator (int, char **);
88-#endif
89-
90-
91-#ifdef HAVE_TCP_WRAPPER
92-#include "tcpwrapper.h"
93-
94-static void
95-sm_prog_1_wrapper (struct svc_req *rqstp, register SVCXPRT *transp)
96-{
97- /* remote host authorization check */
98- if (!check_default("statd", nfs_getrpccaller(transp), SM_PROG)) {
99- svcerr_auth (transp, AUTH_FAILED);
100- return;
101- }
102-
103- sm_prog_1 (rqstp, transp);
104-}
105-
106-#define sm_prog_1 sm_prog_1_wrapper
107-#endif
108-
109-static void
110-statd_unregister(void) {
111- nfs_svc_unregister(SM_PROG, SM_VERS);
112-}
113-
114-/*
115- * Signal handler.
116- */
117-static void
118-killer (int sig)
119-{
120- statd_unregister ();
121- xlog_err ("Caught signal %d, un-registering and exiting", sig);
122-}
123-
124-static void
125-sigusr (int sig)
126-{
127- extern void my_svc_exit (void);
128- xlog(D_GENERAL, "Caught signal %d, re-notifying (state %d)", sig,
129- MY_STATE);
130- my_svc_exit();
131-}
132-
133-/*
134- * Startup information.
135- */
136-static void log_modes(void)
137-{
138- char buf[128]; /* watch stack size... */
139-
140- /* No flags = no message */
141- if (!run_mode) return;
142-
143- memset(buf,0,128);
144- sprintf(buf,"Flags: ");
145- if (run_mode & MODE_NODAEMON)
146- strcat(buf,"No-Daemon ");
147- if (run_mode & MODE_LOG_STDERR)
148- strcat(buf,"Log-STDERR ");
149-#ifdef HAVE_LIBTIRPC
150- strcat(buf, "TI-RPC ");
151-#endif
152-
153- xlog_warn(buf);
154-}
155-
156-/*
157- * Since we do more than standard statd stuff, we might need to
158- * help the occasional admin.
159- */
160-static void
161-usage(void)
162-{
163- fprintf(stderr,"usage: %s [options]\n", name_p);
164- fprintf(stderr," -h, -?, --help Print this help screen.\n");
165- fprintf(stderr," -F, --foreground Foreground (no-daemon mode)\n");
166- fprintf(stderr," -d, --no-syslog Verbose logging to stderr. Foreground mode only.\n");
167- fprintf(stderr," -p, --port Port to listen on\n");
168- fprintf(stderr," -o, --outgoing-port Port for outgoing connections\n");
169- fprintf(stderr," -V, -v, --version Display version information and exit.\n");
170- fprintf(stderr," -n, --name Specify a local hostname.\n");
171- fprintf(stderr," -P State directory path.\n");
172- fprintf(stderr," -N Run in notify only mode.\n");
173- fprintf(stderr," -L, --no-notify Do not perform any notification.\n");
174- fprintf(stderr," -H Specify a high-availability callout program.\n");
175-}
176-
177-static const char *pidfile = "/var/run/rpc.statd.pid";
178-
179-int pidfd = -1;
180-static void create_pidfile(void)
181-{
182- FILE *fp;
183-
184- unlink(pidfile);
185- fp = fopen(pidfile, "w");
186- if (!fp)
187- xlog_err("Opening %s failed: %m\n", pidfile);
188- fprintf(fp, "%d\n", getpid());
189- pidfd = dup(fileno(fp));
190- if (fclose(fp) < 0) {
191- xlog_warn("Flushing pid file failed: errno %d (%m)\n",
192- errno);
193- }
194-}
195-
196-static void truncate_pidfile(void)
197-{
198- if (pidfd >= 0) {
199- if (ftruncate(pidfd, 0) < 0) {
200- xlog_warn("truncating pid file failed: errno %d (%m)\n",
201- errno);
202- }
203- }
204-}
205-
206-static void run_sm_notify(int outport)
207-{
208- char op[20];
209- char *av[6];
210- int ac = 0;
211-
212- av[ac++] = "/usr/sbin/sm-notify";
213- if (run_mode & MODE_NODAEMON)
214- av[ac++] = "-d";
215- if (outport) {
216- sprintf(op, "-p%d", outport);
217- av[ac++] = op;
218- }
219- if (run_mode & STATIC_HOSTNAME) {
220- av[ac++] = "-v";
221- av[ac++] = MY_NAME;
222- }
223- av[ac] = NULL;
224- execv(av[0], av);
225- fprintf(stderr, "%s: failed to run %s\n", name_p, av[0]);
226- exit(2);
227-
228-}
229-/*
230- * Entry routine/main loop.
231- */
232-int main (int argc, char **argv)
233-{
234- extern char *optarg;
235- int pid;
236- int arg;
237- int port = 0, out_port = 0;
238- struct rlimit rlim;
239-
240- int pipefds[2] = { -1, -1};
241- char status;
242-
243- /* Default: daemon mode, no other options */
244- run_mode = 0;
245- xlog_stderr(0);
246- xlog_syslog(1);
247-
248- /* Set the basename */
249- if ((name_p = strrchr(argv[0],'/')) != NULL) {
250- name_p ++;
251- } else {
252- name_p = argv[0];
253- }
254-
255- /* Set hostname */
256- MY_NAME = NULL;
257-
258- /* Process command line switches */
259- while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) {
260- switch (arg) {
261- case 'V': /* Version */
262- case 'v':
263- printf("%s version " VERSION "\n",name_p);
264- exit(0);
265- case 'F': /* Foreground/nodaemon mode */
266- run_mode |= MODE_NODAEMON;
267- break;
268- case 'N':
269- run_mode |= MODE_NOTIFY_ONLY;
270- break;
271- case 'L': /* Listen only */
272- run_mode |= MODE_NO_NOTIFY;
273- break;
274- case 'd': /* No daemon only - log to stderr */
275- run_mode |= MODE_LOG_STDERR;
276- break;
277- case 'o':
278- out_port = atoi(optarg);
279- if (out_port < 1 || out_port > 65535) {
280- fprintf(stderr, "%s: bad port number: %s\n",
281- argv[0], optarg);
282- usage();
283- exit(1);
284- }
285- break;
286- case 'p':
287- port = atoi(optarg);
288- if (port < 1 || port > 65535) {
289- fprintf(stderr, "%s: bad port number: %s\n",
290- argv[0], optarg);
291- usage();
292- exit(1);
293- }
294- break;
295- case 'n': /* Specify local hostname */
296- run_mode |= STATIC_HOSTNAME;
297- MY_NAME = xstrdup(optarg);
298- break;
299- case 'P':
300- if (!nsm_setup_pathnames(argv[0], optarg))
301- exit(1);
302- break;
303- case 'H': /* PRC: specify the ha-callout program */
304- if ((ha_callout_prog = xstrdup(optarg)) == NULL) {
305- fprintf(stderr, "%s: xstrdup(%s) failed!\n",
306- argv[0], optarg);
307- exit(1);
308- }
309- break;
310- case '?': /* heeeeeelllllllpppp? heh */
311- case 'h':
312- usage();
313- exit (0);
314- default: /* oh dear ... heh */
315- usage();
316- exit(-1);
317- }
318- }
319-
320- if (port == out_port && port != 0) {
321- fprintf(stderr, "Listening and outgoing ports cannot be the same!\n");
322- exit(-1);
323- }
324-
325- if (run_mode & MODE_NOTIFY_ONLY) {
326- fprintf(stderr, "%s: -N deprecated, consider using /usr/sbin/sm-notify directly\n",
327- name_p);
328- run_sm_notify(out_port);
329- }
330-
331- if (!(run_mode & MODE_NODAEMON)) {
332- run_mode &= ~MODE_LOG_STDERR; /* Never log to console in
333- daemon mode. */
334- }
335-
336- if (getrlimit (RLIMIT_NOFILE, &rlim) != 0)
337- fprintf(stderr, "%s: getrlimit (RLIMIT_NOFILE) failed: %s\n",
338- argv [0], strerror(errno));
339- else {
340- /* glibc sunrpc code dies if getdtablesize > FD_SETSIZE */
341- if (rlim.rlim_cur > FD_SETSIZE) {
342- rlim.rlim_cur = FD_SETSIZE;
343-
344- if (setrlimit (RLIMIT_NOFILE, &rlim) != 0) {
345- fprintf(stderr, "%s: setrlimit (RLIMIT_NOFILE) failed: %s\n",
346- argv [0], strerror(errno));
347- }
348- }
349- }
350-
351-#ifdef SIMULATIONS
352- if (argc > 1)
353- /* LH - I _really_ need to update simulator... */
354- simulator (--argc, ++argv); /* simulator() does exit() */
355-#endif
356-
357- if (!(run_mode & MODE_NODAEMON)) {
358- int tempfd;
359-
360- if (pipe(pipefds)<0) {
361- perror("statd: unable to create pipe");
362- exit(1);
363- }
364- if ((pid = fork ()) < 0) {
365- perror ("statd: Could not fork");
366- exit (1);
367- } else if (pid != 0) {
368- /* Parent.
369- * Wait for status from child.
370- */
371- close(pipefds[1]);
372- if (read(pipefds[0], &status, 1) != 1)
373- exit(1);
374- exit (0);
375- }
376- /* Child. */
377- close(pipefds[0]);
378- setsid ();
379-
380- while (pipefds[1] <= 2) {
381- pipefds[1] = dup(pipefds[1]);
382- if (pipefds[1]<0) {
383- perror("statd: dup");
384- exit(1);
385- }
386- }
387- tempfd = open("/dev/null", O_RDWR);
388- dup2(tempfd, 0);
389- dup2(tempfd, 1);
390- dup2(tempfd, 2);
391- dup2(pipefds[1], 3);
392- pipefds[1] = 3;
393- closeall(4);
394- }
395-
396- /* Child. */
397-
398- if (run_mode & MODE_LOG_STDERR) {
399- xlog_syslog(0);
400- xlog_stderr(1);
401- xlog_config(D_ALL, 1);
402- }
403- xlog_open(name_p);
404- xlog(L_NOTICE, "Version " VERSION " starting");
405-
406- log_modes();
407-
408- signal (SIGHUP, killer);
409- signal (SIGINT, killer);
410- signal (SIGTERM, killer);
411- /* PRC: trap SIGUSR1 to re-read notify list from disk */
412- signal(SIGUSR1, sigusr);
413- /* WARNING: the following works on Linux and SysV, but not BSD! */
414- signal(SIGCHLD, SIG_IGN);
415- /*
416- * Ignore SIGPIPE to avoid statd dying when peers close their
417- * TCP connection while we're trying to reply to them.
418- */
419- signal(SIGPIPE, SIG_IGN);
420-
421- create_pidfile();
422- atexit(truncate_pidfile);
423-
424- if (! (run_mode & MODE_NO_NOTIFY))
425- switch (pid = fork()) {
426- case 0:
427- run_sm_notify(out_port);
428- break;
429- case -1:
430- break;
431- default:
432- waitpid(pid, NULL, 0);
433- }
434-
435- /* Make sure we have a privilege port for calling into the kernel */
436- if (statd_get_socket() < 0)
437- exit(1);
438-
439- /* If sm-notify didn't take all the state files, load
440- * state information into our notify-list so we can
441- * pass on any SM_NOTIFY that arrives
442- */
443- load_state();
444-
445- MY_STATE = nsm_get_state(0);
446- if (MY_STATE == 0)
447- exit(1);
448- xlog(D_GENERAL, "Local NSM state number: %d", MY_STATE);
449- nsm_update_kernel_state(MY_STATE);
450-
451- /*
452- * ORDER
453- * Clear old listeners while still root, to override any
454- * permission checking done by rpcbind.
455- */
456- statd_unregister();
457-
458- /*
459- * ORDER
460- */
461- if (!nsm_drop_privileges(pidfd))
462- exit(1);
463-
464- /*
465- * ORDER
466- * Create RPC listeners after dropping privileges. This permits
467- * statd to unregister its own listeners when it exits.
468- */
469- if (nfs_svc_create("statd", SM_PROG, SM_VERS, sm_prog_1, port) == 0) {
470- xlog(L_ERROR, "failed to create RPC listeners, exiting");
471- exit(1);
472- }
473- atexit(statd_unregister);
474-
475- /* If we got this far, we have successfully started, so notify parent */
476- if (pipefds[1] > 0) {
477- status = 0;
478- if (write(pipefds[1], &status, 1) != 1) {
479- xlog_warn("writing to parent pipe failed: errno %d (%s)\n",
480- errno, strerror(errno));
481- }
482- close(pipefds[1]);
483- pipefds[1] = -1;
484- }
485-
486- for (;;) {
487- /*
488- * Handle incoming requests: SM_NOTIFY socket requests, as
489- * well as callbacks from lockd.
490- */
491- my_svc_run(); /* I rolled my own, Olaf made it better... */
492-
493- /* Only get here when simulating a crash so we should probably
494- * start sm-notify running again. As we have already dropped
495- * privileges, this might not work, but I don't think
496- * responding to SM_SIMU_CRASH is an important use cases to
497- * get perfect.
498- */
499- if (! (run_mode & MODE_NO_NOTIFY))
500- switch (pid = fork()) {
501- case 0:
502- run_sm_notify(out_port);
503- break;
504- case -1:
505- break;
506- default:
507- waitpid(pid, NULL, 0);
508- }
509-
510- }
511- return 0;
512-}
513
514=== removed directory '.pc/02-524255-manpages.patch'
515=== removed directory '.pc/02-524255-manpages.patch/utils'
516=== removed directory '.pc/02-524255-manpages.patch/utils/exportfs'
517=== removed file '.pc/02-524255-manpages.patch/utils/exportfs/nfsd.man'
518--- .pc/02-524255-manpages.patch/utils/exportfs/nfsd.man 2012-05-25 20:41:58 +0000
519+++ .pc/02-524255-manpages.patch/utils/exportfs/nfsd.man 1970-01-01 00:00:00 +0000
520@@ -1,206 +0,0 @@
521-.\"
522-.\" nfsd(7) - The nfsd filesystem
523-.\"
524-.\" Copyright (C) 2003 Neil Brown <neilb@cse.unsw.edu.au>
525-.\" Licensed for public use under the terms of the FSF
526-.\" General Public License (GPL) version 2.
527-.TH nfsd 7 "3 July 2003"
528-.SH NAME
529-nfsd \- special filesystem for controlling Linux NFS server
530-.SH SYNPOSIS
531-.B "mount -t nfsd nfsd /proc/fs/nfsd"
532-.SH DESCRIPTION
533-The
534-.B nfsd
535-filesystem is a special filesystem which provides access to the Linux
536-NFS server. The filesystem consists of a single directory which
537-contains a number of files. These files are actually gateways into
538-the NFS server. Writing to them can affect the server. Reading from
539-them can provide information about the server.
540-.P
541-This file system is only available in Linux 2.6 and later series
542-kernels (and in the later parts of the 2.5 development series leading
543-up to 2.6). This man page does not apply to 2.4 and earlier.
544-.P
545-As well as this filesystem, there are a collection of files in the
546-.B procfs
547-filesystem (normally mounted at
548-.BR /proc )
549-which are used to control the NFS server.
550-This manual page describes all of these files.
551-.P
552-The
553-.I exportfs
554-and
555-.I mountd
556-programs (part of the nfs-utils package) expect to find this
557-filesystem mounted at
558-.B /proc/fs/nfsd
559-or
560-.BR /proc/fs/nfs .
561-If it is not mounted, they will fall-back on 2.4 style functionality.
562-This involves accessing the NFS server via a systemcall. This
563-systemcall is scheduled to be removed after the 2.6 kernel series.
564-.SH DETAILS
565-The three files in the
566-.B nfsd
567-filesystem are:
568-.TP
569-.B exports
570-This file contains a list of filesystems that are currently exported
571-and clients that each filesystem is exported to, together with a list
572-of export options for that client/filesystem pair. This is similar
573-to the
574-.B /proc/fs/nfs/exports
575-file in 2.4.
576-One difference is that a client doesn't necessarily correspond to just
577-one host. It can respond to a large collection of hosts that are
578-being treated identically.
579-
580-Each line of the file contains a path name, a client name, and a
581-number of options in parentheses. Any space, tab, newline or
582-back-slash character in the path name or client name will be replaced
583-by a backslash followed by the octal ASCII code for that character.
584-
585-.TP
586-.B threads
587-This file represents the number of
588-.B nfsd
589-thread currently running. Reading it will show the number of
590-threads. Writing an ASCII decimal number will cause the number of
591-threads to be changed (increased or decreased as necessary) to achieve
592-that number.
593-
594-.TP
595-.B filehandle
596-This is a somewhat unusual file in that what is read from it depends
597-on what was just written to it. It provides a transactional interface
598-where a program can open the file, write a request, and read a
599-response. If two separate programs open, write, and read at the same
600-time, their requests will not be mixed up.
601-
602-The request written to
603-.B filehandle
604-should be a client name, a path name, and a number of bytes. This
605-should be followed by a newline, with white-space separating the
606-fields, and octal quoting of special characters.
607-
608-On writing this, the program will be able to read back a filehandle
609-for that path as exported to the given client. The filehandle's length
610-will be at most the number of bytes given.
611-
612-The filehandle will be represented in hex with a leading '\ex'.
613-.PP
614-The directory
615-.B /proc/net/rpc
616-in the
617-.B procfs
618-filesystem contains a number of files and directories.
619-The files contain statistics that can be display using the
620-.I nfsstat
621-program.
622-The directories contain information about various caches that the NFS
623-server maintains to keep track of access permissions that different
624-clients have for different filesystems.
625-The caches are:
626-
627-.TP
628-.B auth.domain
629-This cache maps the name of a client (or domain) to an internal data
630-structure. The only access that is possible is to flush the cache.
631-
632-.TP
633-.B auth.unix.ip
634-This cache contains a mapping from IP address to the name of the
635-authentication domain that the ipaddress should be treated as part of.
636-
637-.TP
638-.B nfsd.export
639-This cache contains a mapping from directory and domain to export
640-options.
641-
642-.TP
643-.B nfsd.fh
644-This cache contains a mapping from domain and a filesystem identifier
645-to a directory. The filesystem identifier is stored in the
646-filehandles and consists of a number indicating the type of identifier
647-and a number of hex bytes indicating the content of the identifier.
648-
649-.PP
650-Each directory representing a cache can hold from 1 to 3 files. They
651-are:
652-.TP
653-.B flush
654-When a number of seconds since epoch (1 Jan 1970) is written to this
655-file, all entries in the cache that were last updated before that file
656-become invalidated and will be flushed out. Writing 1 will flush
657-everything. This is the only file that will always be present.
658-
659-.TP
660-.B content
661-This file, if present, contains a textual representation of ever entry
662-in the cache, one per line. If an entry is still in the cache
663-(because it is actively being used) but has expired or is otherwise
664-invalid, it will be presented as a comment (with a leading hash
665-character).
666-
667-.TP
668-.B channel
669-This file, if present, acts a channel for request from the kernel-based
670-nfs server to be passed to a user-space program for handling.
671-
672-When the kernel needs some information which isn't in the cache, it
673-makes a line appear in the
674-.B channel
675-file giving the key for the information. A user-space program should
676-read this, find the answer, and write a line containing the key, an
677-expiry time, and the content.
678-For example the kernel might make
679-.ti +5
680-nfsd 127.0.0.1
681-.br
682-appear in the
683-.B auth.unix.ip/content
684-file. The user-space program might then write
685-.ti +5
686-nfsd 127.0.0.1 1057206953 localhost
687-.br
688-to indicate that 127.0.0.1 should map to localhost, at least for now.
689-
690-If the program uses select(2) or poll(2) to discover if it can read
691-from the
692-.B channel
693-then it will never see and end-of-file but when all requests have been
694-answered, it will block until another request appears.
695-
696-.PP
697-In the
698-.B /proc
699-filesystem there are 4 files that can be used to enabled extra tracing
700-of nfsd and related code. They are:
701-.in +5
702-.B /proc/sys/sunrpc/nfs_debug
703-.br
704-.B /proc/sys/sunrpc/nfsd_debug
705-.br
706-.B /proc/sys/sunrpc/nlm_debug
707-.br
708-.B /proc/sys/sunrpc/rpc_debug
709-.br
710-.in -5
711-They control tracing for the NFS client, the NFS server, the Network
712-Lock Manager (lockd) and the underlying RPC layer respectively.
713-Decimal numbers can be read from or written to these files. Each
714-number represents a bit-pattern where bits that are set cause certain
715-classes of tracing to be enabled. Consult the kernel header files to
716-find out what number correspond to what tracing.
717-
718-.SH SEE ALSO
719-.BR rpc.nfsd (8),
720-.BR exports (5),
721-.BR nfsstat (8),
722-.BR mountd (8)
723-.BR exportfs (8).
724-
725-.SH AUTHOR
726-NeilBrown
727
728=== removed directory '.pc/02-524255-manpages.patch/utils/nfsd'
729=== removed file '.pc/02-524255-manpages.patch/utils/nfsd/nfsd.man'
730--- .pc/02-524255-manpages.patch/utils/nfsd/nfsd.man 2012-05-25 20:41:58 +0000
731+++ .pc/02-524255-manpages.patch/utils/nfsd/nfsd.man 1970-01-01 00:00:00 +0000
732@@ -1,105 +0,0 @@
733-.\"
734-.\" nfsd(8)
735-.\"
736-.\" Copyright (C) 1999 Olaf Kirch <okir@monad.swb.de>
737-.TH rpc.nfsd 8 "7 Aug 2006"
738-.SH NAME
739-rpc.nfsd \- NFS server process
740-.SH SYNOPSIS
741-.BI "/usr/sbin/rpc.nfsd [" options "]" " "nproc
742-.SH DESCRIPTION
743-The
744-.B rpc.nfsd
745-program implements the user level part of the NFS service. The
746-main functionality is handled by the
747-.B nfsd
748-kernel module. The user space program merely specifies what sort of sockets
749-the kernel service should listen on, what NFS versions it should support, and
750-how many kernel threads it should use.
751-.P
752-The
753-.B rpc.mountd
754-server provides an ancillary service needed to satisfy mount requests
755-by NFS clients.
756-.SH OPTIONS
757-.TP
758-.B \-d " or " \-\-debug
759-enable logging of debugging messages
760-.TP
761-.B \-H " or " \-\-host hostname
762-specify a particular hostname (or address) that NFS requests will
763-be accepted on. By default,
764-.B rpc.nfsd
765-will accept NFS requests on all known network addresses.
766-Note that
767-.B lockd
768-(which performs file locking services for NFS) may still accept
769-request on all known network addresses. This may change in future
770-releases of the Linux Kernel.
771-.TP
772-.B \-p " or " \-\-port port
773-specify a different port to listen on for NFS requests. By default,
774-.B rpc.nfsd
775-will listen on port 2049.
776-.TP
777-.B \-N " or " \-\-no-nfs-version vers
778-This option can be used to request that
779-.B rpc.nfsd
780-does not offer certain versions of NFS. The current version of
781-.B rpc.nfsd
782-can support both NFS version 2,3 and the newer version 4.
783-.TP
784-.B \-s " or " \-\-syslog
785-By default,
786-.B rpc.nfsd
787-logs error messages (and debug messages, if enabled) to stderr. This option makes
788-.B rpc.nfsd
789-log these messages to syslog instead. Note that errors encountered during
790-option processing will still be logged to stderr regardless of this option.
791-.TP
792-.B \-T " or " \-\-no-tcp
793-Disable
794-.B rpc.nfsd
795-from accepting TCP connections from clients.
796-.TP
797-.B \-U " or " \-\-no-udp
798-Disable
799-.B rpc.nfsd
800-from accepting UDP connections from clients.
801-.TP
802-.I nproc
803-specify the number of NFS server threads. By default, just one
804-thread is started. However, for optimum performance several threads
805-should be used. The actual figure depends on the number of and the work
806-load created by the NFS clients, but a useful starting point is
807-8 threads. Effects of modifying that number can be checked using
808-the
809-.BR nfsstat (8)
810-program.
811-.P
812-Note that if the NFS server is already running, then the options for
813-specifying host, port, and protocol will be ignored. The number of
814-processes given will be the only option considered, and the number of
815-active
816-.B nfsd
817-processes will be increased or decreased to match this number.
818-In particular
819-.B rpc.nfsd 0
820-will stop all threads and thus close any open connections.
821-
822-.SH NOTES
823-If the program is built with TI-RPC support, it will enable any protocol and
824-address family combinations that are marked visible in the
825-.B netconfig
826-database.
827-
828-.SH SEE ALSO
829-.BR rpc.mountd (8),
830-.BR exports (5),
831-.BR exportfs (8),
832-.BR rpc.rquotad (8),
833-.BR nfsstat (8),
834-.BR netconfig(5).
835-.SH AUTHOR
836-Olaf Kirch, Bill Hawes, H. J. Lu, G. Allan Morris III,
837-and a host of others.
838
839=== removed directory '.pc/03-handle-mtab-symlink.patch'
840=== removed directory '.pc/03-handle-mtab-symlink.patch/utils'
841=== removed directory '.pc/03-handle-mtab-symlink.patch/utils/mount'
842=== removed file '.pc/03-handle-mtab-symlink.patch/utils/mount/fstab.c'
843--- .pc/03-handle-mtab-symlink.patch/utils/mount/fstab.c 2011-10-02 18:29:53 +0000
844+++ .pc/03-handle-mtab-symlink.patch/utils/mount/fstab.c 1970-01-01 00:00:00 +0000
845@@ -1,649 +0,0 @@
846-/* 1999-02-22 Arkadiusz Miskiewicz <misiek@pld.ORG.PL>
847- * - added Native Language Support
848- * Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
849- * - fixed strerr(errno) in gettext calls
850- *
851- * 2006-06-08 Amit Gud <agud@redhat.com>
852- * - Moved code to nfs-utils/support/nfs from util-linux/mount.
853- */
854-
855-#include <errno.h>
856-#include <stdio.h>
857-#include <fcntl.h>
858-#include <unistd.h>
859-#include <string.h>
860-#include <sys/stat.h>
861-#include <mntent.h>
862-
863-#include "fstab.h"
864-#include "xcommon.h"
865-#include "nfs_mntent.h"
866-#include "nfs_paths.h"
867-#include "nls.h"
868-
869-#define LOCK_TIMEOUT 10
870-#define streq(s, t) (strcmp ((s), (t)) == 0)
871-#define PROC_MOUNTS "/proc/mounts"
872-
873-extern char *progname;
874-extern int verbose;
875-
876-/* Information about mtab. ------------------------------------*/
877-static int have_mtab_info = 0;
878-static int var_mtab_does_not_exist = 0;
879-static int var_mtab_is_a_symlink = 0;
880-
881-static void
882-get_mtab_info(void) {
883- struct stat mtab_stat;
884-
885- if (!have_mtab_info) {
886- if (lstat(MOUNTED, &mtab_stat))
887- var_mtab_does_not_exist = 1;
888- else if (S_ISLNK(mtab_stat.st_mode))
889- var_mtab_is_a_symlink = 1;
890- have_mtab_info = 1;
891- }
892-}
893-
894-void
895-reset_mtab_info(void) {
896- have_mtab_info = 0;
897-}
898-
899-int
900-mtab_does_not_exist(void) {
901- get_mtab_info();
902- return var_mtab_does_not_exist;
903-}
904-
905-static int
906-mtab_is_a_symlink(void) {
907- get_mtab_info();
908- return var_mtab_is_a_symlink;
909-}
910-
911-int
912-mtab_is_writable() {
913- int fd;
914-
915- /* Should we write to /etc/mtab upon an update?
916- Probably not if it is a symlink to /proc/mounts, since that
917- would create a file /proc/mounts in case the proc filesystem
918- is not mounted. */
919- if (mtab_is_a_symlink())
920- return 0;
921-
922- fd = open(MOUNTED, O_RDWR | O_CREAT, 0644);
923- if (fd >= 0) {
924- close(fd);
925- return 1;
926- } else
927- return 0;
928-}
929-
930-/* Contents of mtab and fstab ---------------------------------*/
931-
932-struct mntentchn mounttable;
933-static int got_mtab = 0;
934-struct mntentchn procmounts;
935-static int got_procmounts = 0;
936-struct mntentchn fstab;
937-static int got_fstab = 0;
938-
939-static void read_mounttable(void);
940-static void read_procmounts(void);
941-static void read_fstab(void);
942-
943-static struct mntentchn *
944-mtab_head(void)
945-{
946- if (!got_mtab)
947- read_mounttable();
948- return &mounttable;
949-}
950-
951-static struct mntentchn *
952-procmounts_head(void)
953-{
954- if (!got_procmounts)
955- read_procmounts();
956- return &procmounts;
957-}
958-
959-static struct mntentchn *
960-fstab_head(void)
961-{
962- if (!got_fstab)
963- read_fstab();
964- return &fstab;
965-}
966-
967-#if 0
968-static void
969-my_free(const void *s) {
970- if (s)
971- free((void *) s);
972-}
973-
974-static void
975-discard_mntentchn(struct mntentchn *mc0) {
976- struct mntentchn *mc, *mc1;
977-
978- for (mc = mc0->nxt; mc && mc != mc0; mc = mc1) {
979- mc1 = mc->nxt;
980- my_free(mc->m.mnt_fsname);
981- my_free(mc->m.mnt_dir);
982- my_free(mc->m.mnt_type);
983- my_free(mc->m.mnt_opts);
984- free(mc);
985- }
986-}
987-#endif
988-
989-static void
990-read_mntentchn(mntFILE *mfp, const char *fnam, struct mntentchn *mc0) {
991- struct mntentchn *mc = mc0;
992- struct mntent *mnt;
993-
994- while ((mnt = nfs_getmntent(mfp)) != NULL) {
995- if (!streq(mnt->mnt_type, MNTTYPE_IGNORE)) {
996- mc->nxt = (struct mntentchn *) xmalloc(sizeof(*mc));
997- mc->nxt->prev = mc;
998- mc = mc->nxt;
999- mc->m = *mnt;
1000- mc->nxt = mc0;
1001- }
1002- }
1003- mc0->prev = mc;
1004- if (ferror(mfp->mntent_fp)) {
1005- int errsv = errno;
1006- nfs_error(_("warning: error reading %s: %s"),
1007- fnam, strerror (errsv));
1008- mc0->nxt = mc0->prev = NULL;
1009- }
1010- nfs_endmntent(mfp);
1011-}
1012-
1013-/*
1014- * Read /etc/mtab. If that fails, try /proc/mounts.
1015- * This produces a linked list. The list head mounttable is a dummy.
1016- * Return 0 on success.
1017- */
1018-static void
1019-read_mounttable() {
1020- mntFILE *mfp;
1021- const char *fnam;
1022- struct mntentchn *mc = &mounttable;
1023-
1024- got_mtab = 1;
1025- mc->nxt = mc->prev = NULL;
1026-
1027- fnam = MOUNTED;
1028- mfp = nfs_setmntent (fnam, "r");
1029- if (mfp == NULL || mfp->mntent_fp == NULL) {
1030- int errsv = errno;
1031- fnam = PROC_MOUNTS;
1032- mfp = nfs_setmntent (fnam, "r");
1033- if (mfp == NULL || mfp->mntent_fp == NULL) {
1034- nfs_error(_("warning: can't open %s: %s"),
1035- MOUNTED, strerror (errsv));
1036- return;
1037- }
1038- if (verbose)
1039- printf(_("%s: could not open %s; using %s instead\n"),
1040- progname, MOUNTED, PROC_MOUNTS);
1041- }
1042- read_mntentchn(mfp, fnam, mc);
1043-}
1044-
1045-/*
1046- * Read /proc/mounts.
1047- * This produces a linked list. The list head procmounts is a dummy.
1048- * Return 0 on success.
1049- */
1050-static void
1051-read_procmounts() {
1052- mntFILE *mfp;
1053- const char *fnam;
1054- struct mntentchn *mc = &procmounts;
1055-
1056- got_procmounts = 1;
1057- mc->nxt = mc->prev = NULL;
1058-
1059- fnam = PROC_MOUNTS;
1060- mfp = nfs_setmntent(fnam, "r");
1061- if (mfp == NULL || mfp->mntent_fp == NULL) {
1062- nfs_error(_("warning: can't open %s: %s"),
1063- PROC_MOUNTS, strerror (errno));
1064- return;
1065- }
1066- read_mntentchn(mfp, fnam, mc);
1067-}
1068-
1069-static void
1070-read_fstab()
1071-{
1072- mntFILE *mfp = NULL;
1073- const char *fnam;
1074- struct mntentchn *mc = &fstab;
1075-
1076- got_fstab = 1;
1077- mc->nxt = mc->prev = NULL;
1078-
1079- fnam = _PATH_FSTAB;
1080- mfp = nfs_setmntent (fnam, "r");
1081- if (mfp == NULL || mfp->mntent_fp == NULL) {
1082- int errsv = errno;
1083- nfs_error(_("warning: can't open %s: %s"),
1084- _PATH_FSTAB, strerror (errsv));
1085- return;
1086- }
1087- read_mntentchn(mfp, fnam, mc);
1088-}
1089-
1090-/*
1091- * Given the directory name NAME, and the place MCPREV we found it last time,
1092- * try to find more occurrences.
1093- */
1094-struct mntentchn *
1095-getmntdirbackward (const char *name, struct mntentchn *mcprev) {
1096- struct mntentchn *mc, *mc0;
1097-
1098- mc0 = mtab_head();
1099- if (!mcprev)
1100- mcprev = mc0;
1101- for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
1102- if (streq(mc->m.mnt_dir, name))
1103- return mc;
1104- return NULL;
1105-}
1106-
1107-/*
1108- * Given the directory name NAME, and the place MCPREV we found it last time,
1109- * try to find more occurrences.
1110- */
1111-struct mntentchn *
1112-getprocmntdirbackward (const char *name, struct mntentchn *mcprev) {
1113- struct mntentchn *mc, *mc0;
1114-
1115- mc0 = procmounts_head();
1116- if (!mcprev)
1117- mcprev = mc0;
1118- for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
1119- if (streq(mc->m.mnt_dir, name))
1120- return mc;
1121- return NULL;
1122-}
1123-
1124-/*
1125- * Given the device name NAME, and the place MCPREV we found it last time,
1126- * try to find more occurrences.
1127- */
1128-struct mntentchn *
1129-getmntdevbackward (const char *name, struct mntentchn *mcprev) {
1130- struct mntentchn *mc, *mc0;
1131-
1132- mc0 = mtab_head();
1133- if (!mcprev)
1134- mcprev = mc0;
1135- for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev)
1136- if (streq(mc->m.mnt_fsname, name))
1137- return mc;
1138- return NULL;
1139-}
1140-
1141-/* Find the dir FILE in fstab. */
1142-struct mntentchn *
1143-getfsfile (const char *file)
1144-{
1145- struct mntentchn *mc, *mc0;
1146-
1147- mc0 = fstab_head();
1148- for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
1149- if (streq(mc->m.mnt_dir, file))
1150- return mc;
1151- return NULL;
1152-}
1153-
1154-/* Find the device SPEC in fstab. */
1155-struct mntentchn *
1156-getfsspec (const char *spec)
1157-{
1158- struct mntentchn *mc, *mc0;
1159-
1160- mc0 = fstab_head();
1161- for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
1162- if (streq(mc->m.mnt_fsname, spec))
1163- return mc;
1164- return NULL;
1165-}
1166-
1167-/* Updating mtab ----------------------------------------------*/
1168-
1169-/* Flag for already existing lock file. */
1170-static int we_created_lockfile = 0;
1171-static int lockfile_fd = -1;
1172-
1173-/* Flag to indicate that signals have been set up. */
1174-static int signals_have_been_setup = 0;
1175-
1176-/* Ensure that the lock is released if we are interrupted. */
1177-extern char *strsignal(int sig); /* not always in <string.h> */
1178-
1179-static void
1180-handler (int sig) {
1181- die(EX_USER, "%s", strsignal(sig));
1182-}
1183-
1184-static void
1185-setlkw_timeout (__attribute__((unused)) int sig) {
1186- /* nothing, fcntl will fail anyway */
1187-}
1188-
1189-/* Remove lock file. */
1190-void
1191-unlock_mtab (void) {
1192- if (we_created_lockfile) {
1193- close(lockfile_fd);
1194- lockfile_fd = -1;
1195- unlink (MOUNTED_LOCK);
1196- we_created_lockfile = 0;
1197- }
1198-}
1199-
1200-/* Create the lock file.
1201- The lock file will be removed if we catch a signal or when we exit. */
1202-/* The old code here used flock on a lock file /etc/mtab~ and deleted
1203- this lock file afterwards. However, as rgooch remarks, that has a
1204- race: a second mount may be waiting on the lock and proceed as
1205- soon as the lock file is deleted by the first mount, and immediately
1206- afterwards a third mount comes, creates a new /etc/mtab~, applies
1207- flock to that, and also proceeds, so that the second and third mount
1208- now both are scribbling in /etc/mtab.
1209- The new code uses a link() instead of a creat(), where we proceed
1210- only if it was us that created the lock, and hence we always have
1211- to delete the lock afterwards. Now the use of flock() is in principle
1212- superfluous, but avoids an arbitrary sleep(). */
1213-
1214-/* Where does the link point to? Obvious choices are mtab and mtab~~.
1215- HJLu points out that the latter leads to races. Right now we use
1216- mtab~.<pid> instead. Use 20 as upper bound for the length of %d. */
1217-#define MOUNTLOCK_LINKTARGET MOUNTED_LOCK "%d"
1218-#define MOUNTLOCK_LINKTARGET_LTH (sizeof(MOUNTED_LOCK)+20)
1219-
1220-void
1221-lock_mtab (void) {
1222- int tries = 100000, i;
1223- char linktargetfile[MOUNTLOCK_LINKTARGET_LTH];
1224-
1225- at_die = unlock_mtab;
1226-
1227- if (!signals_have_been_setup) {
1228- int sig = 0;
1229- struct sigaction sa;
1230-
1231- sa.sa_flags = 0;
1232- sigfillset (&sa.sa_mask);
1233-
1234- while (sigismember (&sa.sa_mask, ++sig) != -1) {
1235- switch(sig) {
1236- case SIGCHLD:
1237- case SIGKILL:
1238- case SIGCONT:
1239- case SIGSTOP:
1240- /* The cannot be caught, or should not,
1241- * so don't even try.
1242- */
1243- continue;
1244- case SIGALRM:
1245- sa.sa_handler = setlkw_timeout;
1246- break;
1247- case SIGHUP:
1248- case SIGINT:
1249- case SIGQUIT:
1250- case SIGWINCH:
1251- case SIGTSTP:
1252- case SIGTTIN:
1253- case SIGTTOU:
1254- case SIGPIPE:
1255- case SIGXFSZ:
1256- case SIGXCPU:
1257- /* non-priv user can cause these to be
1258- * generated, so ignore them.
1259- */
1260- sa.sa_handler = SIG_IGN;
1261- break;
1262- default:
1263- /* The rest should not be possible, so just
1264- * print a message and unlock mtab.
1265- */
1266- sa.sa_handler = handler;
1267- }
1268- sigaction (sig, &sa, (struct sigaction *) 0);
1269- }
1270- signals_have_been_setup = 1;
1271- }
1272-
1273- sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ());
1274-
1275- i = open (linktargetfile, O_WRONLY|O_CREAT, 0);
1276- if (i < 0) {
1277- int errsv = errno;
1278- /* linktargetfile does not exist (as a file)
1279- and we cannot create it. Read-only filesystem?
1280- Too many files open in the system?
1281- Filesystem full? */
1282- die (EX_FILEIO, _("can't create lock file %s: %s "
1283- "(use -n flag to override)"),
1284- linktargetfile, strerror (errsv));
1285- }
1286- close(i);
1287-
1288- /* Repeat until it was us who made the link */
1289- while (!we_created_lockfile) {
1290- struct flock flock;
1291- int j;
1292-
1293- j = link(linktargetfile, MOUNTED_LOCK);
1294-
1295- {
1296- int errsv = errno;
1297-
1298- if (j == 0)
1299- we_created_lockfile = 1;
1300-
1301- if (j < 0 && errsv != EEXIST) {
1302- (void) unlink(linktargetfile);
1303- die (EX_FILEIO, _("can't link lock file %s: %s "
1304- "(use -n flag to override)"),
1305- MOUNTED_LOCK, strerror (errsv));
1306- }
1307- }
1308-
1309- lockfile_fd = open (MOUNTED_LOCK, O_WRONLY);
1310-
1311- if (lockfile_fd < 0) {
1312- int errsv = errno;
1313- /* Strange... Maybe the file was just deleted? */
1314- if (errno == ENOENT && tries-- > 0) {
1315- if (tries % 200 == 0)
1316- usleep(30);
1317- continue;
1318- }
1319- (void) unlink(linktargetfile);
1320- die (EX_FILEIO, _("can't open lock file %s: %s "
1321- "(use -n flag to override)"),
1322- MOUNTED_LOCK, strerror (errsv));
1323- }
1324-
1325- flock.l_type = F_WRLCK;
1326- flock.l_whence = SEEK_SET;
1327- flock.l_start = 0;
1328- flock.l_len = 0;
1329-
1330- if (j == 0) {
1331- /* We made the link. Now claim the lock. */
1332- if (fcntl (lockfile_fd, F_SETLK, &flock) == -1) {
1333- if (verbose) {
1334- int errsv = errno;
1335- nfs_error(_("%s: Can't lock lock file "
1336- "%s: %s"), progname,
1337- MOUNTED_LOCK,
1338- strerror (errsv));
1339- }
1340- /* proceed anyway */
1341- }
1342- (void) unlink(linktargetfile);
1343- } else {
1344- static int retries = 0;
1345-
1346- /* Someone else made the link. Wait. */
1347- alarm(LOCK_TIMEOUT);
1348- if (fcntl (lockfile_fd, F_SETLKW, &flock) == -1) {
1349- int errsv = errno;
1350- (void) unlink(linktargetfile);
1351- die (EX_FILEIO, _("can't lock lock file %s: %s"),
1352- MOUNTED_LOCK, (errno == EINTR) ?
1353- _("timed out") : strerror (errsv));
1354- }
1355- alarm(0);
1356- /* Limit the number of iterations - maybe there
1357- still is some old /etc/mtab~ */
1358- ++retries;
1359- if (retries % 200 == 0)
1360- usleep(30);
1361- if (retries > 100000) {
1362- (void) unlink(linktargetfile);
1363- close(lockfile_fd);
1364- die (EX_FILEIO, _("Cannot create link %s\n"
1365- "Perhaps there is a stale lock file?\n"),
1366- MOUNTED_LOCK);
1367- }
1368- close(lockfile_fd);
1369- }
1370- }
1371-}
1372-
1373-/*
1374- * Update the mtab.
1375- * Used by umount with null INSTEAD: remove the last DIR entry.
1376- * Used by mount upon a remount: update option part,
1377- * and complain if a wrong device or type was given.
1378- * [Note that often a remount will be a rw remount of /
1379- * where there was no entry before, and we'll have to believe
1380- * the values given in INSTEAD.]
1381- */
1382-
1383-void
1384-update_mtab (const char *dir, struct mntent *instead)
1385-{
1386- mntFILE *mfp, *mftmp;
1387- const char *fnam = MOUNTED;
1388- struct mntentchn mtabhead; /* dummy */
1389- struct mntentchn *mc, *mc0, *absent = NULL;
1390-
1391- if (mtab_does_not_exist() || !mtab_is_writable())
1392- return;
1393-
1394- lock_mtab();
1395-
1396- /* having locked mtab, read it again */
1397- mc0 = mc = &mtabhead;
1398- mc->nxt = mc->prev = NULL;
1399-
1400- mfp = nfs_setmntent(fnam, "r");
1401- if (mfp == NULL || mfp->mntent_fp == NULL) {
1402- int errsv = errno;
1403- nfs_error (_("cannot open %s (%s) - mtab not updated"),
1404- fnam, strerror (errsv));
1405- goto leave;
1406- }
1407-
1408- read_mntentchn(mfp, fnam, mc);
1409-
1410- /* find last occurrence of dir */
1411- for (mc = mc0->prev; mc && mc != mc0; mc = mc->prev)
1412- if (streq(mc->m.mnt_dir, dir))
1413- break;
1414- if (mc && mc != mc0) {
1415- if (instead == NULL) {
1416- /* An umount - remove entry */
1417- if (mc && mc != mc0) {
1418- mc->prev->nxt = mc->nxt;
1419- mc->nxt->prev = mc->prev;
1420- free(mc);
1421- }
1422- } else {
1423- /* A remount */
1424- mc->m.mnt_opts = instead->mnt_opts;
1425- }
1426- } else if (instead) {
1427- /* not found, add a new entry */
1428- absent = xmalloc(sizeof(*absent));
1429- absent->m = *instead;
1430- absent->nxt = mc0;
1431- absent->prev = mc0->prev;
1432- mc0->prev = absent;
1433- if (mc0->nxt == NULL)
1434- mc0->nxt = absent;
1435- }
1436-
1437- /* write chain to mtemp */
1438- mftmp = nfs_setmntent (MOUNTED_TEMP, "w");
1439- if (mftmp == NULL || mftmp->mntent_fp == NULL) {
1440- int errsv = errno;
1441- nfs_error (_("cannot open %s (%s) - mtab not updated"),
1442- MOUNTED_TEMP, strerror (errsv));
1443- goto leave;
1444- }
1445-
1446- for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
1447- if (nfs_addmntent(mftmp, &(mc->m)) == 1) {
1448- int errsv = errno;
1449- die (EX_FILEIO, _("error writing %s: %s"),
1450- MOUNTED_TEMP, strerror (errsv));
1451- }
1452- }
1453-
1454-#if 0
1455- /* the chain might have strings copied from 'instead',
1456- * so we cannot safely free it.
1457- * And there is no need anyway because we are going to exit
1458- * shortly. So just don't call discard_mntentchn....
1459- */
1460- discard_mntentchn(mc0);
1461-#endif
1462- if (fchmod (fileno (mftmp->mntent_fp),
1463- S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
1464- int errsv = errno;
1465- nfs_error(_("%s: error changing mode of %s: %s"),
1466- progname, MOUNTED_TEMP, strerror (errsv));
1467- }
1468- nfs_endmntent (mftmp);
1469-
1470- { /*
1471- * If mount is setuid and some non-root user mounts sth,
1472- * then mtab.tmp might get the group of this user. Copy uid/gid
1473- * from the present mtab before renaming.
1474- */
1475- struct stat sbuf;
1476- if (stat (MOUNTED, &sbuf) == 0) {
1477- if (chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid) < 0) {
1478- nfs_error(_("%s: error changing owner of %s: %s"),
1479- progname, MOUNTED_TEMP, strerror (errno));
1480- }
1481- }
1482- }
1483-
1484- /* rename mtemp to mtab */
1485- if (rename (MOUNTED_TEMP, MOUNTED) < 0) {
1486- int errsv = errno;
1487- nfs_error(_("%s: can't rename %s to %s: %s\n"),
1488- progname, MOUNTED_TEMP, MOUNTED,
1489- strerror(errsv));
1490- }
1491-
1492- leave:
1493- unlock_mtab();
1494-}
1495
1496=== removed file '.pc/03-handle-mtab-symlink.patch/utils/mount/fstab.h'
1497--- .pc/03-handle-mtab-symlink.patch/utils/mount/fstab.h 2011-10-02 18:29:53 +0000
1498+++ .pc/03-handle-mtab-symlink.patch/utils/mount/fstab.h 1970-01-01 00:00:00 +0000
1499@@ -1,31 +0,0 @@
1500-#ifndef _NFS_UTILS_MOUNT_FSTAB_H
1501-#define _NFS_UTILS_MOUNT_FSTAB_H
1502-
1503-#include "nfs_mntent.h"
1504-
1505-#ifndef _PATH_FSTAB
1506-#define _PATH_FSTAB "/etc/fstab"
1507-#endif
1508-
1509-int mtab_is_writable(void);
1510-int mtab_does_not_exist(void);
1511-void reset_mtab_info(void);
1512-
1513-struct mntentchn {
1514- struct mntentchn *nxt, *prev;
1515- struct mntent m;
1516-};
1517-
1518-struct mntentchn *getmntoptfile (const char *file);
1519-struct mntentchn *getmntdirbackward (const char *dir, struct mntentchn *mc);
1520-struct mntentchn *getprocmntdirbackward (const char *name, struct mntentchn *mc);
1521-struct mntentchn *getmntdevbackward (const char *dev, struct mntentchn *mc);
1522-
1523-struct mntentchn *getfsfile (const char *file);
1524-struct mntentchn *getfsspec (const char *spec);
1525-
1526-void lock_mtab (void);
1527-void unlock_mtab (void);
1528-void update_mtab (const char *special, struct mntent *with);
1529-
1530-#endif /* _NFS_UTILS_MOUNT_FSTAB_H */
1531
1532=== removed file '.pc/03-handle-mtab-symlink.patch/utils/mount/mount.c'
1533--- .pc/03-handle-mtab-symlink.patch/utils/mount/mount.c 2011-07-09 16:28:32 +0000
1534+++ .pc/03-handle-mtab-symlink.patch/utils/mount/mount.c 1970-01-01 00:00:00 +0000
1535@@ -1,550 +0,0 @@
1536-/*
1537- * mount.c -- Linux NFS mount
1538- *
1539- * Copyright (C) 2006 Amit Gud <agud@redhat.com>
1540- *
1541- * - Basic code and wrapper around mount and umount code of NFS.
1542- * Based on util-linux/mount/mount.c.
1543- *
1544- * This program is free software; you can redistribute it and/or modify
1545- * it under the terms of the GNU General Public License as published by
1546- * the Free Software Foundation; either version 2, or (at your option)
1547- * any later version.
1548- *
1549- * This program is distributed in the hope that it will be useful,
1550- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1551- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1552- * GNU General Public License for more details.
1553- *
1554- */
1555-
1556-#ifdef HAVE_CONFIG_H
1557-#include <config.h>
1558-#endif
1559-
1560-#include <unistd.h>
1561-#include <sys/types.h>
1562-#include <sys/stat.h>
1563-#include <stdio.h>
1564-#include <string.h>
1565-#include <errno.h>
1566-#include <fcntl.h>
1567-#include <sys/mount.h>
1568-#include <getopt.h>
1569-#include <mntent.h>
1570-#include <pwd.h>
1571-
1572-#include "fstab.h"
1573-#include "xcommon.h"
1574-#include "nls.h"
1575-#include "mount_constants.h"
1576-#include "mount_config.h"
1577-#include "nfs_paths.h"
1578-#include "nfs_mntent.h"
1579-
1580-#include "nfs_mount.h"
1581-#include "nfs4_mount.h"
1582-#include "mount.h"
1583-#include "error.h"
1584-#include "stropts.h"
1585-#include "utils.h"
1586-
1587-char *progname;
1588-int nfs_mount_data_version;
1589-int nomtab;
1590-int verbose;
1591-int sloppy;
1592-int string;
1593-
1594-#define FOREGROUND (0)
1595-#define BACKGROUND (1)
1596-
1597-static struct option longopts[] = {
1598- { "fake", 0, 0, 'f' },
1599- { "help", 0, 0, 'h' },
1600- { "no-mtab", 0, 0, 'n' },
1601- { "read-only", 0, 0, 'r' },
1602- { "ro", 0, 0, 'r' },
1603- { "verbose", 0, 0, 'v' },
1604- { "version", 0, 0, 'V' },
1605- { "read-write", 0, 0, 'w' },
1606- { "rw", 0, 0, 'w' },
1607- { "options", 1, 0, 'o' },
1608- { NULL, 0, 0, 0 }
1609-};
1610-
1611-/*
1612- * Map from -o and fstab option strings to the flag argument to mount(2).
1613- */
1614-struct opt_map {
1615- const char *opt; /* option name */
1616- int skip; /* skip in mtab option string */
1617- int inv; /* true if flag value should be inverted */
1618- int mask; /* flag mask value */
1619-};
1620-
1621-static const struct opt_map opt_map[] = {
1622- { "defaults", 0, 0, 0 }, /* default options */
1623- { "ro", 1, 0, MS_RDONLY }, /* read-only */
1624- { "rw", 1, 1, MS_RDONLY }, /* read-write */
1625- { "exec", 0, 1, MS_NOEXEC }, /* permit execution of binaries */
1626- { "noexec", 0, 0, MS_NOEXEC }, /* don't execute binaries */
1627- { "suid", 0, 1, MS_NOSUID }, /* honor suid executables */
1628- { "nosuid", 0, 0, MS_NOSUID }, /* don't honor suid executables */
1629- { "dev", 0, 1, MS_NODEV }, /* interpret device files */
1630- { "nodev", 0, 0, MS_NODEV }, /* don't interpret devices */
1631- { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */
1632- { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */
1633- { "dirsync", 0, 0, MS_DIRSYNC}, /* synchronous directory modifications */
1634- { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */
1635- { "bind", 0, 0, MS_BIND }, /* Remount part of tree elsewhere */
1636- { "rbind", 0, 0, MS_BIND|MS_REC }, /* Idem, plus mounted subtrees */
1637- { "auto", 0, 0, MS_DUMMY }, /* Can be mounted using -a */
1638- { "noauto", 0, 0, MS_DUMMY }, /* Can only be mounted explicitly */
1639- { "users", 1, 0, MS_USERS }, /* Allow ordinary user to mount */
1640- { "nousers", 0, 1, MS_DUMMY }, /* Forbid ordinary user to mount */
1641- { "user", 1, 0, MS_USER }, /* Allow ordinary user to mount */
1642- { "nouser", 0, 1, MS_DUMMY }, /* Forbid ordinary user to mount */
1643- { "owner", 0, 0, MS_DUMMY }, /* Let the owner of the device mount */
1644- { "noowner", 0, 0, MS_DUMMY }, /* Device owner has no special privs */
1645- { "group", 0, 0, MS_DUMMY }, /* Let the group of the device mount */
1646- { "nogroup", 0, 0, MS_DUMMY }, /* Device group has no special privs */
1647- { "_netdev", 0, 0, MS_DUMMY}, /* Device requires network */
1648- { "comment", 0, 0, MS_DUMMY}, /* fstab comment only (kudzu,_netdev)*/
1649-
1650- /* add new options here */
1651-#ifdef MS_NOSUB
1652- { "sub", 0, 1, MS_NOSUB }, /* allow submounts */
1653- { "nosub", 0, 0, MS_NOSUB }, /* don't allow submounts */
1654-#endif
1655-#ifdef MS_SILENT
1656- { "quiet", 0, 0, MS_SILENT }, /* be quiet */
1657- { "loud", 0, 1, MS_SILENT }, /* print out messages. */
1658-#endif
1659-#ifdef MS_MANDLOCK
1660- { "mand", 0, 0, MS_MANDLOCK }, /* Allow mandatory locks on this FS */
1661- { "nomand", 0, 1, MS_MANDLOCK }, /* Forbid mandatory locks on this FS */
1662-#endif
1663- { "loop", 1, 0, MS_DUMMY }, /* use a loop device */
1664-#ifdef MS_NOATIME
1665- { "atime", 0, 1, MS_NOATIME }, /* Update access time */
1666- { "noatime", 0, 0, MS_NOATIME }, /* Do not update access time */
1667-#endif
1668-#ifdef MS_NODIRATIME
1669- { "diratime", 0, 1, MS_NODIRATIME }, /* Update dir access times */
1670- { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
1671-#endif
1672-#ifdef MS_RELATIME
1673- { "relatime", 0, 0, MS_RELATIME }, /* Update access times relative to
1674- mtime/ctime */
1675- { "norelatime", 0, 1, MS_RELATIME }, /* Update access time without regard
1676- to mtime/ctime */
1677-#endif
1678- { "noquota", 0, 0, MS_DUMMY }, /* Don't enforce quota */
1679- { "quota", 0, 0, MS_DUMMY }, /* Enforce user quota */
1680- { "usrquota", 0, 0, MS_DUMMY }, /* Enforce user quota */
1681- { "grpquota", 0, 0, MS_DUMMY }, /* Enforce group quota */
1682- { NULL, 0, 0, 0 }
1683-};
1684-
1685-static void parse_opts(const char *options, int *flags, char **extra_opts);
1686-
1687-/*
1688- * Build a canonical mount option string for /etc/mtab.
1689- */
1690-static char *fix_opts_string(int flags, const char *extra_opts)
1691-{
1692- const struct opt_map *om;
1693- char *new_opts;
1694-
1695- new_opts = xstrdup((flags & MS_RDONLY) ? "ro" : "rw");
1696- if (flags & MS_USER) {
1697- /* record who mounted this so they can unmount */
1698- struct passwd *pw = getpwuid(getuid());
1699- if(pw)
1700- new_opts = xstrconcat3(new_opts, ",user=", pw->pw_name);
1701- }
1702- if (flags & MS_USERS)
1703- new_opts = xstrconcat3(new_opts, ",users", "");
1704-
1705- for (om = opt_map; om->opt != NULL; om++) {
1706- if (om->skip)
1707- continue;
1708- if (om->inv || !om->mask || (flags & om->mask) != om->mask)
1709- continue;
1710- new_opts = xstrconcat3(new_opts, ",", om->opt);
1711- flags &= ~om->mask;
1712- }
1713- if (extra_opts && *extra_opts) {
1714- new_opts = xstrconcat3(new_opts, ",", extra_opts);
1715- }
1716- return new_opts;
1717-}
1718-
1719-static void
1720-init_mntent(struct mntent *mnt, char *fsname, char *dir, char *type,
1721- int flags, char *opts)
1722-{
1723- mnt->mnt_fsname = fsname;
1724- mnt->mnt_dir = dir;
1725- mnt->mnt_type = type;
1726- mnt->mnt_opts = fix_opts_string(flags & ~MS_NOMTAB, opts);
1727-
1728- /* these are always zero for NFS */
1729- mnt->mnt_freq = 0;
1730- mnt->mnt_passno = 0;
1731-}
1732-
1733-/* Create mtab with a root entry. */
1734-static void
1735-create_mtab (void) {
1736- struct mntentchn *fstab;
1737- struct mntent mnt;
1738- int flags;
1739- mntFILE *mfp;
1740-
1741- lock_mtab();
1742-
1743- mfp = nfs_setmntent (MOUNTED, "a+");
1744- if (mfp == NULL || mfp->mntent_fp == NULL) {
1745- int errsv = errno;
1746- die (EX_FILEIO, _("mount: can't open %s for writing: %s"),
1747- MOUNTED, strerror (errsv));
1748- }
1749-
1750- /* Find the root entry by looking it up in fstab */
1751- if ((fstab = getfsfile ("/")) || (fstab = getfsfile ("root"))) {
1752- char *extra_opts;
1753- parse_opts (fstab->m.mnt_opts, &flags, &extra_opts);
1754- init_mntent(&mnt, xstrdup(fstab->m.mnt_fsname), "/",
1755- fstab->m.mnt_type, flags, extra_opts);
1756- free(extra_opts);
1757-
1758- if (nfs_addmntent (mfp, &mnt) == 1) {
1759- int errsv = errno;
1760- die (EX_FILEIO, _("mount: error writing %s: %s"),
1761- _PATH_MOUNTED, strerror (errsv));
1762- }
1763- }
1764- if (fchmod (fileno (mfp->mntent_fp), 0644) < 0)
1765- if (errno != EROFS) {
1766- int errsv = errno;
1767- die (EX_FILEIO,
1768- _("mount: error changing mode of %s: %s"),
1769- _PATH_MOUNTED, strerror (errsv));
1770- }
1771- nfs_endmntent (mfp);
1772-
1773- unlock_mtab();
1774-
1775- reset_mtab_info();
1776-}
1777-
1778-static int add_mtab(char *spec, char *mount_point, char *fstype,
1779- int flags, char *opts)
1780-{
1781- struct mntent ment;
1782- int result = EX_SUCCESS;
1783-
1784- init_mntent(&ment, spec, mount_point, fstype, flags, opts);
1785-
1786- if (!nomtab && mtab_does_not_exist()) {
1787- if (verbose > 1)
1788- printf(_("mount: no %s found - creating it..\n"),
1789- MOUNTED);
1790- create_mtab ();
1791- }
1792-
1793- if (!nomtab && mtab_is_writable()) {
1794- if (flags & MS_REMOUNT)
1795- update_mtab(ment.mnt_dir, &ment);
1796- else {
1797- mntFILE *mtab;
1798-
1799- lock_mtab();
1800- mtab = nfs_setmntent(MOUNTED, "a+");
1801- if (mtab == NULL || mtab->mntent_fp == NULL) {
1802- nfs_error(_("Can't open mtab: %s"),
1803- strerror(errno));
1804- result = EX_FILEIO;
1805- } else {
1806- if (nfs_addmntent(mtab, &ment) == 1) {
1807- nfs_error(_("Can't write mount entry to mtab: %s"),
1808- strerror(errno));
1809- result = EX_FILEIO;
1810- }
1811- }
1812- nfs_endmntent(mtab);
1813- unlock_mtab();
1814- }
1815- }
1816-
1817- free(ment.mnt_opts);
1818-
1819- return result;
1820-}
1821-
1822-static void parse_opt(const char *opt, int *mask, char *extra_opts, size_t len)
1823-{
1824- const struct opt_map *om;
1825-
1826- for (om = opt_map; om->opt != NULL; om++) {
1827- if (!strcmp (opt, om->opt)) {
1828- if (om->inv)
1829- *mask &= ~om->mask;
1830- else
1831- *mask |= om->mask;
1832- return;
1833- }
1834- }
1835-
1836- len -= strlen(extra_opts);
1837-
1838- if (*extra_opts && --len > 0)
1839- strcat(extra_opts, ",");
1840-
1841- if ((len -= strlen(opt)) > 0)
1842- strcat(extra_opts, opt);
1843-}
1844-
1845-/*
1846- * Convert the provided mount command-line options into the 4th &
1847- * 5th arguments to mount(2). Output parameter "@flags" gets the
1848- * standard options (indicated by MS_ bits), and output parameter
1849- * "@extra_opts" gets all the filesystem-specific options.
1850- */
1851-static void parse_opts(const char *options, int *flags, char **extra_opts)
1852-{
1853- if (options != NULL) {
1854- char *opts = xstrdup(options);
1855- char *opt, *p;
1856- size_t len = strlen(opts) + 1; /* include room for a null */
1857- int open_quote = 0;
1858-
1859- *extra_opts = xmalloc(len);
1860- **extra_opts = '\0';
1861-
1862- for (p = opts, opt = NULL; p && *p; p++) {
1863- if (!opt)
1864- opt = p; /* begin of the option item */
1865- if (*p == '"')
1866- open_quote ^= 1; /* reverse the status */
1867- if (open_quote)
1868- continue; /* still in a quoted block */
1869- if (*p == ',')
1870- *p = '\0'; /* terminate the option item */
1871-
1872- /* end of option item or last item */
1873- if (*p == '\0' || *(p + 1) == '\0') {
1874- parse_opt(opt, flags, *extra_opts, len);
1875- opt = NULL;
1876- }
1877- }
1878- free(opts);
1879- }
1880-}
1881-
1882-static int try_mount(char *spec, char *mount_point, int flags,
1883- char *fs_type, char **extra_opts, char *mount_opts,
1884- int fake, int bg)
1885-{
1886- int ret;
1887-
1888- if (string)
1889- ret = nfsmount_string(spec, mount_point, fs_type, flags,
1890- extra_opts, fake, bg);
1891- else {
1892- if (strcmp(fs_type, "nfs4") == 0)
1893- ret = nfs4mount(spec, mount_point, flags,
1894- extra_opts, fake, bg);
1895- else
1896- ret = nfsmount(spec, mount_point, flags,
1897- extra_opts, fake, bg);
1898- }
1899-
1900- if (ret)
1901- return ret;
1902-
1903- if (!fake)
1904- print_one(spec, mount_point, fs_type, mount_opts);
1905-
1906- return add_mtab(spec, mount_point, fs_type, flags, *extra_opts);
1907-}
1908-
1909-int main(int argc, char *argv[])
1910-{
1911- int c, flags = 0, mnt_err = 1, fake = 0;
1912- char *spec = NULL, *mount_point = NULL, *fs_type = "nfs";
1913- char *extra_opts = NULL, *mount_opts = NULL;
1914- uid_t uid = getuid();
1915-
1916- progname = basename(argv[0]);
1917-
1918- nfs_mount_data_version = discover_nfs_mount_data_version(&string);
1919-
1920- if(!strncmp(progname, "umount", strlen("umount")))
1921- exit(nfsumount(argc, argv));
1922-
1923- if ((argc < 3)) {
1924- mount_usage();
1925- exit(EX_USAGE);
1926- }
1927-
1928- mount_config_init(progname);
1929-
1930- while ((c = getopt_long(argc, argv, "rvVwfno:hs",
1931- longopts, NULL)) != -1) {
1932- switch (c) {
1933- case 'r':
1934- flags |= MS_RDONLY;
1935- break;
1936- case 'v':
1937- ++verbose;
1938- break;
1939- case 'V':
1940- printf("%s: ("PACKAGE_STRING")\n", progname);
1941- exit(EX_SUCCESS);
1942- case 'w':
1943- flags &= ~MS_RDONLY;
1944- break;
1945- case 'f':
1946- ++fake;
1947- break;
1948- case 'n':
1949- ++nomtab;
1950- break;
1951- case 'o': /* specify mount options */
1952- if (mount_opts)
1953- mount_opts = xstrconcat3(mount_opts, ",", optarg);
1954- else
1955- mount_opts = xstrdup(optarg);
1956- break;
1957- case 's':
1958- ++sloppy;
1959- break;
1960- case 'h':
1961- default:
1962- mount_usage();
1963- goto out_usage;
1964- }
1965- }
1966-
1967- /*
1968- * Extra non-option words at the end are bogus...
1969- */
1970- if (optind != argc - 2) {
1971- mount_usage();
1972- goto out_usage;
1973- } else {
1974- while (optind < argc) {
1975- if (!spec)
1976- spec = argv[optind];
1977- else
1978- mount_point = argv[optind];
1979- optind++;
1980- }
1981- }
1982-
1983- if (strcmp(progname, "mount.nfs4") == 0)
1984- fs_type = "nfs4";
1985-
1986- /*
1987- * If a non-root user is attempting to mount, make sure the
1988- * user's requested options match the options specified in
1989- * /etc/fstab; otherwise, don't allow the mount.
1990- */
1991- if (uid != 0) {
1992- struct mntentchn *mc;
1993-
1994- if ((mc = getfsfile(mount_point)) == NULL ||
1995- strcmp(mc->m.mnt_fsname, spec) != 0 ||
1996- strcmp(mc->m.mnt_type, fs_type) != 0) {
1997- nfs_error(_("%s: permission denied: no match for %s "
1998- "found in /etc/fstab"), progname, mount_point);
1999- goto out_usage;
2000- }
2001-
2002- /*
2003- * 'mount' munges the options from fstab before passing them
2004- * to us, so it is non-trivial to test that we have the correct
2005- * set of options and we don't want to trust what the user
2006- * gave us, so just take whatever is in /etc/fstab.
2007- */
2008- mount_opts = strdup(mc->m.mnt_opts);
2009- }
2010-
2011- mount_point = canonicalize(mount_point);
2012- if (!mount_point) {
2013- nfs_error(_("%s: no mount point provided"), progname);
2014- goto out_usage;
2015- }
2016- if (mount_point[0] != '/') {
2017- nfs_error(_("%s: unrecognized mount point %s"),
2018- progname, mount_point);
2019- mnt_err = EX_USAGE;
2020- goto out;
2021- }
2022- /*
2023- * Concatenate mount options from the configuration file
2024- */
2025- mount_opts = mount_config_opts(spec, mount_point, mount_opts);
2026-
2027- parse_opts(mount_opts, &flags, &extra_opts);
2028-
2029- if (uid != 0) {
2030- if (!(flags & (MS_USERS|MS_USER))) {
2031- nfs_error(_("%s: permission denied"), progname);
2032- mnt_err = EX_USAGE;
2033- goto out;
2034- }
2035-
2036- if (geteuid() != 0) {
2037- nfs_error(_("%s: not installed setuid - "
2038- "\"user\" NFS mounts not supported."), progname);
2039- exit(EX_FAIL);
2040- }
2041- }
2042-
2043- if (chk_mountpoint(mount_point)) {
2044- mnt_err = EX_USAGE;
2045- goto out;
2046- }
2047-
2048- mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts,
2049- mount_opts, fake, FOREGROUND);
2050- if (mnt_err == EX_BG) {
2051- printf(_("%s: backgrounding \"%s\"\n"),
2052- progname, spec);
2053- printf(_("%s: mount options: \"%s\"\n"),
2054- progname, extra_opts);
2055-
2056- fflush(stdout);
2057-
2058- /*
2059- * Parent exits immediately with success.
2060- */
2061- if (daemon(0, 0)) {
2062- nfs_error(_("%s: failed to start "
2063- "background process: %s\n"),
2064- progname, strerror(errno));
2065- exit(EX_FAIL);
2066- }
2067-
2068- mnt_err = try_mount(spec, mount_point, flags, fs_type,
2069- &extra_opts, mount_opts, fake,
2070- BACKGROUND);
2071- if (verbose && mnt_err)
2072- printf(_("%s: giving up \"%s\"\n"),
2073- progname, spec);
2074- }
2075-
2076-out:
2077- free(mount_opts);
2078- free(extra_opts);
2079- free(mount_point);
2080- exit(mnt_err);
2081-
2082-out_usage:
2083- free(mount_opts);
2084- exit(EX_USAGE);
2085-}
2086
2087=== removed directory '.pc/11-532048-reduce-verbosity.patch'
2088=== removed directory '.pc/11-532048-reduce-verbosity.patch/utils'
2089=== removed directory '.pc/11-532048-reduce-verbosity.patch/utils/gssd'
2090=== removed file '.pc/11-532048-reduce-verbosity.patch/utils/gssd/gss_util.c'
2091--- .pc/11-532048-reduce-verbosity.patch/utils/gssd/gss_util.c 2011-07-09 16:28:32 +0000
2092+++ .pc/11-532048-reduce-verbosity.patch/utils/gssd/gss_util.c 1970-01-01 00:00:00 +0000
2093@@ -1,341 +0,0 @@
2094-/*
2095- * Adapted in part from MIT Kerberos 5-1.2.1 slave/kprop.c and from
2096- * http://docs.sun.com/?p=/doc/816-1331/6m7oo9sms&a=view
2097- *
2098- * Copyright (c) 2002 The Regents of the University of Michigan.
2099- * All rights reserved.
2100- *
2101- * Andy Adamson <andros@umich.edu>
2102- * J. Bruce Fields <bfields@umich.edu>
2103- * Marius Aamodt Eriksen <marius@umich.edu>
2104- */
2105-
2106-/*
2107- * slave/kprop.c
2108- *
2109- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
2110- * All Rights Reserved.
2111- *
2112- * Export of this software from the United States of America may
2113- * require a specific license from the United States Government.
2114- * It is the responsibility of any person or organization contemplating
2115- * export to obtain such a license before exporting.
2116- *
2117- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
2118- * distribute this software and its documentation for any purpose and
2119- * without fee is hereby granted, provided that the above copyright
2120- * notice appear in all copies and that both that copyright notice and
2121- * this permission notice appear in supporting documentation, and that
2122- * the name of M.I.T. not be used in advertising or publicity pertaining
2123- * to distribution of the software without specific, written prior
2124- * permission. Furthermore if you modify this software you must label
2125- * your software as modified software and not distribute it in such a
2126- * fashion that it might be confused with the original M.I.T. software.
2127- * M.I.T. makes no representations about the suitability of
2128- * this software for any purpose. It is provided "as is" without express
2129- * or implied warranty.
2130- */
2131-
2132-/*
2133- * Copyright 1994 by OpenVision Technologies, Inc.
2134- *
2135- * Permission to use, copy, modify, distribute, and sell this software
2136- * and its documentation for any purpose is hereby granted without fee,
2137- * provided that the above copyright notice appears in all copies and
2138- * that both that copyright notice and this permission notice appear in
2139- * supporting documentation, and that the name of OpenVision not be used
2140- * in advertising or publicity pertaining to distribution of the software
2141- * without specific, written prior permission. OpenVision makes no
2142- * representations about the suitability of this software for any
2143- * purpose. It is provided "as is" without express or implied warranty.
2144- *
2145- * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2146- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
2147- * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2148- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
2149- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2150- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2151- * PERFORMANCE OF THIS SOFTWARE.
2152- */
2153-
2154-#ifdef HAVE_CONFIG_H
2155-#include <config.h>
2156-#endif /* HAVE_CONFIG_H */
2157-
2158-#include <errno.h>
2159-#include <stdio.h>
2160-#include <ctype.h>
2161-#include <sys/file.h>
2162-#include <signal.h>
2163-#include <string.h>
2164-#include <sys/types.h>
2165-#include <sys/time.h>
2166-#include <sys/stat.h>
2167-#include <sys/socket.h>
2168-#include <netinet/in.h>
2169-#include <sys/param.h>
2170-#include <netdb.h>
2171-#include <fcntl.h>
2172-#include <gssapi/gssapi.h>
2173-#if defined(HAVE_KRB5) && !defined(GSS_C_NT_HOSTBASED_SERVICE)
2174-#include <gssapi/gssapi_generic.h>
2175-#define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
2176-#endif
2177-#include "gss_util.h"
2178-#include "err_util.h"
2179-#include "gssd.h"
2180-#ifdef HAVE_UNISTD_H
2181-#include <unistd.h>
2182-#endif
2183-#include <stdlib.h>
2184-#ifdef HAVE_COM_ERR_H
2185-#include <com_err.h>
2186-#endif
2187-
2188-/* Global gssd_credentials handle */
2189-gss_cred_id_t gssd_creds;
2190-
2191-gss_OID g_mechOid = GSS_C_NULL_OID;;
2192-
2193-#if 0
2194-static void
2195-display_status_1(char *m, u_int32_t code, int type, const gss_OID mech)
2196-{
2197- u_int32_t maj_stat, min_stat;
2198- gss_buffer_desc msg = GSS_C_EMPTY_BUFFER;
2199- u_int32_t msg_ctx = 0;
2200- char *typestr;
2201-
2202- switch (type) {
2203- case GSS_C_GSS_CODE:
2204- typestr = "GSS";
2205- break;
2206- case GSS_C_MECH_CODE:
2207- typestr = "mechanism";
2208- break;
2209- default:
2210- return;
2211- /* NOTREACHED */
2212- }
2213-
2214- for (;;) {
2215- maj_stat = gss_display_status(&min_stat, code,
2216- type, mech, &msg_ctx, &msg);
2217- if (maj_stat != GSS_S_COMPLETE) {
2218- printerr(0, "ERROR: in call to "
2219- "gss_display_status called from %s\n", m);
2220- break;
2221- } else {
2222- printerr(0, "ERROR: GSS-API: (%s) error in %s(): %s\n",
2223- typestr, m, (char *)msg.value);
2224- }
2225-
2226- if (msg.length != 0)
2227- (void) gss_release_buffer(&min_stat, &msg);
2228-
2229- if (msg_ctx == 0)
2230- break;
2231- }
2232-}
2233-#endif
2234-static char *
2235-gss_display_error(OM_uint32 status)
2236-{
2237- char *error = NULL;
2238-
2239- switch(status) {
2240- case GSS_S_COMPLETE:
2241- error = "GSS_S_COMPLETE";
2242- break;
2243- case GSS_S_CALL_INACCESSIBLE_READ:
2244- error = "GSS_S_CALL_INACCESSIBLE_READ";
2245- break;
2246- case GSS_S_CALL_INACCESSIBLE_WRITE:
2247- error = "GSS_S_CALL_INACCESSIBLE_WRITE";
2248- break;
2249- case GSS_S_CALL_BAD_STRUCTURE:
2250- error = "GSS_S_CALL_BAD_STRUCTURE";
2251- break;
2252- case GSS_S_BAD_MECH:
2253- error = "GSS_S_BAD_MECH";
2254- break;
2255- case GSS_S_BAD_NAME:
2256- error = "GSS_S_BAD_NAME";
2257- break;
2258- case GSS_S_BAD_NAMETYPE:
2259- error = "GSS_S_BAD_NAMETYPE";
2260- break;
2261- case GSS_S_BAD_BINDINGS:
2262- error = "GSS_S_BAD_BINDINGS";
2263- break;
2264- case GSS_S_BAD_STATUS:
2265- error = "GSS_S_BAD_STATUS";
2266- break;
2267- case GSS_S_BAD_SIG:
2268- error = "GSS_S_BAD_SIG";
2269- break;
2270- case GSS_S_NO_CRED:
2271- error = "GSS_S_NO_CRED";
2272- break;
2273- case GSS_S_NO_CONTEXT:
2274- error = "GSS_S_NO_CONTEXT";
2275- break;
2276- case GSS_S_DEFECTIVE_TOKEN:
2277- error = "GSS_S_DEFECTIVE_TOKEN";
2278- break;
2279- case GSS_S_DEFECTIVE_CREDENTIAL:
2280- error = "GSS_S_DEFECTIVE_CREDENTIAL";
2281- break;
2282- case GSS_S_CREDENTIALS_EXPIRED:
2283- error = "GSS_S_CREDENTIALS_EXPIRED";
2284- break;
2285- case GSS_S_CONTEXT_EXPIRED:
2286- error = "GSS_S_CONTEXT_EXPIRED";
2287- break;
2288- case GSS_S_FAILURE:
2289- error = "GSS_S_FAILURE";
2290- break;
2291- case GSS_S_BAD_QOP:
2292- error = "GSS_S_BAD_QOP";
2293- break;
2294- case GSS_S_UNAUTHORIZED:
2295- error = "GSS_S_UNAUTHORIZED";
2296- break;
2297- case GSS_S_UNAVAILABLE:
2298- error = "GSS_S_UNAVAILABLE";
2299- break;
2300- case GSS_S_DUPLICATE_ELEMENT:
2301- error = "GSS_S_DUPLICATE_ELEMENT";
2302- break;
2303- case GSS_S_NAME_NOT_MN:
2304- error = "GSS_S_NAME_NOT_MN";
2305- break;
2306- default:
2307- error = "Not defined";
2308- }
2309- return error;
2310-}
2311-
2312-static void
2313-display_status_2(char *m, u_int32_t major, u_int32_t minor, const gss_OID mech)
2314-{
2315- u_int32_t maj_stat1, min_stat1;
2316- u_int32_t maj_stat2, min_stat2;
2317- gss_buffer_desc maj_gss_buf = GSS_C_EMPTY_BUFFER;
2318- gss_buffer_desc min_gss_buf = GSS_C_EMPTY_BUFFER;
2319- char maj_buf[30], min_buf[30];
2320- char *maj, *min;
2321- u_int32_t msg_ctx = 0;
2322- int msg_verbosity = 0;
2323-
2324- /* Get major status message */
2325- maj_stat1 = gss_display_status(&min_stat1, major,
2326- GSS_C_GSS_CODE, mech, &msg_ctx, &maj_gss_buf);
2327-
2328- if (maj_stat1 != GSS_S_COMPLETE) {
2329- snprintf(maj_buf, sizeof(maj_buf), "(0x%08x)", major);
2330- maj = &maj_buf[0];
2331- } else {
2332- maj = maj_gss_buf.value;
2333- }
2334-
2335- /* Get minor status message */
2336- maj_stat2 = gss_display_status(&min_stat2, minor,
2337- GSS_C_MECH_CODE, mech, &msg_ctx, &min_gss_buf);
2338-
2339- if (maj_stat2 != GSS_S_COMPLETE) {
2340- snprintf(min_buf, sizeof(min_buf), "(0x%08x)", minor);
2341- min = &min_buf[0];
2342- } else {
2343- min = min_gss_buf.value;
2344- }
2345-
2346- if (major == GSS_S_CREDENTIALS_EXPIRED)
2347- msg_verbosity = 1;
2348-
2349- printerr(msg_verbosity, "ERROR: GSS-API: error in %s(): %s (%s) - %s\n",
2350- m, gss_display_error(major), maj, min);
2351-
2352- if (maj_gss_buf.length != 0)
2353- (void) gss_release_buffer(&min_stat1, &maj_gss_buf);
2354- if (min_gss_buf.length != 0)
2355- (void) gss_release_buffer(&min_stat2, &min_gss_buf);
2356-}
2357-
2358-void
2359-pgsserr(char *msg, u_int32_t maj_stat, u_int32_t min_stat, const gss_OID mech)
2360-{
2361- display_status_2(msg, maj_stat, min_stat, mech);
2362-}
2363-
2364-int
2365-gssd_acquire_cred(char *server_name, const gss_OID oid)
2366-{
2367- gss_buffer_desc name;
2368- gss_name_t target_name;
2369- u_int32_t maj_stat, min_stat;
2370- u_int32_t ignore_maj_stat, ignore_min_stat;
2371- gss_buffer_desc pbuf;
2372-
2373- /* If server_name is NULL, get cred for GSS_C_NO_NAME */
2374- if (server_name == NULL) {
2375- target_name = GSS_C_NO_NAME;
2376- } else {
2377- name.value = (void *)server_name;
2378- name.length = strlen(server_name);
2379-
2380- maj_stat = gss_import_name(&min_stat, &name,
2381- oid,
2382- &target_name);
2383-
2384- if (maj_stat != GSS_S_COMPLETE) {
2385- pgsserr("gss_import_name", maj_stat, min_stat, g_mechOid);
2386- return (FALSE);
2387- }
2388- }
2389-
2390- maj_stat = gss_acquire_cred(&min_stat, target_name, GSS_C_INDEFINITE,
2391- GSS_C_NO_OID_SET, GSS_C_ACCEPT,
2392- &gssd_creds, NULL, NULL);
2393-
2394- if (maj_stat != GSS_S_COMPLETE) {
2395- pgsserr("gss_acquire_cred", maj_stat, min_stat, g_mechOid);
2396- ignore_maj_stat = gss_display_name(&ignore_min_stat,
2397- target_name, &pbuf, NULL);
2398- if (ignore_maj_stat == GSS_S_COMPLETE) {
2399- printerr(1, "Unable to obtain credentials for '%.*s'\n",
2400- pbuf.length, pbuf.value);
2401- ignore_maj_stat = gss_release_buffer(&ignore_min_stat,
2402- &pbuf);
2403- }
2404- }
2405-
2406- ignore_maj_stat = gss_release_name(&ignore_min_stat, &target_name);
2407-
2408- return (maj_stat == GSS_S_COMPLETE);
2409-}
2410-
2411-int gssd_check_mechs(void)
2412-{
2413- u_int32_t maj_stat, min_stat;
2414- gss_OID_set supported_mechs = GSS_C_NO_OID_SET;
2415- int retval = -1;
2416-
2417- maj_stat = gss_indicate_mechs(&min_stat, &supported_mechs);
2418- if (maj_stat != GSS_S_COMPLETE) {
2419- printerr(0, "Unable to obtain list of supported mechanisms. "
2420- "Check that gss library is properly configured.\n");
2421- goto out;
2422- }
2423- if (supported_mechs == GSS_C_NO_OID_SET ||
2424- supported_mechs->count == 0) {
2425- printerr(0, "Unable to obtain list of supported mechanisms. "
2426- "Check that gss library is properly configured.\n");
2427- goto out;
2428- }
2429- maj_stat = gss_release_oid_set(&min_stat, &supported_mechs);
2430- retval = 0;
2431-out:
2432- return retval;
2433-}
2434-
2435
2436=== removed file '.pc/11-532048-reduce-verbosity.patch/utils/gssd/gssd_proc.c'
2437--- .pc/11-532048-reduce-verbosity.patch/utils/gssd/gssd_proc.c 2012-05-25 20:41:58 +0000
2438+++ .pc/11-532048-reduce-verbosity.patch/utils/gssd/gssd_proc.c 1970-01-01 00:00:00 +0000
2439@@ -1,1241 +0,0 @@
2440-/*
2441- gssd_proc.c
2442-
2443- Copyright (c) 2000-2004 The Regents of the University of Michigan.
2444- All rights reserved.
2445-
2446- Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>.
2447- Copyright (c) 2001 Andy Adamson <andros@UMICH.EDU>.
2448- Copyright (c) 2002 Marius Aamodt Eriksen <marius@UMICH.EDU>.
2449- Copyright (c) 2002 Bruce Fields <bfields@UMICH.EDU>
2450- Copyright (c) 2004 Kevin Coffman <kwc@umich.edu>
2451- All rights reserved, all wrongs reversed.
2452-
2453- Redistribution and use in source and binary forms, with or without
2454- modification, are permitted provided that the following conditions
2455- are met:
2456-
2457- 1. Redistributions of source code must retain the above copyright
2458- notice, this list of conditions and the following disclaimer.
2459- 2. Redistributions in binary form must reproduce the above copyright
2460- notice, this list of conditions and the following disclaimer in the
2461- documentation and/or other materials provided with the distribution.
2462- 3. Neither the name of the University nor the names of its
2463- contributors may be used to endorse or promote products derived
2464- from this software without specific prior written permission.
2465-
2466- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
2467- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2468- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2469- DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2470- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2471- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2472- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2473- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
2474- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2475- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2476- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2477-
2478-*/
2479-
2480-#ifdef HAVE_CONFIG_H
2481-#include <config.h>
2482-#endif /* HAVE_CONFIG_H */
2483-
2484-#ifndef _GNU_SOURCE
2485-#define _GNU_SOURCE
2486-#endif
2487-
2488-#include <sys/param.h>
2489-#include <rpc/rpc.h>
2490-#include <sys/stat.h>
2491-#include <sys/socket.h>
2492-#include <arpa/inet.h>
2493-#include <sys/fsuid.h>
2494-
2495-#include <stdio.h>
2496-#include <stdlib.h>
2497-#include <pwd.h>
2498-#include <grp.h>
2499-#include <string.h>
2500-#include <dirent.h>
2501-#include <poll.h>
2502-#include <fcntl.h>
2503-#include <signal.h>
2504-#include <unistd.h>
2505-#include <errno.h>
2506-#include <gssapi/gssapi.h>
2507-#include <netdb.h>
2508-
2509-#include "gssd.h"
2510-#include "err_util.h"
2511-#include "gss_util.h"
2512-#include "krb5_util.h"
2513-#include "context.h"
2514-#include "nfsrpc.h"
2515-#include "nfslib.h"
2516-
2517-/*
2518- * pollarray:
2519- * array of struct pollfd suitable to pass to poll. initialized to
2520- * zero - a zero struct is ignored by poll() because the events mask is 0.
2521- *
2522- * clnt_list:
2523- * linked list of struct clnt_info which associates a clntXXX directory
2524- * with an index into pollarray[], and other basic data about that client.
2525- *
2526- * Directory structure: created by the kernel
2527- * {rpc_pipefs}/{dir}/clntXX : one per rpc_clnt struct in the kernel
2528- * {rpc_pipefs}/{dir}/clntXX/krb5 : read uid for which kernel wants
2529- * a context, write the resulting context
2530- * {rpc_pipefs}/{dir}/clntXX/info : stores info such as server name
2531- * {rpc_pipefs}/{dir}/clntXX/gssd : pipe for all gss mechanisms using
2532- * a text-based string of parameters
2533- *
2534- * Algorithm:
2535- * Poll all {rpc_pipefs}/{dir}/clntXX/YYYY files. When data is ready,
2536- * read and process; performs rpcsec_gss context initialization protocol to
2537- * get a cred for that user. Writes result to corresponding krb5 file
2538- * in a form the kernel code will understand.
2539- * In addition, we make sure we are notified whenever anything is
2540- * created or destroyed in {rpc_pipefs} or in any of the clntXX directories,
2541- * and rescan the whole {rpc_pipefs} when this happens.
2542- */
2543-
2544-struct pollfd * pollarray;
2545-
2546-int pollsize; /* the size of pollaray (in pollfd's) */
2547-
2548-/*
2549- * convert a presentation address string to a sockaddr_storage struct. Returns
2550- * true on success or false on failure.
2551- *
2552- * Note that we do not populate the sin6_scope_id field here for IPv6 addrs.
2553- * gssd nececessarily relies on hostname resolution and DNS AAAA records
2554- * do not generally contain scope-id's. This means that GSSAPI auth really
2555- * can't work with IPv6 link-local addresses.
2556- *
2557- * We *could* consider changing this if we did something like adopt the
2558- * Microsoft "standard" of using the ipv6-literal.net domainname, but it's
2559- * not really feasible at present.
2560- */
2561-static int
2562-addrstr_to_sockaddr(struct sockaddr *sa, const char *node, const char *port)
2563-{
2564- int rc;
2565- struct addrinfo *res;
2566- struct addrinfo hints = { .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV };
2567-
2568-#ifndef IPV6_SUPPORTED
2569- hints.ai_family = AF_INET;
2570-#endif /* IPV6_SUPPORTED */
2571-
2572- rc = getaddrinfo(node, port, &hints, &res);
2573- if (rc) {
2574- printerr(0, "ERROR: unable to convert %s|%s to sockaddr: %s\n",
2575- node, port, rc == EAI_SYSTEM ? strerror(errno) :
2576- gai_strerror(rc));
2577- return 0;
2578- }
2579-
2580-#ifdef IPV6_SUPPORTED
2581- /*
2582- * getnameinfo ignores the scopeid. If the address turns out to have
2583- * a non-zero scopeid, we can't use it -- the resolved host might be
2584- * completely different from the one intended.
2585- */
2586- if (res->ai_addr->sa_family == AF_INET6) {
2587- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr;
2588- if (sin6->sin6_scope_id) {
2589- printerr(0, "ERROR: address %s has non-zero "
2590- "sin6_scope_id!\n", node);
2591- freeaddrinfo(res);
2592- return 0;
2593- }
2594- }
2595-#endif /* IPV6_SUPPORTED */
2596-
2597- memcpy(sa, res->ai_addr, res->ai_addrlen);
2598- freeaddrinfo(res);
2599- return 1;
2600-}
2601-
2602-/*
2603- * convert a sockaddr to a hostname
2604- */
2605-static char *
2606-sockaddr_to_hostname(const struct sockaddr *sa, const char *addr)
2607-{
2608- socklen_t addrlen;
2609- int err;
2610- char *hostname;
2611- char hbuf[NI_MAXHOST];
2612-
2613- switch (sa->sa_family) {
2614- case AF_INET:
2615- addrlen = sizeof(struct sockaddr_in);
2616- break;
2617-#ifdef IPV6_SUPPORTED
2618- case AF_INET6:
2619- addrlen = sizeof(struct sockaddr_in6);
2620- break;
2621-#endif /* IPV6_SUPPORTED */
2622- default:
2623- printerr(0, "ERROR: unrecognized addr family %d\n",
2624- sa->sa_family);
2625- return NULL;
2626- }
2627-
2628- err = getnameinfo(sa, addrlen, hbuf, sizeof(hbuf), NULL, 0,
2629- NI_NAMEREQD);
2630- if (err) {
2631- printerr(0, "ERROR: unable to resolve %s to hostname: %s\n",
2632- addr, err == EAI_SYSTEM ? strerror(err) :
2633- gai_strerror(err));
2634- return NULL;
2635- }
2636-
2637- hostname = strdup(hbuf);
2638-
2639- return hostname;
2640-}
2641-
2642-/* XXX buffer problems: */
2643-static int
2644-read_service_info(char *info_file_name, char **servicename, char **servername,
2645- int *prog, int *vers, char **protocol,
2646- struct sockaddr *addr) {
2647-#define INFOBUFLEN 256
2648- char buf[INFOBUFLEN + 1];
2649- static char dummy[128];
2650- int nbytes;
2651- static char service[128];
2652- static char address[128];
2653- char program[16];
2654- char version[16];
2655- char protoname[16];
2656- char port[128];
2657- char *p;
2658- int fd = -1;
2659- int numfields;
2660-
2661- *servicename = *servername = *protocol = NULL;
2662-
2663- if ((fd = open(info_file_name, O_RDONLY)) == -1) {
2664- printerr(0, "ERROR: can't open %s: %s\n", info_file_name,
2665- strerror(errno));
2666- goto fail;
2667- }
2668- if ((nbytes = read(fd, buf, INFOBUFLEN)) == -1)
2669- goto fail;
2670- close(fd);
2671- buf[nbytes] = '\0';
2672-
2673- numfields = sscanf(buf,"RPC server: %127s\n"
2674- "service: %127s %15s version %15s\n"
2675- "address: %127s\n"
2676- "protocol: %15s\n",
2677- dummy,
2678- service, program, version,
2679- address,
2680- protoname);
2681-
2682- if (numfields == 5) {
2683- strcpy(protoname, "tcp");
2684- } else if (numfields != 6) {
2685- goto fail;
2686- }
2687-
2688- port[0] = '\0';
2689- if ((p = strstr(buf, "port")) != NULL)
2690- sscanf(p, "port: %127s\n", port);
2691-
2692- /* check service, program, and version */
2693- if (memcmp(service, "nfs", 3) != 0)
2694- return -1;
2695- *prog = atoi(program + 1); /* skip open paren */
2696- *vers = atoi(version);
2697-
2698- if (strlen(service) == 3 ) {
2699- if ((*prog != 100003) || ((*vers != 2) && (*vers != 3) &&
2700- (*vers != 4)))
2701- goto fail;
2702- } else if (memcmp(service, "nfs4_cb", 7) == 0) {
2703- if (*vers != 1)
2704- goto fail;
2705- }
2706-
2707- if (!addrstr_to_sockaddr(addr, address, port))
2708- goto fail;
2709-
2710- *servername = sockaddr_to_hostname(addr, address);
2711- if (*servername == NULL)
2712- goto fail;
2713-
2714- nbytes = snprintf(buf, INFOBUFLEN, "%s@%s", service, *servername);
2715- if (nbytes > INFOBUFLEN)
2716- goto fail;
2717-
2718- if (!(*servicename = calloc(strlen(buf) + 1, 1)))
2719- goto fail;
2720- memcpy(*servicename, buf, strlen(buf));
2721-
2722- if (!(*protocol = strdup(protoname)))
2723- goto fail;
2724- return 0;
2725-fail:
2726- printerr(0, "ERROR: failed to read service info\n");
2727- if (fd != -1) close(fd);
2728- free(*servername);
2729- free(*servicename);
2730- free(*protocol);
2731- *servicename = *servername = *protocol = NULL;
2732- return -1;
2733-}
2734-
2735-static void
2736-destroy_client(struct clnt_info *clp)
2737-{
2738- if (clp->krb5_poll_index != -1)
2739- memset(&pollarray[clp->krb5_poll_index], 0,
2740- sizeof(struct pollfd));
2741- if (clp->gssd_poll_index != -1)
2742- memset(&pollarray[clp->gssd_poll_index], 0,
2743- sizeof(struct pollfd));
2744- if (clp->dir_fd != -1) close(clp->dir_fd);
2745- if (clp->krb5_fd != -1) close(clp->krb5_fd);
2746- if (clp->gssd_fd != -1) close(clp->gssd_fd);
2747- free(clp->dirname);
2748- free(clp->servicename);
2749- free(clp->servername);
2750- free(clp->protocol);
2751- free(clp);
2752-}
2753-
2754-static struct clnt_info *
2755-insert_new_clnt(void)
2756-{
2757- struct clnt_info *clp = NULL;
2758-
2759- if (!(clp = (struct clnt_info *)calloc(1,sizeof(struct clnt_info)))) {
2760- printerr(0, "ERROR: can't malloc clnt_info: %s\n",
2761- strerror(errno));
2762- goto out;
2763- }
2764- clp->krb5_poll_index = -1;
2765- clp->gssd_poll_index = -1;
2766- clp->krb5_fd = -1;
2767- clp->gssd_fd = -1;
2768- clp->dir_fd = -1;
2769-
2770- TAILQ_INSERT_HEAD(&clnt_list, clp, list);
2771-out:
2772- return clp;
2773-}
2774-
2775-static int
2776-process_clnt_dir_files(struct clnt_info * clp)
2777-{
2778- char name[PATH_MAX];
2779- char gname[PATH_MAX];
2780- char info_file_name[PATH_MAX];
2781-
2782- if (clp->gssd_fd == -1) {
2783- snprintf(gname, sizeof(gname), "%s/gssd", clp->dirname);
2784- clp->gssd_fd = open(gname, O_RDWR);
2785- }
2786- if (clp->gssd_fd == -1) {
2787- if (clp->krb5_fd == -1) {
2788- snprintf(name, sizeof(name), "%s/krb5", clp->dirname);
2789- clp->krb5_fd = open(name, O_RDWR);
2790- }
2791-
2792- /* If we opened a gss-specific pipe, let's try opening
2793- * the new upcall pipe again. If we succeed, close
2794- * gss-specific pipe(s).
2795- */
2796- if (clp->krb5_fd != -1) {
2797- clp->gssd_fd = open(gname, O_RDWR);
2798- if (clp->gssd_fd != -1) {
2799- if (clp->krb5_fd != -1)
2800- close(clp->krb5_fd);
2801- clp->krb5_fd = -1;
2802- }
2803- }
2804- }
2805-
2806- if ((clp->krb5_fd == -1) && (clp->gssd_fd == -1))
2807- return -1;
2808- snprintf(info_file_name, sizeof(info_file_name), "%s/info",
2809- clp->dirname);
2810- if ((clp->servicename == NULL) &&
2811- read_service_info(info_file_name, &clp->servicename,
2812- &clp->servername, &clp->prog, &clp->vers,
2813- &clp->protocol, (struct sockaddr *) &clp->addr))
2814- return -1;
2815- return 0;
2816-}
2817-
2818-static int
2819-get_poll_index(int *ind)
2820-{
2821- int i;
2822-
2823- *ind = -1;
2824- for (i=0; i<FD_ALLOC_BLOCK; i++) {
2825- if (pollarray[i].events == 0) {
2826- *ind = i;
2827- break;
2828- }
2829- }
2830- if (*ind == -1) {
2831- printerr(0, "ERROR: No pollarray slots open\n");
2832- return -1;
2833- }
2834- return 0;
2835-}
2836-
2837-
2838-static int
2839-insert_clnt_poll(struct clnt_info *clp)
2840-{
2841- if ((clp->gssd_fd != -1) && (clp->gssd_poll_index == -1)) {
2842- if (get_poll_index(&clp->gssd_poll_index)) {
2843- printerr(0, "ERROR: Too many gssd clients\n");
2844- return -1;
2845- }
2846- pollarray[clp->gssd_poll_index].fd = clp->gssd_fd;
2847- pollarray[clp->gssd_poll_index].events |= POLLIN;
2848- }
2849-
2850- if ((clp->krb5_fd != -1) && (clp->krb5_poll_index == -1)) {
2851- if (get_poll_index(&clp->krb5_poll_index)) {
2852- printerr(0, "ERROR: Too many krb5 clients\n");
2853- return -1;
2854- }
2855- pollarray[clp->krb5_poll_index].fd = clp->krb5_fd;
2856- pollarray[clp->krb5_poll_index].events |= POLLIN;
2857- }
2858-
2859- return 0;
2860-}
2861-
2862-static void
2863-process_clnt_dir(char *dir, char *pdir)
2864-{
2865- struct clnt_info * clp;
2866-
2867- if (!(clp = insert_new_clnt()))
2868- goto fail_destroy_client;
2869-
2870- /* An extra for the '/', and an extra for the null */
2871- if (!(clp->dirname = calloc(strlen(dir) + strlen(pdir) + 2, 1))) {
2872- goto fail_destroy_client;
2873- }
2874- sprintf(clp->dirname, "%s/%s", pdir, dir);
2875- if ((clp->dir_fd = open(clp->dirname, O_RDONLY)) == -1) {
2876- printerr(0, "ERROR: can't open %s: %s\n",
2877- clp->dirname, strerror(errno));
2878- goto fail_destroy_client;
2879- }
2880- fcntl(clp->dir_fd, F_SETSIG, DNOTIFY_SIGNAL);
2881- fcntl(clp->dir_fd, F_NOTIFY, DN_CREATE | DN_DELETE | DN_MULTISHOT);
2882-
2883- if (process_clnt_dir_files(clp))
2884- goto fail_keep_client;
2885-
2886- if (insert_clnt_poll(clp))
2887- goto fail_destroy_client;
2888-
2889- return;
2890-
2891-fail_destroy_client:
2892- if (clp) {
2893- TAILQ_REMOVE(&clnt_list, clp, list);
2894- destroy_client(clp);
2895- }
2896-fail_keep_client:
2897- /* We couldn't find some subdirectories, but we keep the client
2898- * around in case we get a notification on the directory when the
2899- * subdirectories are created. */
2900- return;
2901-}
2902-
2903-void
2904-init_client_list(void)
2905-{
2906- TAILQ_INIT(&clnt_list);
2907- /* Eventually plan to grow/shrink poll array: */
2908- pollsize = FD_ALLOC_BLOCK;
2909- pollarray = calloc(pollsize, sizeof(struct pollfd));
2910-}
2911-
2912-/*
2913- * This is run after a DNOTIFY signal, and should clear up any
2914- * directories that are no longer around, and re-scan any existing
2915- * directories, since the DNOTIFY could have been in there.
2916- */
2917-static void
2918-update_old_clients(struct dirent **namelist, int size, char *pdir)
2919-{
2920- struct clnt_info *clp;
2921- void *saveprev;
2922- int i, stillhere;
2923- char fname[PATH_MAX];
2924-
2925- for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) {
2926- /* only compare entries in the global list that are from the
2927- * same pipefs parent directory as "pdir"
2928- */
2929- if (strncmp(clp->dirname, pdir, strlen(pdir)) != 0) continue;
2930-
2931- stillhere = 0;
2932- for (i=0; i < size; i++) {
2933- snprintf(fname, sizeof(fname), "%s/%s",
2934- pdir, namelist[i]->d_name);
2935- if (strcmp(clp->dirname, fname) == 0) {
2936- stillhere = 1;
2937- break;
2938- }
2939- }
2940- if (!stillhere) {
2941- printerr(2, "destroying client %s\n", clp->dirname);
2942- saveprev = clp->list.tqe_prev;
2943- TAILQ_REMOVE(&clnt_list, clp, list);
2944- destroy_client(clp);
2945- clp = saveprev;
2946- }
2947- }
2948- for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) {
2949- if (!process_clnt_dir_files(clp))
2950- insert_clnt_poll(clp);
2951- }
2952-}
2953-
2954-/* Search for a client by directory name, return 1 if found, 0 otherwise */
2955-static int
2956-find_client(char *dirname, char *pdir)
2957-{
2958- struct clnt_info *clp;
2959- char fname[PATH_MAX];
2960-
2961- for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) {
2962- snprintf(fname, sizeof(fname), "%s/%s", pdir, dirname);
2963- if (strcmp(clp->dirname, fname) == 0)
2964- return 1;
2965- }
2966- return 0;
2967-}
2968-
2969-static int
2970-process_pipedir(char *pipe_name)
2971-{
2972- struct dirent **namelist;
2973- int i, j;
2974-
2975- if (chdir(pipe_name) < 0) {
2976- printerr(0, "ERROR: can't chdir to %s: %s\n",
2977- pipe_name, strerror(errno));
2978- return -1;
2979- }
2980-
2981- j = scandir(pipe_name, &namelist, NULL, alphasort);
2982- if (j < 0) {
2983- printerr(0, "ERROR: can't scandir %s: %s\n",
2984- pipe_name, strerror(errno));
2985- return -1;
2986- }
2987-
2988- update_old_clients(namelist, j, pipe_name);
2989- for (i=0; i < j; i++) {
2990- if (i < FD_ALLOC_BLOCK
2991- && !strncmp(namelist[i]->d_name, "clnt", 4)
2992- && !find_client(namelist[i]->d_name, pipe_name))
2993- process_clnt_dir(namelist[i]->d_name, pipe_name);
2994- free(namelist[i]);
2995- }
2996-
2997- free(namelist);
2998-
2999- return 0;
3000-}
3001-
3002-/* Used to read (and re-read) list of clients, set up poll array. */
3003-int
3004-update_client_list(void)
3005-{
3006- int retval = -1;
3007- struct topdirs_info *tdi;
3008-
3009- TAILQ_FOREACH(tdi, &topdirs_list, list) {
3010- retval = process_pipedir(tdi->dirname);
3011- if (retval)
3012- printerr(1, "WARNING: error processing %s\n",
3013- tdi->dirname);
3014-
3015- }
3016- return retval;
3017-}
3018-
3019-/* Encryption types supported by the kernel rpcsec_gss code */
3020-int num_krb5_enctypes = 0;
3021-krb5_enctype *krb5_enctypes = NULL;
3022-
3023-/*
3024- * Parse the supported encryption type information
3025- */
3026-static int
3027-parse_enctypes(char *enctypes)
3028-{
3029- int n = 0;
3030- char *curr, *comma;
3031- int i;
3032- static char *cached_types;
3033-
3034- if (cached_types && strcmp(cached_types, enctypes) == 0)
3035- return 0;
3036- free(cached_types);
3037-
3038- if (krb5_enctypes != NULL) {
3039- free(krb5_enctypes);
3040- krb5_enctypes = NULL;
3041- num_krb5_enctypes = 0;
3042- }
3043-
3044- /* count the number of commas */
3045- for (curr = enctypes; curr && *curr != '\0'; curr = ++comma) {
3046- comma = strchr(curr, ',');
3047- if (comma != NULL)
3048- n++;
3049- else
3050- break;
3051- }
3052- /* If no more commas and we're not at the end, there's one more value */
3053- if (*curr != '\0')
3054- n++;
3055-
3056- /* Empty string, return an error */
3057- if (n == 0)
3058- return ENOENT;
3059-
3060- /* Allocate space for enctypes array */
3061- if ((krb5_enctypes = (int *) calloc(n, sizeof(int))) == NULL) {
3062- return ENOMEM;
3063- }
3064-
3065- /* Now parse each value into the array */
3066- for (curr = enctypes, i = 0; curr && *curr != '\0'; curr = ++comma) {
3067- krb5_enctypes[i++] = atoi(curr);
3068- comma = strchr(curr, ',');
3069- if (comma == NULL)
3070- break;
3071- }
3072-
3073- num_krb5_enctypes = n;
3074- if ((cached_types = malloc(strlen(enctypes)+1)))
3075- strcpy(cached_types, enctypes);
3076-
3077- return 0;
3078-}
3079-
3080-static int
3081-do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
3082- gss_buffer_desc *context_token)
3083-{
3084- char *buf = NULL, *p = NULL, *end = NULL;
3085- unsigned int timeout = context_timeout;
3086- unsigned int buf_size = 0;
3087-
3088- printerr(1, "doing downcall\n");
3089- buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
3090- sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
3091- sizeof(context_token->length) + context_token->length;
3092- p = buf = malloc(buf_size);
3093- end = buf + buf_size;
3094-
3095- if (WRITE_BYTES(&p, end, uid)) goto out_err;
3096- if (WRITE_BYTES(&p, end, timeout)) goto out_err;
3097- if (WRITE_BYTES(&p, end, pd->pd_seq_win)) goto out_err;
3098- if (write_buffer(&p, end, &pd->pd_ctx_hndl)) goto out_err;
3099- if (write_buffer(&p, end, context_token)) goto out_err;
3100-
3101- if (write(k5_fd, buf, p - buf) < p - buf) goto out_err;
3102- if (buf) free(buf);
3103- return 0;
3104-out_err:
3105- if (buf) free(buf);
3106- printerr(1, "Failed to write downcall!\n");
3107- return -1;
3108-}
3109-
3110-static int
3111-do_error_downcall(int k5_fd, uid_t uid, int err)
3112-{
3113- char buf[1024];
3114- char *p = buf, *end = buf + 1024;
3115- unsigned int timeout = 0;
3116- int zero = 0;
3117-
3118- printerr(1, "doing error downcall\n");
3119-
3120- if (WRITE_BYTES(&p, end, uid)) goto out_err;
3121- if (WRITE_BYTES(&p, end, timeout)) goto out_err;
3122- /* use seq_win = 0 to indicate an error: */
3123- if (WRITE_BYTES(&p, end, zero)) goto out_err;
3124- if (WRITE_BYTES(&p, end, err)) goto out_err;
3125-
3126- if (write(k5_fd, buf, p - buf) < p - buf) goto out_err;
3127- return 0;
3128-out_err:
3129- printerr(1, "Failed to write error downcall!\n");
3130- return -1;
3131-}
3132-
3133-/*
3134- * If the port isn't already set, do an rpcbind query to the remote server
3135- * using the program and version and get the port.
3136- *
3137- * Newer kernels send the value of the port= mount option in the "info"
3138- * file for the upcall or '0' for NFSv2/3. For NFSv4 it sends the value
3139- * of the port= option or '2049'. The port field in a new sockaddr should
3140- * reflect the value that was sent by the kernel.
3141- */
3142-static int
3143-populate_port(struct sockaddr *sa, const socklen_t salen,
3144- const rpcprog_t program, const rpcvers_t version,
3145- const unsigned short protocol)
3146-{
3147- struct sockaddr_in *s4 = (struct sockaddr_in *) sa;
3148-#ifdef IPV6_SUPPORTED
3149- struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) sa;
3150-#endif /* IPV6_SUPPORTED */
3151- unsigned short port;
3152-
3153- /*
3154- * Newer kernels send the port in the upcall. If we already have
3155- * the port, there's no need to look it up.
3156- */
3157- switch (sa->sa_family) {
3158- case AF_INET:
3159- if (s4->sin_port != 0) {
3160- printerr(2, "DEBUG: port already set to %d\n",
3161- ntohs(s4->sin_port));
3162- return 1;
3163- }
3164- break;
3165-#ifdef IPV6_SUPPORTED
3166- case AF_INET6:
3167- if (s6->sin6_port != 0) {
3168- printerr(2, "DEBUG: port already set to %d\n",
3169- ntohs(s6->sin6_port));
3170- return 1;
3171- }
3172- break;
3173-#endif /* IPV6_SUPPORTED */
3174- default:
3175- printerr(0, "ERROR: unsupported address family %d\n",
3176- sa->sa_family);
3177- return 0;
3178- }
3179-
3180- /*
3181- * Newer kernels that send the port in the upcall set the value to
3182- * 2049 for NFSv4 mounts when one isn't specified. The check below is
3183- * only for kernels that don't send the port in the upcall. For those
3184- * we either have to do an rpcbind query or set it to the standard
3185- * port. Doing a query could be problematic (firewalls, etc), so take
3186- * the latter approach.
3187- */
3188- if (program == 100003 && version == 4) {
3189- port = 2049;
3190- goto set_port;
3191- }
3192-
3193- port = nfs_getport(sa, salen, program, version, protocol);
3194- if (!port) {
3195- printerr(0, "ERROR: unable to obtain port for prog %ld "
3196- "vers %ld\n", program, version);
3197- return 0;
3198- }
3199-
3200-set_port:
3201- printerr(2, "DEBUG: setting port to %hu for prog %lu vers %lu\n", port,
3202- program, version);
3203-
3204- switch (sa->sa_family) {
3205- case AF_INET:
3206- s4->sin_port = htons(port);
3207- break;
3208-#ifdef IPV6_SUPPORTED
3209- case AF_INET6:
3210- s6->sin6_port = htons(port);
3211- break;
3212-#endif /* IPV6_SUPPORTED */
3213- }
3214-
3215- return 1;
3216-}
3217-
3218-/*
3219- * Create an RPC connection and establish an authenticated
3220- * gss context with a server.
3221- */
3222-int create_auth_rpc_client(struct clnt_info *clp,
3223- CLIENT **clnt_return,
3224- AUTH **auth_return,
3225- uid_t uid,
3226- int authtype)
3227-{
3228- CLIENT *rpc_clnt = NULL;
3229- struct rpc_gss_sec sec;
3230- AUTH *auth = NULL;
3231- uid_t save_uid = -1;
3232- int retval = -1;
3233- OM_uint32 min_stat;
3234- char rpc_errmsg[1024];
3235- int protocol;
3236- struct timeval timeout = {5, 0};
3237- struct sockaddr *addr = (struct sockaddr *) &clp->addr;
3238- socklen_t salen;
3239-
3240- /* Create the context as the user (not as root) */
3241- save_uid = geteuid();
3242- if (setfsuid(uid) != 0) {
3243- printerr(0, "WARNING: Failed to setfsuid for "
3244- "user with uid %d\n", uid);
3245- goto out_fail;
3246- }
3247- printerr(2, "creating context using fsuid %d (save_uid %d)\n",
3248- uid, save_uid);
3249-
3250- sec.qop = GSS_C_QOP_DEFAULT;
3251- sec.svc = RPCSEC_GSS_SVC_NONE;
3252- sec.cred = GSS_C_NO_CREDENTIAL;
3253- sec.req_flags = 0;
3254- if (authtype == AUTHTYPE_KRB5) {
3255- sec.mech = (gss_OID)&krb5oid;
3256- sec.req_flags = GSS_C_MUTUAL_FLAG;
3257- }
3258- else {
3259- printerr(0, "ERROR: Invalid authentication type (%d) "
3260- "in create_auth_rpc_client\n", authtype);
3261- goto out_fail;
3262- }
3263-
3264-
3265- if (authtype == AUTHTYPE_KRB5) {
3266-#ifdef HAVE_SET_ALLOWABLE_ENCTYPES
3267- /*
3268- * Do this before creating rpc connection since we won't need
3269- * rpc connection if it fails!
3270- */
3271- if (limit_krb5_enctypes(&sec)) {
3272- printerr(1, "WARNING: Failed while limiting krb5 "
3273- "encryption types for user with uid %d\n",
3274- uid);
3275- goto out_fail;
3276- }
3277-#endif
3278- }
3279-
3280- /* create an rpc connection to the nfs server */
3281-
3282- printerr(2, "creating %s client for server %s\n", clp->protocol,
3283- clp->servername);
3284-
3285- if ((strcmp(clp->protocol, "tcp")) == 0) {
3286- protocol = IPPROTO_TCP;
3287- } else if ((strcmp(clp->protocol, "udp")) == 0) {
3288- protocol = IPPROTO_UDP;
3289- } else {
3290- printerr(0, "WARNING: unrecognized protocol, '%s', requested "
3291- "for connection to server %s for user with uid %d\n",
3292- clp->protocol, clp->servername, uid);
3293- goto out_fail;
3294- }
3295-
3296- switch (addr->sa_family) {
3297- case AF_INET:
3298- salen = sizeof(struct sockaddr_in);
3299- break;
3300-#ifdef IPV6_SUPPORTED
3301- case AF_INET6:
3302- salen = sizeof(struct sockaddr_in6);
3303- break;
3304-#endif /* IPV6_SUPPORTED */
3305- default:
3306- printerr(1, "ERROR: Unknown address family %d\n",
3307- addr->sa_family);
3308- goto out_fail;
3309- }
3310-
3311- if (!populate_port(addr, salen, clp->prog, clp->vers, protocol))
3312- goto out_fail;
3313-
3314- rpc_clnt = nfs_get_rpcclient(addr, salen, protocol, clp->prog,
3315- clp->vers, &timeout);
3316- if (!rpc_clnt) {
3317- snprintf(rpc_errmsg, sizeof(rpc_errmsg),
3318- "WARNING: can't create %s rpc_clnt to server %s for "
3319- "user with uid %d",
3320- protocol == IPPROTO_TCP ? "tcp" : "udp",
3321- clp->servername, uid);
3322- printerr(0, "%s\n",
3323- clnt_spcreateerror(rpc_errmsg));
3324- goto out_fail;
3325- }
3326-
3327- printerr(2, "creating context with server %s\n", clp->servicename);
3328- auth = authgss_create_default(rpc_clnt, clp->servicename, &sec);
3329- if (!auth) {
3330- /* Our caller should print appropriate message */
3331- printerr(2, "WARNING: Failed to create krb5 context for "
3332- "user with uid %d for server %s\n",
3333- uid, clp->servername);
3334- goto out_fail;
3335- }
3336-
3337- /* Success !!! */
3338- rpc_clnt->cl_auth = auth;
3339- *clnt_return = rpc_clnt;
3340- *auth_return = auth;
3341- retval = 0;
3342-
3343- out:
3344- if (sec.cred != GSS_C_NO_CREDENTIAL)
3345- gss_release_cred(&min_stat, &sec.cred);
3346- /* Restore euid to original value */
3347- if (((int)save_uid != -1) && (setfsuid(save_uid) != (int)uid)) {
3348- printerr(0, "WARNING: Failed to restore fsuid"
3349- " to uid %d from %d\n", save_uid, uid);
3350- }
3351- return retval;
3352-
3353- out_fail:
3354- /* Only destroy here if failure. Otherwise, caller is responsible */
3355- if (rpc_clnt) clnt_destroy(rpc_clnt);
3356-
3357- goto out;
3358-}
3359-
3360-static char *
3361-user_cachedir(char *dirname, uid_t uid)
3362-{
3363- struct passwd *pw;
3364- char *ptr;
3365-
3366- if ((pw = getpwuid(uid)) == NULL) {
3367- printerr(0, "user_cachedir: Failed to find '%d' uid"
3368- " for cache directory\n");
3369- return NULL;
3370- }
3371- ptr = malloc(strlen(dirname)+strlen(pw->pw_name)+2);
3372- if (ptr)
3373- sprintf(ptr, "%s/%s", dirname, pw->pw_name);
3374-
3375- return ptr;
3376-}
3377-/*
3378- * this code uses the userland rpcsec gss library to create a krb5
3379- * context on behalf of the kernel
3380- */
3381-static void
3382-process_krb5_upcall(struct clnt_info *clp, uid_t uid, int fd, char *tgtname,
3383- char *service)
3384-{
3385- CLIENT *rpc_clnt = NULL;
3386- AUTH *auth = NULL;
3387- struct authgss_private_data pd;
3388- gss_buffer_desc token;
3389- char **credlist = NULL;
3390- char **ccname;
3391- char **dirname, *dir, *userdir;
3392- int create_resp = -1;
3393- int err, downcall_err = -EACCES;
3394-
3395- printerr(1, "handling krb5 upcall (%s)\n", clp->dirname);
3396-
3397- if (tgtname) {
3398- if (clp->servicename) {
3399- free(clp->servicename);
3400- clp->servicename = strdup(tgtname);
3401- }
3402- }
3403- token.length = 0;
3404- token.value = NULL;
3405- memset(&pd, 0, sizeof(struct authgss_private_data));
3406-
3407- /*
3408- * If "service" is specified, then the kernel is indicating that
3409- * we must use machine credentials for this request. (Regardless
3410- * of the uid value or the setting of root_uses_machine_creds.)
3411- * If the service value is "*", then any service name can be used.
3412- * Otherwise, it specifies the service name that should be used.
3413- * (For now, the values of service will only be "*" or "nfs".)
3414- *
3415- * Restricting gssd to use "nfs" service name is needed for when
3416- * the NFS server is doing a callback to the NFS client. In this
3417- * case, the NFS server has to authenticate itself as "nfs" --
3418- * even if there are other service keys such as "host" or "root"
3419- * in the keytab.
3420- *
3421- * Another case when the kernel may specify the service attribute
3422- * is when gssd is being asked to create the context for a
3423- * SETCLIENT_ID operation. In this case, machine credentials
3424- * must be used for the authentication. However, the service name
3425- * used for this case is not important.
3426- *
3427- */
3428- printerr(2, "%s: service is '%s'\n", __func__,
3429- service ? service : "<null>");
3430- if (uid != 0 || (uid == 0 && root_uses_machine_creds == 0 &&
3431- service == NULL)) {
3432- /* Tell krb5 gss which credentials cache to use */
3433- for (dirname = ccachesearch; *dirname != NULL; dirname++) {
3434- /* See if the user name is needed */
3435- if (strncmp(*dirname, GSSD_USER_CRED_DIR,
3436- strlen(GSSD_USER_CRED_DIR)) == 0) {
3437- userdir = user_cachedir(*dirname, uid);
3438- if (userdir == NULL)
3439- continue;
3440- dir = userdir;
3441- } else
3442- dir = *dirname;
3443-
3444- err = gssd_setup_krb5_user_gss_ccache(uid, clp->servername, dir);
3445-
3446- if (userdir) {
3447- free(userdir);
3448- userdir = NULL;
3449- }
3450- if (err == -EKEYEXPIRED)
3451- downcall_err = -EKEYEXPIRED;
3452- else if (!err)
3453- create_resp = create_auth_rpc_client(clp, &rpc_clnt, &auth, uid,
3454- AUTHTYPE_KRB5);
3455- if (create_resp == 0)
3456- break;
3457- }
3458- }
3459- if (create_resp != 0) {
3460- if (uid == 0 && (root_uses_machine_creds == 1 ||
3461- service != NULL)) {
3462- int nocache = 0;
3463- int success = 0;
3464- do {
3465- gssd_refresh_krb5_machine_credential(clp->servername,
3466- NULL, service);
3467- /*
3468- * Get a list of credential cache names and try each
3469- * of them until one works or we've tried them all
3470- */
3471- if (gssd_get_krb5_machine_cred_list(&credlist)) {
3472- printerr(0, "ERROR: No credentials found "
3473- "for connection to server %s\n",
3474- clp->servername);
3475- goto out_return_error;
3476- }
3477- for (ccname = credlist; ccname && *ccname; ccname++) {
3478- gssd_setup_krb5_machine_gss_ccache(*ccname);
3479- if ((create_auth_rpc_client(clp, &rpc_clnt,
3480- &auth, uid,
3481- AUTHTYPE_KRB5)) == 0) {
3482- /* Success! */
3483- success++;
3484- break;
3485- }
3486- printerr(2, "WARNING: Failed to create machine krb5 context "
3487- "with credentials cache %s for server %s\n",
3488- *ccname, clp->servername);
3489- }
3490- gssd_free_krb5_machine_cred_list(credlist);
3491- if (!success) {
3492- if(nocache == 0) {
3493- nocache++;
3494- printerr(2, "WARNING: Machine cache is prematurely expired or corrupted "
3495- "trying to recreate cache for server %s\n", clp->servername);
3496- } else {
3497- printerr(1, "WARNING: Failed to create machine krb5 context "
3498- "with any credentials cache for server %s\n",
3499- clp->servername);
3500- goto out_return_error;
3501- }
3502- }
3503- } while(!success);
3504- } else {
3505- printerr(1, "WARNING: Failed to create krb5 context "
3506- "for user with uid %d for server %s\n",
3507- uid, clp->servername);
3508- goto out_return_error;
3509- }
3510- }
3511-
3512- if (!authgss_get_private_data(auth, &pd)) {
3513- printerr(1, "WARNING: Failed to obtain authentication "
3514- "data for user with uid %d for server %s\n",
3515- uid, clp->servername);
3516- goto out_return_error;
3517- }
3518-
3519- if (serialize_context_for_kernel(pd.pd_ctx, &token, &krb5oid, NULL)) {
3520- printerr(0, "WARNING: Failed to serialize krb5 context for "
3521- "user with uid %d for server %s\n",
3522- uid, clp->servername);
3523- goto out_return_error;
3524- }
3525-
3526- do_downcall(fd, uid, &pd, &token);
3527-
3528-out:
3529- if (token.value)
3530- free(token.value);
3531-#ifndef HAVE_LIBTIRPC
3532- if (pd.pd_ctx_hndl.length != 0)
3533- authgss_free_private_data(&pd);
3534-#endif
3535- if (auth)
3536- AUTH_DESTROY(auth);
3537- if (rpc_clnt)
3538- clnt_destroy(rpc_clnt);
3539- return;
3540-
3541-out_return_error:
3542- do_error_downcall(fd, uid, downcall_err);
3543- goto out;
3544-}
3545-
3546-void
3547-handle_krb5_upcall(struct clnt_info *clp)
3548-{
3549- uid_t uid;
3550-
3551- if (read(clp->krb5_fd, &uid, sizeof(uid)) < (ssize_t)sizeof(uid)) {
3552- printerr(0, "WARNING: failed reading uid from krb5 "
3553- "upcall pipe: %s\n", strerror(errno));
3554- return;
3555- }
3556-
3557- return process_krb5_upcall(clp, uid, clp->krb5_fd, NULL, NULL);
3558-}
3559-
3560-void
3561-handle_gssd_upcall(struct clnt_info *clp)
3562-{
3563- uid_t uid;
3564- char *lbuf = NULL;
3565- int lbuflen = 0;
3566- char *p;
3567- char *mech = NULL;
3568- char *target = NULL;
3569- char *service = NULL;
3570- char *enctypes = NULL;
3571-
3572- printerr(1, "handling gssd upcall (%s)\n", clp->dirname);
3573-
3574- if (readline(clp->gssd_fd, &lbuf, &lbuflen) != 1) {
3575- printerr(0, "WARNING: handle_gssd_upcall: "
3576- "failed reading request\n");
3577- return;
3578- }
3579- printerr(2, "%s: '%s'\n", __func__, lbuf);
3580-
3581- /* find the mechanism name */
3582- if ((p = strstr(lbuf, "mech=")) != NULL) {
3583- mech = malloc(lbuflen);
3584- if (!mech)
3585- goto out;
3586- if (sscanf(p, "mech=%s", mech) != 1) {
3587- printerr(0, "WARNING: handle_gssd_upcall: "
3588- "failed to parse gss mechanism name "
3589- "in upcall string '%s'\n", lbuf);
3590- goto out;
3591- }
3592- } else {
3593- printerr(0, "WARNING: handle_gssd_upcall: "
3594- "failed to find gss mechanism name "
3595- "in upcall string '%s'\n", lbuf);
3596- goto out;
3597- }
3598-
3599- /* read uid */
3600- if ((p = strstr(lbuf, "uid=")) != NULL) {
3601- if (sscanf(p, "uid=%d", &uid) != 1) {
3602- printerr(0, "WARNING: handle_gssd_upcall: "
3603- "failed to parse uid "
3604- "in upcall string '%s'\n", lbuf);
3605- goto out;
3606- }
3607- } else {
3608- printerr(0, "WARNING: handle_gssd_upcall: "
3609- "failed to find uid "
3610- "in upcall string '%s'\n", lbuf);
3611- goto out;
3612- }
3613-
3614- /* read supported encryption types if supplied */
3615- if ((p = strstr(lbuf, "enctypes=")) != NULL) {
3616- enctypes = malloc(lbuflen);
3617- if (!enctypes)
3618- goto out;
3619- if (sscanf(p, "enctypes=%s", enctypes) != 1) {
3620- printerr(0, "WARNING: handle_gssd_upcall: "
3621- "failed to parse encryption types "
3622- "in upcall string '%s'\n", lbuf);
3623- goto out;
3624- }
3625- if (parse_enctypes(enctypes) != 0) {
3626- printerr(0, "WARNING: handle_gssd_upcall: "
3627- "parsing encryption types failed: errno %d\n", errno);
3628- }
3629- }
3630-
3631- /* read target name */
3632- if ((p = strstr(lbuf, "target=")) != NULL) {
3633- target = malloc(lbuflen);
3634- if (!target)
3635- goto out;
3636- if (sscanf(p, "target=%s", target) != 1) {
3637- printerr(0, "WARNING: handle_gssd_upcall: "
3638- "failed to parse target name "
3639- "in upcall string '%s'\n", lbuf);
3640- goto out;
3641- }
3642- }
3643-
3644- /*
3645- * read the service name
3646- *
3647- * The presence of attribute "service=" indicates that machine
3648- * credentials should be used for this request. If the value
3649- * is "*", then any machine credentials available can be used.
3650- * If the value is anything else, then machine credentials for
3651- * the specified service name (always "nfs" for now) should be
3652- * used.
3653- */
3654- if ((p = strstr(lbuf, "service=")) != NULL) {
3655- service = malloc(lbuflen);
3656- if (!service)
3657- goto out;
3658- if (sscanf(p, "service=%s", service) != 1) {
3659- printerr(0, "WARNING: handle_gssd_upcall: "
3660- "failed to parse service type "
3661- "in upcall string '%s'\n", lbuf);
3662- goto out;
3663- }
3664- }
3665-
3666- if (strcmp(mech, "krb5") == 0)
3667- process_krb5_upcall(clp, uid, clp->gssd_fd, target, service);
3668- else
3669- printerr(0, "WARNING: handle_gssd_upcall: "
3670- "received unknown gss mech '%s'\n", mech);
3671-
3672-out:
3673- free(lbuf);
3674- free(mech);
3675- free(enctypes);
3676- free(target);
3677- free(service);
3678- return;
3679-}
3680-
3681
3682=== removed directory '.pc/16-mount.nfs.man-update-distinction-between-fstype.patch'
3683=== removed directory '.pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils'
3684=== removed directory '.pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils/mount'
3685=== removed file '.pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils/mount/mount.nfs.man'
3686--- .pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils/mount/mount.nfs.man 2011-03-27 18:54:45 +0000
3687+++ .pc/16-mount.nfs.man-update-distinction-between-fstype.patch/utils/mount/mount.nfs.man 1970-01-01 00:00:00 +0000
3688@@ -1,86 +0,0 @@
3689-.\"@(#)mount.nfs.8"
3690-.TH MOUNT.NFS 8 "5 Jun 2006"
3691-.SH NAME
3692-mount.nfs, mount.nfs4 \- mount a Network File System
3693-.SH SYNOPSIS
3694-.BI "mount.nfs" " remotetarget dir" " [\-rvVwfnsh ] [\-o " options "]
3695-.SH DESCRIPTION
3696-.BR mount.nfs
3697-is a part of
3698-.BR nfs (5)
3699-utilities package, which provides NFS client functionality.
3700-
3701-.BR mount.nfs
3702-is meant to be used by the
3703-.BR mount (8)
3704-command for mounting NFS shares. This subcommand, however, can also be used as a standalone command with limited functionality.
3705-
3706-.BR mount.nfs4
3707-is used for mounting NFSv4 file system, while
3708-.BR mount.nfs
3709-is used to mount NFS file systems versions 3 or 2.
3710-.I remotetarget
3711-is a server share usually in the form of
3712-.BR servername:/path/to/share.
3713-.I dir
3714-is the directory on which the file system is to be mounted.
3715-
3716-.SH OPTIONS
3717-.TP
3718-.BI "\-r"
3719-Mount file system readonly.
3720-.TP
3721-.BI "\-v"
3722-Be verbose.
3723-.TP
3724-.BI "\-V"
3725-Print version.
3726-.TP
3727-.BI "\-w"
3728-Mount file system read-write.
3729-.TP
3730-.BI "\-f"
3731-Fake mount. Don't actually call the mount system call.
3732-.TP
3733-.BI "\-n"
3734-Do not update
3735-.I /etc/mtab.
3736-By default, an entry is created in
3737-.I /etc/mtab
3738-for every mounted file system. Use this option to skip making an entry.
3739-.TP
3740-.BI "\-s"
3741-Tolerate sloppy mount options rather than fail.
3742-.TP
3743-.BI "\-h"
3744-Print help message.
3745-.TP
3746-.BI "nfsoptions"
3747-Refer to
3748-.BR nfs (5)
3749-or
3750-.BR mount (8)
3751-manual pages.
3752-
3753-.SH NOTE
3754-For further information please refer
3755-.BR nfs (5)
3756-and
3757-.BR mount (8)
3758-manual pages.
3759-
3760-.SH FILES
3761-.TP 18n
3762-.I /etc/fstab
3763-file system table
3764-.TP
3765-.I /etc/mtab
3766-table of mounted file systems
3767-
3768-.PD
3769-.SH "SEE ALSO"
3770-.BR nfs (5),
3771-.BR mount (8),
3772-
3773-.SH "AUTHOR"
3774-Amit Gud <agud@redhat.com>
3775
3776=== removed directory '.pc/17-multiarch-kerberos-paths.patch'
3777=== removed directory '.pc/17-multiarch-kerberos-paths.patch/aclocal'
3778=== removed file '.pc/17-multiarch-kerberos-paths.patch/aclocal/kerberos5.m4'
3779--- .pc/17-multiarch-kerberos-paths.patch/aclocal/kerberos5.m4 2012-05-25 20:41:58 +0000
3780+++ .pc/17-multiarch-kerberos-paths.patch/aclocal/kerberos5.m4 1970-01-01 00:00:00 +0000
3781@@ -1,115 +0,0 @@
3782-dnl Checks for Kerberos
3783-dnl NOTE: while we intend to do generic gss-api, currently we
3784-dnl have a requirement to get an initial Kerberos machine
3785-dnl credential. Thus, the requirement for Kerberos.
3786-dnl The Kerberos gssapi library will be dynamically loaded?
3787-AC_DEFUN([AC_KERBEROS_V5],[
3788- AC_MSG_CHECKING(for Kerberos v5)
3789- AC_ARG_WITH(krb5,
3790- [AC_HELP_STRING([--with-krb5=DIR], [use Kerberos v5 installation in DIR])],
3791- [ case "$withval" in
3792- yes|no)
3793- krb5_with=""
3794- ;;
3795- *)
3796- krb5_with="$withval"
3797- ;;
3798- esac ]
3799- )
3800-
3801- for dir in $krb5_with /usr /usr/kerberos /usr/local /usr/local/krb5 \
3802- /usr/krb5 /usr/heimdal /usr/local/heimdal /usr/athena ; do
3803- dnl This ugly hack brought on by the split installation of
3804- dnl MIT Kerberos on Fedora Core 1
3805- K5CONFIG=""
3806- if test -f $dir/bin/krb5-config; then
3807- K5CONFIG=$dir/bin/krb5-config
3808- elif test -f "/usr/kerberos/bin/krb5-config"; then
3809- K5CONFIG="/usr/kerberos/bin/krb5-config"
3810- elif test -f "/usr/lib/mit/bin/krb5-config"; then
3811- K5CONFIG="/usr/lib/mit/bin/krb5-config"
3812- fi
3813- if test "$K5CONFIG" != ""; then
3814- KRBCFLAGS=`$K5CONFIG --cflags`
3815- KRBLIBS=`$K5CONFIG --libs`
3816- K5VERS=`$K5CONFIG --version | head -n 1 | awk '{split($(4),v,"."); if (v@<:@"3"@:>@ == "") v@<:@"3"@:>@ = "0"; print v@<:@"1"@:>@v@<:@"2"@:>@v@<:@"3"@:>@ }'`
3817- AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
3818- if test -f $dir/include/gssapi/gssapi_krb5.h -a \
3819- \( -f $dir/lib/libgssapi_krb5.a -o \
3820- -f $dir/lib64/libgssapi_krb5.a -o \
3821- -f $dir/lib64/libgssapi_krb5.so -o \
3822- -f $dir/lib/libgssapi_krb5.so \) ; then
3823- AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
3824- KRBDIR="$dir"
3825- dnl If we are using MIT K5 1.3.1 and before, we *MUST* use the
3826- dnl private function (gss_krb5_ccache_name) to get correct
3827- dnl behavior of changing the ccache used by gssapi.
3828- dnl Starting in 1.3.2, we *DO NOT* want to use
3829- dnl gss_krb5_ccache_name, instead we want to set KRB5CCNAME
3830- dnl to get gssapi to use a different ccache
3831- if test $K5VERS -le 131; then
3832- AC_DEFINE(USE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the private function, gss_krb5_cache_name, must be used to tell the Kerberos library which credentials cache to use. Otherwise, this is done by setting the KRB5CCNAME environment variable])
3833- fi
3834- gssapi_lib=gssapi_krb5
3835- break
3836- dnl The following ugly hack brought on by the split installation
3837- dnl of Heimdal Kerberos on SuSe
3838- elif test \( -f $dir/include/heim_err.h -o\
3839- -f $dir/include/heimdal/heim_err.h \) -a \
3840- -f $dir/lib/libroken.a; then
3841- AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
3842- KRBDIR="$dir"
3843- gssapi_lib=gssapi
3844- break
3845- fi
3846- fi
3847- done
3848- dnl We didn't find a usable Kerberos environment
3849- if test "x$KRBDIR" = "x"; then
3850- if test "x$krb5_with" = "x"; then
3851- AC_MSG_ERROR(Kerberos v5 with GSS support not found: consider --disable-gss or --with-krb5=)
3852- else
3853- AC_MSG_ERROR(Kerberos v5 with GSS support not found at $krb5_with)
3854- fi
3855- fi
3856- AC_MSG_RESULT($KRBDIR)
3857-
3858- dnl Check if -rpath=$(KRBDIR)/lib is needed
3859- echo "The current KRBDIR is $KRBDIR"
3860- if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
3861- -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
3862- KRBLDFLAGS="";
3863- elif /sbin/ldconfig -p | grep > /dev/null "=> $KRBDIR/lib/"; then
3864- KRBLDFLAGS="";
3865- else
3866- KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
3867- fi
3868-
3869- dnl Now check for functions within gssapi library
3870- AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
3871- AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIBS)
3872- AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes,
3873- AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIBS)
3874- AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name,
3875- AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIBS)
3876-
3877- dnl Check for newer error message facility
3878- AC_CHECK_LIB($gssapi_lib, krb5_get_error_message,
3879- AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE, 1, [Define this if the function krb5_get_error_message is available]), ,$KRBLIBS)
3880-
3881- dnl Check for function to specify addressless tickets
3882- AC_CHECK_LIB($gssapi_lib, krb5_get_init_creds_opt_set_addressless,
3883- AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS, 1, [Define this if the function krb5_get_init_creds_opt_set_addressless is available]), ,$KRBLIBS)
3884-
3885- dnl If they specified a directory and it didn't work, give them a warning
3886- if test "x$krb5_with" != "x" -a "$krb5_with" != "$KRBDIR"; then
3887- AC_MSG_WARN(Using $KRBDIR instead of requested value of $krb5_with for Kerberos!)
3888- fi
3889-
3890- AC_SUBST([KRBDIR])
3891- AC_SUBST([KRBLIBS])
3892- AC_SUBST([KRBCFLAGS])
3893- AC_SUBST([KRBLDFLAGS])
3894- AC_SUBST([K5VERS])
3895-
3896-])
3897
3898=== removed directory '.pc/18-osd_login-sbindir.patch'
3899=== removed directory '.pc/18-osd_login-sbindir.patch/utils'
3900=== removed directory '.pc/18-osd_login-sbindir.patch/utils/osd_login'
3901=== removed file '.pc/18-osd_login-sbindir.patch/utils/osd_login/Makefile.am'
3902--- .pc/18-osd_login-sbindir.patch/utils/osd_login/Makefile.am 2012-06-22 15:04:56 +0000
3903+++ .pc/18-osd_login-sbindir.patch/utils/osd_login/Makefile.am 1970-01-01 00:00:00 +0000
3904@@ -1,12 +0,0 @@
3905-## Process this file with automake to produce Makefile.in
3906-
3907-OSD_LOGIN_FILES= osd_login
3908-
3909-EXTRA_DIST= $(OSD_LOGIN_FILES)
3910-
3911-all-local: $(OSD_LOGIN_FILES)
3912-
3913-install-data-hook:
3914- $(INSTALL) --mode 755 osd_login $(DESTDIR)/sbin/osd_login
3915-
3916-MAINTAINERCLEANFILES = Makefile.in
3917
3918=== removed directory '.pc/19-iscsiadm-path.patch'
3919=== removed directory '.pc/19-iscsiadm-path.patch/utils'
3920=== removed directory '.pc/19-iscsiadm-path.patch/utils/osd_login'
3921=== removed file '.pc/19-iscsiadm-path.patch/utils/osd_login/osd_login'
3922--- .pc/19-iscsiadm-path.patch/utils/osd_login/osd_login 2012-06-22 15:04:56 +0000
3923+++ .pc/19-iscsiadm-path.patch/utils/osd_login/osd_login 1970-01-01 00:00:00 +0000
3924@@ -1,118 +0,0 @@
3925-#!/bin/bash
3926-#
3927-# osd_login : This script is part of the autologin feature
3928-# mandated by the pnfs-objects standard.
3929-# It is called from objlayoutdriver.ko in the kernel.
3930-
3931-# Copyright (C) 2012, Sachin Bhamare <sbhamare@panasas.com>
3932-# Copyright (C) 2012, Boaz Harrosh <bharrosh@panasas.com>
3933-#
3934-# This program is free software; you can redistribute it and/or modify
3935-# it under the terms of the GNU General Public License version 2 as
3936-# published by the Free Software Foundation.
3937-#
3938-# This program is distributed in the hope that it will be useful,
3939-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3940-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3941-# GNU General Public License for more details.
3942-#
3943-# You should have received a copy of the GNU General Public License
3944-# along with this program; if not, write to the Free Software
3945-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
3946-# MA 02110-1301 USA
3947-
3948-umask 022
3949-
3950-PATH="/sbin:/usr/sbin:/bin:/usr/bin"
3951-
3952-iscsiadm=/sbin/iscsiadm
3953-
3954-PARENT_PID=$BASHPID
3955-WATCHDOG_TIMEOUT=15
3956-
3957-protocol=""
3958-portal=""
3959-uri=""
3960-osdname=""
3961-systemid=""
3962-
3963-usage()
3964-{
3965- echo "Usage: $0 -u <URI> -o <OSDNAME> -s <SYSTEMID>"
3966- echo "Options:"
3967- echo "-u target uri e.g. iscsi://<ip>:<port>"
3968- echo "-o osdname of the target OSD"
3969- echo "-s systemid of the target OSD"
3970-}
3971-
3972-parse_cmdline()
3973-{
3974- argc=$#
3975- if [ $# -lt 3 ]; then
3976- usage
3977- exit 1
3978- fi
3979-
3980- # parse the input arguments
3981- while getopts "u:o:s:" options; do
3982- case $options in
3983- u ) uri=$OPTARG;;
3984- o ) osdname=$OPTARG;;
3985- s ) systemid=$OPTARG;;
3986- \? ) usage
3987- exit 1;;
3988- * ) usage
3989- exit 1;;
3990- esac
3991- done
3992-
3993- echo "-u : $uri"
3994- echo "-o : $osdname"
3995- echo "-s : $systemid"
3996-
3997- protocol=`echo $uri | awk -F ':' '{print $1}'`
3998- portal=`echo $uri | awk -F '//' '{print $2}'`
3999-}
4000-
4001-watchdog()
4002-{
4003- timeout=$1
4004- portal=$2
4005-
4006- sleep $timeout
4007- if kill -9 $PARENT_PID; then
4008- echo "watchdog : Timed out (>$timeout seconds) while login into $portal" | logger -t "osd_login"
4009- fi
4010- echo "watchdog: exiting .."
4011- exit 2
4012-}
4013-
4014-login_iscsi_osd()
4015-{
4016- echo "login into: $1"
4017- if ! $iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
4018- echo "$iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
4019- sleep 1;
4020- fi
4021-}
4022-
4023-echo "============= osd_login ========="
4024-echo "progname : $0"
4025-parse_cmdline "$@"
4026-echo "protocol: $protocol"
4027-echo "portal: $portal"
4028-
4029-watchdog $WATCHDOG_TIMEOUT $portal &
4030-watchdog_pid=$!
4031-
4032-case $protocol in
4033-iscsi)
4034- login_iscsi_osd $portal |& logger -t "osd_login"
4035- ;;
4036-*)
4037- echo "Error: protocol $protocol not supported !" | logger -t "osd_login"
4038- ;;
4039-esac
4040-
4041-kill -9 $watchdog_pid
4042-exit 0
4043
4044=== removed file '.pc/applied-patches'
4045--- .pc/applied-patches 2012-06-22 15:04:56 +0000
4046+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
4047@@ -1,8 +0,0 @@
4048-01-sm-notify-in-sbin.patch
4049-02-524255-manpages.patch
4050-03-handle-mtab-symlink.patch
4051-11-532048-reduce-verbosity.patch
4052-16-mount.nfs.man-update-distinction-between-fstype.patch
4053-17-multiarch-kerberos-paths.patch
4054-18-osd_login-sbindir.patch
4055-19-iscsiadm-path.patch
4056
4057=== modified file 'aclocal/kerberos5.m4'
4058--- aclocal/kerberos5.m4 2012-06-22 15:04:56 +0000
4059+++ aclocal/kerberos5.m4 2012-08-05 05:01:18 +0000
4060@@ -29,7 +29,6 @@
4061 elif test -f "/usr/lib/mit/bin/krb5-config"; then
4062 K5CONFIG="/usr/lib/mit/bin/krb5-config"
4063 fi
4064- MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null || true`
4065 if test "$K5CONFIG" != ""; then
4066 KRBCFLAGS=`$K5CONFIG --cflags`
4067 KRBLIBS=`$K5CONFIG --libs`
4068@@ -39,7 +38,6 @@
4069 \( -f $dir/lib/libgssapi_krb5.a -o \
4070 -f $dir/lib64/libgssapi_krb5.a -o \
4071 -f $dir/lib64/libgssapi_krb5.so -o \
4072- -f $dir/lib/$MULTIARCH/libgssapi_krb5.so -o \
4073 -f $dir/lib/libgssapi_krb5.so \) ; then
4074 AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
4075 KRBDIR="$dir"
4076
4077=== modified file 'debian/changelog'
4078--- debian/changelog 2012-06-22 18:25:32 +0000
4079+++ debian/changelog 2012-08-05 05:01:18 +0000
4080@@ -1,3 +1,30 @@
4081+nfs-utils (1:1.2.6-3ubuntu1) quantal; urgency=low
4082+
4083+ * Merge from Debian unstable. Remaining changes:
4084+ - debian/nfs-common.{statd,statd-mounting,gssd,idmapd}.upstart,
4085+ debian/control, debian/nfs-common.{preinst,postinst,prerm,postrm},
4086+ debian/rules: drop nfs-common init script in favor of upstart jobs,
4087+ and build-depend on debhelper (>= 7.3.15ubuntu3) for correct upstart
4088+ init handling.
4089+ - Depend on rpcbind (>= 0.2.0-6ubuntu1) for upstart support.
4090+ - debian/nfs-kernel-server.postinst: don't call "invoke-rc.d nfs-common"
4091+ in the postinst, this is redundant anyway and the nfs-common init script
4092+ is gone now.
4093+ - nfs-kernel-server.init: Unmount nfsd fs when init script stops
4094+ - Allow issuing options to rpc.nfsd
4095+ - debian/nfs-common.defaults: always start idmapd automatically; drop
4096+ the configuration option.
4097+ - Move /var/lib/nfs/rpc_pipefs to /run/rpc_pipefs. This does not belong
4098+ in /var/lib.
4099+
4100+ -- Logan Rosen <logatronico@gmail.com> Sun, 05 Aug 2012 00:56:05 -0400
4101+
4102+nfs-utils (1:1.2.6-3) unstable; urgency=low
4103+
4104+ * Iterate through exports.d to look for expors (Closes: #676604).
4105+
4106+ -- Luk Claes <luk@zomers.be> Tue, 10 Jul 2012 19:38:22 +0200
4107+
4108 nfs-utils (1:1.2.6-2ubuntu1) quantal; urgency=low
4109
4110 * Merge from Debian unstable, remaining changes:
4111
4112=== modified file 'debian/nfs-kernel-server.init'
4113--- debian/nfs-kernel-server.init 2012-06-22 15:04:56 +0000
4114+++ debian/nfs-kernel-server.init 2012-08-05 05:01:18 +0000
4115@@ -61,7 +61,13 @@
4116 # See how we were called.
4117 case "$1" in
4118 start)
4119- if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports
4120+ export_files="/etc/exports"
4121+ for file in /etc/exports.d/*.exports ; do
4122+ if [ -f "$file" ]; then
4123+ export_files="$export_files $file"
4124+ fi
4125+ done
4126+ if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' $export_files
4127 then
4128 do_modprobe nfsd
4129
4130
4131=== modified file 'utils/exportfs/nfsd.man'
4132--- utils/exportfs/nfsd.man 2012-05-25 20:41:58 +0000
4133+++ utils/exportfs/nfsd.man 2012-08-05 05:01:18 +0000
4134@@ -196,7 +196,6 @@
4135 find out what number correspond to what tracing.
4136
4137 .SH SEE ALSO
4138-.BR nfsd (8),
4139 .BR rpc.nfsd (8),
4140 .BR exports (5),
4141 .BR nfsstat (8),
4142
4143=== modified file 'utils/gssd/gss_util.c'
4144--- utils/gssd/gss_util.c 2011-07-09 16:28:32 +0000
4145+++ utils/gssd/gss_util.c 2012-08-05 05:01:18 +0000
4146@@ -126,7 +126,7 @@
4147 "gss_display_status called from %s\n", m);
4148 break;
4149 } else {
4150- printerr(2, "ERROR: GSS-API: (%s) error in %s(): %s\n",
4151+ printerr(0, "ERROR: GSS-API: (%s) error in %s(): %s\n",
4152 typestr, m, (char *)msg.value);
4153 }
4154
4155
4156=== modified file 'utils/gssd/gssd_proc.c'
4157--- utils/gssd/gssd_proc.c 2012-05-25 20:41:58 +0000
4158+++ utils/gssd/gssd_proc.c 2012-08-05 05:01:18 +0000
4159@@ -676,7 +676,7 @@
4160 unsigned int timeout = 0;
4161 int zero = 0;
4162
4163- printerr(2, "doing error downcall\n");
4164+ printerr(1, "doing error downcall\n");
4165
4166 if (WRITE_BYTES(&p, end, uid)) goto out_err;
4167 if (WRITE_BYTES(&p, end, timeout)) goto out_err;
4168@@ -953,7 +953,7 @@
4169 int create_resp = -1;
4170 int err, downcall_err = -EACCES;
4171
4172- printerr(2, "handling krb5 upcall (%s)\n", clp->dirname);
4173+ printerr(1, "handling krb5 upcall (%s)\n", clp->dirname);
4174
4175 if (tgtname) {
4176 if (clp->servicename) {
4177@@ -1071,7 +1071,7 @@
4178 }
4179
4180 if (!authgss_get_private_data(auth, &pd)) {
4181- printerr(2, "WARNING: Failed to obtain authentication "
4182+ printerr(1, "WARNING: Failed to obtain authentication "
4183 "data for user with uid %d for server %s\n",
4184 uid, clp->servername);
4185 goto out_return_error;
4186
4187=== modified file 'utils/mount/fstab.c'
4188--- utils/mount/fstab.c 2011-10-02 18:29:53 +0000
4189+++ utils/mount/fstab.c 2012-08-05 05:01:18 +0000
4190@@ -57,7 +57,7 @@
4191 return var_mtab_does_not_exist;
4192 }
4193
4194-int
4195+static int
4196 mtab_is_a_symlink(void) {
4197 get_mtab_info();
4198 return var_mtab_is_a_symlink;
4199
4200=== modified file 'utils/mount/fstab.h'
4201--- utils/mount/fstab.h 2011-10-02 18:29:53 +0000
4202+++ utils/mount/fstab.h 2012-08-05 05:01:18 +0000
4203@@ -7,7 +7,6 @@
4204 #define _PATH_FSTAB "/etc/fstab"
4205 #endif
4206
4207-int mtab_is_a_symlink(void);
4208 int mtab_is_writable(void);
4209 int mtab_does_not_exist(void);
4210 void reset_mtab_info(void);
4211
4212=== modified file 'utils/mount/mount.c'
4213--- utils/mount/mount.c 2011-07-09 16:28:32 +0000
4214+++ utils/mount/mount.c 2012-08-05 05:01:18 +0000
4215@@ -203,13 +203,6 @@
4216 int flags;
4217 mntFILE *mfp;
4218
4219- /* Avoid writing if the mtab is a symlink to /proc/mounts, since
4220- that would create a file /proc/mounts in case the proc filesystem
4221- is not mounted, and the fchmod below would also fail. */
4222- if (mtab_is_a_symlink()) {
4223- return EX_SUCCESS;
4224- }
4225-
4226 lock_mtab();
4227
4228 mfp = nfs_setmntent (MOUNTED, "a+");
4229
4230=== modified file 'utils/mount/mount.nfs.man'
4231--- utils/mount/mount.nfs.man 2011-03-16 23:10:15 +0000
4232+++ utils/mount/mount.nfs.man 2012-08-05 05:01:18 +0000
4233@@ -15,20 +15,16 @@
4234 .BR mount (8)
4235 command for mounting NFS shares. This subcommand, however, can also be used as a standalone command with limited functionality.
4236
4237+.BR mount.nfs4
4238+is used for mounting NFSv4 file system, while
4239+.BR mount.nfs
4240+is used to mount NFS file systems versions 3 or 2.
4241 .I remotetarget
4242 is a server share usually in the form of
4243 .BR servername:/path/to/share.
4244 .I dir
4245 is the directory on which the file system is to be mounted.
4246
4247-Under Linux 2.6.32 and later kernel versions,
4248-.BR mount.nfs
4249-can mount all NFS file system versions. Under earlier Linux kernel versions,
4250-.BR mount.nfs4
4251-must be used for mounting NFSv4 file systems while
4252-.BR mount.nfs
4253-must be used for NFSv3 and v2.
4254-
4255 .SH OPTIONS
4256 .TP
4257 .BI "\-r"
4258
4259=== modified file 'utils/nfsd/nfsd.man'
4260--- utils/nfsd/nfsd.man 2012-05-25 20:41:58 +0000
4261+++ utils/nfsd/nfsd.man 2012-08-05 05:01:18 +0000
4262@@ -94,7 +94,6 @@
4263 database.
4264
4265 .SH SEE ALSO
4266-.BR nfsd (7),
4267 .BR rpc.mountd (8),
4268 .BR exports (5),
4269 .BR exportfs (8),
4270
4271=== modified file 'utils/osd_login/Makefile.am'
4272--- utils/osd_login/Makefile.am 2012-05-25 20:41:58 +0000
4273+++ utils/osd_login/Makefile.am 2012-08-05 05:01:18 +0000
4274@@ -1,9 +1,12 @@
4275 ## Process this file with automake to produce Makefile.in
4276
4277-# These binaries go in /sbin (not /usr/sbin), and that cannot be
4278-# overridden at config time.
4279-sbindir = /sbin
4280-
4281-sbin_SCRIPTS = osd_login
4282+OSD_LOGIN_FILES= osd_login
4283+
4284+EXTRA_DIST= $(OSD_LOGIN_FILES)
4285+
4286+all-local: $(OSD_LOGIN_FILES)
4287+
4288+install-data-hook:
4289+ $(INSTALL) --mode 755 osd_login $(DESTDIR)/sbin/osd_login
4290
4291 MAINTAINERCLEANFILES = Makefile.in
4292
4293=== modified file 'utils/osd_login/osd_login'
4294--- utils/osd_login/osd_login 2012-05-25 20:41:58 +0000
4295+++ utils/osd_login/osd_login 2012-08-05 05:01:18 +0000
4296@@ -25,6 +25,8 @@
4297
4298 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
4299
4300+iscsiadm=/sbin/iscsiadm
4301+
4302 PARENT_PID=$BASHPID
4303 WATCHDOG_TIMEOUT=15
4304
4305@@ -88,8 +90,8 @@
4306 login_iscsi_osd()
4307 {
4308 echo "login into: $1"
4309- if ! iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
4310- echo "iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
4311+ if ! $iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
4312+ echo "$iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
4313 sleep 1;
4314 fi
4315 }
4316
4317=== modified file 'utils/statd/statd.c'
4318--- utils/statd/statd.c 2010-04-06 16:11:22 +0000
4319+++ utils/statd/statd.c 2012-08-05 05:01:18 +0000
4320@@ -190,7 +190,7 @@
4321 char *av[6];
4322 int ac = 0;
4323
4324- av[ac++] = "/sbin/sm-notify";
4325+ av[ac++] = "/usr/sbin/sm-notify";
4326 if (run_mode & MODE_NODAEMON)
4327 av[ac++] = "-d";
4328 if (outport) {

Subscribers

People subscribed via source and target branches

to all changes: