The branch, v3-2-stable has been updated
       via  3202012836cc25b6981bced9c9fa12458df0de9d (commit)
       via  2ec8e5ed87c826cb5ad6bff03cf1b03eaf57df69 (commit)
      from  7787122c5cc8e05e0479704804eafcae4bdf103d (commit)

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


- Log -----------------------------------------------------------------
commit 3202012836cc25b6981bced9c9fa12458df0de9d
Author: Karolin Seeger <[EMAIL PROTECTED]>
Date:   Wed Sep 17 15:32:51 2008 +0200

    WHATSNEW: Update changes since 3.2.3.
    
    Karolin
    (cherry picked from commit 01fa2fa4b38d90573ada3dd4f9d67b1be52fd83b)

commit 2ec8e5ed87c826cb5ad6bff03cf1b03eaf57df69
Author: Gerald W. Carter <[EMAIL PROTECTED]>
Date:   Mon Sep 15 12:38:36 2008 -0500

    idmap_ad: Fix a segfault when calling nss_get_info() with a NULL ads 
structure.
    (cherry picked from commit 30a660ea41faa3b84afa8819c7673b3fe334e79b)

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

Summary of changes:
 WHATSNEW.txt               |    5 +++
 source/winbindd/idmap_ad.c |   81 +++++++++++++++++++++++++++++++++++++------
 2 files changed, 74 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index d6c5be9..2a211ec 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -3,13 +3,16 @@
                        September 18, 2008
                    ==============================
 
+
 This is a bug fix release of the Samba 3.2 series.
 
 Major bug fixes included in Samba 3.2.4 are:
 
+  o Fix Winbind crashes.
   o Fix changing of machine account passwords.
   o Fix non guest connections to shares when "security = share"
     is used.
+  o Fix file write times.
 
 
 ######################################################################
@@ -46,6 +49,8 @@ o   Jeremy Allison <[EMAIL PROTECTED]>
 
 o   Gerald (Jerry) Carter <[EMAIL PROTECTED]>
     * Fix Winbind crash.
+    * idmap_ad: Fix a segfault when calling nss_get_info() with a NULL ads
+      structure.
 
 
 o   Steven Danneman <[EMAIL PROTECTED]>
diff --git a/source/winbindd/idmap_ad.c b/source/winbindd/idmap_ad.c
index 0d7c068..a2c0dac 100644
--- a/source/winbindd/idmap_ad.c
+++ b/source/winbindd/idmap_ad.c
@@ -748,6 +748,16 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry 
*e,
                                  uint32 *gid )
 {
        ADS_STRUCT *ads_internal = NULL;
+       const char *attrs[] = {NULL, /* attr_homedir */
+                              NULL, /* attr_shell */
+                              NULL, /* attr_gecos */
+                              NULL, /* attr_gidnumber */
+                              NULL };
+       char *filter = NULL;
+       LDAPMessage *msg_internal = NULL;
+       ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+       NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+       char *sidstr = NULL;
 
        /* Only do query if we are online */
        if (idmap_is_offline()) {
@@ -759,22 +769,69 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry 
*e,
 
        ads_internal = ad_idmap_cached_connection();
 
-       if ( !ads_internal || !ad_schema )
+       if ( !ads_internal || !ad_schema ) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       
-       if ( !homedir || !shell || !gecos )
+       }
+
+       if (!sid || !homedir || !shell || !gecos) {
                return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       /* See if we can use the ADS connection struct swe were given */
 
-       *homedir = ads_pull_string( ads, ctx, msg, 
ad_schema->posix_homedir_attr );
-       *shell   = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr 
);
-       *gecos   = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr 
);
-       
-       if ( gid ) {            
-               if ( !ads_pull_uint32(ads, msg, 
ad_schema->posix_gidnumber_attr, gid ) )
-                       *gid = (uint32)-1;              
+       if (ads) {
+               *homedir = ads_pull_string( ads, ctx, msg, 
ad_schema->posix_homedir_attr );
+               *shell   = ads_pull_string( ads, ctx, msg, 
ad_schema->posix_shell_attr );
+               *gecos   = ads_pull_string( ads, ctx, msg, 
ad_schema->posix_gecos_attr );
+
+               if (gid) {
+                       if ( !ads_pull_uint32(ads, msg, 
ad_schema->posix_gidnumber_attr, gid ) )
+                               *gid = (uint32)-1;
+               }
+
+               nt_status = NT_STATUS_OK;
+               goto done;
        }
-               
-       return NT_STATUS_OK;
+
+       /* Have to do our own query */
+
+       attrs[0] = ad_schema->posix_homedir_attr;
+       attrs[1] = ad_schema->posix_shell_attr;
+       attrs[2] = ad_schema->posix_gecos_attr;
+       attrs[3] = ad_schema->posix_gidnumber_attr;
+
+       sidstr = sid_binstring(sid);
+       filter = talloc_asprintf(ctx, "(objectSid=%s)", sidstr);
+       SAFE_FREE(sidstr);
+
+       if (!filter) {
+               nt_status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       ads_status = ads_search_retry(ads_internal, &msg_internal, filter, 
attrs);
+       if (!ADS_ERR_OK(ads_status)) {
+               nt_status = ads_ntstatus(ads_status);
+               goto done;
+       }
+
+       *homedir = ads_pull_string(ads_internal, ctx, msg_internal, 
ad_schema->posix_homedir_attr);
+       *shell   = ads_pull_string(ads_internal, ctx, msg_internal, 
ad_schema->posix_shell_attr);
+       *gecos   = ads_pull_string(ads_internal, ctx, msg_internal, 
ad_schema->posix_gecos_attr);
+
+       if (gid) {
+               if (!ads_pull_uint32(ads_internal, msg_internal, 
ad_schema->posix_gidnumber_attr, gid))
+                       *gid = (uint32)-1;
+       }
+
+       nt_status = NT_STATUS_OK;
+
+done:
+       if (msg_internal) {
+               ads_msgfree(ads_internal, msg_internal);
+       }
+
+       return nt_status;
 }
 
 /************************************************************************


-- 
Samba Shared Repository

Reply via email to