Page MenuHomeFreeBSD

mount_smbfs: Issue a warning when .nsmbrc section name contains lowercase characters
ClosedPublic

Authored by arrowd on Nov 9 2019, 6:53 AM.
Tags
None
Referenced Files
F156426758: D22289.id.diff
Wed, May 13, 3:11 PM
F156403678: D22289.id66298.diff
Wed, May 13, 11:06 AM
Unknown Object (File)
Wed, May 6, 5:23 AM
Unknown Object (File)
Wed, May 6, 5:22 AM
Unknown Object (File)
Wed, May 6, 5:19 AM
Unknown Object (File)
Thu, Apr 30, 11:41 AM
Unknown Object (File)
Mon, Apr 27, 12:22 PM
Unknown Object (File)
Wed, Apr 22, 11:29 PM

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

donner added inline comments.
contrib/smbfs/lib/smb/rcfile.c
166–171 ↗(On Diff #64102)

I'd propose:

for(sectletter = sectname; *sectletter; sectletter++) {
   if(isupper(*sectletter)  || *sectletter == ':')
      continue;
   if(!strcmp(sectname, "default"))
      dprintf(STDERR_FILENO, "warning: Section name [%s] may contain problematic chars, like lower-case letters\n", sectname);
   break;
}

This makes the scan more readable, short cut if the result is known, and keep the search and the response together.

bapt requested changes to this revision.Jan 3 2020, 11:29 AM
bapt added a subscriber: bapt.
bapt added inline comments.
contrib/smbfs/lib/smb/rcfile.c
166–171 ↗(On Diff #64102)

I like the proposal better, but I think that special chars should be allowed, then testing isupper and !islower should do the trick instead of only testing ':'

This revision now requires changes to proceed.Jan 3 2020, 11:29 AM
contrib/smbfs/lib/smb/rcfile.c
166–171 ↗(On Diff #64102)

This would simplify the code to:

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;
  }
}
donner requested changes to this revision.Jan 3 2020, 11:36 AM
arrowd marked 3 inline comments as done.

Address comments.

donner added inline comments.
contrib/smbfs/lib/smb/rcfile.c
161–162 ↗(On Diff #66292)

If the section was found, the check is skipped.

That's okay, because the check should be done only if the a new section is encountered the first time.

This revision is now accepted and ready to land.Jan 3 2020, 12:49 PM