Skip to content

Commit bf82067

Browse files
author
Steve French
committed
[CIFS] Kerberos and CIFS ACL support part 1
Signed-off-by: Steve French <[email protected]>
1 parent 8345187 commit bf82067

File tree

4 files changed

+94
-9
lines changed

4 files changed

+94
-9
lines changed

fs/cifs/README

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,17 @@ A partial list of the supported mount options follows:
436436
SFU does). In the future the bottom 9 bits of the mode
437437
mode also will be emulated using queries of the security
438438
descriptor (ACL).
439-
439+
sec Security mode. Allowed values are:
440+
none attempt to connection as a null user (no name)
441+
krb5 Use Kerberos version 5 authentication
442+
krb5i Use Kerberos authentication and packet signing
443+
ntlm Use NTLM password hashing (default)
444+
ntlmi Use NTLM password hashing with signing (if
445+
/proc/fs/cifs/PacketSigningEnabled on or if
446+
server requires signing also can be the default)
447+
ntlmv2 Use NTLMv2 password hashing
448+
ntlmv2i Use NTLMv2 password hashing with packet signing
449+
440450
The mount.cifs mount helper also accepts a few mount options before -o
441451
including:
442452

fs/cifs/cifsacl.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* fs/cifs/cifsacl.h
3+
*
4+
* Copyright (c) International Business Machines Corp., 2005
5+
* Author(s): Steve French ([email protected])
6+
*
7+
* This library is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU Lesser General Public License as published
9+
* by the Free Software Foundation; either version 2.1 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15+
* the GNU Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public License
18+
* along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
*/
21+
22+
#ifndef _CIFSACL_H
23+
#define _CIFSACL_H
24+
25+
struct cifs_sid {
26+
__u8 revision; /* revision level */
27+
__u8 num_subauths;
28+
__u8 authority[6];
29+
__u8 sub_auth[4];
30+
/* next sub_auth if any ... */
31+
} __attribute__((packed));
32+
33+
/* everyone */
34+
const cifs_sid sid_everyone = {1, 1, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0}};
35+
/* group users */
36+
const cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {32, 545, 0, 0}};

fs/cifs/cifspdu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* fs/cifs/cifspdu.h
33
*
4-
* Copyright (c) International Business Machines Corp., 2002
4+
* Copyright (c) International Business Machines Corp., 2002,2005
55
* Author(s): Steve French ([email protected])
66
*
77
* This library is free software; you can redistribute it and/or modify

fs/cifs/connect.c

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ struct smb_vol {
8282
unsigned remap:1; /* set to remap seven reserved chars in filenames */
8383
unsigned posix_paths:1; /* unset to not ask for posix pathnames. */
8484
unsigned sfu_emul:1;
85+
unsigned krb5:1;
86+
unsigned ntlm:1;
87+
unsigned ntlmv2:1;
88+
unsigned nullauth:1; /* attempt to authenticate with null user */
89+
unsigned sign:1;
90+
unsigned seal:1; /* encrypt */
8591
unsigned nocase; /* request case insensitive filenames */
8692
unsigned nobrl; /* disable sending byte range locks to srv */
8793
unsigned int rsize;
@@ -777,7 +783,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
777783

778784
/* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */
779785
vol->rw = TRUE;
780-
786+
vol->ntlm = TRUE;
781787
/* default is always to request posix paths. */
782788
vol->posix_paths = 1;
783789

@@ -903,6 +909,39 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
903909
printk(KERN_WARNING "CIFS: ip address too long\n");
904910
return 1;
905911
}
912+
} else if (strnicmp(data, "sec", 3) == 0) {
913+
if (!value || !*value) {
914+
cERROR(1,("no security value specified"));
915+
continue;
916+
} else if (strnicmp(value, "krb5i", 5) == 0) {
917+
vol->sign = 1;
918+
vol->krb5 = 1;
919+
} else if (strnicmp(value, "krb5p", 5) == 0) {
920+
/* vol->seal = 1;
921+
vol->krb5 = 1; */
922+
cERROR(1,("Krb5 cifs privacy not supported"));
923+
return 1;
924+
} else if (strnicmp(value, "krb5", 4) == 0) {
925+
vol->krb5 = 1;
926+
} else if (strnicmp(value, "ntlmv2i", 7) == 0) {
927+
vol->ntlmv2 = 1;
928+
vol->sign = 1;
929+
} else if (strnicmp(value, "ntlmv2", 6) == 0) {
930+
vol->ntlmv2 = 1;
931+
} else if (strnicmp(value, "ntlmi", 5) == 0) {
932+
vol->ntlm = 1;
933+
vol->sign = 1;
934+
} else if (strnicmp(value, "ntlm", 4) == 0) {
935+
/* ntlm is default so can be turned off too */
936+
vol->ntlm = 1;
937+
} else if (strnicmp(value, "nontlm", 6) == 0) {
938+
vol->ntlm = 0;
939+
} else if (strnicmp(value, "none", 4) == 0) {
940+
vol->nullauth = 1;
941+
} else {
942+
cERROR(1,("bad security option: %s", value));
943+
return 1;
944+
}
906945
} else if ((strnicmp(data, "unc", 3) == 0)
907946
|| (strnicmp(data, "target", 6) == 0)
908947
|| (strnicmp(data, "path", 4) == 0)) {
@@ -1546,7 +1585,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
15461585
cFYI(1, ("Username: %s ", volume_info.username));
15471586

15481587
} else {
1549-
cifserror("No username specified ");
1588+
cifserror("No username specified");
15501589
/* In userspace mount helper we can get user name from alternate
15511590
locations such as env variables and files on disk */
15521591
kfree(volume_info.UNC);
@@ -1587,7 +1626,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
15871626
return -EINVAL;
15881627
} else /* which servers DFS root would we conect to */ {
15891628
cERROR(1,
1590-
("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified "));
1629+
("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified"));
15911630
kfree(volume_info.UNC);
15921631
kfree(volume_info.password);
15931632
FreeXid(xid);
@@ -1626,7 +1665,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
16261665

16271666

16281667
if (srvTcp) {
1629-
cFYI(1, ("Existing tcp session with server found "));
1668+
cFYI(1, ("Existing tcp session with server found"));
16301669
} else { /* create socket */
16311670
if(volume_info.port)
16321671
sin_server.sin_port = htons(volume_info.port);
@@ -1689,11 +1728,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
16891728

16901729
if (existingCifsSes) {
16911730
pSesInfo = existingCifsSes;
1692-
cFYI(1, ("Existing smb sess found "));
1731+
cFYI(1, ("Existing smb sess found"));
16931732
kfree(volume_info.password);
16941733
/* volume_info.UNC freed at end of function */
16951734
} else if (!rc) {
1696-
cFYI(1, ("Existing smb sess not found "));
1735+
cFYI(1, ("Existing smb sess not found"));
16971736
pSesInfo = sesInfoAlloc();
16981737
if (pSesInfo == NULL)
16991738
rc = -ENOMEM;
@@ -1777,7 +1816,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
17771816
find_unc(sin_server.sin_addr.s_addr, volume_info.UNC,
17781817
volume_info.username);
17791818
if (tcon) {
1780-
cFYI(1, ("Found match on UNC path "));
1819+
cFYI(1, ("Found match on UNC path"));
17811820
/* we can have only one retry value for a connection
17821821
to a share so for resources mounted more than once
17831822
to the same server share the last value passed in

0 commit comments

Comments
 (0)