You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UnixPasswordValidator.cxx 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2006 Martin Koegler
  3. * Copyright (C) 2010 TigerVNC Team
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  18. * USA.
  19. */
  20. #ifdef HAVE_CONFIG_H
  21. #include <config.h>
  22. #endif
  23. #include <rfb/Configuration.h>
  24. #include <rfb/Exception.h>
  25. #include <rfb/UnixPasswordValidator.h>
  26. #include <rfb/pam.h>
  27. using namespace rfb;
  28. static StringParameter pamService
  29. ("PAMService", "Service name for PAM password validation", "vnc");
  30. AliasParameter pam_service("pam_service", "Alias for PAMService",
  31. &pamService);
  32. int do_pam_auth(const char *service, const char *username,
  33. const char *password);
  34. bool UnixPasswordValidator::validateInternal(SConnection * /*sc*/,
  35. const char *username,
  36. const char *password)
  37. {
  38. CharArray service(strDup(pamService.getData()));
  39. return do_pam_auth(service.buf, username, password);
  40. }