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/lib/sharesec.c | |
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/lib/sharesec.c')
-rw-r--r-- | source3/lib/sharesec.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index 53187c0435..9b3d5607fd 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -139,7 +139,7 @@ static int upgrade_v2_to_v3(struct db_record *rec, void *priv) bool share_info_db_init(void) { const char *vstring = "INFO/version"; - int32 vers_id; + int32 vers_id = 0; bool upgrade_ok = true; NTSTATUS status; @@ -155,7 +155,11 @@ bool share_info_db_init(void) return False; } - vers_id = dbwrap_fetch_int32(share_db, vstring); + status = dbwrap_fetch_int32(share_db, vstring, &vers_id); + if (!NT_STATUS_IS_OK(status)) { + vers_id = 0; + } + if (vers_id == SHARE_DATABASE_VERSION_V3) { return true; } @@ -166,7 +170,11 @@ bool share_info_db_init(void) return false; } - vers_id = dbwrap_fetch_int32(share_db, vstring); + status = dbwrap_fetch_int32(share_db, vstring, &vers_id); + if (!NT_STATUS_IS_OK(status)) { + vers_id = 0; + } + if (vers_id == SHARE_DATABASE_VERSION_V3) { /* * Race condition |