SOURCES: nfs-utils-CITI_NFS4.patch - http://www.citi.umich.edu/pro...

qboosh qboosh at pld-linux.org
Sat Nov 3 13:46:42 CET 2007


Author: qboosh                       Date: Sat Nov  3 12:46:42 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- http://www.citi.umich.edu/projects/nfsv4/linux/nfs-utils-patches/1.1.1-1/nfs-utils-1.1.1-CITI_NFS4_ALL-1.dif with auto* parts removed

---- Files affected:
SOURCES:
   nfs-utils-CITI_NFS4.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/nfs-utils-CITI_NFS4.patch
diff -u SOURCES/nfs-utils-CITI_NFS4.patch:1.5 SOURCES/nfs-utils-CITI_NFS4.patch:1.6
--- SOURCES/nfs-utils-CITI_NFS4.patch:1.5	Tue Aug 14 16:12:41 2007
+++ SOURCES/nfs-utils-CITI_NFS4.patch	Sat Nov  3 13:46:37 2007
@@ -2,570 +2,1658 @@
 
 The complete set of CITI nfs-utils patches rolled into one patch.
 
-Changes since 1.0.11-CITI_NFS4_ALL-1:
+Changes since 1.1.0-CITI_NFS4_ALL-2:
 
- * Update to nfs-utils-1.1.0
+ * Update to nfs-utils-1.1.1
 
- * Include patches from git not yet in a release:
-   - Fix mount error messages
+ * Patch from Steve Langasek <vorlon at debian.org> and
+   Steinar H. Gunderson <sesse at debian.org> fixing segfault problem on
+   64-bit platforms introduced by the xlog cleanup (re-using va_list).
 
- * Update gssd usage message to include new -n option.
 
- * Patches from Bruce Fields to clean up compile warning, and
-   move pseudoflavor code to a common location
-
- * Patch from Bruce Fields and Fred Isaman that adds support
-   to exportfs for reading a sec= option and sending server
-   security data through cache via
-   "... secinfo n flavor1 flag1 ... flavorN flagN".
 
 
 ---
 
- nfs-utils-1.1.0-kwc/support/include/nfslib.h        |   10 +
- nfs-utils-1.1.0-kwc/support/include/pseudoflavors.h |   17 ++
- nfs-utils-1.1.0-kwc/support/nfs/exports.c           |  158 ++++++++++++++++++--
- nfs-utils-1.1.0-kwc/utils/exportfs/exportfs.c       |    1 
- nfs-utils-1.1.0-kwc/utils/gssd/gssd.c               |    2 
- nfs-utils-1.1.0-kwc/utils/mount/mount.c             |   40 ++++-
- nfs-utils-1.1.0-kwc/utils/mount/nfs4_mount.h        |   12 -
- nfs-utils-1.1.0-kwc/utils/mount/nfs4mount.c         |   27 ---
- nfs-utils-1.1.0-kwc/utils/mountd/cache.c            |   21 ++
- 10 files changed, 240 insertions(+), 49 deletions(-)
+-nfs-utils-1.1.1-kwc/aclocal.m4                  |  569 +++--------
+-nfs-utils-1.1.1-kwc/config.guess                |   34 
+-nfs-utils-1.1.1-kwc/config.sub                  |   24 
+-nfs-utils-1.1.1-kwc/configure                   | 1195 ++++++++++--------------
+-nfs-utils-1.1.1-kwc/ltmain.sh                   |  147 +-
+ nfs-utils-1.1.1-kwc/support/nfs/xlog.c          |    8 
+ nfs-utils-1.1.1-kwc/utils/gssd/context.h        |    6 
+ nfs-utils-1.1.1-kwc/utils/gssd/context_lucid.c  |  391 +++++++
+ nfs-utils-1.1.1-kwc/utils/gssd/context_mit.c    |  256 ++++-
+ nfs-utils-1.1.1-kwc/utils/gssd/gssd.c           |    8 
+ nfs-utils-1.1.1-kwc/utils/gssd/gssd.h           |    3 
+ nfs-utils-1.1.1-kwc/utils/gssd/gssd_main_loop.c |   20 
+ nfs-utils-1.1.1-kwc/utils/gssd/gssd_proc.c      |  119 +-
+ nfs-utils-1.1.1-kwc/utils/gssd/krb5_util.c      |  231 +++-
+ nfs-utils-1.1.1-kwc/utils/gssd/krb5_util.h      |    2 
+ nfs-utils-1.1.1-kwc/utils/gssd/svcgssd_proc.c   |   84 +
+ 16 files changed, 1786 insertions(+), 1311 deletions(-)
 
-diff -puN utils/mount/mount.c~CITI_NFS4_ALL utils/mount/mount.c
---- nfs-utils-1.1.0/utils/mount/mount.c~CITI_NFS4_ALL	2007-06-22 10:51:38.885022000 -0400
-+++ nfs-utils-1.1.0-kwc/utils/mount/mount.c	2007-06-22 10:52:04.954241000 -0400
-@@ -285,22 +285,49 @@ static void parse_opts (const char *opti
+diff -puN support/nfs/xlog.c~CITI_NFS4_ALL support/nfs/xlog.c
+--- nfs-utils-1.1.1/support/nfs/xlog.c~CITI_NFS4_ALL	2007-10-23 14:17:18.316202000 -0400
++++ nfs-utils-1.1.1-kwc/support/nfs/xlog.c	2007-10-23 14:17:18.385133000 -0400
+@@ -133,9 +133,13 @@ xlog_enabled(int fac)
+ void
+ xlog_backend(int kind, const char *fmt, va_list args)
+ {
++	va_list args2;
++
+ 	if (!(kind & (L_ALL)) && !(logging && (kind & logmask)))
+ 		return;
+ 
++	va_copy(args2, args);
++
+ 	if (log_syslog) {
+ 		switch (kind) {
+ 		case L_FATAL:
+@@ -172,10 +176,12 @@ xlog_backend(int kind, const char *fmt, 
+ 		fprintf(stderr, "%s: ", log_name);
+ #endif
+ 
+-		vfprintf(stderr, fmt, args);
++		vfprintf(stderr, fmt, args2);
+ 		fprintf(stderr, "\n");
  	}
+ 
++	va_end(args2);
++
+ 	if (kind == L_FATAL)
+ 		exit(1);
  }
+diff -puN utils/gssd/svcgssd_proc.c~CITI_NFS4_ALL utils/gssd/svcgssd_proc.c
+--- nfs-utils-1.1.1/utils/gssd/svcgssd_proc.c~CITI_NFS4_ALL	2007-10-23 14:17:18.488030000 -0400
++++ nfs-utils-1.1.1-kwc/utils/gssd/svcgssd_proc.c	2007-10-23 14:17:18.505013000 -0400
+@@ -51,6 +51,7 @@
+ #include "gss_util.h"
+ #include "err_util.h"
+ #include "context.h"
++#include "gss_oids.h"
+ 
+ extern char * mech2file(gss_OID mech);
+ #define SVCGSSD_CONTEXT_CHANNEL "/proc/net/rpc/auth.rpcsec.context/channel"
+@@ -66,8 +67,30 @@ struct svc_cred {
+ };
  
--static void mount_error(char *node)
-+static void mount_error(char *mntpnt, char *node)
- {
- 	switch(errno) {
- 		case ENOTDIR:
--			fprintf(stderr, "%s: mount point %s is not a directory\n", progname, node);
-+			fprintf(stderr, "%s: mount point %s is not a directory\n", 
-+				progname, mntpnt);
- 			break;
- 		case EBUSY:
--			fprintf(stderr, "%s: %s is already mounted or busy\n", progname, node);
-+			fprintf(stderr, "%s: %s is already mounted or busy\n", 
-+				progname, mntpnt);
- 			break;
- 		case ENOENT:
--			fprintf(stderr, "%s: mount point %s does not exist\n", progname, node);
-+			if (node) {
-+				fprintf(stderr, "%s: %s failed, reason given by server: %s\n",
-+					progname, node, strerror(errno));
-+			} else
-+				fprintf(stderr, "%s: mount point %s does not exist\n", 
-+					progname, mntpnt);
- 			break;
- 		default:
- 			fprintf(stderr, "%s: %s\n", progname, strerror(errno));
+ static int
++get_krb5_hostbased_name (gss_buffer_desc name, char **hostbased_name)
++{
++	char *p, *sname = NULL;
++	if (strchr(name.value, '@') && strchr(name.value, '/')) {
++		if (!(sname = calloc(name.length, 1))) {
++			printerr(0, "ERROR: get_krb5_hostbased_name failed "
++				 "to allocate %d bytes\n", name.length);
++			goto out_err;
++		}
++		/* read in name and instance and replace '/' with '@' */
++		sscanf(name.value, "%[^@]", sname);
++		p = strchr(sname, '/');
++		p[0] = '@';
++	}
++	*hostbased_name = sname;
++	return 0;
++out_err:
++	return -1;
++}
++
++static int
+ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred,
+-		gss_OID mech, gss_buffer_desc *context_token)
++		gss_OID mech, gss_buffer_desc *context_token,
++		char *client_name)
+ {
+ 	FILE *f;
+ 	int i;
+@@ -91,8 +114,9 @@ do_svc_downcall(gss_buffer_desc *out_han
+ 	qword_printint(f, cred->cr_gid);
+ 	qword_printint(f, cred->cr_ngroups);
+ 	printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d, "
+-		 "uid: %d, gid: %d, num aux grps: %d:\n",
++		 "clnt: %s, uid: %d, gid: %d, num aux grps: %d:\n",
+ 		 fname, out_handle->length, context_token->length, 0x7fffffff,
++		 client_name ? client_name : "<null>",
+ 		 cred->cr_uid, cred->cr_gid, cred->cr_ngroups);
+ 	for (i=0; i < cred->cr_ngroups; i++) {
+ 		qword_printint(f, cred->cr_groups[i]);
+@@ -100,6 +124,8 @@ do_svc_downcall(gss_buffer_desc *out_han
  	}
+ 	qword_print(f, fname);
+ 	qword_printhex(f, context_token->value, context_token->length);
++	if (client_name)
++		qword_print(f, client_name);
+ 	err = qword_eol(f);
+ 	fclose(f);
+ 	return err;
+@@ -294,6 +320,45 @@ print_hexl(const char *description, unsi
  }
-+static int chk_mountpoint(char *mount_point)
+ #endif
+ 
++static int
++get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
++			  char **hostbased_name)
 +{
-+	struct stat sb;
++	u_int32_t	maj_stat, min_stat;
++	gss_buffer_desc	name;
++	gss_OID		name_type = GSS_C_NO_OID;
++	char		*cname;
++	int		res = -1;
++
++	/* get the client name and for service principals only
++	 * add it after the context (service name used for
++	 * authenticating callbacks) */
++	maj_stat = gss_display_name(&min_stat, client_name, &name, &name_type);
++	if (maj_stat != GSS_S_COMPLETE) {
++		pgsserr("get_hostbased_client_name: gss_display_name",
++			maj_stat, min_stat, mech);
++		goto out_err;
++	}
++	if (name.length >= 0xffff) { /* be certain name.length+1 doesn't overflow */
++		printerr(0, "ERROR: get_hostbased_client_name: "
++			 "received gss_name is too long (%d bytes)\n",
++			 name.length);
++		goto out_rel_buf;
++	}
++	/* For Kerberos, transform the NT_KRB5_PRINCIPAL to
++	 * NT_HOSTBASED_SERVICE */
++	if (g_OID_equal(&krb5oid, mech)) {
++		if (!get_krb5_hostbased_name(name, &cname))
++			*hostbased_name = cname;
++	}
++	/* For SPKM3, do ??? */
++	res = 0;
++out_rel_buf:
++	gss_release_buffer(&min_stat, &name);
++out_err:
++	return res;
++}
 +
-+	if (stat(mount_point, &sb) < 0){
-+		mount_error(mount_point, NULL);
-+		return 1;
-+	}
-+	if (S_ISDIR(sb.st_mode) == 0){
-+		errno = ENOTDIR;
-+		mount_error(mount_point, NULL);
-+		return 1;
-+	}
-+	if (access(mount_point, X_OK) < 0) {
-+		mount_error(mount_point, NULL);
-+		return 1;
+ void
+ handle_nullreq(FILE *f) {
+ 	/* XXX initialize to a random integer to reduce chances of unnecessary
+@@ -320,6 +385,7 @@ handle_nullreq(FILE *f) {
+ 	static char		*lbuf = NULL;
+ 	static int		lbuflen = 0;
+ 	static char		*cp;
++	char			*hostbased_name = NULL;
+ 
+ 	printerr(1, "handling null request\n");
+ 
+@@ -385,8 +451,12 @@ handle_nullreq(FILE *f) {
+ 		gss_release_name(&ignore_min_stat, &client_name);
+ 		goto out_err;
+ 	}
+-	gss_release_name(&ignore_min_stat, &client_name);
+-
++	if (get_hostbased_client_name(client_name, mech, &hostbased_name)) {
++		/* get_hostbased_client_name() prints error msg */
++		maj_stat = GSS_S_BAD_NAME; /* XXX ? */
++		gss_release_name(&ignore_min_stat, &client_name);
++		goto out_err;
++	}
+ 
+ 	/* Context complete. Pass handle_seq in out_handle to use
+ 	 * for context lookup in the kernel. */
+@@ -400,12 +470,14 @@ handle_nullreq(FILE *f) {
+ 		printerr(0, "WARNING: handle_nullreq: "
+ 			    "serialize_context_for_kernel failed\n");
+ 		maj_stat = GSS_S_FAILURE;
++		gss_release_name(&ignore_min_stat, &client_name);
+ 		goto out_err;
+ 	}
+ 	/* We no longer need the gss context */
+ 	gss_delete_sec_context(&ignore_min_stat, &ctx, &ignore_out_tok);
+ 
+-	do_svc_downcall(&out_handle, &cred, mech, &ctx_token);
++	do_svc_downcall(&out_handle, &cred, mech, &ctx_token, hostbased_name);
++	gss_release_name(&ignore_min_stat, &client_name);
+ continue_needed:
+ 	send_response(f, &in_handle, &in_tok, maj_stat, min_stat,
+ 			&out_handle, &out_tok);
+@@ -414,6 +486,8 @@ out:
+ 		free(ctx_token.value);
+ 	if (out_tok.value != NULL)
+ 		gss_release_buffer(&ignore_min_stat, &out_tok);
++	if (hostbased_name)
++		free(hostbased_name);
+ 	printerr(1, "finished handling null request\n");
+ 	return;
+ 
+diff -puN utils/gssd/gssd_main_loop.c~CITI_NFS4_ALL utils/gssd/gssd_main_loop.c
+--- nfs-utils-1.1.1/utils/gssd/gssd_main_loop.c~CITI_NFS4_ALL	2007-10-23 14:17:18.606911000 -0400
++++ nfs-utils-1.1.1-kwc/utils/gssd/gssd_main_loop.c	2007-10-23 14:17:18.878793000 -0400
+@@ -98,7 +98,7 @@ gssd_run()
+ {
+ 	int			ret;
+ 	struct sigaction	dn_act;
+-	int			fd;
++	int			fd, fd_cb;
+ 
+ 	/* Taken from linux/Documentation/dnotify.txt: */
+ 	dn_act.sa_sigaction = dir_notify_handler;
+@@ -114,6 +114,19 @@ gssd_run()
+ 	fcntl(fd, F_SETSIG, DNOTIFY_SIGNAL);
+ 	fcntl(fd, F_NOTIFY, DN_CREATE|DN_DELETE|DN_MODIFY|DN_MULTISHOT);
+ 
++	if ((fd_cb = open(pipefs_nfscbdir, O_RDONLY)) == -1) {
++		/* could be an older kernel or a newer one doing NFS 4.1 */
++		if (errno != ENOENT)
++			printerr(0, "WARNING: failed to open %s: %s\n",
++				 pipefs_nfscbdir, strerror(errno));
++		/* ignore processing callback directory */
++		memset(pipefs_nfscbdir, '\0', sizeof(pipefs_nfscbdir));
++	} else {
++		fcntl(fd_cb, F_SETSIG, DNOTIFY_SIGNAL);
++		fcntl(fd_cb, F_NOTIFY,
++			DN_CREATE|DN_DELETE|DN_MODIFY|DN_MULTISHOT);
 +	}
 +
-+	return 0;
-+}
+ 	init_client_list();
  
- extern u_short getport(
- 	struct sockaddr_in *saddr,
-@@ -508,6 +535,9 @@ int main(int argc, char *argv[])
- 	    }
- 	}
- 
-+	if (chk_mountpoint(mount_point))
-+		exit(EX_FAIL);
-+
- 	if (nfs_mount_vers == 4)
- 		mnt_err = nfs4mount(spec, mount_point, &flags, &extra_opts, &mount_opts, 0);
- 	else {
-@@ -538,7 +568,7 @@ int main(int argc, char *argv[])
- 					   mount_opts);
- 
- 		if (mnt_err) {
--			mount_error(mount_point);
-+			mount_error(mount_point, spec);
- 			exit(EX_FAIL);
+ 	printerr(1, "beginning poll\n");
+@@ -121,8 +134,7 @@ gssd_run()
+ 		while (dir_changed) {
+ 			dir_changed = 0;
+ 			if (update_client_list()) {
+-				printerr(0, "ERROR: couldn't update "
+-					 "client list\n");
++				/* Error msg is already printed */
+ 				exit(1);
+ 			}
+ 		}
+@@ -141,5 +153,7 @@ gssd_run()
  		}
  	}
-diff -puN utils/gssd/gssd.c~CITI_NFS4_ALL utils/gssd/gssd.c
---- nfs-utils-1.1.0/utils/gssd/gssd.c~CITI_NFS4_ALL	2007-06-22 10:51:53.782368000 -0400
-+++ nfs-utils-1.1.0-kwc/utils/gssd/gssd.c	2007-06-22 10:51:56.521019000 -0400
-@@ -81,7 +81,7 @@ sig_hup(int signal)
+ 	close(fd);
++	if (fd_cb != -1)
++		close(fd_cb);
+ 	return;
+ }
+diff -puN utils/gssd/gssd_proc.c~CITI_NFS4_ALL utils/gssd/gssd_proc.c
+--- nfs-utils-1.1.1/utils/gssd/gssd_proc.c~CITI_NFS4_ALL	2007-10-23 14:17:18.662855000 -0400
++++ nfs-utils-1.1.1-kwc/utils/gssd/gssd_proc.c	2007-10-23 14:17:19.021793000 -0400
+@@ -102,7 +102,7 @@ int pollsize;  /* the size of pollaray (
+ /* XXX buffer problems: */
+ static int
+ read_service_info(char *info_file_name, char **servicename, char **servername,
+-		  int *prog, int *vers, char **protocol) {
++		  int *prog, int *vers, char **protocol, int *port) {
+ #define INFOBUFLEN 256
+ 	char		buf[INFOBUFLEN];
+ 	static char	dummy[128];
+@@ -112,6 +112,9 @@ read_service_info(char *info_file_name, 
+ 	char		program[16];
+ 	char		version[16];
+ 	char		protoname[16];
++	char		princname[128];
++	char		cb_port[128];
++	char		*p;
+ 	in_addr_t	inaddr;
+ 	int		fd = -1;
+ 	struct hostent	*ent = NULL;
+@@ -136,19 +139,33 @@ read_service_info(char *info_file_name, 
+ 		   service, program, version,
+ 		   address,
+ 		   protoname);
+-
+ 	if (numfields == 5) {
+ 		strcpy(protoname, "tcp");
+ 	} else if (numfields != 6) {
+ 		goto fail;
+ 	}
+ 
++	princname[0] = '\0';
++	if ((p = strstr(buf, "principal name:")) != NULL)
++		sscanf(p, "principal name: %127s\n", princname);
++	cb_port[0] = '\0';
++	if ((p = strstr(buf, "port")) != NULL)
++		sscanf(p, "port: %127s\n", cb_port);
++
+ 	/* check service, program, and version */
+-	if(memcmp(service, "nfs", 3)) return -1;
++	if (memcmp(service, "nfs", 3))
++		return -1;
+ 	*prog = atoi(program + 1); /* skip open paren */
+ 	*vers = atoi(version);
+-	if((*prog != 100003) || ((*vers != 2) && (*vers != 3) && (*vers != 4)))
+-		goto fail;
++
++	if (strlen(service) == 3 && !memcmp(service, "nfs", 3)) {
++		if ((*prog != 100003) || ((*vers != 2) && (*vers != 3) &&
++		    (*vers != 4)))
++			goto fail;
++	} else if (!memcmp(service, "nfs4_cb", 7)) {
++		if (*vers != 1)
++			goto fail;
++	}
+ 
+ 	/* create service name */
+ 	inaddr = inet_addr(address);
+@@ -159,7 +176,12 @@ read_service_info(char *info_file_name, 
+ 	if (!(*servername = calloc(strlen(ent->h_name) + 1, 1)))
+ 		goto fail;
+ 	memcpy(*servername, ent->h_name, strlen(ent->h_name));
+-	snprintf(buf, INFOBUFLEN, "%s@%s", service, ent->h_name);
++	if (princname[0] != '\0')
++		printerr(2, "info file contains princname=%s\n", princname);
++
++	snprintf(buf, INFOBUFLEN, "nfs@%s", ent->h_name);
++	if (cb_port[0] != '\0')
++		*port = atoi(cb_port);
+ 	if (!(*servicename = calloc(strlen(buf) + 1, 1)))
+ 		goto fail;
+ 	memcpy(*servicename, buf, strlen(buf));
+@@ -219,9 +241,9 @@ out:
+ static int
+ process_clnt_dir_files(struct clnt_info * clp)
+ {
+-	char	kname[32];
+-	char	sname[32];
+-	char	info_file_name[32];
++	char	kname[PATH_MAX];
++	char	sname[PATH_MAX];
++	char	info_file_name[PATH_MAX];
+ 
+ 	if (clp->krb5_fd == -1) {
+ 		snprintf(kname, sizeof(kname), "%s/krb5", clp->dirname);
+@@ -231,14 +253,14 @@ process_clnt_dir_files(struct clnt_info 
+ 		snprintf(sname, sizeof(sname), "%s/spkm3", clp->dirname);
+ 		clp->spkm3_fd = open(sname, O_RDWR);
+ 	}
+-	if((clp->krb5_fd == -1) && (clp->spkm3_fd == -1))
++	if ((clp->krb5_fd == -1) && (clp->spkm3_fd == -1))
+ 		return -1;
+ 	snprintf(info_file_name, sizeof(info_file_name), "%s/info",
+ 			clp->dirname);
+ 	if ((clp->servicename == NULL) &&
+ 	     read_service_info(info_file_name, &clp->servicename,
+ 				&clp->servername, &clp->prog, &clp->vers,
+-				&clp->protocol))
++				&clp->protocol, &clp->port))
+ 		return -1;
+ 	return 0;
+ }
+@@ -288,17 +310,17 @@ insert_clnt_poll(struct clnt_info *clp)
+ }
+ 
  static void
- usage(char *progname)
+-process_clnt_dir(char *dir)
++process_clnt_dir(char *dir, char *pdir)
  {
--	fprintf(stderr, "usage: %s [-f] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir]\n",
-+	fprintf(stderr, "usage: %s [-f] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir]\n",
- 		progname);
- 	exit(1);
- }
-diff -puN /dev/null support/include/pseudoflavors.h
---- /dev/null	2007-06-21 19:03:53.875366737 -0400
-+++ nfs-utils-1.1.0-kwc/support/include/pseudoflavors.h	2007-06-22 10:52:22.335293000 -0400
-@@ -0,0 +1,17 @@
-+#define RPC_AUTH_GSS_KRB5       390003
-+#define RPC_AUTH_GSS_KRB5I      390004
-+#define RPC_AUTH_GSS_KRB5P      390005
-+#define RPC_AUTH_GSS_LKEY       390006
-+#define RPC_AUTH_GSS_LKEYI      390007
-+#define RPC_AUTH_GSS_LKEYP      390008
-+#define RPC_AUTH_GSS_SPKM       390009
-+#define RPC_AUTH_GSS_SPKMI      390010
-+#define RPC_AUTH_GSS_SPKMP      390011
-+
-+struct flav_info {
-+	char    *flavour;
-+	int     fnum;
-+};
+ 	struct clnt_info *	clp;
+ 
+ 	if (!(clp = insert_new_clnt()))
+ 		goto fail_destroy_client;
+ 
+-	if (!(clp->dirname = calloc(strlen(dir) + 1, 1))) {
++	if (!(clp->dirname = calloc(strlen(dir) + strlen(pdir) + 1, 1))) {
+ 		goto fail_destroy_client;
+ 	}
+-	memcpy(clp->dirname, dir, strlen(dir));
++	sprintf(clp->dirname, "%s/%s", pdir, dir);
+ 	if ((clp->dir_fd = open(clp->dirname, O_RDONLY)) == -1) {
+ 		printerr(0, "ERROR: can't open %s: %s\n",
+ 			 clp->dirname, strerror(errno));
+@@ -342,16 +364,24 @@ init_client_list(void)
+  * directories, since the DNOTIFY could have been in there.
+  */
+ static void
+-update_old_clients(struct dirent **namelist, int size)
++update_old_clients(struct dirent **namelist, int size, char *pdir)
+ {
+ 	struct clnt_info *clp;
+ 	void *saveprev;
+ 	int i, stillhere;
++	char fname[PATH_MAX];
+ 
+ 	for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) {
++		/* only compare entries in the global list that are from the
++		 * same pipefs parent directory as "pdir"
++		 */
++		if (strncmp(clp->dirname, pdir, strlen(pdir)) != 0) break;
++
+ 		stillhere = 0;
+ 		for (i=0; i < size; i++) {
+-			if (!strcmp(clp->dirname, namelist[i]->d_name)) {
++			snprintf(fname, sizeof(fname), "%s/%s",
++				 pdir, namelist[i]->d_name);
++			if (strcmp(clp->dirname, fname) == 0) {
+ 				stillhere = 1;
+ 				break;
+ 			}
+@@ -372,47 +402,72 @@ update_old_clients(struct dirent **namel
+ 
+ /* Search for a client by directory name, return 1 if found, 0 otherwise */
+ static int
+-find_client(char *dirname)
++find_client(char *dirname, char *pdir)
+ {
+ 	struct clnt_info	*clp;
++	char fname[PATH_MAX];
+ 
+-	for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next)
+-		if (!strcmp(clp->dirname, dirname))
++	for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next) {
++		snprintf(fname, sizeof(fname), "%s/%s", pdir, dirname);
++		if (strcmp(clp->dirname, fname) == 0)
+ 			return 1;
++	}
+ 	return 0;
+ }
+ 
+-/* Used to read (and re-read) list of clients, set up poll array. */
+-int
+-update_client_list(void)
++static int
++process_pipedir(char *pipe_name)
+ {
+ 	struct dirent **namelist;
+ 	int i, j;
+ 
+-	if (chdir(pipefs_nfsdir) < 0) {
++	if (chdir(pipe_name) < 0) {
+ 		printerr(0, "ERROR: can't chdir to %s: %s\n",
+-			 pipefs_nfsdir, strerror(errno));
++			 pipe_name, strerror(errno));
+ 		return -1;
+ 	}
+ 
+-	j = scandir(pipefs_nfsdir, &namelist, NULL, alphasort);
++	j = scandir(pipe_name, &namelist, NULL, alphasort);
+ 	if (j < 0) {
+ 		printerr(0, "ERROR: can't scandir %s: %s\n",
+-			 pipefs_nfsdir, strerror(errno));
++			 pipe_name, strerror(errno));
+ 		return -1;
+ 	}
+-	update_old_clients(namelist, j);
 +
-+extern struct flav_info flav_map[];
-+extern const int flav_map_size;
-diff -puN support/nfs/exports.c~CITI_NFS4_ALL support/nfs/exports.c
---- nfs-utils-1.1.0/support/nfs/exports.c~CITI_NFS4_ALL	2007-06-22 10:52:16.682999000 -0400
-+++ nfs-utils-1.1.0-kwc/support/nfs/exports.c	2007-06-22 10:52:40.578175000 -0400
-@@ -30,10 +30,29 @@
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/nfs-utils-CITI_NFS4.patch?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list