Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support callback data for fingerprints function. #33

Closed
wants to merge 1 commit into from
Closed

support callback data for fingerprints function. #33

wants to merge 1 commit into from

Conversation

calfeld-zz
Copy link

This change is backwards compatible. It adds two new functions, is_sqli2() and is_string_sqli2() which take a ptr_fingerprints2_fn instead of a ptr_fingerprint_fn and an extra void* callback data argument. ptr_fingerprints2_fn is int ()(const char, void*) and the callback data passed to is_sqli() is then forwarded to the fingerprints function.

This functionality is needed in IronBee to support user defined fingerprint sets. I.e., the callback data will be used to pass in an datastructure to look the fingerprint up in.

This change is backwards compatible.  It adds two new functions, is_sqli2() and is_string_sqli2() which take a ptr_fingerprints2_fn instead of a ptr_fingerprint_fn and an extra void* callback data argument.  ptr_fingerprints2_fn is int (*)(const char*, void*) and the callback data passed to is_sqli() is then forwarded to the fingerprints function.
@client9
Copy link
Owner

client9 commented May 15, 2013

Oh great! the callback arg makes sense... something I should have thought of.

I might make it backwards incompatible, as think I know of the two other "in production" users and can work with them directly.

I'm flying from San Francisco to Tokyo so either i'll get this merged in today... or later on the plane.

thanks again!

@calfeld-zz
Copy link
Author

Sure. Non-backwards compatible makes sense if it doesn't break anyone.

As an aside: We use callback data throughout IronBee, in part to support C++ functionals. There is a generic library (https://github.com/ironbee/ironbee/blob/master/include/ironbeepp/c_trampoline.hpp) that converts a C++ functional into a C function pointer and a void * callback data.

@client9
Copy link
Owner

client9 commented May 15, 2013

Hi,
just pushed a change to allow a callback arg to is_sqli.

ALSO note I change the function name to "libininjection_is_sqli" to help with linker collision, etc.

can you take a look at the .h file and tell me if it meets your requirements?

and thanks again!

@calfeld-zz
Copy link
Author

Looks good.

Thanks!

@calfeld-zz calfeld-zz closed this May 15, 2013
@client9
Copy link
Owner

client9 commented May 15, 2013

one more change!

change filenames to be more legit

sqlparse.h --> libinjection.h
sqlparse.c -> libinjection_sqli.c

I think that's it!

enjoy!

nickg

On 2013/05/15, at 11:00, Christopher Alfeld notifications@github.com wrote:

Looks good.

Thanks!

�$B!=�(B
Reply to this email directly or view it on GitHub.

@client9
Copy link
Owner

client9 commented May 15, 2013

all done with tweaking files.

these

libinjection.h
libinjection_private.h
libinjection_sqli.c
libinjection_sqli_data.h

these are the only files you need to include now.

nickg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants