smbclient(samba-4.10.4) cannot log data in log.smbclient while samba-3.6.23 can

Amit Kumar amitkuma at redhat.com
Thu Mar 19 06:36:56 UTC 2020


Any updates ..

On 3/18/20 18:04, Amit Kumar wrote:
>
> Hello,
>
> smbclient cannot create log file when log-basename is specified in 
> samba-master.
>
>        -l|--log-basename=logdirectory
>            Base directory name for log/debug files. The extension 
> ".progname" will
>            be appended (e.g. log.smbclient, log.smbd, etc...). The log 
> file is
>            never removed by the client.
>
> *On samba-4.10.4*:
> # smbclient -l /var/log/samba //<samba-server-ip>/<share-name>   -U 
> username%password
> smb: \> ls
>   .                                   D        0  Wed Mar 18 05:34:29 2020
>   ..                                  D        0  Mon Mar  2 06:46:14 2020
>   test1.xml                               A  9727426  Mon Mar  2 
> 06:50:39 2020
>
>         26699940 blocks of size 1024. 1524304 blocks available
> smb: \> q
> # ls -ltr /var/log/samba
> -rw-r--r--. 1 root root       0 Mar 18 05:35 log.smbclient 
> <<<<<<<<<<<See file size=0
> #
>
> *samba-3.6.23:
> *# smbclient -l /var/log/samba //<samba-server-ip>/<share-name>   -U 
> username%password
> smb: \> ls
>   .                                   D        0  Wed Mar 18 06:41:49 2020
>   ..                                 DR        0  Wed Mar 18 06:41:45 2020
>   file-1                                       0  Wed Mar 18 06:41:49 2020
>
>         44732 blocks of size 1048576. 36679 blocks available
> smb: \> q
> # ls -ltr /var/log/samba/
> -rw-r--r--. 1 root root    242 Mar 18 08:13 log.smbclient 
> <<<<<<<Creates the file.
>
>
> I tried breaking samba-4.10.4 in setup_logging() using gdb but on 
> running gdb "Single stepping until exit from function setup_logging, 
> which has no line number information", maybe its pproblem of gdb ad 
> gcc version mismatch but i am using both latest version.
> samba-3.23 breaks perfactly into setup_logging().
>
> I think using git bisect between these versions would be tough as, 
> versions are far apart.
>
> Even there is significant change log handling between two versions. I 
> tried adding the old code back but still no luck.
>
> samba-4.10.4/lib/util/debug.c
> void setup_logging(const char *prog_name, enum debug_logtype new_logtype)
>
> {
>         debug_init();
>         if (state.logtype < new_logtype) {
>                 state.logtype = new_logtype;
>         }
>         if (prog_name) {
>                 const char *p = strrchr(prog_name, '/');
>
>                 if (p) {
>                         prog_name = p + 1;
>                 }
>
>                 state.prog_name = prog_name;
>         }
>         reopen_logs_internal();
>  +       if (state.logtype == DEBUG_FILE) {
> +#ifdef WITH_SYSLOG
> +              //const char *p = strrchr_m( prog_name,'/' );
> +            const char *p = "/log.smbclient";
> +                if (p)
> +                       prog_name = p + 1;
> +#ifdef LOG_DAEMON
> + openlog( prog_name, LOG_PID, SYSLOG_FACILITY );
> +#else
> + /* for old systems that have no facility codes. */
> + openlog( prog_name, LOG_PID );
> +#endif
> +#endif
> + }
>
> }
> -- 
>
> Thank you,
> Amit Kumar
>
> <https://www.redhat.com/en/openshift-4>
>
-- 

Thank you,
Amit Kumar

Red Hat Insights - Predict risk. Get guidance. Improve security.
<https://www.redhat.com/en/technologies/management/insights>Red Hat 
Enterprise Linux 8. Any Cloud. Any Workload. One OS.
<https://www.redhat.com/en/enterprise-linux-8>Red Hat Openshift 4 is 
here <https://www.redhat.com/en/openshift-4>
<https://www.redhat.com/en/openshift-4>



More information about the samba-technical mailing list