Skip to content

Commit fb157ed

Browse files
author
Steve French
committed
cifs: when insecure legacy is disabled shrink amount of SMB1 code
Currently much of the smb1 code is built even when CONFIG_CIFS_ALLOW_INSECURE_LEGACY is disabled. Move cifssmb.c to only be compiled when insecure legacy is disabled, and move various SMB1/CIFS helper functions to that ifdef. Some functions that were not SMB1/CIFS specific needed to be moved out of cifssmb.c This shrinks cifs.ko by more than 10% which is good - but also will help with the eventual movement of the legacy code to a distinct module. Follow on patches can shrink the number of ifdefs by code restructuring where smb1 code is wedged in functions that should be calling dialect specific helper functions instead, and also by moving some functions from file.c/dir.c/inode.c into smb1 specific c files. Reviewed-by: Ronnie Sahlberg <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 97b82c0 commit fb157ed

File tree

13 files changed

+582
-463
lines changed

13 files changed

+582
-463
lines changed

fs/cifs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
ccflags-y += -I$(src) # needed for trace events
66
obj-$(CONFIG_CIFS) += cifs.o
77

8-
cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
8+
cifs-y := trace.o cifsfs.o cifs_debug.o connect.o dir.o file.o \
99
inode.o link.o misc.o netmisc.o smbencrypt.o transport.o \
1010
cifs_unicode.o nterr.o cifsencrypt.o \
1111
readdir.o ioctl.o sess.o export.o unc.o winucase.o \
@@ -31,4 +31,4 @@ cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o
3131

3232
cifs-$(CONFIG_CIFS_ROOT) += cifsroot.o
3333

34-
cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += smb1ops.o
34+
cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += smb1ops.o cifssmb.o

fs/cifs/cifsacl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
13791379
return rc;
13801380
}
13811381

1382+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
13821383
struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
13831384
const struct cifs_fid *cifsfid, u32 *pacllen,
13841385
u32 __maybe_unused unused)
@@ -1512,6 +1513,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
15121513
cifs_put_tlink(tlink);
15131514
return rc;
15141515
}
1516+
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
15151517

15161518
/* Translate the CIFS ACL (similar to NTFS ACL) for a file into mode bits */
15171519
int

fs/cifs/cifsproto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ extern int generate_smb30signingkey(struct cifs_ses *ses,
521521
extern int generate_smb311signingkey(struct cifs_ses *ses,
522522
struct TCP_Server_Info *server);
523523

524+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
524525
extern int CIFSSMBCopy(unsigned int xid,
525526
struct cifs_tcon *source_tcon,
526527
const char *fromName,
@@ -551,6 +552,7 @@ extern int CIFSSMBSetPosixACL(const unsigned int xid, struct cifs_tcon *tcon,
551552
const struct nls_table *nls_codepage, int remap_special_chars);
552553
extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
553554
const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
555+
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
554556
extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
555557
extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
556558
extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,

0 commit comments

Comments
 (0)