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
This commit is contained in:
Gleb Popov 2020-01-03 12:54:14 +00:00
parent 6d26116baa
commit 4d6e5658e4

View File

@ -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);