#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) {
if (he != NULL && he->h_name != NULL) {
if (strlen(he->h_name) >= hostlen)
return EAI_OVERFLOW;
- strcpy(host, he->h_name);
+ snprintf(host, hostlen, "%s", he->h_name);
if (flags & NI_NOFQDN)
host[strcspn(host, ".")] = '\0';
} else {
if (service != NULL) {
if (strlen(service->s_name) >= servlen)
return EAI_OVERFLOW;
- strcpy(serv, service->s_name);
+ snprintf(serv, servlen, "%s", service->s_name);
} else {
if (snprintf(serv, servlen, "%u", port) >= (int) servlen)
return EAI_OVERFLOW;