Skip to content

Commit 0b0430c

Browse files
Kenneth D'souzasmfrench
authored andcommitted
cifs: Add get_security_type_str function to return sec type.
This code is more organized and robust. Signed-off-by: Kenneth D'souza <kdsouza@redhat.com> Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 5865985 commit 0b0430c

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

fs/cifs/cifs_debug.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
221221
struct cifs_ses *ses;
222222
struct cifs_tcon *tcon;
223223
int i, j;
224-
const char *security_types[] = {"Unspecified", "LANMAN", "NTLM",
225-
"NTLMv2", "RawNTLMSSP", "Kerberos"};
226224

227225
seq_puts(m,
228226
"Display Internal CIFS Data Structures for Debugging\n"
@@ -379,7 +377,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
379377
}
380378

381379
seq_printf(m,"Security type: %s\n",
382-
security_types[server->ops->select_sectype(server, ses->sectype)]);
380+
get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
383381

384382
if (server->rdma)
385383
seq_printf(m, "RDMA\n\t");

fs/cifs/cifsglob.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,24 @@ extern struct smb_version_values smb302_values;
20082008
extern struct smb_version_operations smb311_operations;
20092009
extern struct smb_version_values smb311_values;
20102010

2011+
static inline char *get_security_type_str(enum securityEnum sectype)
2012+
{
2013+
switch (sectype) {
2014+
case RawNTLMSSP:
2015+
return "RawNTLMSSP";
2016+
case Kerberos:
2017+
return "Kerberos";
2018+
case NTLMv2:
2019+
return "NTLMv2";
2020+
case NTLM:
2021+
return "NTLM";
2022+
case LANMAN:
2023+
return "LANMAN";
2024+
default:
2025+
return "Unknown";
2026+
}
2027+
}
2028+
20112029
static inline bool is_smb1_server(struct TCP_Server_Info *server)
20122030
{
20132031
return strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0;

0 commit comments

Comments
 (0)