From 4d6e5658e4ec78ec687448995b9414e1b70649f9 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Fri, 3 Jan 2020 12:54:14 +0000 Subject: [PATCH] mount_smbfs: Issue a warning when .nsmbrc section name contains lowercase characters. PR: 231656 Approved by: bapt MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D22289 --- contrib/smbfs/lib/smb/rcfile.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/smbfs/lib/smb/rcfile.c b/contrib/smbfs/lib/smb/rcfile.c index 5f92c8a311f4..26a31d6f37ee 100644 --- a/contrib/smbfs/lib/smb/rcfile.c +++ b/contrib/smbfs/lib/smb/rcfile.c @@ -156,11 +156,19 @@ static struct rcsection * rc_addsect(struct rcfile *rcp, const char *sectname) { struct rcsection *p; + const char* sectletter = sectname; p = rc_findsect(rcp, sectname); if (p) return p; p = malloc(sizeof(*p)); if (!p) return NULL; + for(sectletter = sectname; *sectletter; sectletter++) { + if (islower(*sectletter)) { + if (strcmp(sectname, "default")) + dprintf(STDERR_FILENO, "warning: section name [%s] contains lower-case letters\n", sectname); + break; + } + } p->rs_name = strdup(sectname); SLIST_INIT(&p->rs_keys); SLIST_INSERT_HEAD(&rcp->rf_sect, p, rs_next);