diff options
author | Andrew Bartlett <abartlet@samba.org> | 2001-09-26 11:36:37 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2001-09-26 11:36:37 +0000 |
commit | f12ebc00a847e5d38e0a591e8958c4e71f2c2842 (patch) | |
tree | f4f02db93fba5090954a19639b9284722af8c49b | |
parent | 9b1c40b7a41a4c70fba1f93d69c17689511bea01 (diff) | |
download | samba-f12ebc00a847e5d38e0a591e8958c4e71f2c2842.tar.gz samba-f12ebc00a847e5d38e0a591e8958c4e71f2c2842.tar.bz2 samba-f12ebc00a847e5d38e0a591e8958c4e71f2c2842.zip |
Fix up TDB_SAM with repect to case sensitvity. (need to use unix_strlower)
Also attempt to make some of the syntax clearer, its confusing enought for the
compiler... (it thinks that there is use of an unitilaised variable)
In fact there is, see next patch...
(This used to be commit 540abc8125f1b821bd362dc0d8c19a107382479f)
-rw-r--r-- | source3/passdb/pdb_tdb.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 700a241be8..8ec0e82c3e 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -502,7 +502,9 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, char *sname) return False; } - fstrcpy (name, sname); + /* Data is stored in all lower-case */ + unix_strlower(sname, -1, name, sizeof(name)); + get_private_directory(tdbfile); pstrcat (tdbfile, PASSDB_FILE_NAME); @@ -648,8 +650,7 @@ BOOL pdb_delete_sam_account(char *sname) uint32 rid; fstring name; - fstrcpy (name, sname); - strlower (name); + unix_strlower(sname, -1, name, sizeof(name)); get_private_directory(tdbfile); pstrcat (tdbfile, PASSDB_FILE_NAME); @@ -756,8 +757,7 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) } data.dptr = buf; - fstrcpy (name, pdb_get_username(newpwd)); - strlower (name); + unix_strlower(pdb_get_username(newpwd), -1, name, sizeof(name)); /* setup the USER index key */ slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name); @@ -771,11 +771,13 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) } /* open the account TDB passwd*/ - if (!(pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR, 0600))) { + pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR, 0600); + if (!pwd_tdb) { DEBUG(0, ("tdb_update_sam: Unable to open TDB passwd!\n")); if (flag == TDB_INSERT) { DEBUG(0, ("Unable to open TDB passwd, trying create new!\n")); - if (!(pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL, 0600))) { + pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL, 0600); + if (!pwd_tdb) { DEBUG(0, ("Unable to create TDB passwd (passdb.tdb) !!!\n")); ret = False; goto done; |