Skip to contentSkip to conversation

cifs: dump Security Type info in DebugData

PATCH Superseded Kenneth D'souza 2 participants 3 messages Jun 4, 2020 – Jun 5, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cifs: dump Security Type info in DebugData

Currently the end user is unaware with what sec type the cifs share is mounted if no sec=<type> option is parsed. With this patch one can easily check from DebugData.

Example:
1) Name: x.x.x.x Uses: 1 Capability: 0x8001f3fc Session Status: 1 Security type: RawNTLMSSP

---
 fs/cifs/cifs_debug.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/cifs/cifs_debug.c +6 -0
index 916567d770f5..3ad1a98fd567 100644
@@ -221,6 +221,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
 	int i, j;
+	const char *security_types[] = {"Unspecified", "LANMAN", "NTLM",
+                                       "NTLMv2", "RawNTLMSSP", "Kerberos"};
 
 	seq_puts(m,
 		    "Display Internal CIFS Data Structures for Debugging\n"
@@ -375,6 +377,10 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
 				ses->ses_count, ses->serverOS, ses->serverNOS,
 				ses->capabilities, ses->status);
 			}
+
+			seq_printf(m,"Security type: %s\n",
+                                      security_types[server->ops->select_sectype(server, ses->sectype)]);
+
 			if (server->rdma)
 				seq_printf(m, "RDMA\n\t");
 			seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "
Signature · 1 line
2.21.1
#1 lore raw
Quoted 3 lines · Kenneth D'souza

Currently the end user is unaware with what sec type the cifs share is mounted if no sec=<type> option is parsed. With this patch one can easily check from DebugData.

LGTM but I would move the security_types next to the enum definition in cifsglob.h somehow, so that it will be harder to forget to update one if the other changes.

Since it is in a header, maybe via an inline func with a switch... simple but more verbose. Or X-macros [1] magic (might be overkill).

1: https://www.geeksforgeeks.org/x-macros-in-c/

Cheers,

Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
#2 lore raw

Aurélien, Implemented your suggestion.
Sent v3 for the same.

Quoted 23 lines · Aurélien Aptel
Quoted 3 lines · Kenneth D'souza

Currently the end user is unaware with what sec type the cifs share is mounted if no sec=<type> option is parsed. With this patch one can easily check from DebugData.

LGTM but I would move the security_types next to the enum definition in cifsglob.h somehow, so that it will be harder to forget to update one if the other changes.

Since it is in a header, maybe via an inline func with a switch... simple but more verbose. Or X-macros [1] magic (might be overkill).

1: https://www.geeksforgeeks.org/x-macros-in-c/

Cheers,
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)