# STRUCT MEMBERS
check_struct_has_member("struct sockaddr" sa_len "sys/socket.h netinet/in.h" HAVE_STRUCT_SOCKADDR_SA_LEN)
+check_struct_has_member("struct passwd" pw_class "pwd.h" HAVE_STRUCT_PASSWD_PW_CLASS)
+check_struct_has_member("struct passwd" pw_change "pwd.h" HAVE_STRUCT_PASSWD_PW_CHANGE)
+check_struct_has_member("struct passwd" pw_expire "pwd.h" HAVE_STRUCT_PASSWD_PW_EXPIRE)
# IPV6
check_c_source_compiles("
#cmakedefine HAVE_LINUX_GETNAMEINFO_UNSIGNED 1
#cmakedefine HAVE_STRUCT_SOCKADDR_SA_LEN 1
+#cmakedefine HAVE_STRUCT_PASSWD_PW_CLASS 1
+#cmakedefine HAVE_STRUCT_PASSWD_PW_CHANGE 1
+#cmakedefine HAVE_STRUCT_PASSWD_PW_EXPIRE 1
+
#cmakedefine HAVE_IPV6 1
#cmakedefine HAVE_ATTRIBUTE_PRINTF_FORMAT 1
#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0)
#endif
+#ifndef discard_const
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
+#endif
+
+#ifndef discard_const_p
+#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#endif
+
#ifdef HAVE_IPV6
#define NWRAP_INET_ADDRSTRLEN INET6_ADDRSTRLEN
#else
NWRAP_LOG(NWRAP_LOG_TRACE, "gid[%u]\n", pw->pw_gid);
+#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
+ pw->pw_class = discard_const_p(char, "");
+
+ NWRAP_LOG(NWRAP_LOG_TRACE, "class[%s]", pw->pw_class);
+#endif /* HAVE_STRUCT_PASSWD_PW_CLASS */
+
+#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
+ pw->pw_change = 0;
+
+ NWRAP_LOG(NWRAP_LOG_TRACE,
+ "change[%lu]",
+ (unsigned long)pw->pw_change);
+#endif /* HAVE_STRUCT_PASSWD_PW_CHANGE */
+
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
+ pw->pw_expire = 0;
+
+ NWRAP_LOG(NWRAP_LOG_TRACE,
+ "expire[%lu]",
+ (unsigned long)pw->pw_expire);
+#endif /* HAVE_STRUCT_PASSWD_PW_EXPIRE */
+
/* gecos */
p = strchr(c, ':');
if (!p) {