libpamc.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (c) Andrew G. Morgan <morgan@ftp.kernel.org>
  5. *
  6. */
  7. #ifndef LIBPAMC_H
  8. #define LIBPAMC_H
  9. #include "config.h"
  10. #include <security/pam_client.h>
  11. #include <security/_pam_macros.h>
  12. #include <sys/stat.h>
  13. #include <unistd.h>
  14. #include <sys/types.h>
  15. #include <dirent.h>
  16. #include <sys/wait.h>
  17. #include <stdint.h>
  18. #include <stdlib.h>
  19. #include <errno.h>
  20. #include <ctype.h>
  21. #define _PAMC_DEFAULT_TOP_FD 10
  22. struct pamc_handle_s {
  23. struct pamc_agent_s *current;
  24. struct pamc_agent_s *chain;
  25. struct pamc_blocked_s *blocked_agents;
  26. int max_path;
  27. char **agent_paths;
  28. int combined_status;
  29. int highest_fd_to_close;
  30. };
  31. typedef struct pamc_blocked_s {
  32. char *id; /* <NUL> terminated */
  33. struct pamc_blocked_s *next;
  34. } pamc_blocked_t;
  35. typedef struct pamc_agent_s {
  36. char *id;
  37. int id_length;
  38. struct pamc_agent_s *next;
  39. int writer; /* write to agent */
  40. int reader; /* read from agent */
  41. pid_t pid; /* agent process id */
  42. } pamc_agent_t;
  43. /* used to build a tree of unique, sorted agent ids */
  44. typedef struct pamc_id_node {
  45. struct pamc_id_node *left, *right;
  46. int child_count;
  47. char *agent_id;
  48. } pamc_id_node_t;
  49. /* internal function */
  50. int __pamc_valid_agent_id(int id_length, const char *id);
  51. #define PAMC_SYSTEM_AGENT_PATH "/lib/pamc:/usr/lib/pamc"
  52. #define PAMC_SYSTEM_AGENT_SEPARATOR ':'
  53. #endif /* LIBPAMC_H */