Skip to content

Commit 6103335

Browse files
author
Steve French
committed
[CIFS] DNS name resolution helper upcall for cifs
Adds additional option CIFS_DFS_UPCALL to fs/Kconfig for enabling DFS support. Resolved IP address is saved as a string in the key payload. Igor has a series of related patches that will follow which finish up CIFS DFS support Acked-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
1 parent f6d0998 commit 6103335

3 files changed

Lines changed: 42 additions & 14 deletions

File tree

‎fs/Kconfig‎

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,13 +1905,15 @@ config CIFS
19051905
file servers such as Windows 2000 (including Windows 2003, NT 4
19061906
and Windows XP) as well by Samba (which provides excellent CIFS
19071907
server support for Linux and many other operating systems). Limited
1908-
support for OS/2 and Windows ME and similar servers is provided as well.
1909-
1910-
The intent of the cifs module is to provide an advanced
1911-
network file system client for mounting to CIFS compliant servers,
1912-
including support for dfs (hierarchical name space), secure per-user
1913-
session establishment, safe distributed caching (oplock), optional
1914-
packet signing, Unicode and other internationalization improvements.
1908+
support for OS/2 and Windows ME and similar servers is provided as
1909+
well.
1910+
1911+
The cifs module provides an advanced network file system
1912+
client for mounting to CIFS compliant servers. It includes
1913+
support for DFS (hierarchical name space), secure per-user
1914+
session establishment via Kerberos or NTLM or NTLMv2,
1915+
safe distributed caching (oplock), optional packet
1916+
signing, Unicode and other internationalization improvements.
19151917
If you need to mount to Samba or Windows from this machine, say Y.
19161918

19171919
config CIFS_STATS
@@ -1943,16 +1945,17 @@ config CIFS_WEAK_PW_HASH
19431945
(since 1997) support stronger NTLM (and even NTLMv2 and Kerberos)
19441946
security mechanisms. These hash the password more securely
19451947
than the mechanisms used in the older LANMAN version of the
1946-
SMB protocol needed to establish sessions with old SMB servers.
1948+
SMB protocol but LANMAN based authentication is needed to
1949+
establish sessions with some old SMB servers.
19471950

19481951
Enabling this option allows the cifs module to mount to older
19491952
LANMAN based servers such as OS/2 and Windows 95, but such
19501953
mounts may be less secure than mounts using NTLM or more recent
19511954
security mechanisms if you are on a public network. Unless you
19521955
have a need to access old SMB servers (and are on a private
19531956
network) you probably want to say N. Even if this support
1954-
is enabled in the kernel build, they will not be used
1955-
automatically. At runtime LANMAN mounts are disabled but
1957+
is enabled in the kernel build, LANMAN authentication will not be
1958+
used automatically. At runtime LANMAN mounts are disabled but
19561959
can be set to required (or optional) either in
19571960
/proc/fs/cifs (see fs/cifs/README for more detail) or via an
19581961
option on the mount command. This support is disabled by
@@ -2018,12 +2021,22 @@ config CIFS_UPCALL
20182021
depends on CIFS_EXPERIMENTAL
20192022
depends on KEYS
20202023
help
2021-
Enables an upcall mechanism for CIFS which will be used to contact
2022-
userspace helper utilities to provide SPNEGO packaged Kerberos
2023-
tickets which are needed to mount to certain secure servers
2024+
Enables an upcall mechanism for CIFS which accesses
2025+
userspace helper utilities to provide SPNEGO packaged (RFC 4178)
2026+
Kerberos tickets which are needed to mount to certain secure servers
20242027
(for which more secure Kerberos authentication is required). If
20252028
unsure, say N.
20262029

2030+
config CIFS_DFS_UPCALL
2031+
bool "DFS feature support (EXPERIMENTAL)"
2032+
depends on CIFS_EXPERIMENTAL
2033+
depends on KEYS
2034+
help
2035+
Enables an upcall mechanism for CIFS which contacts userspace
2036+
helper utilities to provide server name resolution (host names to
2037+
IP addresses) which is needed for implicit mounts of DFS junction
2038+
points. If unsure, say N.
2039+
20272040
config NCP_FS
20282041
tristate "NCP file system support (to mount NetWare volumes)"
20292042
depends on IPX!=n || INET

‎fs/cifs/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \
99
readdir.o ioctl.o sess.o export.o cifsacl.o
1010

1111
cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
12+
13+
cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o

‎fs/cifs/cifsfs.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "cifs_fs_sb.h"
4545
#include <linux/mm.h>
4646
#include <linux/key-type.h>
47+
#include "dns_resolve.h"
4748
#include "cifs_spnego.h"
4849
#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */
4950

@@ -1014,12 +1015,17 @@ init_cifs(void)
10141015
rc = register_key_type(&cifs_spnego_key_type);
10151016
if (rc)
10161017
goto out_unregister_filesystem;
1018+
#endif
1019+
#ifdef CONFIG_CIFS_DFS_UPCALL
1020+
rc = register_key_type(&key_type_dns_resolver);
1021+
if (rc)
1022+
goto out_unregister_key_type;
10171023
#endif
10181024
oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd");
10191025
if (IS_ERR(oplockThread)) {
10201026
rc = PTR_ERR(oplockThread);
10211027
cERROR(1, ("error %d create oplock thread", rc));
1022-
goto out_unregister_key_type;
1028+
goto out_unregister_dfs_key_type;
10231029
}
10241030

10251031
dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd");
@@ -1033,7 +1039,11 @@ init_cifs(void)
10331039

10341040
out_stop_oplock_thread:
10351041
kthread_stop(oplockThread);
1042+
out_unregister_dfs_key_type:
1043+
#ifdef CONFIG_CIFS_DFS_UPCALL
1044+
unregister_key_type(&key_type_dns_resolver);
10361045
out_unregister_key_type:
1046+
#endif
10371047
#ifdef CONFIG_CIFS_UPCALL
10381048
unregister_key_type(&cifs_spnego_key_type);
10391049
out_unregister_filesystem:
@@ -1059,6 +1069,9 @@ exit_cifs(void)
10591069
#ifdef CONFIG_PROC_FS
10601070
cifs_proc_clean();
10611071
#endif
1072+
#ifdef CONFIG_CIFS_DFS_UPCALL
1073+
unregister_key_type(&key_type_dns_resolver);
1074+
#endif
10621075
#ifdef CONFIG_CIFS_UPCALL
10631076
unregister_key_type(&cifs_spnego_key_type);
10641077
#endif

0 commit comments

Comments
 (0)