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

Segmentaion error when entering wrong credentials or server is down #1

Closed
nourmat opened this issue May 19, 2020 · 4 comments
Closed

Comments

@nourmat
Copy link

nourmat commented May 19, 2020

From what I understand "etesync_set_auth_token" opens the session for the API to a specific user (as token is calculated using username and password), if the server is down or the url is wrong or the token was calculated wrong (wrong credentials) it gives Segmentaion error and it shouldn't segfault.

I reproduce this just by running the example.c with wrong password and another time with server down and once with wrong url

@tasn
Copy link
Member

tasn commented Jun 7, 2020

Just documenting my thoughts: we'll probably add an errno-like solution for error reporting since all of our APIs should return a value that can be checked for errors.
In the meanwhile, just make sure your code doesn't error. :P

@tasn
Copy link
Member

tasn commented Jun 9, 2020

I can't reproduce it. It doesn't segfault here. I added more tests to verify, but things seem fine.

Edit: I just realise what your problem may be though. The API returns NULL on error, you should check the return value to see if NULL or not before using it. NULL means error.

tasn added a commit that referenced this issue Jun 9, 2020
This is testing what's reported in #1.
@nourmat
Copy link
Author

nourmat commented Jun 9, 2020

Hey, tasn. you're right I wasn't checking if token returned null or not, this was a problem.
And as for the encryption_password I need to check if keypair also returned null or not.
Guess that solved the problem :D
Thank you and sorry for the inconvenience.
should I close the issue now? :/

@tasn
Copy link
Member

tasn commented Jun 9, 2020

Closed in favour of #4, as there's still something that needs fixing (getting the error information), but this ticket is invalid.

@tasn tasn closed this as completed Jun 9, 2020
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

No branches or pull requests

2 participants