Merge idra's fix for pdb_tdb segfaults from HEAD to 3.0 - sombody changed
authorAndrew Bartlett <abartlet@samba.org>
Wed, 23 Apr 2003 00:56:06 +0000 (00:56 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 23 Apr 2003 00:56:06 +0000 (00:56 +0000)
unix_strlower semantics.

Andrew Bartlett

source/passdb/pdb_tdb.c

index 7e2f4b832f4a6765b31ca2f332530c6786c7b4e9..3a1702a4e07bbc49ddb24a97c3fbdf3e932f02f0 100644 (file)
@@ -585,8 +585,10 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT
                return nt_status;
        }
 
+       
        /* Data is stored in all lower-case */
-       unix_strlower(sname, -1, name, sizeof(name));
+       fstrcpy(name, sname);
+       strlower(name);
 
        /* set search key */
        slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name);
@@ -692,7 +694,8 @@ static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods, SAM_AC
        uint32          rid;
        fstring         name;
        
-       unix_strlower(pdb_get_username(sam_pass), -1, name, sizeof(name));
+       fstrcpy(name, pdb_get_username(sam_pass));
+       strlower(name);
        
        /* open the TDB */
        if (!(pwd_tdb = tdb_open_log(tdb_state->tdbsam_location, 0, TDB_DEFAULT, O_RDWR, 0600))) {
@@ -826,7 +829,8 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, SAM_ACCOUNT* newpwd,
        }
        data.dptr = buf;
 
-       unix_strlower(pdb_get_username(newpwd), -1, name, sizeof(name));
+       fstrcpy(name, pdb_get_username(newpwd));
+       strlower(name);
        
        DEBUG(5, ("Storing %saccount %s with RID %d\n", flag == TDB_INSERT ? "(new) " : "", name, user_rid));