Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

UserDialog.cxx 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. #include <assert.h>
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include <FL/fl_ask.H>
  22. #include <rfb/util.h>
  23. #include <rfb/Password.h>
  24. #include <rfb/Exception.h>
  25. #include "i18n.h"
  26. #include "parameters.h"
  27. #include "UserDialog.h"
  28. using namespace rfb;
  29. UserDialog::UserDialog()
  30. {
  31. }
  32. UserDialog::~UserDialog()
  33. {
  34. }
  35. void UserDialog::getUserPasswd(char** user, char** password)
  36. {
  37. CharArray passwordFileStr(passwordFile.getData());
  38. assert(password);
  39. if (!user && passwordFileStr.buf[0]) {
  40. ObfuscatedPasswd obfPwd(256);
  41. FILE* fp;
  42. fp = fopen(passwordFileStr.buf, "r");
  43. if (!fp)
  44. throw rfb::Exception(_("Opening password file failed"));
  45. obfPwd.length = fread(obfPwd.buf, 1, obfPwd.length, fp);
  46. fclose(fp);
  47. PlainPasswd passwd(obfPwd);
  48. *password = passwd.takeBuf();
  49. return;
  50. }
  51. if (!user) {
  52. *password = strDup(fl_password(_("VNC authentication"), ""));
  53. if (!*password)
  54. throw rfb::Exception(_("Authentication cancelled"));
  55. return;
  56. }
  57. fl_alert(_("NOT IMPLEMENTED!"));
  58. *user = strDup("");
  59. *password = strDup("");
  60. }
  61. bool UserDialog::showMsgBox(int flags, const char* title, const char* text)
  62. {
  63. fl_message_title(title);
  64. fl_message(text);
  65. return false;
  66. }