port-aix.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. *
  3. * Copyright (c) 2001 Gert Doering. All rights reserved.
  4. * Copyright (c) 2004,2005,2006 Darren Tucker. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  18. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  21. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  22. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifdef _AIX
  27. #ifdef HAVE_SYS_SOCKET_H
  28. # include <sys/socket.h>
  29. #endif
  30. struct ssh;
  31. struct sshbuf;
  32. /* These should be in the system headers but are not. */
  33. int usrinfo(int, char *, int);
  34. #if defined(HAVE_DECL_SETAUTHDB) && (HAVE_DECL_SETAUTHDB == 0)
  35. int setauthdb(const char *, char *);
  36. #endif
  37. /* these may or may not be in the headers depending on the version */
  38. #if defined(HAVE_DECL_AUTHENTICATE) && (HAVE_DECL_AUTHENTICATE == 0)
  39. int authenticate(char *, char *, int *, char **);
  40. #endif
  41. #if defined(HAVE_DECL_LOGINFAILED) && (HAVE_DECL_LOGINFAILED == 0)
  42. int loginfailed(char *, char *, char *);
  43. #endif
  44. #if defined(HAVE_DECL_LOGINRESTRICTIONS) && (HAVE_DECL_LOGINRESTRICTIONS == 0)
  45. int loginrestrictions(char *, int, char *, char **);
  46. #endif
  47. #if defined(HAVE_DECL_LOGINSUCCESS) && (HAVE_DECL_LOGINSUCCESS == 0)
  48. int loginsuccess(char *, char *, char *, char **);
  49. #endif
  50. #if defined(HAVE_DECL_PASSWDEXPIRED) && (HAVE_DECL_PASSWDEXPIRED == 0)
  51. int passwdexpired(char *, char **);
  52. #endif
  53. /* Some versions define r_type in the above headers, which causes a conflict */
  54. #ifdef r_type
  55. # undef r_type
  56. #endif
  57. /* AIX 4.2.x doesn't have nanosleep but does have nsleep which is equivalent */
  58. #if !defined(HAVE_NANOSLEEP) && defined(HAVE_NSLEEP)
  59. # define nanosleep(a,b) nsleep(a,b)
  60. #endif
  61. /* For struct timespec on AIX 4.2.x */
  62. #ifdef HAVE_SYS_TIMERS_H
  63. # include <sys/timers.h>
  64. #endif
  65. /* for setpcred and friends */
  66. #ifdef HAVE_USERSEC_H
  67. # include <usersec.h>
  68. #endif
  69. /*
  70. * According to the setauthdb man page, AIX password registries must be 15
  71. * chars or less plus terminating NUL.
  72. */
  73. #ifdef HAVE_SETAUTHDB
  74. # define REGISTRY_SIZE 16
  75. #endif
  76. void aix_usrinfo(struct passwd *);
  77. #ifdef WITH_AIXAUTHENTICATE
  78. # define CUSTOM_SYS_AUTH_PASSWD 1
  79. # define CUSTOM_SYS_AUTH_ALLOWED_USER 1
  80. int sys_auth_allowed_user(struct passwd *, struct sshbuf *);
  81. # define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
  82. int sys_auth_record_login(const char *, const char *, const char *,
  83. struct sshbuf *);
  84. # define CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG
  85. char *sys_auth_get_lastlogin_msg(const char *, uid_t);
  86. # define CUSTOM_FAILED_LOGIN 1
  87. # if defined(S_AUTHDOMAIN) && defined (S_AUTHNAME)
  88. # define USE_AIX_KRB_NAME
  89. char *aix_krb5_get_principal_name(const char *);
  90. # endif
  91. #endif
  92. void aix_setauthdb(const char *);
  93. void aix_restoreauthdb(void);
  94. void aix_remove_embedded_newlines(char *);
  95. #if defined(AIX_GETNAMEINFO_HACK) && !defined(BROKEN_GETADDRINFO)
  96. # ifdef getnameinfo
  97. # undef getnameinfo
  98. # endif
  99. int sshaix_getnameinfo(const struct sockaddr *, size_t, char *, size_t,
  100. char *, size_t, int);
  101. # define getnameinfo(a,b,c,d,e,f,g) (sshaix_getnameinfo(a,b,c,d,e,f,g))
  102. #endif
  103. /*
  104. * We use getgrset in preference to multiple getgrent calls for efficiency
  105. * plus it supports NIS and LDAP groups.
  106. */
  107. #if !defined(HAVE_GETGROUPLIST) && defined(HAVE_GETGRSET)
  108. # define HAVE_GETGROUPLIST
  109. # define USE_GETGRSET
  110. int getgrouplist(const char *, gid_t, gid_t *, int *);
  111. #endif
  112. #endif /* _AIX */