#include <pthread.h>
#endif
-#ifdef HAVE_PTHREAD
-static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
/* Maximum number of users to pass back over the unix domain socket
per call. This is not a static limit on the total number of users
or groups returned in total. */
fprintf(stderr, "[%5d]: setpwent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
if (num_pw_cache > 0) {
ndx_pw_cache = num_pw_cache = 0;
winbindd_free_response(&getpwent_response);
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
return ret;
}
fprintf(stderr, "[%5d]: endpwent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
if (num_pw_cache > 0) {
ndx_pw_cache = num_pw_cache = 0;
winbindd_free_response(&getpwent_response);
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: getpwent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* Return an entry from the cache if we have one, or if we are
called again because we exceeded our static buffer. */
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
return ret;
}
fprintf(stderr, "[%5d]: getpwuid_r %d\n", getpid(), (unsigned int)uid);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* If our static buffer needs to be expanded we are called again */
if (!keep_response || uid != response.data.pw.pw_uid) {
(unsigned int)uid, nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: getpwnam_r %s\n", getpid(), name);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* If our static buffer needs to be expanded we are called again */
if (!keep_response || strcmp(name,response.data.pw.pw_name) != 0) {
name, nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: setgrent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
if (num_gr_cache > 0) {
ndx_gr_cache = num_gr_cache = 0;
winbindd_free_response(&getgrent_response);
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: endgrent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
if (num_gr_cache > 0) {
ndx_gr_cache = num_gr_cache = 0;
winbindd_free_response(&getgrent_response);
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: getgrent\n", getpid());
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* Return an entry from the cache if we have one, or if we are
called again because we exceeded our static buffer. */
nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: getgrnam %s\n", getpid(), name);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* If our static buffer needs to be expanded we are called again */
/* Or if the stored response group name differs from the request. */
name, nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}
fprintf(stderr, "[%5d]: getgrgid %d\n", getpid(), gid);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
/* If our static buffer needs to be expanded we are called again */
/* Or if the stored response group name differs from the request. */
(unsigned int)gid, nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
return ret;
}
user, group);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_lock(&winbind_nss_mutex);
-#endif
-
ZERO_STRUCT(request);
ZERO_STRUCT(response);
user, nss_err_str(ret), ret);
#endif
-#ifdef HAVE_PTHREAD
- pthread_mutex_unlock(&winbind_nss_mutex);
-#endif
-
return ret;
}