rpms/nfs-utils/devel nfs-utils-1.0.9-mount-quotes.patch, NONE, 1.1 nfs-utils.spec, 1.115, 1.116
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Dec 18 23:37:26 UTC 2006
Author: kzak
Update of /cvs/dist/rpms/nfs-utils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2919
Modified Files:
nfs-utils.spec
Added Files:
nfs-utils-1.0.9-mount-quotes.patch
Log Message:
* Mon Dec 18 2006 Karel Zak <kzak at redhat.com> 1.0.10-6
- add support for mount options that contain commas (bz 219645)
- Resolves: rhbz#219645
nfs-utils-1.0.9-mount-quotes.patch:
mount.c | 26 +++++++++++++++++++-------
nfsmount.c | 34 ++++++++++++++++++++++++++++++----
2 files changed, 49 insertions(+), 11 deletions(-)
--- NEW FILE nfs-utils-1.0.9-mount-quotes.patch ---
Thi patch avoid the collision between commas in security contexts and the
delimiter betweeen mount options.
Signed-off-by: Karel Zak <kzak at redhat.com>
Signed-off-by: Cory Olmo <colmo at TrustedCS.com>
--- nfs-utils-1.0.9/utils/mount/nfsmount.c.kzak 2006-12-18 23:52:37.000000000 +0100
+++ nfs-utils-1.0.9/utils/mount/nfsmount.c 2006-12-18 23:59:34.000000000 +0100
@@ -548,15 +548,31 @@
struct pmap *mnt_pmap = &mnt_server->pmap;
struct pmap *nfs_pmap = &nfs_server->pmap;
int len;
- char *opt, *opteq;
+ char *opt, *opteq, *p, *opt_b;
char *mounthost = NULL;
char cbuf[128];
+ int open_quote = 0;
data->flags = 0;
*bg = 0;
len = strlen(new_opts);
- for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
+ for (p=old_opts, opt_b=NULL; p && *p; p++) {
+ if (!opt_b)
+ opt_b = p; /* begin of the option item */
+ if (*p == '"')
+ open_quote ^= 1; /* reverse the status */
+ if (open_quote)
+ continue; /* still in quoted block */
+ if (*p == ',')
+ *p = '\0'; /* terminate the option item */
+ if (*p == '\0' || *(p+1) == '\0') {
+ opt = opt_b; /* opt is useful now */
+ opt_b = NULL;
+ }
+ else
+ continue; /* still somewhere in the option item */
+
if (strlen(opt) >= sizeof(cbuf))
goto bad_parameter;
if ((opteq = strchr(opt, '=')) && isdigit(opteq[1])) {
@@ -671,13 +687,23 @@
strcspn(opteq+1," \t\n\r,"));
else if (!strcmp(opt, "context")) {
char *context = opteq + 1;
+ int ctxlen = strlen(context);
- if (strlen(context) > NFS_MAX_CONTEXT_LEN) {
+ if (ctxlen > NFS_MAX_CONTEXT_LEN) {
printf(_("context parameter exceeds limit of %d\n"),
NFS_MAX_CONTEXT_LEN);
goto bad_parameter;
}
- strncpy(data->context, context, NFS_MAX_CONTEXT_LEN);
+ /* The context string is in the format of
+ * "system_u:object_r:...". We only want
+ * the context str between the quotes.
+ */
+ if (*context == '"')
+ strncpy(data->context, context+1,
+ ctxlen-2);
+ else
+ strncpy(data->context, context,
+ NFS_MAX_CONTEXT_LEN);
} else if (!sloppy)
goto bad_parameter;
sprintf(cbuf, "%s=%s,", opt, opteq+1);
--- nfs-utils-1.0.9/utils/mount/mount.c.kzak 2006-12-18 23:52:37.000000000 +0100
+++ nfs-utils-1.0.9/utils/mount/mount.c 2006-12-18 23:52:37.000000000 +0100
@@ -289,18 +289,30 @@
{
if (options != NULL) {
char *opts = xstrdup(options);
- char *opt;
- int len = strlen(opts) + 20;
-
+ char *opt, *p;
+ int len = strlen(opts) + 256;
+ int open_quote = 0;
+
*extra_opts = xmalloc(len);
**extra_opts = '\0';
- for (opt = strtok(opts, ","); opt; opt = strtok(NULL, ","))
- parse_opt(opt, flags, *extra_opts, len);
-
+ for (p=opts, opt=NULL; p && *p; p++) {
+ if (!opt)
+ opt = p; /* begin of the option item */
+ if (*p == '"')
+ open_quote ^= 1; /* reverse the status */
+ if (open_quote)
+ continue; /* still in quoted block */
+ if (*p == ',')
+ *p = '\0'; /* terminate the option item */
+ /* end of option item or last item */
+ if (*p == '\0' || *(p+1) == '\0') {
+ parse_opt(opt, flags, *extra_opts, len);
+ opt = NULL;
+ }
+ }
free(opts);
}
-
}
/*
Index: nfs-utils.spec
===================================================================
RCS file: /cvs/dist/rpms/nfs-utils/devel/nfs-utils.spec,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- nfs-utils.spec 13 Dec 2006 15:10:07 -0000 1.115
+++ nfs-utils.spec 18 Dec 2006 23:37:24 -0000 1.116
@@ -1,7 +1,7 @@
Summary: NFS utlilities and supporting clients and daemons for the kernel NFS server.
Name: nfs-utils
Version: 1.0.10
-Release: 5%{?dist}
+Release: 6%{?dist}
Epoch: 1
# group all 32bit related archs
@@ -46,6 +46,7 @@
Patch78: nfs-utils-1.0.10-mount-nfsvers.patch
Patch79: nfs-utils-1.0.10-udp-no-connect.patch
Patch80: nfs-utils-1.0.10-v4-umounts.patch
+Patch81: nfs-utils-1.0.9-mount-quotes.patch
%if %{enablefscache}
Patch90: nfs-utils-1.0.9-mount-fsc.patch
@@ -113,6 +114,7 @@
%patch78 -p1
%patch79 -p1
%patch80 -p1
+%patch81 -p1
%if %{enablefscache}
%patch90 -p1
%endif
@@ -290,6 +292,9 @@
%endif
%changelog
+* Mon Dec 18 2006 Karel Zak <kzak at redhat.com> 1.0.10-6
+- add support for mount options that contain commas (bz 219645)
+
* Wed Dec 13 2006 Steve Dickson <steved at redhat.com> 1.0.10-5
- Stopped v4 umounts from ping rpc.mountd (bz 215553)
More information about the fedora-cvs-commits
mailing list