From patchwork Tue May 18 04:53:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Lovenberg X-Patchwork-Id: 100320 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4I4rMTf028500 for ; Tue, 18 May 2010 04:53:57 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id D8914AD206; Mon, 17 May 2010 22:53:24 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.8 tests=AWL, BAYES_00, NO_MORE_FUNN, SPF_PASS autolearn=no version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail-qy0-f200.google.com (mail-qy0-f200.google.com [209.85.221.200]) by lists.samba.org (Postfix) with ESMTP id AA7CCAD19B for ; Mon, 17 May 2010 22:53:17 -0600 (MDT) Received: by qyk38 with SMTP id 38so6258619qyk.17 for ; Mon, 17 May 2010 21:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:content-type :content-transfer-encoding; bh=6HTy6RLq9J69sKna9GG22nGdeD2xmAK0E4KYYkRgMA4=; b=QAkBnme8Dfvvp/No7Asi+F+A/4gBkpHq2TB4dw23ta5GGouYp3v/u+uWU9okiNeTXV Hp1HHXV5s12m4qQ/Xew0Y+0pNuiaZXJ2x0fApNqLZsaGNpPP/iqXtZ9H4CTFX1UPMT0o KKelbE3CO+qV+7LPyCEbJMBWxZ8Ab9adNFC8s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :content-type:content-transfer-encoding; b=aX0Tifd3+UwsMyzGsBTP7WzjukpI0/Xs0x+Kiq99z/tEd0Jjwkn5HQ3bx/okLmWPGu O5tYw8jWcrIVfSkbYt+5uEXTNUzJLOF0RTItWemSN7huELJJXXvyZhlVlNlmPYSqy3k1 y2Ld6DWAI8wsUZ1fgvzSl4EGG2Y/VlVOJkeO8= Received: by 10.224.24.203 with SMTP id w11mr3400582qab.296.1274158394397; Mon, 17 May 2010 21:53:14 -0700 (PDT) Received: from localhost.localdomain (24.115.161.116.res-cmts.flt.ptd.net [24.115.161.116]) by mx.google.com with ESMTPS id 7sm11662718qwf.56.2010.05.17.21.53.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 May 2010 21:53:13 -0700 (PDT) From: Scott Lovenberg To: linux-cifs-client@lists.samba.org Date: Tue, 18 May 2010 00:53:06 -0400 Message-Id: <1274158387-26599-2-git-send-email-scott.lovenberg@gmail.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1274158387-26599-1-git-send-email-scott.lovenberg@gmail.com> References: <1274158387-26599-1-git-send-email-scott.lovenberg@gmail.com> Cc: jlayton@samba.org Subject: [linux-cifs-client] [PATCH 1/2] connect.c: define mount options enum and parsing function X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 04:53:57 +0000 (UTC) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2208f06..83d5cd8 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -52,6 +52,94 @@ #define CIFS_PORT 445 #define RFC1001_PORT 139 +/* mounting option values */ +enum CIFS_MOUNT_TOKEN { + CIFS_TOKEN_ERROR = -1, + USERXATTR = 1, + NO_USERXATTR = 2, + USER = 3, + PASS = 4, + IP = 5, + ADDR = 6, + SEC = 7, + UNC = 8, + TARGET = 9, + PATH = 10, + DOMAIN = 11, + WORKGROUP = 12, + PREFIXPATH = 13, + IOCHARSET = 14, + UID = 15, + FORCE_UID = 16, + NO_FORCE_UID = 17, + GID = 18, + FORCE_GID = 19, + NO_FORCE_GID = 20, + FILEMODE = 21, + DIRMODE = 22, + PORT = 23, + RSIZE = 24, + WSIZE = 25, + SOCKOPT = 26, + NETBIOSNAME = 27, + SERVERNAME = 28, + CREDENTIALS = 29, + VERSION = 30, + GUEST = 31, + RW = 32, + RO = 33, + NO_BLOCKSEND = 34, + NO_AUTOTUNE = 35, + NO_AUTO = 36, + SUID = 37, + NO_SUID = 38, + EXEC = 39, + NO_EXEC = 40, + DEV = 41, + NO_DEV = 42, + HARD = 43, + NO_HARD = 44, + SOFT = 45, + NO_SOFT = 46, + PERM = 47, + NO_PERM = 48, + MAPCHARS = 49, + NO_MAPCHARS = 50, + SFU = 51, + NO_SFU = 52, + NO_DFS = 53, + POSIXPATHS = 54, + NO_POSIXPATHS = 55, + NO_UNIX = 56, + NO_LINUX = 57, + NO_CASE = 58, + IGNORECASE = 59, + BRL = 60, + NO_BRL = 61, + NO_LOCK = 62, + FORCE_MANDATORYLOCK = 63, + SETUIDS = 64, + NO_SETUIDS = 65, + DYNPERM = 66, + NO_DYNPERM = 67, + INTR = 68, + NO_INTR = 69, + STRICTSYNC = 70, + NO_STRICTSYNC = 71, + SERVERINO = 72, + NO_SERVERINO = 73, + ACL = 74, + NO_ACL = 75, + CIFSACL = 76, + NO_CIFSACL = 77, + LOCALLEASE = 78, + SIGN = 79, + SEAL = 80, + DIRECT = 81, + FORCE_DIRECT = 82, + NO_AC = 83 +}; + extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); @@ -797,6 +885,184 @@ extract_hostname(const char *unc) return dst; } +/* returns the CIFS_MOUNT_TOKEN value that represents 'option' */ +static int cifs_parse_mount_token(const char *option) +{ + if (option == NULL) + return CIFS_TOKEN_ERROR; + + if (strnicmp(option, "user_xattr", 10) == 0) + return USERXATTR; + if (strnicmp(option, "nouser_xattr", 12) == 0) + return NO_USERXATTR; + if (strnicmp(option, "user", 4) == 0) + return USER; + if (strnicmp(option, "pass", 4) == 0) + return PASS; + if (strnicmp(option, "ip", 2) == 0) + return IP; + if (strnicmp(option, "addr", 4) == 0) + return ADDR; + if (strnicmp(option, "sec", 3) == 0) + return SEC; + if (strnicmp(option, "unc", 3) == 0) + return UNC; + if (strnicmp(option, "target", 6) == 0) + return TARGET; + if (strnicmp(option, "path", 4) == 0) + return PATH; + if (strnicmp(option, "domain", 3) == 0) + return DOMAIN; + if (strnicmp(option, "workgroup", 5) == 0) + return WORKGROUP; + if (strnicmp(option, "prefixpath", 10) == 0) + return PREFIXPATH; + if (strnicmp(option, "iocharset", 9) == 0) + return IOCHARSET; + if (strnicmp(option, "uid", 3) == 0) + return UID; + if (strnicmp(option, "forceuid", 8) == 0) + return FORCE_UID; + if (strnicmp(option, "noforceuid", 10) == 0) + return NO_FORCE_UID; + if (strnicmp(option, "gid", 3) == 0) + return GID; + if (strnicmp(option, "forcegid", 8) == 0) + return FORCE_GID; + if (strnicmp(option, "noforcegid", 10) == 0) + return NO_FORCE_GID; + if (strnicmp(option, "file_mode", 4) == 0) + return FILEMODE; + /* dir_mode || dirmode */ + if (strnicmp(option, "dir", 3) == 0) + return DIRMODE; + if (strnicmp(option, "port", 4) == 0) + return PORT; + if (strnicmp(option, "rsize", 5) == 0) + return RSIZE; + if (strnicmp(option, "wsize", 5) == 0) + return WSIZE; + if (strnicmp(option, "sockopt", 5) == 0) + return SOCKOPT; + if (strnicmp(option, "netbiosname", 4) == 0) + return NETBIOSNAME; + if (strnicmp(option, "servername", 7) == 0) + return SERVERNAME; + if (strnicmp(option, "credentials", 4) == 0) + return CREDENTIALS; + if (strnicmp(option, "version", 3) == 0) + return VERSION; + if (strnicmp(option, "guest", 5) == 0) + return GUEST; + if (strnicmp(option, "rw", 2) == 0) + return RW; + if (strnicmp(option, "ro", 2) == 0) + return RO; + if (strnicmp(option, "noblocksend", 11) == 0) + return NO_BLOCKSEND; + if (strnicmp(option, "noautotune", 10) == 0) + return NO_AUTOTUNE; + if (strnicmp(option, "suid", 4) == 0) + return SUID; + if (strnicmp(option, "nosuid", 6) == 0) + return NO_SUID; + if (strnicmp(option, "exec", 4) == 0) + return EXEC; + if (strnicmp(option, "noexec", 6) == 0) + return NO_EXEC; + if (strnicmp(option, "dev", 3) == 0) + return DEV; + if (strnicmp(option, "nodev", 5) == 0) + return NO_DEV; + if (strnicmp(option, "noauto", 6) == 0) + return NO_AUTO; + if (strnicmp(option, "hard", 4) == 0) + return HARD; + if (strnicmp(option, "nohard", 6) == 0) + return NO_HARD; + if (strnicmp(option, "soft", 4) == 0) + return SOFT; + if (strnicmp(option, "nosoft", 6) == 0) + return NO_SOFT; + if (strnicmp(option, "perm", 4) == 0) + return PERM; + if (strnicmp(option, "noperm", 6) == 0) + return NO_PERM; + if (strnicmp(option, "mapchars", 8) == 0) + return MAPCHARS; + if (strnicmp(option, "nomapchars", 10) == 0) + return NO_MAPCHARS; + if (strnicmp(option, "sfu", 3) == 0) + return SFU; + if (strnicmp(option, "nosfu", 5) == 0) + return NO_SFU; + if (strnicmp(option, "nodfs", 5) == 0) + return NO_DFS; + if (strnicmp(option, "posixpaths", 10) == 0) + return POSIXPATHS; + if (strnicmp(option, "noposixpaths", 12) == 0) + return NO_POSIXPATHS; + if (strnicmp(option, "nounix", 6) == 0) + return NO_UNIX; + if (strnicmp(option, "nolinux", 7) == 0) + return NO_LINUX; + if (strnicmp(option, "nocase", 6) == 0) + return NO_CASE; + if (strnicmp(option, "ignorecase", 10) == 0) + return IGNORECASE; + if (strnicmp(option, "brl", 3) == 0) + return BRL; + if (strnicmp(option, "nobrl", 5) == 0) + return NO_BRL; + if (strnicmp(option, "nolock", 6) == 0) + return NO_LOCK; + if (strnicmp(option, "forcemandatorylock", 9) == 0) + return FORCE_MANDATORYLOCK; + if (strnicmp(option, "setuids", 7) == 0) + return SETUIDS; + if (strnicmp(option, "nosetuids", 9) == 0) + return NO_SETUIDS; + if (strnicmp(option, "dynperm", 7) == 0) + return DYNPERM; + if (strnicmp(option, "nodynperm", 9) == 0) + return NO_DYNPERM; + if (strnicmp(option, "intr", 4) == 0) + return INTR; + if (strnicmp(option, "nointr", 6) == 0) + return NO_INTR; + if (strnicmp(option, "strictsync", 10) == 0) + return STRICTSYNC; + if (strnicmp(option, "nostrictsync", 12) == 0) + return NO_STRICTSYNC; + if (strnicmp(option, "serverino", 7) == 0) + return SERVERINO; + if (strnicmp(option, "noserverino", 9) == 0) + return NO_SERVERINO; + if (strnicmp(option, "cifsacl", 7) == 0) + return CIFSACL; + if (strnicmp(option, "nocifsacl", 9) == 0) + return NO_CIFSACL; + if (strnicmp(option, "acl", 3) == 0) + return ACL; + if (strnicmp(option, "noacl", 5) == 0) + return NO_ACL; + if (strnicmp(option, "locallease", 6) == 0) + return LOCALLEASE; + if (strnicmp(option, "sign", 4) == 0) + return SIGN; + if (strnicmp(option, "seal", 4) == 0) + return SEAL; + if (strnicmp(option, "direct", 6) == 0) + return DIRECT; + if (strnicmp(option, "forcedirectio", 13) == 0) + return FORCE_DIRECT; + if (strnicmp(option, "noac", 4) == 0) + return NO_AC; + + return CIFS_TOKEN_ERROR; +} + + static int cifs_parse_mount_options(char *options, const char *devname, struct smb_vol *vol)