[Samba] logfile reopen error happen (may be samba bug?)

oota at mail.linux.bs1.fc.nec.co.jp oota at mail.linux.bs1.fc.nec.co.jp
Tue Mar 18 02:10:57 GMT 2008


Dear Samba Team

When I used Samba , I found some error messages in syslog.
The error messages were printed immediately when I executed smbcontrol command
with "reload-config" option (as follows).

# smbcontrol smbd reload-config

The error messages are as follows. 

Mar 11 13:58:27 ML4SP2 smb: nmbd startup succeeded
Mar 11 13:58:47 ML4SP2 smbd[20860]: [2008/03/11 13:58:47, 0, pid=20860, effective(99, 99), real(99, 0)] lib/debug.c:reopen_logs(625) 
Mar 11 13:58:47 ML4SP2 smbd[20860]:   Unable to open new log file /var/log/samba/10.19.71.31.log: Permission denied 
Mar 11 13:58:47 ML4SP2 smbd[20860]: [2008/03/11 13:58:47, 0, pid=20860, effective(99, 99), real(99, 0)] lib/debug.c:reopen_logs(625) 
Mar 11 13:58:47 ML4SP2 smbd[20860]:   Unable to open new log file /var/log/samba/10.19.71.31.log: Permission denied 
Mar 11 13:58:47 ML4SP2 smbd[20860]: [2008/03/11 13:58:47, 0, pid=20860, effective(99, 99), real(99, 0)] lib/debug.c:reopen_logs(625) 
Mar 11 13:58:47 ML4SP2 smbd[20860]:   Unable to open new log file /var/log/samba/10.19.71.31.log: Permission denied


I checked the source code, and I found the error in "reopen_logs" function in "lib/debuc.c".
A part concerned is as follows. 


 621         new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644);
 622 
 623         if (!new_dbf) {
 624                 log_overflow = True;
 625                 DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno)));
 626                 log_overflow = False;
 627                 if (dbf)
 628                         x_fflush(dbf);
 629                 ret = False;
 630         } else {
 631                 x_setbuf(new_dbf, NULL);
 632                 old_dbf = dbf;
 633                 dbf = new_dbf;
 634                 if (old_dbf)
 635                         (void) x_fclose(old_dbf);
 636         }


The cause is the execution of the smbcontrol command when smbd runs as user uid (not root uid). 
When smbd runs as  user uid, the log file cannot be opened again because there are no right to
write to the directory.

I think the reason of the error is that there is no right to access in the directory.

Is it possible to deal with this problem?

--
--- Oota Toshiya ---  oota at mail.linux.bs1.fc.nec.co.jp
NEC Computers Software Operations Unit              Shiba,Minato,Tokyo
Open Source Software Platform Development Division  Japan,Earth,Solar system
(samba-jp/ldap-jp Staff,mutt-j admin,analog-jp/samba-jp postmaster)


More information about the samba mailing list