A settimes command for smbclient

Andreas Schneider asn at samba.org
Tue Sep 12 17:48:24 UTC 2017

On Tuesday, 12 September 2017 18:38:29 CEST Richard Sharpe via samba-technical 
> Hi folks,

Hi Richard,
> In order to write some nice unit tests for things I would like a
> settimes command in smbclient.
> The difficulty seems to be that there is no cli_sfileinfo API
> available and I imagine that while I could use smb_raw_setpathinfo
> from source4 but that might cause linking issues.
> Has anyone written anything like this before?

libsmbclient has smbc_utimes which calls cli_setpathinfo_basic() to set 
create_time, access_time, write_time and change_time. It falls back to 
cli_setatrE() and cli_setatr().

Look into SMBC_setatr() in source3/libsmb/libsmb_file.c

If there is no such function in smblclient yet you should call it utimes.

Hope that helps,


Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org

More information about the samba-technical mailing list