Skip to contentSkip to conversation

cifs.upcall: require a uid= or creduid= parm

PATCH In review Jeff Layton 1 participant 6 messages Jul 26, 2010 – Jul 27, 2010 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs.upcall: require a uid= or creduid= parm

Even though all known kernels send the uid= parm to userspace, cifs.upcall doesn't technically require it. It should though. If one wasn't sent for some reason, then the setuid wouldn't occur. Error out if there is no uid= or creduid= parm.

---
 cifs.upcall.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
cifs.upcall.c +5 -0
index 1f4341d..8f7850a 100644
@@ -707,6 +707,11 @@ int main(const int argc, char *const argv[])
 			goto out;
 		}
 		ccname = find_krb5_cc(CIFS_DEFAULT_KRB5_DIR, arg.uid);
+	} else {
+		/* no uid= or creduid= parm -- something is wrong */
+		syslog(LOG_ERR, "No uid= or creduid= parm specified");
+		rc = 1;
+		goto out;
 	}
 
 	host = arg.hostname;
Signature · 1 line
1.7.1.1

A message that is not in the archive (sent off-list or not yet received): 1280163930-983-1-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org

#2 lore raw

PATCH 1/1 mount.cifs: handle the "mand" and "nomand" mount options

These are filesystem-independent mount options that get passed to mount.cifs too. Handle them appropriately by enabling and disabling MS_MANDLOCK and not handing them off to the kernel.

---
 mount.cifs.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
mount.cifs.c +12 -0
index c84e72d..1ca9507 100644
@@ -159,6 +159,8 @@
 #define OPT_RO         24
 #define OPT_RW         25
 #define OPT_REMOUNT    26
+#define OPT_MAND       27
+#define OPT_NOMAND     28
 
 
 /* struct for holding parsed mount info for use by privleged process */
@@ -822,6 +824,10 @@ static int parse_opt_token(const char *token)
 		return OPT_NO_DEV;
 	if (strncmp(token, "nobrl", 5) == 0 || strncmp(token, "nolock", 6) == 0)
 		return OPT_NO_LOCK;
+	if (strncmp(token, "mand", 4) == 0)
+		return OPT_MAND;
+	if (strncmp(token, "nomand", 6) == 0)
+		return OPT_NOMAND;
 	if (strncmp(token, "dev", 3) == 0)
 		return OPT_DEV;
 	if (strncmp(token, "noexec", 6) == 0)
@@ -1106,6 +1112,12 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 		case OPT_NO_LOCK:
 			*filesys_flags &= ~MS_MANDLOCK;
 			break;
+		case OPT_MAND:
+			*filesys_flags |= MS_MANDLOCK;
+			goto nocopy;
+		case OPT_NOMAND:
+			*filesys_flags &= ~MS_MANDLOCK;
+			goto nocopy;
 		case OPT_DEV:
 			*filesys_flags &= ~MS_NODEV;
 			break;
Signature · 1 line
1.7.1.1

A message that is not in the archive (sent off-list or not yet received): 1280163930-983-2-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org

#4 lore raw

Re: [PATCH] mount.cifs: handle the "mand" and "nomand" mount options

Quoted 36 lines · On Mon, 26 Jul 2010 13:05:29 -0400 Jeff Layton…

These are filesystem-independent mount options that get passed to mount.cifs too. Handle them appropriately by enabling and disabling MS_MANDLOCK and not handing them off to the kernel.

---
 mount.cifs.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
mount.cifs.c +6 -0
index c84e72d..1ca9507 100644
@@ -159,6 +159,8 @@
 #define OPT_RO         24
 #define OPT_RW         25
 #define OPT_REMOUNT    26
+#define OPT_MAND       27
+#define OPT_NOMAND     28
 
 
 /* struct for holding parsed mount info for use by privleged process */
@@ -822,6 +824,10 @@ static int parse_opt_token(const char *token)
 		return OPT_NO_DEV;
 	if (strncmp(token, "nobrl", 5) == 0 || strncmp(token, "nolock", 6) == 0)
 		return OPT_NO_LOCK;
+	if (strncmp(token, "mand", 4) == 0)
+		return OPT_MAND;
+	if (strncmp(token, "nomand", 6) == 0)
+		return OPT_NOMAND;
 	if (strncmp(token, "dev", 3) == 0)
 		return OPT_DEV;
 	if (strncmp(token, "noexec", 6) == 0)
@@ -1106,6 +1112,12 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 		case OPT_NO_LOCK:
 			*filesys_flags &= ~MS_MANDLOCK;

mount.cifs.c parse_options(const char *data, struct parsed_mount_info *parsed_info) · line 1123

Quoted 10 lines
mount.cifs.c +6 -0
 			break;
+		case OPT_MAND:
+			*filesys_flags |= MS_MANDLOCK;
+			goto nocopy;
+		case OPT_NOMAND:
+			*filesys_flags &= ~MS_MANDLOCK;
+			goto nocopy;
 		case OPT_DEV:
 			*filesys_flags &= ~MS_NODEV;
 			break;

merged

Signature · 1 line
Jeff Layton <[email protected]>
#5 lore raw

PATCH 1/1 mount.cifs: ignore the "_netdev" mount option

In reply to a message not in the archive

This mount options is used to clue in init scripts that the filesystem shouldn't be mounted until networking is available. /bin/mount also passes that option to the filesystem however, and cifs currently chokes on it. mount.nfs ignores this option -- have mount.cifs do the same.

---
 mount.cifs.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
mount.cifs.c +5 -0
index 1ca9507..89b728c 100644
@@ -133,6 +133,7 @@
  * Values for parsing command line options.
  */
 #define OPT_ERROR       -1
+#define OPT_IGNORE      0
 #define OPT_USERS       1
 #define OPT_USER        2
 #define OPT_USER_XATTR  3
@@ -842,6 +843,8 @@ static int parse_opt_token(const char *token)
 		return OPT_RW;
 	if (strncmp(token, "remount", 7) == 0)
 		return OPT_REMOUNT;
+	if (strncmp(token, "_netdev", 7) == 0)
+		return OPT_IGNORE;
 
 	return OPT_ERROR;
 }
@@ -1140,6 +1143,8 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 		case OPT_REMOUNT:
 			*filesys_flags |= MS_REMOUNT;
 			break;
+		case OPT_IGNORE:
+			goto nocopy;
 		}
 
 		/* check size before copying option to buffer */
Signature · 1 line
1.7.1.1

A message that is not in the archive (sent off-list or not yet received): 1280163930-983-3-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org

#7 lore raw

Re: [PATCH] mount.cifs: ignore the "_netdev" mount option

Quoted 32 lines · On Mon, 26 Jul 2010 13:05:30 -0400 Jeff Layton…

This mount options is used to clue in init scripts that the filesystem shouldn't be mounted until networking is available. /bin/mount also passes that option to the filesystem however, and cifs currently chokes on it. mount.nfs ignores this option -- have mount.cifs do the same.

---
 mount.cifs.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
mount.cifs.c +3 -0
index 1ca9507..89b728c 100644
@@ -133,6 +133,7 @@
  * Values for parsing command line options.
  */
 #define OPT_ERROR       -1
+#define OPT_IGNORE      0
 #define OPT_USERS       1
 #define OPT_USER        2
 #define OPT_USER_XATTR  3
@@ -842,6 +843,8 @@ static int parse_opt_token(const char *token)
 		return OPT_RW;
 	if (strncmp(token, "remount", 7) == 0)
 		return OPT_REMOUNT;
+	if (strncmp(token, "_netdev", 7) == 0)
+		return OPT_IGNORE;
 
 	return OPT_ERROR;
 }

mount.cifs.c parse_options(const char *data, struct parsed_mount_info *parsed_info) · line 1150

Quoted 8 lines
mount.cifs.c +2 -0
@@ -1140,6 +1143,8 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 		case OPT_REMOUNT:
 			*filesys_flags |= MS_REMOUNT;
 			break;
+		case OPT_IGNORE:
+			goto nocopy;
 		}
 
 		/* check size before copying option to buffer */

merged

Signature · 1 line
Jeff Layton <[email protected]>
#8 lore raw
In reply to a message not in the archive
Quoted 16 lines · On Mon, 26 Jul 2010 13:05:28 -0400 Jeff Layton…

Even though all known kernels send the uid= parm to userspace, cifs.upcall doesn't technically require it. It should though. If one wasn't sent for some reason, then the setuid wouldn't occur. Error out if there is no uid= or creduid= parm.

---
 cifs.upcall.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
cifs.upcall.c +0 -0
index 1f4341d..8f7850a 100644
@@ -707,6 +707,11 @@ int main(const int argc, char *const argv[])
 			goto out;

cifs.upcall.c int main(const int argc, char *const argv[]) · line 717

Quoted 10 lines
cifs.upcall.c +5 -0
 		}
 		ccname = find_krb5_cc(CIFS_DEFAULT_KRB5_DIR, arg.uid);
+	} else {
+		/* no uid= or creduid= parm -- something is wrong */
+		syslog(LOG_ERR, "No uid= or creduid= parm specified");
+		rc = 1;
+		goto out;
 	}
 
 	host = arg.hostname;

merged

Signature · 1 line
Jeff Layton <[email protected]>