lib: Update nss_wrapper to version 1.1.3
[samba.git] / lib / nss_wrapper / nss_wrapper.c
index c4f1b33e4965250d8d83786a17929f2403d15dd2..82581b17aaf73d868e5d5f62814f9178255fb545 100644 (file)
@@ -154,6 +154,14 @@ typedef nss_status_t NSS_STATUS;
 #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
@@ -1963,6 +1971,28 @@ static bool nwrap_pw_parse_line(struct nwrap_cache *nwrap, char *line)
 
        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) {
@@ -5421,7 +5451,7 @@ static int nwrap_getnameinfo(const struct sockaddr *sa, socklen_t salen,
                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 {
@@ -5439,7 +5469,7 @@ static int nwrap_getnameinfo(const struct sockaddr *sa, socklen_t salen,
                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;