Jeremy Allison
2020-Dec-02 17:57 UTC
[Samba] Strange logs: check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
On Wed, Dec 02, 2020 at 09:46:23AM -0800, Jeremy Allison via samba wrote:> >Rowland, can you log a bug and I'll create a patch MR >for this ?Can you test the following patch before we do so ? I think it'll quiet down the log-spam. diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index fbeed6782ad..3de22b350f1 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3424,6 +3424,11 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i open and fstat. Ensure this isn't a symlink link. */ if (sys_lstat(fname, &lsbuf, false) != 0) { + if (errno == ENOENT) { + /* Unknown share requested. Just ignore. */ + goto out; + } + /* Only log messages for meaningful problems. */ DEBUG(0,("process_usershare_file: stat of %s failed. %s\n", fname, strerror(errno) )); goto out; @@ -3629,6 +3634,11 @@ int load_usershare_service(const char *servicename) int max_user_shares = Globals.usershare_max_shares; int snum_template = -1; + if (servicename[0] == '\0') { + /* Invalid service name. */ + return -1; + } + if (*usersharepath == 0 || max_user_shares == 0) { return -1; }
Rowland penny
2020-Dec-02 18:24 UTC
[Samba] Strange logs: check_usershare_stat: file /var/lib/samba/usershares/ owned by uid 0 is not a regular file
On 02/12/2020 17:57, Jeremy Allison wrote:> On Wed, Dec 02, 2020 at 09:46:23AM -0800, Jeremy Allison via samba wrote: >> >> Rowland, can you log a bug and I'll create a patch MR >> for this ? > > Can you test the following patch before we do so ? > I think it'll quiet down the log-spam. > > diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c > index fbeed6782ad..3de22b350f1 100644 > --- a/source3/param/loadparm.c > +++ b/source3/param/loadparm.c > @@ -3424,6 +3424,11 @@ static int process_usershare_file(const char > *dir_name, const char *file_name, i > ?????????? open and fstat. Ensure this isn't a symlink link. */ > > ??????? if (sys_lstat(fname, &lsbuf, false) != 0) { > +?????????????? if (errno == ENOENT) { > +?????????????????????? /* Unknown share requested. Just ignore. */ > +?????????????????????? goto out; > +?????????????? } > +?????????????? /* Only log messages for meaningful problems. */ > ??????????????? DEBUG(0,("process_usershare_file: stat of %s failed. > %s\n", > ??????????????????????? fname, strerror(errno) )); > ??????????????? goto out; > @@ -3629,6 +3634,11 @@ int load_usershare_service(const char > *servicename) > ??????? int max_user_shares = Globals.usershare_max_shares; > ??????? int snum_template = -1; > > +?????? if (servicename[0] == '\0') { > +?????????????? /* Invalid service name. */ > +?????????????? return -1; > +?????? } > + > ??????? if (*usersharepath == 0 ||? max_user_shares == 0) { > ??????????????? return -1; > ??????? }OK, will do, I have found a VM running 4.12.9 on Debian 10, changed the profile path in my AD object to point to it and logged into Win10 and the log lines appeared in syslog, so it is reproducible. Just need to compile Samba with your patch now. Rowland