The branch, v3-2-stable has been updated
       via  aa817cec0648130920daf082626eefb3a14f7440 (commit)
       via  e3c9bdeb737a85f30edb1f1ea592c72e66af69f3 (commit)
       via  bc6a6816ea5332d98b6c49bb8080b9c3524d41a1 (commit)
       via  8a5d0e0989ea0ba40b0d08752248c3d2e4fb061b (commit)
      from  f64d676dd13cf2c84d8e12dd07cad5fd77cc5891 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable


- Log -----------------------------------------------------------------
commit aa817cec0648130920daf082626eefb3a14f7440
Author: Karolin Seeger <[email protected]>
Date:   Mon Mar 30 12:43:17 2009 +0200

    WHATSNEW: Update changes.
    
    Karolin
    (cherry picked from commit e7634cd0c17d0fa4dcca5952313b6af750477dec)

commit e3c9bdeb737a85f30edb1f1ea592c72e66af69f3
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 27 21:26:56 2009 -0700

    Fix the problem of 3.0.x passdb databases being version
    3 but using a different hash calculation than 3.2.x passwd
    databases (also version 3). Introduces a minor version
    number.
    Jeremy.
    (cherry picked from commit 10b518592e616ecfaadd829ecd0674a04510b422)

commit bc6a6816ea5332d98b6c49bb8080b9c3524d41a1
Author: Derrell Lipman <derr...@dworkin.(none)>
Date:   Fri Mar 27 17:10:04 2009 -0400

    [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set 
errno
    
    Fixed.
    
    It turns out there were a number of places where cli_resolve_path() was 
called
    and the error path upon that function failing did not set errno. There were 
a
    couple of places the failure handling code did set errno to ENOENT, so I 
made
    them all consistent, although I think better errno choices for this 
condition
    exist, e.g.  EHOSTUNREACH.
    
    Derrell
    (cherry picked from commit f4e68b09a6ba30d968bccfad8bf6b67b4456b111)

commit 8a5d0e0989ea0ba40b0d08752248c3d2e4fb061b
Author: Jeremy Allison <[email protected]>
Date:   Fri Mar 27 12:09:51 2009 -0700

    Fix bug #6195 - Migrating from 3.0.x to 3.3.x can fail to update passdb.tdb 
correctly. For the clustering case.
    Clustered setups should have only ever used
    the unsigned version of TDB_DATA in the
    first place so they can't be in this mess :-).
    Just do the normal upgrade in the clustered case.
    Jeremy.
    (cherry picked from commit 52fe104996439db24a7e6b17baa7fec47ba230bb)

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

Summary of changes:
 WHATSNEW.txt                |    5 ++++
 source/include/dbwrap.h     |    2 +
 source/lib/dbwrap.c         |   27 ++++++++++++++++++++++
 source/libsmb/libsmb_dir.c  |    8 ++++++-
 source/libsmb/libsmb_file.c |    7 ++++++
 source/libsmb/libsmb_stat.c |    1 +
 source/passdb/pdb_tdb.c     |   51 +++++++++++++++++++++++++++++++++++++-----
 7 files changed, 94 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 7a9b393..6044e1f 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -114,6 +114,11 @@ o   Volker Lendecke <[email protected]>
     * Fix a scary "fill_share_mode_lock failed" message.
 
 
+o   Derrell Lipman <derr...@dworkin.(none)>
+    * BUG 6228: Fix SMBC_open_ctx failure due to path resolve failure doesn't
+      set errno.
+
+
 o   Stefan Metzmacher <[email protected]
     * BUG 6100: Implement _netr_LogonGetCapabilities() with
       NT_STATUS_NOT_IMPLEMENTED.
diff --git a/source/include/dbwrap.h b/source/include/dbwrap.h
index 1f38816..329c191 100644
--- a/source/include/dbwrap.h
+++ b/source/include/dbwrap.h
@@ -49,6 +49,8 @@ struct db_context {
        bool persistent;
 };
 
+bool db_is_local(const char *name);
+
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           const char *name,
                           int hash_size, int tdb_flags,
diff --git a/source/lib/dbwrap.c b/source/lib/dbwrap.c
index 7fe1631..00182aa 100644
--- a/source/lib/dbwrap.c
+++ b/source/lib/dbwrap.c
@@ -42,6 +42,33 @@ static int dbwrap_fallback_fetch(struct db_context *db, 
TALLOC_CTX *mem_ctx,
        return 0;
 }
 
+bool db_is_local(const char *name)
+{
+#ifdef CLUSTER_SUPPORT
+       const char *sockname = lp_ctdbd_socket();
+
+       if(!sockname || !*sockname) {
+               sockname = CTDB_PATH;
+       }
+
+       if (lp_clustering() && socket_exist(sockname)) {
+               const char *partname;
+               /* ctdb only wants the file part of the name */
+               partname = strrchr(name, '/');
+               if (partname) {
+                       partname++;
+               } else {
+                       partname = name;
+               }
+               /* allow ctdb for individual databases to be disabled */
+               if (lp_parm_bool(-1, "ctdb", partname, True)) {
+                       return false;
+               }
+       }
+#endif
+       return true;
+}
+
 /**
  * If you need transaction support use db_open_trans()
  */
diff --git a/source/libsmb/libsmb_dir.c b/source/libsmb/libsmb_dir.c
index b0762e8..8ce660a 100644
--- a/source/libsmb/libsmb_dir.c
+++ b/source/libsmb/libsmb_dir.c
@@ -1168,7 +1168,8 @@ SMBC_mkdir_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
-               TALLOC_FREE(frame);
+                errno = ENOENT;
+                TALLOC_FREE(frame);
                return -1;
        }
        /*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
@@ -1275,6 +1276,7 @@ SMBC_rmdir_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1738,6 +1740,8 @@ SMBC_unlink_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1904,6 +1908,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
        if (!cli_resolve_path(frame, "", srv->cli, path1,
                               &targetcli1, &targetpath1)) {
                d_printf("Could not resolve %s\n", path1);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1912,6 +1917,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
        if (!cli_resolve_path(frame, "", srv->cli, path2,
                               &targetcli2, &targetpath2)) {
                d_printf("Could not resolve %s\n", path2);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
diff --git a/source/libsmb/libsmb_file.c b/source/libsmb/libsmb_file.c
index 27b7e4f..a8c2629 100644
--- a/source/libsmb/libsmb_file.c
+++ b/source/libsmb/libsmb_file.c
@@ -118,6 +118,7 @@ SMBC_open_ctx(SMBCCTX *context,
                if (!cli_resolve_path(frame, "", srv->cli, path,
                                       &targetcli, &targetpath)) {
                        d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
                        SAFE_FREE(file);
                        TALLOC_FREE(frame);
                        return NULL;
@@ -298,6 +299,7 @@ SMBC_read_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", file->srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -387,6 +389,7 @@ SMBC_write_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", file->srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -462,6 +465,7 @@ SMBC_close_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", file->srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -544,6 +548,7 @@ SMBC_getatr(SMBCCTX * context,
        if (!cli_resolve_path(frame, "", srv->cli, fixedpath,
                               &targetcli, &targetpath)) {
                d_printf("Couldn't resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return False;
        }
@@ -756,6 +761,7 @@ SMBC_lseek_ctx(SMBCCTX *context,
                if (!cli_resolve_path(frame, "", file->srv->cli, path,
                                       &targetcli, &targetpath)) {
                        d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
                        TALLOC_FREE(frame);
                        return -1;
                }
@@ -847,6 +853,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", file->srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
diff --git a/source/libsmb/libsmb_stat.c b/source/libsmb/libsmb_stat.c
index 27546f6..2aa4cff 100644
--- a/source/libsmb/libsmb_stat.c
+++ b/source/libsmb/libsmb_stat.c
@@ -260,6 +260,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
        if (!cli_resolve_path(frame, "", file->srv->cli, path,
                               &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index 9928768..f8fd11d 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/passdb/pdb_tdb.c
@@ -4,7 +4,7 @@
  * Copyright (C) Andrew Tridgell   1992-1998
  * Copyright (C) Simo Sorce        2000-2003
  * Copyright (C) Gerald Carter     2000-2006
- * Copyright (C) Jeremy Allison    2001
+ * Copyright (C) Jeremy Allison    2001-2009
  * Copyright (C) Andrew Bartlett   2002
  * Copyright (C) Jim McDonough <[email protected]> 2005
  * 
@@ -38,7 +38,9 @@ static int tdbsam_debug_level = DBGC_ALL;
 #endif
 
 #define TDBSAM_VERSION 3       /* Most recent TDBSAM version */
+#define TDBSAM_MINOR_VERSION   1       /* Most recent TDBSAM minor version */
 #define TDBSAM_VERSION_STRING  "INFO/version"
+#define TDBSAM_MINOR_VERSION_STRING    "INFO/minor_version"
 #define PASSDB_FILE_NAME       "passdb.tdb"
 #define USERPREFIX             "USER_"
 #define USERPREFIX_LEN         5
@@ -921,7 +923,8 @@ static bool tdbsam_convert(struct db_context **pp_db, const 
char *name, int32 fr
        struct db_context *db = NULL;
        int ret;
 
-       if (!tdbsam_convert_backup(name, pp_db)) {
+       /* We only need the update backup for local db's. */
+       if (db_is_local(name) && !tdbsam_convert_backup(name, pp_db)) {
                DEBUG(0, ("tdbsam_convert: Could not backup %s\n", name));
                return false;
        }
@@ -952,6 +955,12 @@ static bool tdbsam_convert(struct db_context **pp_db, 
const char *name, int32 fr
                goto cancel;
        }
 
+       if (dbwrap_store_int32(db, TDBSAM_MINOR_VERSION_STRING,
+                              TDBSAM_MINOR_VERSION) != 0) {
+               DEBUG(0, ("tdbsam_convert: Could not store tdbsam minor 
version\n"));
+               goto cancel;
+       }
+
        if (db->transaction_commit(db) != 0) {
                DEBUG(0, ("tdbsam_convert: Could not commit transaction\n"));
                goto cancel;
@@ -975,6 +984,7 @@ static bool tdbsam_convert(struct db_context **pp_db, const 
char *name, int32 fr
 static bool tdbsam_open( const char *name )
 {
        int32   version;
+       int32   minor_version;
 
        /* check if we are already open */
 
@@ -997,6 +1007,12 @@ static bool tdbsam_open( const char *name )
                version = 0;    /* Version not found, assume version 0 */
        }
 
+       /* Get the minor version */
+       minor_version = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING);
+       if (minor_version == -1) {
+               minor_version = 0; /* Minor version not found, assume 0 */
+       }
+
        /* Compare the version */
        if (version > TDBSAM_VERSION) {
                /* Version more recent than the latest known */
@@ -1005,7 +1021,9 @@ static bool tdbsam_open( const char *name )
                return false;
        }
 
-       if ( version < TDBSAM_VERSION ) {
+       if ( version < TDBSAM_VERSION ||
+                       (version == TDBSAM_VERSION &&
+                        minor_version < TDBSAM_MINOR_VERSION) ) {
                /*
                 * Ok - we think we're going to have to convert.
                 * Due to the backup process we now must do to
@@ -1030,6 +1048,12 @@ static bool tdbsam_open( const char *name )
                        version = 0;    /* Version not found, assume version 0 
*/
                }
 
+               /* Re-check the minor version */
+               minor_version = dbwrap_fetch_int32(db_sam, 
TDBSAM_MINOR_VERSION_STRING);
+               if (minor_version == -1) {
+                       minor_version = 0; /* Minor version not found, assume 0 
*/
+               }
+
                /* Compare the version */
                if (version > TDBSAM_VERSION) {
                        /* Version more recent than the latest known */
@@ -1039,9 +1063,24 @@ static bool tdbsam_open( const char *name )
                        return false;
                }
 
-               if ( version < TDBSAM_VERSION ) {
-                       DEBUG(1, ("tdbsam_open: Converting version %d database 
to "
-                                 "version %d.\n", version, TDBSAM_VERSION));
+               if ( version < TDBSAM_VERSION ||
+                               (version == TDBSAM_VERSION &&
+                                minor_version < TDBSAM_MINOR_VERSION) ) {
+                       /*
+                        * Note that minor versions we read that are greater
+                        * than the current minor version we have hard coded
+                        * are assumed to be compatible if they have the same
+                        * major version. That allows previous versions of the
+                        * passdb code that don't know about minor versions to
+                        * still use this database. JRA.
+                        */
+
+                       DEBUG(1, ("tdbsam_open: Converting version %d.%d 
database to "
+                                 "version %d.%d.\n",
+                                       version,
+                                       minor_version,
+                                       TDBSAM_VERSION,
+                                       TDBSAM_MINOR_VERSION));
 
                        if ( !tdbsam_convert(&db_sam, name, version) ) {
                                DEBUG(0, ("tdbsam_open: Error when trying to 
convert "


-- 
Samba Shared Repository

Reply via email to