Author: jerry Date: 2005-06-21 20:56:52 +0000 (Tue, 21 Jun 2005) New Revision: 7819
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7819 Log: svn merge -r7798:7817 svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_3_0 Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt branches/SAMBA_3_0_RELEASE/source/libsmb/libsmbclient.c branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c Changeset: Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt =================================================================== --- branches/SAMBA_3_0_RELEASE/WHATSNEW.txt 2005-06-21 20:39:51 UTC (rev 7818) +++ branches/SAMBA_3_0_RELEASE/WHATSNEW.txt 2005-06-21 20:56:52 UTC (rev 7819) @@ -242,6 +242,8 @@ * Error code fixes when attempting to manipulating non-existent shares. * Cleanup "net share migrate" code. + * Allow to touch mtime in vfs-recycle with "recycle:touch_mtime + = true". o Renaud Duhaut <[EMAIL PROTECTED]> @@ -318,6 +320,8 @@ * Correctly detect AF_LOCAL support in configure. * Fix problem updating file times on Windows 98 hosts using libsmbclient. + * Fix compile breakage on Solaris by eliminating the use of + ctime_r() in libsmbclient DEBUG statement. o Jason Mader <[EMAIL PROTECTED]> Modified: branches/SAMBA_3_0_RELEASE/source/libsmb/libsmbclient.c =================================================================== --- branches/SAMBA_3_0_RELEASE/source/libsmb/libsmbclient.c 2005-06-21 20:39:51 UTC (rev 7818) +++ branches/SAMBA_3_0_RELEASE/source/libsmb/libsmbclient.c 2005-06-21 20:56:52 UTC (rev 7819) @@ -3017,14 +3017,26 @@ m_time = tbuf[1].tv_sec; } + if (DEBUGLVL(4)) { + char *p; char atimebuf[32]; char mtimebuf[32]; - DEBUG(4, ("smbc_utimes(%s, atime = %s mtime = %s)\n", - fname, - ctime_r(&a_time, atimebuf), - ctime_r(&m_time, mtimebuf))); + strncpy(atimebuf, ctime(&a_time), sizeof(atimebuf)); + atimebuf[sizeof(atimebuf) - 1] = '\0'; + if ((p = strchr(atimebuf, '\n')) != NULL) { + *p = '\0'; + } + + strncpy(mtimebuf, ctime(&m_time), sizeof(mtimebuf)); + mtimebuf[sizeof(mtimebuf) - 1] = '\0'; + if ((p = strchr(mtimebuf, '\n')) != NULL) { + *p = '\0'; + } + + dbgtext("smbc_utimes(%s, atime = %s mtime = %s)\n", + fname, atimebuf, mtimebuf); } if (smbc_parse_path(context, fname, Modified: branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c =================================================================== --- branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c 2005-06-21 20:39:51 UTC (rev 7818) +++ branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c 2005-06-21 20:56:52 UTC (rev 7819) @@ -109,6 +109,17 @@ return ret; } +static BOOL recycle_touch_mtime(vfs_handle_struct *handle) +{ + BOOL ret; + + ret = lp_parm_bool(SNUM(handle->conn), "recycle", "touch_mtime", False); + + DEBUG(10, ("recycle: touch_mtime = %s\n", ret?"True":"False")); + + return ret; +} + static const char **recycle_exclude(vfs_handle_struct *handle) { const char **tmp_lp; @@ -317,9 +328,9 @@ } /** - * Touch access date + * Touch access or modify date **/ -static void recycle_do_touch(vfs_handle_struct *handle, const char *fname) +static void recycle_do_touch(vfs_handle_struct *handle, const char *fname, BOOL touch_mtime) { SMB_STRUCT_STAT st; struct utimbuf tb; @@ -331,7 +342,7 @@ } currtime = time(&currtime); tb.actime = currtime; - tb.modtime = st.st_mtime; + tb.modtime = touch_mtime ? currtime : st.st_mtime; if (SMB_VFS_NEXT_UTIME(handle, handle->conn, fname, &tb) == -1 ) { DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno))); @@ -490,8 +501,8 @@ } /* touch access date of moved file */ - if (recycle_touch(handle) == True ) - recycle_do_touch(handle, final_name); + if (recycle_touch(handle) == True || recycle_touch_mtime(handle)) + recycle_do_touch(handle, final_name, recycle_touch_mtime(handle)); done: SAFE_FREE(path_name);