Added
Link Here
|
1 |
--- libnss_cache_oslogin/nss_cache_oslogin.c.orig 2018-06-11 17:16:50 UTC |
2 |
+++ libnss_cache_oslogin/nss_cache_oslogin.c |
3 |
@@ -16,6 +16,7 @@ |
4 |
|
5 |
#include "nss_cache_oslogin.h" |
6 |
|
7 |
+#include <nsswitch.h> |
8 |
#include <sys/mman.h> |
9 |
|
10 |
// Locking implementation: use pthreads. |
11 |
@@ -32,7 +33,7 @@ static pthread_mutex_t mutex = PTHREAD_M |
12 |
|
13 |
static FILE *p_file = NULL; |
14 |
static char p_filename[NSS_CACHE_OSLOGIN_PATH_LENGTH] = |
15 |
- "/etc/oslogin_passwd.cache"; |
16 |
+ "/usr/local/etc/oslogin_passwd.cache"; |
17 |
#ifdef BSD |
18 |
extern int fgetpwent_r(FILE *, struct passwd *, char *, size_t, |
19 |
struct passwd **); |
20 |
@@ -435,3 +436,26 @@ enum nss_status _nss_cache_oslogin_getpw |
21 |
|
22 |
return ret; |
23 |
} |
24 |
+ |
25 |
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwnam_r); |
26 |
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwuid_r); |
27 |
+NSS_METHOD_PROTOTYPE(__nss_compat_getpwent_r); |
28 |
+NSS_METHOD_PROTOTYPE(__nss_compat_setpwent); |
29 |
+NSS_METHOD_PROTOTYPE(__nss_compat_endpwent); |
30 |
+ |
31 |
+static ns_mtab methods[] = { |
32 |
+ { NSDB_PASSWD, "getpwnam_r", __nss_compat_getpwnam_r, (void*)_nss_cache_oslogin_getpwnam_r }, |
33 |
+ { NSDB_PASSWD, "getpwuid_r", __nss_compat_getpwuid_r, (void*)_nss_cache_oslogin_getpwuid_r }, |
34 |
+ { NSDB_PASSWD, "getpwent_r", __nss_compat_getpwent_r, (void*)_nss_cache_oslogin_getpwent_r }, |
35 |
+ { NSDB_PASSWD, "endpwent", __nss_compat_endpwent, (void*)_nss_cache_oslogin_endpwent }, |
36 |
+ { NSDB_PASSWD, "setpwent", __nss_compat_setpwent, (void*)_nss_cache_oslogin_setpwent }, |
37 |
+}; |
38 |
+ |
39 |
+ns_mtab * |
40 |
+nss_module_register (const char *name, unsigned int *size, |
41 |
+ nss_module_unregister_fn *unregister) |
42 |
+{ |
43 |
+ *size = sizeof (methods) / sizeof (methods[0]); |
44 |
+ *unregister = NULL; |
45 |
+ return (methods); |
46 |
+} |