The branch, master has been updated
       via  be8180e net: Let get*sid return error from passdb init
       via  6e583c7 passdb: Do not panic in initialize_password_db
      from  dabb056 s3-auth_samba4: use new_server_id_task() to allocate server 
id values

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


- Log -----------------------------------------------------------------
commit be8180e030ec922ae75b747c2bf4c5551740c404
Author: Christof Schmitt <christof.schm...@us.ibm.com>
Date:   Tue Apr 24 14:33:46 2012 -0700

    net: Let get*sid return error from passdb init
    
    When initialize_password_db returns an error this means that the SID
    stored in the backend cannot be read. Return this error directly
    instead of creating a random SID through get_global_sam_sid.
    
    Autobuild-User: Volker Lendecke <v...@samba.org>
    Autobuild-Date: Mon Apr 30 13:07:20 CEST 2012 on sn-devel-104

commit 6e583c72cc0c235a997c700342e8dc14cb65ec29
Author: Christof Schmitt <christof.schm...@us.ibm.com>
Date:   Tue Apr 24 14:42:28 2012 -0700

    passdb: Do not panic in initialize_password_db
    
    A call to initialize_password_db leads to smb_panic in case the backend
    returns an error. All callers to initialize_password_db check the return
    value, so this code path should return the status instead of calling
    smb_panic.
    
    Move the call to smb_panic from pdb_get_methods_reload pdb_get_methods
    to get it out of the initialize code path.  This allows printing the
    proper error message for 'net getlocalsid' which is much nicer than
    printing the panic stack trace.

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

Summary of changes:
 source3/passdb/pdb_interface.c |   34 +++++++++++++++++-----------------
 source3/utils/net.c            |   10 ++++------
 2 files changed, 21 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index c5fe56c..e2fc679 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -196,27 +196,13 @@ static struct pdb_methods *pdb_get_methods_reload( bool 
reload )
        if ( pdb && reload ) {
                pdb->free_private_data( &(pdb->private_data) );
                if ( !NT_STATUS_IS_OK( make_pdb_method_name( &pdb, 
lp_passdb_backend() ) ) ) {
-                       char *msg = NULL;
-                       if (asprintf(&msg, "pdb_get_methods_reload: "
-                                       "failed to get pdb methods for backend 
%s\n",
-                                       lp_passdb_backend()) > 0) {
-                               smb_panic(msg);
-                       } else {
-                               smb_panic("pdb_get_methods_reload");
-                       }
+                       return NULL;
                }
        }
 
        if ( !pdb ) {
                if ( !NT_STATUS_IS_OK( make_pdb_method_name( &pdb, 
lp_passdb_backend() ) ) ) {
-                       char *msg = NULL;
-                       if (asprintf(&msg, "pdb_get_methods_reload: "
-                                       "failed to get pdb methods for backend 
%s\n",
-                                       lp_passdb_backend()) > 0) {
-                               smb_panic(msg);
-                       } else {
-                               smb_panic("pdb_get_methods_reload");
-                       }
+                       return NULL;
                }
        }
 
@@ -225,7 +211,21 @@ static struct pdb_methods *pdb_get_methods_reload( bool 
reload )
 
 static struct pdb_methods *pdb_get_methods(void)
 {
-       return pdb_get_methods_reload(False);
+       struct pdb_methods *pdb;
+
+       pdb = pdb_get_methods_reload(false);
+       if (!pdb) {
+               char *msg = NULL;
+               if (asprintf(&msg, "pdb_get_methods: "
+                            "failed to get pdb methods for backend %s\n",
+                            lp_passdb_backend()) > 0) {
+                       smb_panic(msg);
+               } else {
+                       smb_panic("pdb_get_methods");
+               }
+       }
+
+       return pdb;
 }
 
 struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx)
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 70ed0aa..1ce5ee6 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -247,8 +247,8 @@ static int net_getlocalsid(struct net_context *c, int argc, 
const char **argv)
        }
 
        if(!initialize_password_db(false, NULL)) {
-               DEBUG(0, ("WARNING: Could not open passdb - local sid may not 
reflect passdb\n"
-                         "backend knowledge (such as the sid stored in 
LDAP)\n"));
+               d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
+               return 1;
        }
 
        /* first check to see if we can even access secrets, so we don't
@@ -327,10 +327,8 @@ static int net_getdomainsid(struct net_context *c, int 
argc, const char **argv)
        }
 
        if(!initialize_password_db(false, NULL)) {
-               DEBUG(0, ("WARNING: Could not open passdb - domain SID may "
-                         "not reflect passdb\n"
-                         "backend knowledge (such as the SID stored in "
-                         "LDAP)\n"));
+               d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
+               return 1;
        }
 
        /* first check to see if we can even access secrets, so we don't


-- 
Samba Shared Repository

Reply via email to