diff options
author | Simo Sorce <idra@samba.org> | 2001-09-27 02:05:30 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-09-27 02:05:30 +0000 |
commit | 59a02ecae1b0251da5cdd5e34653f7eb14704e72 (patch) | |
tree | a2f5c27411b1d5f19c8c7724181275eb12b5a2d1 /source3/passdb | |
parent | c61d1a167974ffd7788253373ec0920cd802805b (diff) | |
download | samba-59a02ecae1b0251da5cdd5e34653f7eb14704e72.tar.gz samba-59a02ecae1b0251da5cdd5e34653f7eb14704e72.tar.bz2 samba-59a02ecae1b0251da5cdd5e34653f7eb14704e72.zip |
minor fixes
(This used to be commit 57e639bbdd115b51362caf7e3db4ba34ccdeddc2)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_tdb.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 6702926355..990d0077b2 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -384,12 +384,10 @@ BOOL pdb_setsampwent(BOOL update) pstrcat (tdbfile, PASSDB_FILE_NAME); /* Open tdb passwd */ - if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, update ? O_RDWR : O_RDONLY, 0600))) { - DEBUG(0, ("Unable to open TDB passwd, trying create new!\n")); - if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT | O_EXCL, 0600))) { - DEBUG(0, ("Unable to create TDB passwd (passdb.tdb) !!!")); - return False; - } + if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, update?(O_RDWR|O_CREAT):O_RDONLY, 0600))) + { + DEBUG(0, ("Unable to open/create TDB passwd\n")); + return False; } global_tdb_ent.key = tdb_firstkey(global_tdb_ent.passwd_tdb); @@ -771,19 +769,11 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) } /* open the account TDB passwd*/ - pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR, 0600); - if (!pwd_tdb) { + pwd_tdb = tdb_open_log(tdbfile, 0, TDB_DEFAULT, O_RDWR | O_CREAT, 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")); - 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 reallydone; - } - newtdb = True; - } + return False; } /* add the account */ @@ -813,13 +803,11 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) } done: - /* cleanup */ tdb_close (pwd_tdb); - -reallydone: SAFE_FREE(buf); - return (ret); + + return (ret); } /*************************************************************************** |