sasl: fix sqlite3 plugin value inserts#753
Open
SyntevoAlex wants to merge 1 commit intocyrusimap:masterfrom
Open
sasl: fix sqlite3 plugin value inserts#753SyntevoAlex wants to merge 1 commit intocyrusimap:masterfrom
SyntevoAlex wants to merge 1 commit intocyrusimap:masterfrom
Conversation
How it was: * When there are no matching records, `SELECT` returned `SQLITE_OK`. * This caused `_sqlite3_exec()` to return 0 (success). * This caused `sql_auxprop_store()` to believe that record exists and `UPDATE` is needed. * `UPDATE` didn't find a matching record to update and returned success. * Plugin believed that it did the work, whereas it did nothing. Now: * `_sqlite3_exec()` returns error when `SELECT` didn't find anything. * This is in line with other SQL implementations, as I understand them. * Also moved string copying into callback. This fixes memory leak when there are multiple values, or when caller didn't give buffer for value. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Contributor
Author
|
Could be related: https://lists.andrew.cmu.edu/pipermail/cyrus-sasl/2020-July/003283.html |
hyc
reviewed
Aug 24, 2023
| } | ||
|
|
||
| /* now get the result set value and value_len */ | ||
| /* we only fetch one because we don't care about the rest */ |
Contributor
There was a problem hiding this comment.
Getting more than one result should be a failure, certainly it is a security vulnerability to have ambiguous credentials. If an attacker can insert their own creds in front of the valid ones, etc...
Contributor
|
@SyntevoAlex: Have you seen the @hyc comment? |
Contributor
Author
|
Sorry, I will no longer work on this PR, because I no longer work with the employer. It can be closed now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consider the following configuration:
sqlite3 database
sqlite.db:saslpasswd.conffileNow, when using
saslpasswd2 -u TestRealm -c TestUserit pretended to succeed, but in fact did nothing.Worse yet, it's not just about
saslpasswd2. In fact, sqlite3 auxprop couldn't insert any new data in the db.Please refer to commit message for the explanation.