diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-04-01 15:19:16 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2010-04-01 15:19:16 -0400 |
commit | bda33540ab300dd9a996580d9f60ef3527490833 (patch) | |
tree | d56c4d7c60b7135a19833fa706435c9fb9be85a1 /mount.cifs.c | |
parent | 279b1648a661c5e38e7650da74551cff9322a4f9 (diff) | |
download | cifs-utils-bda33540ab300dd9a996580d9f60ef3527490833.tar.gz cifs-utils-bda33540ab300dd9a996580d9f60ef3527490833.tar.bz2 cifs-utils-bda33540ab300dd9a996580d9f60ef3527490833.zip |
mount.cifs: declare new struct for holding parsed mount info
Currently mount.cifs puts mount info into a disparate series of
dynamically sized buffers. Declate a new struct that holds a set of
fixed-size buffers. The option and UNC parsing routines can place their
results in this struct.
This should make it easier to implement privilege separation using
shared memory to pass data between processes.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'mount.cifs.c')
-rw-r--r-- | mount.cifs.c | 26 |
1 files changed, 23 insertions, 3 deletions
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; |