diff mbox

[linux-cifs-client,01/19] mount.cifs: declare new struct for holding parsed mount info

Message ID 1269613542-6402-2-git-send-email-jlayton@samba.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton March 26, 2010, 2:25 p.m. UTC
None
diff mbox

Patch

diff --git a/mount.cifs.c b/mount.cifs.c
index 4211b4d..f9a46d9 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -60,6 +60,19 @@ 
 /* I believe that the kernel limits options data to a page */
 #define MAX_OPTIONS_LEN	4096
 
+/*
+ * Maximum length of "share" portion of a UNC. I have no idea if this is at
+ * all valid. According to MSDN, the typical max length of any component is
+ * 255, so use that here.
+ */
+#define MAX_SHARE_LEN 256
+
+/* currently maximum length of IPv6 address string */
+#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
+
+/* limit list of addresses to 16 max-size addrs */
+#define MAX_ADDR_LIST_LEN (MAX_ADDRESS_LEN * 16)
+
 #ifndef SAFE_FREE
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 #endif
@@ -67,9 +80,6 @@ 
 #define MOUNT_PASSWD_SIZE 128
 #define DOMAIN_SIZE 64
 
-/* currently maximum length of IPv6 address string */
-#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
-
 /*
  * value of the ver= option that gets passed to the kernel. Used to indicate
  * behavioral changes introduced in the mount helper.
@@ -108,6 +118,16 @@ 
  */
 #define CIFS_SETUID_FLAGS (MS_NOSUID|MS_NODEV)
 
+/* struct for holding parsed mount info for use by privleged process */
+struct parsed_mount_info {
+	unsigned long	flags;
+	char		host[NI_MAXHOST];
+	char		share[MAX_SHARE_LEN];
+	char		prefix[PATH_MAX];
+	char		options[MAX_OPTIONS_LEN];
+	char		address_list[MAX_ADDR_LIST_LEN];
+};
+
 const char *thisprogram;
 int verboseflag = 0;
 int fakemnt = 0;