#include "winbind_client.h"
-#if HAVE_PTHREAD_H
+#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
/* The struct passwd for Solaris has some extra fields which must
be initialised or nscd crashes. */
-#if HAVE_PASSWD_PW_COMMENT
+#ifdef HAVE_PASSWD_PW_COMMENT
result->pw_comment = "";
#endif
-#if HAVE_PASSWD_PW_AGE
+#ifdef HAVE_PASSWD_PW_AGE
result->pw_age = "";
#endif
fprintf(stderr, "[%5d]: setpwent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
winbindd_free_response(&getpwent_response);
}
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_SETPWENT, NULL, NULL);
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: setpwent returns %s (%d)\n", getpid(),
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
return ret;
fprintf(stderr, "[%5d]: endpwent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
winbindd_free_response(&getpwent_response);
}
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_ENDPWENT, NULL, NULL);
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: endpwent returns %s (%d)\n", getpid(),
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: getpwent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
request.data.num_entries = MAX_GETPWENT_USERS;
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETPWENT, &request,
&getpwent_response);
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
return ret;
fprintf(stderr, "[%5d]: getpwuid_r %d\n", getpid(), (unsigned int)uid);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
/* Call for the first time */
- ZERO_STRUCT(response);
- ZERO_STRUCT(request);
-
- request.data.uid = uid;
-
+ response = (struct winbindd_response) {
+ .length = 0,
+ };
+ request = (struct winbindd_request) {
+ .wb_flags = WBFLAG_FROM_NSS,
+ .data = {
+ .uid = uid,
+ },
+ };
+
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETPWUID, &request, &response);
if (ret == NSS_STATUS_SUCCESS) {
(unsigned int)uid, nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: getpwnam_r %s\n", getpid(), name);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
/* Call for the first time */
- ZERO_STRUCT(response);
- ZERO_STRUCT(request);
+ response = (struct winbindd_response) {
+ .length = 0,
+ };
+ request = (struct winbindd_request) {
+ .wb_flags = WBFLAG_FROM_NSS,
+ };
strncpy(request.data.username, name,
sizeof(request.data.username) - 1);
request.data.username
[sizeof(request.data.username) - 1] = '\0';
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETPWNAM, &request, &response);
if (ret == NSS_STATUS_SUCCESS) {
name, nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: setgrent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
winbindd_free_response(&getgrent_response);
}
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_SETGRENT, NULL, NULL);
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: setgrent returns %s (%d)\n", getpid(),
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: endgrent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
winbindd_free_response(&getgrent_response);
}
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_ENDGRENT, NULL, NULL);
#ifdef DEBUG_NSS
fprintf(stderr, "[%5d]: endgrent returns %s (%d)\n", getpid(),
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: getgrent\n", getpid());
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
request.data.num_entries = MAX_GETGRENT_USERS;
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, cmd, &request,
&getgrent_response);
nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: getgrnam %s\n", getpid(), name);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
/* Call for the first time */
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ response = (struct winbindd_response) {
+ .length = 0,
+ };
+ request = (struct winbindd_request) {
+ .wb_flags = WBFLAG_FROM_NSS,
+ };
strncpy(request.data.groupname, name,
sizeof(request.data.groupname));
request.data.groupname
[sizeof(request.data.groupname) - 1] = '\0';
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETGRNAM,
&request, &response);
name, nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
fprintf(stderr, "[%5d]: getgrgid %d\n", getpid(), gid);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
/* Call for the first time */
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ response = (struct winbindd_response) {
+ .length = 0,
+ };
+ request = (struct winbindd_request) {
+ .wb_flags = WBFLAG_FROM_NSS,
+ };
+
request.data.gid = gid;
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETGRGID,
&request, &response);
(unsigned int)gid, nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif
return ret;
user, group);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_lock(&winbind_nss_mutex);
#endif
strncpy(request.data.username, user,
sizeof(request.data.username) - 1);
+ winbind_set_client_name("nss_winbind");
ret = winbindd_request_response(NULL, WINBINDD_GETGROUPS,
&request, &response);
user, nss_err_str(ret), ret);
#endif
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&winbind_nss_mutex);
#endif