Author: jerry
Date: 2006-06-21 13:05:41 +0000 (Wed, 21 Jun 2006)
New Revision: 16438

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16438

Log:
sync up to r16433
Modified:
   branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
   branches/SAMBA_3_0_RELEASE/source/lib/util_unistr.c
   branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_util.c
   branches/SAMBA_3_0_RELEASE/source/param/loadparm.c
   branches/SAMBA_3_0_RELEASE/source/passdb/pdb_ldap.c
   branches/SAMBA_3_0_RELEASE/source/printing/nt_printing.c
   branches/SAMBA_3_0_RELEASE/source/registry/reg_printing.c
   branches/SAMBA_3_0_RELEASE/source/rpc_server/srv_lsa_nt.c
   branches/SAMBA_3_0_RELEASE/source/utils/net_rpc_samsync.c
   branches/SAMBA_3_0_RELEASE/source/web/cgi.c
   branches/SAMBA_3_0_RELEASE/source/web/swat.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
===================================================================
--- branches/SAMBA_3_0_RELEASE/WHATSNEW.txt     2006-06-21 04:59:52 UTC (rev 
16437)
+++ branches/SAMBA_3_0_RELEASE/WHATSNEW.txt     2006-06-21 13:05:41 UTC (rev 
16438)
@@ -68,6 +68,7 @@
 o   Volker Lendecke <[EMAIL PROTECTED]>
     * Fixes for various Klocwork defect reports.
     * Fixes for various Coverity defect reports.
+    * BUG 3848: Fix WinXP join error in a Samba domain using ldapsam.
 
 
 

Modified: branches/SAMBA_3_0_RELEASE/source/lib/util_unistr.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/lib/util_unistr.c 2006-06-21 04:59:52 UTC 
(rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/lib/util_unistr.c 2006-06-21 13:05:41 UTC 
(rev 16438)
@@ -98,8 +98,10 @@
        /* Get the name of the current locale.  */
        old_locale = setlocale(LC_ALL, NULL);
 
-       /* Save it as it is in static storage. */
-       saved_locale = SMB_STRDUP(old_locale);
+       if (old_locale) {
+               /* Save it as it is in static storage. */
+               saved_locale = SMB_STRDUP(old_locale);
+       }
 
        /* We set back the locale to C to get ASCII-compatible toupper/lower 
functions. */
        setlocale(LC_ALL, "C");
@@ -139,8 +141,10 @@
 
 #ifdef HAVE_SETLOCALE
        /* Restore the old locale. */
-       setlocale (LC_ALL, saved_locale);
-       SAFE_FREE(saved_locale);
+       if (saved_locale) {
+               setlocale (LC_ALL, saved_locale);
+               SAFE_FREE(saved_locale);
+       }
 #endif
 }
 

Modified: branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_util.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_util.c  2006-06-21 
04:59:52 UTC (rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/nsswitch/winbindd_util.c  2006-06-21 
13:05:41 UTC (rev 16438)
@@ -976,14 +976,6 @@
        _num_clients--;
 }
 
-/* Demote a client to be the last in the list */
-
-void winbindd_demote_client(struct winbindd_cli_state *cli)
-{
-       struct winbindd_cli_state *tmp;
-       DLIST_DEMOTE(_client_list, cli, tmp);
-}
-
 /* Close all open clients */
 
 void winbindd_kill_all_clients(void)

Modified: branches/SAMBA_3_0_RELEASE/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/param/loadparm.c  2006-06-21 04:59:52 UTC 
(rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/param/loadparm.c  2006-06-21 13:05:41 UTC 
(rev 16438)
@@ -3244,9 +3244,9 @@
  Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
 ***************************************************************************/
 
-static char* append_ldap_suffix( const char *str )
+static const char *append_ldap_suffix( const char *str )
 {
-       char *suffix_string;
+       const char *suffix_string;
 
 
        if (!lp_talloc)
@@ -3255,13 +3255,13 @@
        suffix_string = talloc_asprintf( lp_talloc, "%s,%s", str, 
Globals.szLdapSuffix );
        if ( !suffix_string ) {
                DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
-               return NULL;
+               return "";
        }
 
        return suffix_string;
 }
 
-char *lp_ldap_machine_suffix(void)
+const char *lp_ldap_machine_suffix(void)
 {
        if (Globals.szLdapMachineSuffix[0])
                return append_ldap_suffix(Globals.szLdapMachineSuffix);
@@ -3269,7 +3269,7 @@
        return lp_string(Globals.szLdapSuffix);
 }
 
-char *lp_ldap_user_suffix(void)
+const char *lp_ldap_user_suffix(void)
 {
        if (Globals.szLdapUserSuffix[0])
                return append_ldap_suffix(Globals.szLdapUserSuffix);
@@ -3277,7 +3277,7 @@
        return lp_string(Globals.szLdapSuffix);
 }
 
-char *lp_ldap_group_suffix(void)
+const char *lp_ldap_group_suffix(void)
 {
        if (Globals.szLdapGroupSuffix[0])
                return append_ldap_suffix(Globals.szLdapGroupSuffix);
@@ -3285,7 +3285,7 @@
        return lp_string(Globals.szLdapSuffix);
 }
 
-char *lp_ldap_idmap_suffix(void)
+const char *lp_ldap_idmap_suffix(void)
 {
        if (Globals.szLdapIdmapSuffix[0])
                return append_ldap_suffix(Globals.szLdapIdmapSuffix);

Modified: branches/SAMBA_3_0_RELEASE/source/passdb/pdb_ldap.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/passdb/pdb_ldap.c 2006-06-21 04:59:52 UTC 
(rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/passdb/pdb_ldap.c 2006-06-21 13:05:41 UTC 
(rev 16438)
@@ -1796,6 +1796,19 @@
        ldap_mods_free(mods,True);
        SAFE_FREE(dn);
 
+       /*
+        * We need to set the backend private data to NULL here. For example
+        * setuserinfo level 25 does a pdb_update_sam_account twice on the
+        * same one, and with the explicit delete / add logic for attribute
+        * values the second time we would use the wrong "old" value which
+        * does not exist in LDAP anymore. Thus the LDAP server would refuse
+        * the update.
+        * The existing LDAPMessage is still being auto-freed by the
+        * destructor.
+        */
+       pdb_set_backend_private_data(newpwd, NULL, NULL, my_methods,
+                                    PDB_CHANGED);
+
        if (!NT_STATUS_IS_OK(ret)) {
                return ret;
        }

Modified: branches/SAMBA_3_0_RELEASE/source/printing/nt_printing.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/printing/nt_printing.c    2006-06-21 
04:59:52 UTC (rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/printing/nt_printing.c    2006-06-21 
13:05:41 UTC (rev 16438)
@@ -2767,6 +2767,8 @@
        fstring *subkeys_ptr = NULL;
        fstring subkeyname;
        
+       *subkeys = NULL;
+
        if ( !data )
                return 0;
 

Modified: branches/SAMBA_3_0_RELEASE/source/registry/reg_printing.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/registry/reg_printing.c   2006-06-21 
04:59:52 UTC (rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/registry/reg_printing.c   2006-06-21 
13:05:41 UTC (rev 16438)
@@ -346,8 +346,10 @@
                if ( lookup_printerkey(printer->info_2->data, subkeyname) == -1 
) {
                        DEBUG(5,("key_printers_store_keys: adding key %s\n", 
                                existing_subkeys[i]));
-                       if ( add_new_printer_key( printer->info_2->data, 
subkeyname ) == -1 ) 
+                       if ( add_new_printer_key( printer->info_2->data, 
subkeyname ) == -1 ) {
+                               SAFE_FREE( existing_subkeys );
                                return False;
+                       }
                }
        }
        
@@ -360,6 +362,8 @@
        if ( printer )
                free_a_printer( &printer, 2 );
 
+       SAFE_FREE( existing_subkeys );
+
        return True;
 }
 

Modified: branches/SAMBA_3_0_RELEASE/source/rpc_server/srv_lsa_nt.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/rpc_server/srv_lsa_nt.c   2006-06-21 
04:59:52 UTC (rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/rpc_server/srv_lsa_nt.c   2006-06-21 
13:05:41 UTC (rev 16438)
@@ -1135,7 +1135,7 @@
 
        if ((ref == NULL) || (rids == NULL) || (rids2 == NULL)) {
                r_u->status = NT_STATUS_NO_MEMORY;
-               goto done;
+               return NT_STATUS_NO_MEMORY;
        }
 
        if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) {
@@ -1149,10 +1149,6 @@
                goto done;
        }
 
-       if (!ref || !rids || !rids2) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
        /* set up the LSA Lookup RIDs response */
        become_root(); /* lookup_name can require root privs */
        r_u->status = lookup_lsa_rids(p->mem_ctx, ref, rids, num_entries,

Modified: branches/SAMBA_3_0_RELEASE/source/utils/net_rpc_samsync.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/utils/net_rpc_samsync.c   2006-06-21 
04:59:52 UTC (rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/utils/net_rpc_samsync.c   2006-06-21 
13:05:41 UTC (rev 16438)
@@ -1025,7 +1025,7 @@
 static NTSTATUS populate_ldap_for_ldif(fstring sid, const char *suffix, const 
char 
                       *builtin_sid, FILE *add_fd)
 {
-       char *user_suffix, *group_suffix, *machine_suffix, *idmap_suffix;
+       const char *user_suffix, *group_suffix, *machine_suffix, *idmap_suffix;
        char *user_attr=NULL, *group_attr=NULL;
        char *suffix_attr;
        int len;

Modified: branches/SAMBA_3_0_RELEASE/source/web/cgi.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/web/cgi.c 2006-06-21 04:59:52 UTC (rev 
16437)
+++ branches/SAMBA_3_0_RELEASE/source/web/cgi.c 2006-06-21 13:05:41 UTC (rev 
16438)
@@ -223,6 +223,7 @@
   browser. Also doesn't allow for variables[] containing multiple variables
   with the same name and the same or different values.
   ***************************************************************************/
+
 const char *cgi_variable(const char *name)
 {
        int i;
@@ -234,6 +235,20 @@
 }
 
 /***************************************************************************
+ Version of the above that can't return a NULL pointer.
+***************************************************************************/
+
+const char *cgi_variable_nonull(const char *name)
+{
+       const char *var = cgi_variable(name);
+       if (var) {
+               return var;
+       } else {
+               return "";
+       }
+}
+
+/***************************************************************************
 tell a browser about a fatal error in the http processing
   ***************************************************************************/
 static void cgi_setup_error(const char *err, const char *header, const char 
*info)

Modified: branches/SAMBA_3_0_RELEASE/source/web/swat.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/web/swat.c        2006-06-21 04:59:52 UTC 
(rev 16437)
+++ branches/SAMBA_3_0_RELEASE/source/web/swat.c        2006-06-21 13:05:41 UTC 
(rev 16438)
@@ -515,7 +515,7 @@
 
        while ((parm = lp_next_parameter(snum, &i, 1))) {
                slprintf(label, sizeof(label)-1, "parm_%s", 
make_parm_name(parm->label));
-               if ((v = cgi_variable(label))) {
+               if ((v = cgi_variable(label)) != NULL) {
                        if (parm->flags & FLAG_HIDE) continue;
                        commit_parameter(snum, parm, v); 
                }
@@ -678,10 +678,10 @@
        }
 
        if (cgi_variable("Commit")){
-               SerType = atoi(cgi_variable("ServerType"));
-               winstype = atoi(cgi_variable("WINSType"));
+               SerType = atoi(cgi_variable_nonull("ServerType"));
+               winstype = atoi(cgi_variable_nonull("WINSType"));
                have_home = lp_servicenumber(HOMES_NAME);
-               HomeExpo = atoi(cgi_variable("HomeExpo"));
+               HomeExpo = atoi(cgi_variable_nonull("HomeExpo"));
 
                /* Plain text passwords are too badly broken - use encrypted 
passwords only */
                lp_do_parameter( GLOBAL_SECTION_SNUM, "encrypt passwords", 
"Yes");
@@ -714,7 +714,7 @@
                                break;
                        case 2:
                                lp_do_parameter( GLOBAL_SECTION_SNUM, "wins 
support", "No" );
-                               lp_do_parameter( GLOBAL_SECTION_SNUM, "wins 
server", cgi_variable("WINSAddr"));
+                               lp_do_parameter( GLOBAL_SECTION_SNUM, "wins 
server", cgi_variable_nonull("WINSAddr"));
                                break;
                }
 
@@ -839,7 +839,7 @@
        }
 
        if ( cgi_variable("ViewMode") )
-               mode = atoi(cgi_variable("ViewMode"));
+               mode = atoi(cgi_variable_nonull("ViewMode"));
        if ( cgi_variable("BasicMode"))
                mode = 0;
        if ( cgi_variable("AdvMode"))
@@ -915,7 +915,7 @@
        printf("<table>\n");
 
        if ( cgi_variable("ViewMode") )
-               mode = atoi(cgi_variable("ViewMode"));
+               mode = atoi(cgi_variable_nonull("ViewMode"));
        if ( cgi_variable("BasicMode"))
                mode = 0;
        if ( cgi_variable("AdvMode"))
@@ -1029,7 +1029,7 @@
        int local_flags = 0;
 
        /* Make sure users name has been specified */
-       if (strlen(cgi_variable(SWAT_USER)) == 0) {
+       if (strlen(cgi_variable_nonull(SWAT_USER)) == 0) {
                printf("<p>%s\n", _(" Must specify \"User Name\" "));
                return;
        }
@@ -1044,27 +1044,27 @@
                 * If current user is not root, make sure old password has been 
specified 
                 * If REMOTE change, even root must provide old password 
                 */
-               if (((!am_root()) && (strlen( cgi_variable(OLD_PSWD)) <= 0)) ||
-                   ((cgi_variable(CHG_R_PASSWD_FLAG)) &&  (strlen( 
cgi_variable(OLD_PSWD)) <= 0))) {
+               if (((!am_root()) && (strlen( cgi_variable_nonull(OLD_PSWD)) <= 
0)) ||
+                   ((cgi_variable(CHG_R_PASSWD_FLAG)) &&  (strlen( 
cgi_variable_nonull(OLD_PSWD)) <= 0))) {
                        printf("<p>%s\n", _(" Must specify \"Old Password\" "));
                        return;
                }
 
                /* If changing a users password on a remote hosts we have to 
know what host */
-               if ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( 
cgi_variable(RHOST)) <= 0)) {
+               if ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( 
cgi_variable_nonull(RHOST)) <= 0)) {
                        printf("<p>%s\n", _(" Must specify \"Remote Machine\" 
"));
                        return;
                }
 
                /* Make sure new passwords have been specified */
-               if ((strlen( cgi_variable(NEW_PSWD)) <= 0) ||
-                   (strlen( cgi_variable(NEW2_PSWD)) <= 0)) {
+               if ((strlen( cgi_variable_nonull(NEW_PSWD)) <= 0) ||
+                   (strlen( cgi_variable_nonull(NEW2_PSWD)) <= 0)) {
                        printf("<p>%s\n", _(" Must specify \"New, and Re-typed 
Passwords\" "));
                        return;
                }
 
                /* Make sure new passwords was typed correctly twice */
-               if (strcmp(cgi_variable(NEW_PSWD), cgi_variable(NEW2_PSWD)) != 
0) {
+               if (strcmp(cgi_variable_nonull(NEW_PSWD), 
cgi_variable_nonull(NEW2_PSWD)) != 0) {
                        printf("<p>%s\n", _(" Re-typed password didn't match 
new password "));
                        return;
                }
@@ -1091,17 +1091,17 @@
        
 
        rslt = change_password(host,
-                              cgi_variable(SWAT_USER),
-                              cgi_variable(OLD_PSWD), cgi_variable(NEW_PSWD),
+                              cgi_variable_nonull(SWAT_USER),
+                              cgi_variable_nonull(OLD_PSWD), 
cgi_variable_nonull(NEW_PSWD),
                                   local_flags);
 
        if(cgi_variable(CHG_S_PASSWD_FLAG)) {
                printf("<p>");
                if (rslt == True) {
-                       printf(_(" The passwd for '%s' has been changed."), 
cgi_variable(SWAT_USER));
+                       printf(_(" The passwd for '%s' has been changed."), 
cgi_variable_nonull(SWAT_USER));
                        printf("\n");
                } else {
-                       printf(_(" The passwd for '%s' has NOT been changed."), 
cgi_variable(SWAT_USER));
+                       printf(_(" The passwd for '%s' has NOT been changed."), 
cgi_variable_nonull(SWAT_USER));
                        printf("\n");
                }
        }
@@ -1121,7 +1121,7 @@
         * changed the User box text to another users name, remember it.
         */
        if (cgi_variable(SWAT_USER)) {
-               new_name = cgi_variable(SWAT_USER);
+               new_name = cgi_variable_nonull(SWAT_USER);
        } 
 
        if (!new_name) new_name = "";
@@ -1265,7 +1265,7 @@
        printf("<FORM name=\"swatform\" method=post>\n");
 
        if ( cgi_variable("ViewMode") )
-               mode = atoi(cgi_variable("ViewMode"));
+               mode = atoi(cgi_variable_nonull("ViewMode"));
         if ( cgi_variable("BasicMode"))
                 mode = 0;
         if ( cgi_variable("AdvMode"))

Reply via email to