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

Adds lastError to rfbClientRec, adds 'error changed' callback #616

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nicmorais
Copy link
Contributor

As requested in #577 (Work in progress)

New rfbClientSetErr() function is only being called in auth.c, when simple password authentication fails.

Calling rfbErr() and rfbClientSetErr() in sequence with the same parameters does not feel good... Not sure what would be the best solution.

Also, do we need some mutex logic when changing cl->lastError?

New rfbClientSetErr() function is only being called in auth.c, when simple password authentication fails.
@nicmorais
Copy link
Contributor Author

nicmorais commented May 12, 2024

How to use it (based on examples/server/simple.c):

#include <rfb/rfb.h>

void clientErrorHandler(rfbClientPtr r) {
    printf("[ERROR] %s\n", r->lastError);
}

int main(int argc,char** argv)
{                                                                
  rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4);
  if(!server)
    return 1;
  server->clientErrorChanged = clientErrorHandler;
  server->frameBuffer=(char*)malloc(400*300*4);
  rfbInitServer(server);           
  rfbRunEventLoop(server,-1,FALSE);
  return(0);
}

Run this server:
./mytestserver -passwd 12345678

And start any VNC client of your preference, but input a wrong password.

Trying to make fuzzing test pass
@RokerHRO
Copy link

return is a statement, not a function. Therefore the returned value does not need (…) around it. ;-)

@nicmorais
Copy link
Contributor Author

@RokerHRO true! I just copied from simple.c and did not notice it ¯_ (ツ)_/¯

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