[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Aug 28 01:50:02 MDT 2012


The branch, master has been updated
       via  9e441c4 s3-classicupgrade: Fix import from ldap
       via  dd21bb0 lib/ldb: Bump ldb version to 1.1.11
       via  dc8d29c s3-vfs: Indicate the symlink destination when failing check_reduced_name
       via  f2ccff7 s3-vfs: Try to be consistent about localtime vs GMT handling in vfs_shadow_copy2
       via  de20958 s3-vfs_shadow_copy2: Also accept a sscanf result
      from  11a5646 VERSION: Move on to beta8

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9e441c4ed98b1a2b83069ad5fa54b2b30dc75598
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Aug 28 11:19:04 2012 +1000

    s3-classicupgrade: Fix import from ldap
    
    We must not reference result before provision(), and do not need
    session_info and lp for reading a normal ldap backend anyway.
    
    Andrew Bartlett
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Aug 28 09:49:39 CEST 2012 on sn-devel-104

commit dd21bb0b728a9c6dfc70f1785a642474fe7bd78b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Aug 28 10:00:34 2012 +1000

    lib/ldb: Bump ldb version to 1.1.11
    
    This will ensure the next Samba release requires an ldb with the recent
    fixes.
    
    Andrew Bartlett

commit dc8d29cdae68e96a3e8a0d647ee952611e69b49e
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jul 3 13:09:33 2012 +1000

    s3-vfs: Indicate the symlink destination when failing check_reduced_name

commit f2ccff7b06a2ad762103f98a736f37da94d7cfdd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jul 2 22:31:49 2012 +1000

    s3-vfs: Try to be consistent about localtime vs GMT handling in vfs_shadow_copy2
    
    With the ability to handle times a abolute time_t values since 1970
    this becomes more important to get absolutly correct.
    
    Andrew Bartlett

commit de209587f9ddbe19d321753bb8f160ce19eb4517
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jul 2 19:31:58 2012 +1000

    s3-vfs_shadow_copy2: Also accept a sscanf result

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb/ABI/{ldb-1.1.10.sigs => ldb-1.1.11.sigs}   |    0
 ...ldb-util-1.1.10.sigs => pyldb-util-1.1.11.sigs} |    0
 lib/ldb/wscript                                    |    2 +-
 source3/modules/vfs_shadow_copy2.c                 |   87 ++++++++++++++------
 source3/smbd/vfs.c                                 |    4 +-
 source4/scripting/python/samba/upgrade.py          |    4 +-
 6 files changed, 66 insertions(+), 31 deletions(-)
 copy lib/ldb/ABI/{ldb-1.1.10.sigs => ldb-1.1.11.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.1.11.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ABI/ldb-1.1.10.sigs b/lib/ldb/ABI/ldb-1.1.11.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-1.1.10.sigs
copy to lib/ldb/ABI/ldb-1.1.11.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-1.1.11.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.1.11.sigs
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 611eebf..3978dd2 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '1.1.10'
+VERSION = '1.1.11'
 
 blddir = 'bin'
 
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index af14e04..7c42052 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -84,6 +84,12 @@
       be compatible with the conversion specifications recognized
       by str[fp]time.  The default value is "@GMT-%Y.%m.%d-%H.%M.%S".
 
+      shadow:sscanf = yes/no (default is no)
+
+      The time is the unsigned long integer (%lu) in the format string
+      rather than a time strptime() can parse.  The result must be a unix time_t
+      time.
+
       shadow:localtime = yes/no (default is no)
 
       This is an optional parameter that indicates whether the
@@ -142,27 +148,45 @@ static char *shadow_copy2_insert_string(TALLOC_CTX *mem_ctx,
 					struct vfs_handle_struct *handle,
 					time_t snapshot)
 {
+	const char *fmt;
 	struct tm snap_tm;
-	fstring gmt;
-	size_t gmt_len;
+	fstring snaptime_string;
+	size_t snaptime_len;
 
-	if (localtime_r(&snapshot, &snap_tm) == 0) {
-		DEBUG(10, ("gmtime_r failed\n"));
-		return NULL;
-	}
-	gmt_len = strftime(gmt, sizeof(gmt),
-			   lp_parm_const_string(SNUM(handle->conn), "shadow",
-						"format", GMT_FORMAT),
-			   &snap_tm);
-	if (gmt_len == 0) {
-		DEBUG(10, ("strftime failed\n"));
-		return NULL;
+	fmt = lp_parm_const_string(SNUM(handle->conn), "shadow",
+				   "format", GMT_FORMAT);
+
+	if (lp_parm_bool(SNUM(handle->conn), "shadow", "sscanf", false)) {
+		snaptime_len = snprintf(snaptime_string, sizeof(snaptime_string), fmt,
+				   (unsigned long)snapshot);
+		if (snaptime_len <= 0) {
+			DEBUG(10, ("snprintf failed\n"));
+			return NULL;
+		}
+	} else {
+		if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime", false)) {
+			if (localtime_r(&snapshot, &snap_tm) == 0) {
+				DEBUG(10, ("gmtime_r failed\n"));
+				return NULL;
+			}
+		} else {
+			if (gmtime_r(&snapshot, &snap_tm) == 0) {
+				DEBUG(10, ("gmtime_r failed\n"));
+				return NULL;
+			}
+		}
+		snaptime_len = strftime(snaptime_string, sizeof(snaptime_string), fmt,
+				   &snap_tm);
+		if (snaptime_len == 0) {
+			DEBUG(10, ("strftime failed\n"));
+			return NULL;
+		}
 	}
 	return talloc_asprintf(mem_ctx, "/%s/%s",
 			       lp_parm_const_string(
 				       SNUM(handle->conn), "shadow", "snapdir",
 				       ".snapshots"),
-			       gmt);
+			       snaptime_string);
 }
 
 static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
@@ -190,7 +214,7 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
 		goto no_snapshot;
 	}
 	tm.tm_isdst = -1;
-	timestamp = mktime(&tm);
+	timestamp = timegm(&tm);
 	if (timestamp == (time_t)-1) {
 		goto no_snapshot;
 	}
@@ -1002,25 +1026,36 @@ static bool shadow_copy2_snapshot_to_gmt(vfs_handle_struct *handle,
 {
 	struct tm timestamp;
 	time_t timestamp_t;
+	unsigned long int timestamp_long;
 	const char *fmt;
 
 	fmt = lp_parm_const_string(SNUM(handle->conn), "shadow",
 				   "format", GMT_FORMAT);
 
 	ZERO_STRUCT(timestamp);
-	if (strptime(name, fmt, &timestamp) == NULL) {
-		DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no match %s: %s\n",
-			   fmt, name));
-		return false;
-	}
-
-	DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name));
-
-	if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime", false)) {
-		timestamp.tm_isdst = -1;
-		timestamp_t = mktime(&timestamp);
+	if (lp_parm_bool(SNUM(handle->conn), "shadow", "sscanf", false)) {
+		if (sscanf(name, fmt, &timestamp_long) != 1) {
+			DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no sscanf match %s: %s\n",
+				   fmt, name));
+			return false;
+		}
+		timestamp_t = timestamp_long;
 		gmtime_r(&timestamp_t, &timestamp);
+	} else {
+		if (strptime(name, fmt, &timestamp) == NULL) {
+			DEBUG(10, ("shadow_copy2_snapshot_to_gmt: no match %s: %s\n",
+				   fmt, name));
+			return false;
+		}
+		DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name));
+		
+		if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime", false)) {
+			timestamp.tm_isdst = -1;
+			timestamp_t = mktime(&timestamp);
+			gmtime_r(&timestamp_t, &timestamp);
+		}
 	}
+
 	strftime(gmt, gmt_len, GMT_FORMAT, &timestamp);
 	return true;
 }
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index d4412a9..0a259cc 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1226,8 +1226,8 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
 			p++;
 			if (strcmp(fname, p)!=0) {
 				DEBUG(2, ("check_reduced_name: Bad access "
-					"attempt: %s is a symlink\n",
-					fname));
+					"attempt: %s is a symlink to %s\n",
+					  fname, p));
 				SAFE_FREE(resolved_name);
 				return NT_STATUS_ACCESS_DENIED;
 			}
diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py
index 19a42c7..d3f0b8d 100644
--- a/source4/scripting/python/samba/upgrade.py
+++ b/source4/scripting/python/samba/upgrade.py
@@ -775,13 +775,13 @@ Please fix this account before attempting to upgrade again
     pgids = {}
     if ldap:
         creds = Credentials()
-        creds.guess(s3param.get_context())
+        creds.guess(samba3.lp)
         creds.set_bind_dn(ldapuser)
         creds.set_password(ldappass)
         urls = samba3.lp.get("passdb backend").split(":",1)[1].strip('"')
         for url in urls.split():
             try:
-                ldb_object = Ldb(url, session_info=system_session(result.lp), credentials=creds, lp=result.lp)
+                ldb_object = Ldb(url, credentials=creds)
             except ldb.LdbError, e:
                 logger.warning("Could not open ldb connection to %s, the error message is: %s", url, e)
             else:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list