diff options
author | Michael Adam <obnox@samba.org> | 2011-10-06 20:34:55 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-10-11 14:17:58 +0200 |
commit | 603c3e1bcb7b4106afe4aefdfed43e7832ede956 (patch) | |
tree | 3bbd74811e5a62786975aada7399931db36d1549 /source3/passdb | |
parent | ce8626cbbe99b26f4e39ace87221792b468b9c93 (diff) | |
download | samba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.tar.gz samba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.tar.bz2 samba-603c3e1bcb7b4106afe4aefdfed43e7832ede956.zip |
s3:dbwrap: convert dbwrap_fetch_int32() to NTSTATUS return code
Return the int32 value retrieved from the db by reference.
Before this, return value "-1" was used as a error indication,
but it could also be a valid value from the database.
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_tdb.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 8a9310cbdb..565dd5d309 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -424,6 +424,7 @@ static bool tdbsam_open( const char *name ) { int32 version; int32 minor_version; + NTSTATUS status; /* check if we are already open */ @@ -441,14 +442,15 @@ static bool tdbsam_open( const char *name ) } /* Check the version */ - version = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING); - if (version == -1) { + status = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING, &version); + if (!NT_STATUS_IS_OK(status)) { version = 0; /* Version not found, assume version 0 */ } /* Get the minor version */ - minor_version = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING); - if (minor_version == -1) { + status = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING, + &minor_version); + if (!NT_STATUS_IS_OK(status)) { minor_version = 0; /* Minor version not found, assume 0 */ } @@ -482,14 +484,16 @@ static bool tdbsam_open( const char *name ) } /* Re-check the version */ - version = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING); - if (version == -1) { + status = dbwrap_fetch_int32(db_sam, TDBSAM_VERSION_STRING, + &version); + if (!NT_STATUS_IS_OK(status)) { version = 0; /* Version not found, assume version 0 */ } /* Re-check the minor version */ - minor_version = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING); - if (minor_version == -1) { + status = dbwrap_fetch_int32(db_sam, TDBSAM_MINOR_VERSION_STRING, + &minor_version); + if (!NT_STATUS_IS_OK(status)) { minor_version = 0; /* Minor version not found, assume 0 */ } |