Make RPC handle properly host names with colons
This is first part of IPv6 support. See <https://sourceforge.net/tracker/?func=detail&atid=118136&aid=3156346&group_id=18136> for more details.
This commit is contained in:
parent
fd4d641ce1
commit
fb1f1905a7
@ -0,0 +1,91 @@
|
||||
From b8ab76ad19e3c284ac14bd0450662bfc41719e03 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kara <jack@suse.cz>
|
||||
Date: Wed, 16 Feb 2011 22:19:55 +0100
|
||||
Subject: [PATCH 2/2] Make RPC handle properly host names with colons
|
||||
|
||||
NFS handles server names with colons (usually IPv6 addresses) by encapsulating
|
||||
them in brackets. Handle this properly.
|
||||
|
||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||
---
|
||||
rquota_client.c | 48 +++++++++++++++++++++++++++++++++---------------
|
||||
1 files changed, 33 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/rquota_client.c b/rquota_client.c
|
||||
index cc1d623..53e0579 100644
|
||||
--- a/rquota_client.c
|
||||
+++ b/rquota_client.c
|
||||
@@ -104,6 +104,35 @@ int rquota_err(int stat)
|
||||
}
|
||||
}
|
||||
|
||||
+static int split_nfs_mount(char *devname, char **host, char **path)
|
||||
+{
|
||||
+ char *pathname;
|
||||
+
|
||||
+ /* NFS server name contained in brackets? */
|
||||
+ if (*devname == '[') {
|
||||
+ *host = devname + 1;
|
||||
+ pathname = strchr(devname, ']');
|
||||
+ if (!pathname || pathname[1] != ':')
|
||||
+ return 0;
|
||||
+ /* Autofs? */
|
||||
+ if (pathname[2] == '(')
|
||||
+ return 0;
|
||||
+ *pathname = 0;
|
||||
+ *path = pathname + 2;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ *host = devname;
|
||||
+ pathname = strchr(devname, ':');
|
||||
+ if (!pathname)
|
||||
+ return 0;
|
||||
+ /* Autofs? */
|
||||
+ if (pathname[1] == '(')
|
||||
+ return 0;
|
||||
+ *pathname = 0;
|
||||
+ *path = pathname + 1;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Collect the requested quota information from a remote host.
|
||||
*/
|
||||
@@ -128,13 +157,7 @@ int rpc_rquota_get(struct dquot *dquot)
|
||||
*/
|
||||
fsname_tmp = (char *)smalloc(strlen(dquot->dq_h->qh_quotadev) + 1);
|
||||
strcpy(fsname_tmp, dquot->dq_h->qh_quotadev);
|
||||
- host = fsname_tmp;
|
||||
-
|
||||
- /*
|
||||
- * Strip off pathname on nfs mounted dir. Ignore entries of any
|
||||
- * automounter.
|
||||
- */
|
||||
- if ((pathname = strchr(fsname_tmp, ':')) == (char *)0 || *(pathname + 1) == '(') {
|
||||
+ if (!split_nfs_mount(fsname_tmp, &host, &pathname)) {
|
||||
free(fsname_tmp);
|
||||
return -ENOENT;
|
||||
}
|
||||
@@ -247,16 +270,11 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
|
||||
*/
|
||||
fsname_tmp = (char *)smalloc(strlen(dquot->dq_h->qh_quotadev) + 1);
|
||||
strcpy(fsname_tmp, dquot->dq_h->qh_quotadev);
|
||||
- host = fsname_tmp;
|
||||
-
|
||||
- /*
|
||||
- * Strip off pathname on nfs mounted dir. Ignore entries of any
|
||||
- * automounter.
|
||||
- */
|
||||
- if ((pathname = strchr(fsname_tmp, ':')) == (char *)0 || *(pathname + 1) == '(')
|
||||
+ if (!split_nfs_mount(fsname_tmp, &host, &pathname)) {
|
||||
+ free(fsname_tmp);
|
||||
return -ENOENT;
|
||||
+ }
|
||||
|
||||
- *pathname++ = '\0';
|
||||
/* For NFSv4, we send the filesystem path without initial /. Server prepends proper
|
||||
* NFS pseudoroot automatically and uses this for detection of NFSv4 mounts. */
|
||||
if ((dquot->dq_h->qh_io_flags & IOFL_NFS_MIXED_PATHS) &&
|
||||
--
|
||||
1.7.4
|
||||
|
||||
@ -62,6 +62,8 @@ Patch21: quota-4.00_pre1-Implement-quotacheck-for-GFS2.patch
|
||||
Patch22: quota-4.00_pre1-Initialize-vfsold-block-and-inode-value-boundries-fo.patch
|
||||
# In upstream 4.00_pre2
|
||||
Patch23: quota-4.00_pre1-Explain-meaning-of-the-second-column-in-repquota-out.patch
|
||||
# In upstream 4.00_pre2
|
||||
Patch24: quota-4.00_pre1-Make-RPC-handle-properly-host-names-with-colons.patch
|
||||
|
||||
%description
|
||||
The quota package contains system administration tools for monitoring
|
||||
@ -155,6 +157,7 @@ Linux/UNIX environment.
|
||||
%patch21 -p1 -b .gfs2_quotacheck
|
||||
%patch22 -p1 -b .inizialize_vfsold_boundries
|
||||
%patch23 -p1 -b .explain_second_column_of_repquota
|
||||
%patch24 -p1 -b .hostnames_with_columns
|
||||
# quotactl(2) moved into `man-pages' package (bug #640590)
|
||||
rm -f quotactl.2
|
||||
# remove VCS files
|
||||
@ -279,6 +282,7 @@ rm -rf %{buildroot}
|
||||
%changelog
|
||||
* Thu Feb 17 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-0.9.pre1
|
||||
- Explain meaning of the second column in repquota output
|
||||
- Make RPC handle properly host names with colons (i.e. IPv6 server host name)
|
||||
|
||||
* Wed Feb 09 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-0.8.pre1
|
||||
- Initialize vfsold block and inode value boundries for new quota file
|
||||
|
||||
Loading…
Reference in New Issue
Block a user