summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_interface.c6
-rw-r--r--source3/passdb/pdb_tdb.c14
2 files changed, 9 insertions, 11 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 82890fee2d..7ff0214c72 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -273,15 +273,15 @@ BOOL pdb_getsampwnam(struct samu *sam_acct, const char *username)
return False;
}
- if (csamuser != NULL) {
+ if ( csamuser ) {
TALLOC_FREE(csamuser);
- csamuser = NULL;
}
pdb_force_pw_initialization( sam_acct );
- if ( (csamuser = samu_new( NULL )) != NULL )
+ if ( (csamuser = samu_new( NULL )) != NULL ) {
pdb_copy_sam_account(csamuser, sam_acct);
+ }
return True;
}
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 0bab02343e..b7161ff589 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -1006,7 +1006,6 @@ static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, struct samu *
static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, struct samu *user, const char *sname)
{
- NTSTATUS result;
TDB_DATA data, key;
fstring keystr;
fstring name;
@@ -1039,8 +1038,8 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, struct samu
DEBUG(5,("pdb_getsampwnam (TDB): error fetching database.\n"));
DEBUGADD(5, (" Error: %s\n", tdb_errorstr(tdbsam)));
DEBUGADD(5, (" Key: %s\n", keystr));
- result = NT_STATUS_NO_SUCH_USER;
- goto done;
+ tdbsam_close();
+ return NT_STATUS_NO_SUCH_USER;
}
/* unpack the buffer */
@@ -1048,17 +1047,16 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, struct samu
if (!init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize)) {
DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
SAFE_FREE(data.dptr);
- result = NT_STATUS_NO_MEMORY;
- goto done;
+ tdbsam_close();
+ return NT_STATUS_NO_MEMORY;
}
- result = NT_STATUS_OK;
+ /* success */
- done:
SAFE_FREE(data.dptr);
tdbsam_close();
- return result;
+ return NT_STATUS_OK;
}
/***************************************************************************