aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-17 12:19:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-17 12:19:29 -0400
commitbc0cf58ec7ccd09dfcd134b9a20fb4fdc4d24554 (patch)
tree28d88cc22b48ce9decd6ce8d1c36d8f83d7a440b /fs
parent4643b05662966a615845803c7bc89c5a5e77d6d5 (diff)
parentbfa890a3cdeed29eef53d54cd7f80cec0fd46b11 (diff)
Merge git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French. * git://git.samba.org/sfrench/cifs-2.6: Fix number parsing in cifs_parse_mount_options Cleanup handling of NULL value passed for a mount option
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/connect.c82
1 files changed, 20 insertions, 62 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d81e933a796b..f31dc9ac37b7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -109,6 +109,8 @@ enum {
109 109
110 /* Options which could be blank */ 110 /* Options which could be blank */
111 Opt_blank_pass, 111 Opt_blank_pass,
112 Opt_blank_user,
113 Opt_blank_ip,
112 114
113 Opt_err 115 Opt_err
114}; 116};
@@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = {
183 { Opt_wsize, "wsize=%s" }, 185 { Opt_wsize, "wsize=%s" },
184 { Opt_actimeo, "actimeo=%s" }, 186 { Opt_actimeo, "actimeo=%s" },
185 187
188 { Opt_blank_user, "user=" },
189 { Opt_blank_user, "username=" },
186 { Opt_user, "user=%s" }, 190 { Opt_user, "user=%s" },
187 { Opt_user, "username=%s" }, 191 { Opt_user, "username=%s" },
188 { Opt_blank_pass, "pass=" }, 192 { Opt_blank_pass, "pass=" },
189 { Opt_pass, "pass=%s" }, 193 { Opt_pass, "pass=%s" },
190 { Opt_pass, "password=%s" }, 194 { Opt_pass, "password=%s" },
195 { Opt_blank_ip, "ip=" },
196 { Opt_blank_ip, "addr=" },
191 { Opt_ip, "ip=%s" }, 197 { Opt_ip, "ip=%s" },
192 { Opt_ip, "addr=%s" }, 198 { Opt_ip, "addr=%s" },
193 { Opt_unc, "unc=%s" }, 199 { Opt_unc, "unc=%s" },
@@ -1117,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
1117 string = match_strdup(args); 1123 string = match_strdup(args);
1118 if (string == NULL) 1124 if (string == NULL)
1119 return -ENOMEM; 1125 return -ENOMEM;
1120 rc = kstrtoul(string, 10, option); 1126 rc = kstrtoul(string, 0, option);
1121 kfree(string); 1127 kfree(string);
1122 1128
1123 return rc; 1129 return rc;
@@ -1534,15 +1540,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1534 1540
1535 /* String Arguments */ 1541 /* String Arguments */
1536 1542
1543 case Opt_blank_user:
1544 /* null user, ie. anonymous authentication */
1545 vol->nullauth = 1;
1546 vol->username = NULL;
1547 break;
1537 case Opt_user: 1548 case Opt_user:
1538 string = match_strdup(args); 1549 string = match_strdup(args);
1539 if (string == NULL) 1550 if (string == NULL)
1540 goto out_nomem; 1551 goto out_nomem;
1541 1552
1542 if (!*string) { 1553 if (strnlen(string, MAX_USERNAME_SIZE) >
1543 /* null user, ie. anonymous authentication */
1544 vol->nullauth = 1;
1545 } else if (strnlen(string, MAX_USERNAME_SIZE) >
1546 MAX_USERNAME_SIZE) { 1554 MAX_USERNAME_SIZE) {
1547 printk(KERN_WARNING "CIFS: username too long\n"); 1555 printk(KERN_WARNING "CIFS: username too long\n");
1548 goto cifs_parse_mount_err; 1556 goto cifs_parse_mount_err;
@@ -1611,14 +1619,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1611 } 1619 }
1612 vol->password[j] = '\0'; 1620 vol->password[j] = '\0';
1613 break; 1621 break;
1622 case Opt_blank_ip:
1623 vol->UNCip = NULL;
1624 break;
1614 case Opt_ip: 1625 case Opt_ip:
1615 string = match_strdup(args); 1626 string = match_strdup(args);
1616 if (string == NULL) 1627 if (string == NULL)
1617 goto out_nomem; 1628 goto out_nomem;
1618 1629
1619 if (!*string) { 1630 if (strnlen(string, INET6_ADDRSTRLEN) >
1620 vol->UNCip = NULL;
1621 } else if (strnlen(string, INET6_ADDRSTRLEN) >
1622 INET6_ADDRSTRLEN) { 1631 INET6_ADDRSTRLEN) {
1623 printk(KERN_WARNING "CIFS: ip address " 1632 printk(KERN_WARNING "CIFS: ip address "
1624 "too long\n"); 1633 "too long\n");
@@ -1636,12 +1645,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1636 if (string == NULL) 1645 if (string == NULL)
1637 goto out_nomem; 1646 goto out_nomem;
1638 1647
1639 if (!*string) {
1640 printk(KERN_WARNING "CIFS: invalid path to "
1641 "network resource\n");
1642 goto cifs_parse_mount_err;
1643 }
1644
1645 temp_len = strnlen(string, 300); 1648 temp_len = strnlen(string, 300);
1646 if (temp_len == 300) { 1649 if (temp_len == 300) {
1647 printk(KERN_WARNING "CIFS: UNC name too long\n"); 1650 printk(KERN_WARNING "CIFS: UNC name too long\n");
@@ -1670,11 +1673,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1670 if (string == NULL) 1673 if (string == NULL)
1671 goto out_nomem; 1674 goto out_nomem;
1672 1675
1673 if (!*string) { 1676 if (strnlen(string, 256) == 256) {
1674 printk(KERN_WARNING "CIFS: invalid domain"
1675 " name\n");
1676 goto cifs_parse_mount_err;
1677 } else if (strnlen(string, 256) == 256) {
1678 printk(KERN_WARNING "CIFS: domain name too" 1677 printk(KERN_WARNING "CIFS: domain name too"
1679 " long\n"); 1678 " long\n");
1680 goto cifs_parse_mount_err; 1679 goto cifs_parse_mount_err;
@@ -1693,11 +1692,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1693 if (string == NULL) 1692 if (string == NULL)
1694 goto out_nomem; 1693 goto out_nomem;
1695 1694
1696 if (!*string) { 1695 if (!cifs_convert_address(
1697 printk(KERN_WARNING "CIFS: srcaddr value not"
1698 " specified\n");
1699 goto cifs_parse_mount_err;
1700 } else if (!cifs_convert_address(
1701 (struct sockaddr *)&vol->srcaddr, 1696 (struct sockaddr *)&vol->srcaddr,
1702 string, strlen(string))) { 1697 string, strlen(string))) {
1703 printk(KERN_WARNING "CIFS: Could not parse" 1698 printk(KERN_WARNING "CIFS: Could not parse"
@@ -1710,11 +1705,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1710 if (string == NULL) 1705 if (string == NULL)
1711 goto out_nomem; 1706 goto out_nomem;
1712 1707
1713 if (!*string) {
1714 printk(KERN_WARNING "CIFS: Invalid path"
1715 " prefix\n");
1716 goto cifs_parse_mount_err;
1717 }
1718 temp_len = strnlen(string, 1024); 1708 temp_len = strnlen(string, 1024);
1719 if (string[0] != '/') 1709 if (string[0] != '/')
1720 temp_len++; /* missing leading slash */ 1710 temp_len++; /* missing leading slash */
@@ -1742,11 +1732,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1742 if (string == NULL) 1732 if (string == NULL)
1743 goto out_nomem; 1733 goto out_nomem;
1744 1734
1745 if (!*string) { 1735 if (strnlen(string, 1024) >= 65) {
1746 printk(KERN_WARNING "CIFS: Invalid iocharset"
1747 " specified\n");
1748 goto cifs_parse_mount_err;
1749 } else if (strnlen(string, 1024) >= 65) {
1750 printk(KERN_WARNING "CIFS: iocharset name " 1736 printk(KERN_WARNING "CIFS: iocharset name "
1751 "too long.\n"); 1737 "too long.\n");
1752 goto cifs_parse_mount_err; 1738 goto cifs_parse_mount_err;
@@ -1771,11 +1757,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1771 if (string == NULL) 1757 if (string == NULL)
1772 goto out_nomem; 1758 goto out_nomem;
1773 1759
1774 if (!*string) {
1775 printk(KERN_WARNING "CIFS: No socket option"
1776 " specified\n");
1777 goto cifs_parse_mount_err;
1778 }
1779 if (strnicmp(string, "TCP_NODELAY", 11) == 0) 1760 if (strnicmp(string, "TCP_NODELAY", 11) == 0)
1780 vol->sockopt_tcp_nodelay = 1; 1761 vol->sockopt_tcp_nodelay = 1;
1781 break; 1762 break;
@@ -1784,12 +1765,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1784 if (string == NULL) 1765 if (string == NULL)
1785 goto out_nomem; 1766 goto out_nomem;
1786 1767
1787 if (!*string) {
1788 printk(KERN_WARNING "CIFS: Invalid (empty)"
1789 " netbiosname\n");
1790 break;
1791 }
1792
1793 memset(vol->source_rfc1001_name, 0x20, 1768 memset(vol->source_rfc1001_name, 0x20,
1794 RFC1001_NAME_LEN); 1769 RFC1001_NAME_LEN);
1795 /* 1770 /*
@@ -1817,11 +1792,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1817 if (string == NULL) 1792 if (string == NULL)
1818 goto out_nomem; 1793 goto out_nomem;
1819 1794
1820 if (!*string) {
1821 printk(KERN_WARNING "CIFS: Empty server"
1822 " netbiosname specified\n");
1823 break;
1824 }
1825 /* last byte, type, is 0x20 for servr type */ 1795 /* last byte, type, is 0x20 for servr type */
1826 memset(vol->target_rfc1001_name, 0x20, 1796 memset(vol->target_rfc1001_name, 0x20,
1827 RFC1001_NAME_LEN_WITH_NULL); 1797 RFC1001_NAME_LEN_WITH_NULL);
@@ -1848,12 +1818,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1848 if (string == NULL) 1818 if (string == NULL)
1849 goto out_nomem; 1819 goto out_nomem;
1850 1820
1851 if (!*string) {
1852 cERROR(1, "no protocol version specified"
1853 " after vers= mount option");
1854 goto cifs_parse_mount_err;
1855 }
1856
1857 if (strnicmp(string, "cifs", 4) == 0 || 1821 if (strnicmp(string, "cifs", 4) == 0 ||
1858 strnicmp(string, "1", 1) == 0) { 1822 strnicmp(string, "1", 1) == 0) {
1859 /* This is the default */ 1823 /* This is the default */
@@ -1868,12 +1832,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1868 if (string == NULL) 1832 if (string == NULL)
1869 goto out_nomem; 1833 goto out_nomem;
1870 1834
1871 if (!*string) {
1872 printk(KERN_WARNING "CIFS: no security flavor"
1873 " specified\n");
1874 break;
1875 }
1876
1877 if (cifs_parse_security_flavors(string, vol) != 0) 1835 if (cifs_parse_security_flavors(string, vol) != 0)
1878 goto cifs_parse_mount_err; 1836 goto cifs_parse_mount_err;
1879 break; 1837 break;