summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-09-26 11:36:37 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-09-26 11:36:37 +0000
commit540abc8125f1b821bd362dc0d8c19a107382479f (patch)
treeff97d5577c860491dbf39de2ff910b3fd1205b69
parentf0f315f31533bb5dc47d27cd6823ad0b146f1ff9 (diff)
downloadsamba-540abc8125f1b821bd362dc0d8c19a107382479f.tar.gz
samba-540abc8125f1b821bd362dc0d8c19a107382479f.tar.xz
samba-540abc8125f1b821bd362dc0d8c19a107382479f.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...
-rw-r--r--source/passdb/pdb_tdb.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index 700a241be87..8ec0e82c3ef 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/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;