The branch, master has been updated via a195562 cpack: Ignore compile_commands.json file via 411e44f gitignore: Ignore all obj directories via f29bece nwrap: Correctly handle realloc() in nwrap_module_init() via f62f26c nwrap: Always fully initialze an nwrap_backend via 6ec14bb nwrap: Rewrite symbol binding for nss modules via 9776c14 nwrap: Add mutex for nss module symbol binding via c007cbd nwrap: Rewrite symbol binding for libc, libnsl and libsocket via b5a67df nwrap: Add mutex for libc symbol binding via bf1b667 tests: Add a basic test to check if the NSS module works from 24c3254 gitlab-ci: Add Ubuntu runner
https://git.samba.org/?p=nss_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a195562409b0f48a558829c50fd32bd94892c2d1 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 2 09:30:42 2020 +0200 cpack: Ignore compile_commands.json file Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit 411e44f3e6188674e92eb2dc36c9fafcecc50257 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 2 09:30:07 2020 +0200 gitignore: Ignore all obj directories Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit f29becec25f22d2eef8e2538a59042af735b315b Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 2 09:51:22 2020 +0200 nwrap: Correctly handle realloc() in nwrap_module_init() Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit f62f26cb960086d3f6445c417f8ccf0fc4520fc3 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 2 09:37:54 2020 +0200 nwrap: Always fully initialze an nwrap_backend Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit 6ec14bb96f0e0447132472910657569f1188149b Author: Andreas Schneider <a...@samba.org> Date: Wed Apr 1 18:32:59 2020 +0200 nwrap: Rewrite symbol binding for nss modules Fixes strict aliasing. Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit 9776c146771d87b18118542422758a1532a953b3 Author: Andreas Schneider <a...@samba.org> Date: Wed Apr 1 18:22:50 2020 +0200 nwrap: Add mutex for nss module symbol binding Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit c007cbdf655f2dfd1914849a8882eb0297b2b120 Author: Andreas Schneider <a...@samba.org> Date: Wed Apr 1 18:32:32 2020 +0200 nwrap: Rewrite symbol binding for libc, libnsl and libsocket This fixes strict aliasing issues which cause segfaults at least on armhfp. Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit b5a67dfa64ebb7733c883b2b0eea18bb557ee1d0 Author: Andreas Schneider <a...@samba.org> Date: Wed Apr 1 18:21:55 2020 +0200 nwrap: Add mutex for libc symbol binding Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> commit bf1b66738387648d633ed96d2a6d94bff184ffe0 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 2 10:41:47 2020 +0200 tests: Add a basic test to check if the NSS module works Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Samuel Cabrero <scabr...@suse.de> ----------------------------------------------------------------------- Summary of changes: .gitignore | 2 +- CPackConfig.cmake | 2 +- src/nss_wrapper.c | 878 +++++++++++++++++++++++++++---------------- tests/CMakeLists.txt | 3 +- tests/nss_nwrap.c | 87 ++++- tests/test_getpwuid_module.c | 36 ++ 6 files changed, 674 insertions(+), 334 deletions(-) create mode 100644 tests/test_getpwuid_module.c Changeset truncated at 500 lines: diff --git a/.gitignore b/.gitignore index 4de573c..fe4bcd8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ *.swp *~$ build -obj +obj*/ cscope.* tags compile_commands.json diff --git a/CPackConfig.cmake b/CPackConfig.cmake index 3a554a9..c4290ab 100644 --- a/CPackConfig.cmake +++ b/CPackConfig.cmake @@ -14,7 +14,7 @@ set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") ### source generator set(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*") +set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*;compile_commands.json") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") if (WIN32) diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c index d90264c..17c8732 100644 --- a/src/nss_wrapper.c +++ b/src/nss_wrapper.c @@ -185,6 +185,8 @@ typedef nss_status_t NSS_STATUS; pthread_mutex_unlock(&( m ## _mutex)); \ } while(0) +static pthread_mutex_t libc_symbol_binding_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t nss_module_symbol_binding_mutex = PTHREAD_MUTEX_INITIALIZER; static bool nwrap_initialized = false; static pthread_mutex_t nwrap_initialized_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -201,6 +203,8 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER; * nwrap_init() function. */ # define NWRAP_LOCK_ALL do { \ + NWRAP_LOCK(libc_symbol_binding); \ + NWRAP_LOCK(nss_module_symbol_binding); \ NWRAP_LOCK(nwrap_initialized); \ NWRAP_LOCK(nwrap_global); \ NWRAP_LOCK(nwrap_gr_global); \ @@ -216,6 +220,8 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER; NWRAP_UNLOCK(nwrap_gr_global); \ NWRAP_UNLOCK(nwrap_global); \ NWRAP_UNLOCK(nwrap_initialized); \ + NWRAP_UNLOCK(nss_module_symbol_binding); \ + NWRAP_UNLOCK(libc_symbol_binding); \ } while (0); static void nwrap_init(void); @@ -311,107 +317,278 @@ static void nwrap_log(enum nwrap_dbglvl_e dbglvl, buffer); } -struct nwrap_libc_fns { - struct passwd *(*_libc_getpwnam)(const char *name); - int (*_libc_getpwnam_r)(const char *name, struct passwd *pwd, - char *buf, size_t buflen, struct passwd **result); - struct passwd *(*_libc_getpwuid)(uid_t uid); - int (*_libc_getpwuid_r)(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result); - void (*_libc_setpwent)(void); - struct passwd *(*_libc_getpwent)(void); +/***************** + * LIBC + *****************/ + +#define LIBC_NAME "libc.so" + +typedef struct passwd *(*__libc_getpwnam)(const char *name); + +typedef int (*__libc_getpwnam_r)(const char *name, + struct passwd *pwd, + char *buf, + size_t buflen, + struct passwd **result); + +typedef struct passwd *(*__libc_getpwuid)(uid_t uid); + +typedef int (*__libc_getpwuid_r)(uid_t uid, + struct passwd *pwd, + char *buf, + size_t buflen, + struct passwd **result); + +typedef void (*__libc_setpwent)(void); + +typedef struct passwd *(*__libc_getpwent)(void); + #ifdef HAVE_GETPWENT_R -# ifdef HAVE_SOLARIS_GETPWENT_R - struct passwd *(*_libc_getpwent_r)(struct passwd *pwbuf, char *buf, size_t buflen); -# else /* HAVE_SOLARIS_GETPWENT_R */ - int (*_libc_getpwent_r)(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp); -# endif /* HAVE_SOLARIS_GETPWENT_R */ +# ifdef HAVE_SOLARIS_GETPWENT_R +typedef struct passwd *(*__libc_getpwent_r)(struct passwd *pwbuf, + char *buf, + size_t buflen); +# else /* HAVE_SOLARIS_GETPWENT_R */ +typedef int (*__libc_getpwent_r)(struct passwd *pwbuf, + char *buf, + size_t buflen, + struct passwd **pwbufp); +# endif /* HAVE_SOLARIS_GETPWENT_R */ #endif /* HAVE_GETPWENT_R */ - void (*_libc_endpwent)(void); - int (*_libc_initgroups)(const char *user, gid_t gid); - struct group *(*_libc_getgrnam)(const char *name); - int (*_libc_getgrnam_r)(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result); - struct group *(*_libc_getgrgid)(gid_t gid); - int (*_libc_getgrgid_r)(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result); - void (*_libc_setgrent)(void); - struct group *(*_libc_getgrent)(void); + +typedef void (*__libc_endpwent)(void); + +typedef int (*__libc_initgroups)(const char *user, gid_t gid); + +typedef struct group *(*__libc_getgrnam)(const char *name); + +typedef int (*__libc_getgrnam_r)(const char *name, + struct group *grp, + char *buf, + size_t buflen, + struct group **result); + +typedef struct group *(*__libc_getgrgid)(gid_t gid); + +typedef int (*__libc_getgrgid_r)(gid_t gid, + struct group *grp, + char *buf, + size_t buflen, + struct group **result); + +typedef void (*__libc_setgrent)(void); + +typedef struct group *(*__libc_getgrent)(void); + #ifdef HAVE_GETGRENT_R -# ifdef HAVE_SOLARIS_GETGRENT_R - struct group *(*_libc_getgrent_r)(struct group *group, char *buf, size_t buflen); -# else /* HAVE_SOLARIS_GETGRENT_R */ - int (*_libc_getgrent_r)(struct group *group, char *buf, size_t buflen, struct group **result); -# endif /* HAVE_SOLARIS_GETGRENT_R */ +# ifdef HAVE_SOLARIS_GETGRENT_R +typedef struct group *(*__libc_getgrent_r)(struct group *group, + char *buf, + size_t buflen); +# else /* HAVE_SOLARIS_GETGRENT_R */ +typedef int (*__libc_getgrent_r)(struct group *group, + char *buf, + size_t buflen, + struct group **result); +# endif /* HAVE_SOLARIS_GETGRENT_R */ #endif /* HAVE_GETGRENT_R */ - void (*_libc_endgrent)(void); - int (*_libc_getgrouplist)(const char *user, gid_t group, gid_t *groups, int *ngroups); - void (*_libc_sethostent)(int stayopen); - struct hostent *(*_libc_gethostent)(void); - void (*_libc_endhostent)(void); +typedef void (*__libc_endgrent)(void); + +typedef int (*__libc_getgrouplist)(const char *user, + gid_t group, + gid_t *groups, + int *ngroups); + +typedef void (*__libc_sethostent)(int stayopen); + +typedef struct hostent *(*__libc_gethostent)(void); + +typedef void (*__libc_endhostent)(void); + +typedef struct hostent *(*__libc_gethostbyname)(const char *name); - struct hostent *(*_libc_gethostbyname)(const char *name); #ifdef HAVE_GETHOSTBYNAME2 /* GNU extension */ - struct hostent *(*_libc_gethostbyname2)(const char *name, int af); +typedef struct hostent *(*__libc_gethostbyname2)(const char *name, int af); #endif + #ifdef HAVE_GETHOSTBYNAME2_R /* GNU extension */ - int (*_libc_gethostbyname2_r)(const char *name, - int af, +typedef int (*__libc_gethostbyname2_r)(const char *name, + int af, + struct hostent *ret, + char *buf, + size_t buflen, + struct hostent **result, + int *h_errnop); +#endif + +typedef struct hostent *(*__libc_gethostbyaddr)(const void *addr, + socklen_t len, + int type); + +typedef int (*__libc_getaddrinfo)(const char *node, + const char *service, + const struct addrinfo *hints, + struct addrinfo **res); +typedef int (*__libc_getnameinfo)(const struct sockaddr *sa, + socklen_t salen, + char *host, + size_t hostlen, + char *serv, + size_t servlen, + int flags); + +typedef int (*__libc_gethostname)(char *name, size_t len); + +#ifdef HAVE_GETHOSTBYNAME_R +typedef int (*__libc_gethostbyname_r)(const char *name, + struct hostent *ret, + char *buf, size_t buflen, + struct hostent **result, int *h_errnop); +#endif + +#ifdef HAVE_GETHOSTBYADDR_R +typedef int (*__libc_gethostbyaddr_r)(const void *addr, + socklen_t len, + int type, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); #endif - struct hostent *(*_libc_gethostbyaddr)(const void *addr, socklen_t len, int type); - - int (*_libc_getaddrinfo)(const char *node, const char *service, - const struct addrinfo *hints, - struct addrinfo **res); - int (*_libc_getnameinfo)(const struct sockaddr *sa, socklen_t salen, - char *host, size_t hostlen, - char *serv, size_t servlen, - int flags); - int (*_libc_gethostname)(char *name, size_t len); + +#define NWRAP_SYMBOL_ENTRY(i) \ + union { \ + __libc_##i f; \ + void *obj; \ + } _libc_##i + +struct nwrap_libc_symbols { + NWRAP_SYMBOL_ENTRY(getpwnam); + NWRAP_SYMBOL_ENTRY(getpwnam_r); + NWRAP_SYMBOL_ENTRY(getpwuid); + NWRAP_SYMBOL_ENTRY(getpwuid_r); + NWRAP_SYMBOL_ENTRY(setpwent); + NWRAP_SYMBOL_ENTRY(getpwent); +#ifdef HAVE_GETPWENT_R + NWRAP_SYMBOL_ENTRY(getpwent_r); +#endif + NWRAP_SYMBOL_ENTRY(endpwent); + + NWRAP_SYMBOL_ENTRY(initgroups); + NWRAP_SYMBOL_ENTRY(getgrnam); + NWRAP_SYMBOL_ENTRY(getgrnam_r); + NWRAP_SYMBOL_ENTRY(getgrgid); + NWRAP_SYMBOL_ENTRY(getgrgid_r); + NWRAP_SYMBOL_ENTRY(setgrent); + NWRAP_SYMBOL_ENTRY(getgrent); +#ifdef HAVE_GETGRENT_R + NWRAP_SYMBOL_ENTRY(getgrent_r); +#endif + NWRAP_SYMBOL_ENTRY(endgrent); + NWRAP_SYMBOL_ENTRY(getgrouplist); + + NWRAP_SYMBOL_ENTRY(sethostent); + NWRAP_SYMBOL_ENTRY(gethostent); + NWRAP_SYMBOL_ENTRY(endhostent); + NWRAP_SYMBOL_ENTRY(gethostbyname); #ifdef HAVE_GETHOSTBYNAME_R - int (*_libc_gethostbyname_r)(const char *name, - struct hostent *ret, - char *buf, size_t buflen, - struct hostent **result, int *h_errnop); + NWRAP_SYMBOL_ENTRY(gethostbyname_r); +#endif +#ifdef HAVE_GETHOSTBYNAME2 + NWRAP_SYMBOL_ENTRY(gethostbyname2); #endif +#ifdef HAVE_GETHOSTBYNAME2_R + NWRAP_SYMBOL_ENTRY(gethostbyname2_r); +#endif + NWRAP_SYMBOL_ENTRY(gethostbyaddr); #ifdef HAVE_GETHOSTBYADDR_R - int (*_libc_gethostbyaddr_r)(const void *addr, socklen_t len, int type, - struct hostent *ret, - char *buf, size_t buflen, - struct hostent **result, int *h_errnop); + NWRAP_SYMBOL_ENTRY(gethostbyaddr_r); #endif + NWRAP_SYMBOL_ENTRY(getaddrinfo); + NWRAP_SYMBOL_ENTRY(getnameinfo); + NWRAP_SYMBOL_ENTRY(gethostname); }; - -struct nwrap_module_nss_fns { - NSS_STATUS (*_nss_getpwnam_r)(const char *name, struct passwd *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_getpwuid_r)(uid_t uid, struct passwd *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_setpwent)(void); - NSS_STATUS (*_nss_getpwent_r)(struct passwd *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_endpwent)(void); - NSS_STATUS (*_nss_initgroups)(const char *user, gid_t group, long int *start, - long int *size, gid_t **groups, long int limit, int *errnop); - NSS_STATUS (*_nss_getgrnam_r)(const char *name, struct group *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_getgrgid_r)(gid_t gid, struct group *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_setgrent)(void); - NSS_STATUS (*_nss_getgrent_r)(struct group *result, char *buffer, - size_t buflen, int *errnop); - NSS_STATUS (*_nss_endgrent)(void); - NSS_STATUS (*_nss_gethostbyaddr_r)(const void *addr, socklen_t addrlen, - int af, struct hostent *result, - char *buffer, size_t buflen, - int *errnop, int *h_errnop); - NSS_STATUS (*_nss_gethostbyname2_r)(const char *name, int af, +#undef NWRAP_SYMBOL_ENTRY + +typedef NSS_STATUS (*__nss_getpwnam_r)(const char *name, + struct passwd *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_getpwuid_r)(uid_t uid, + struct passwd *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_setpwent)(void); +typedef NSS_STATUS (*__nss_getpwent_r)(struct passwd *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_endpwent)(void); +typedef NSS_STATUS (*__nss_initgroups)(const char *user, + gid_t group, + long int *start, + long int *size, + gid_t **groups, + long int limit, + int *errnop); +typedef NSS_STATUS (*__nss_getgrnam_r)(const char *name, + struct group *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_getgrgid_r)(gid_t gid, + struct group *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_setgrent)(void); +typedef NSS_STATUS (*__nss_getgrent_r)(struct group *result, + char *buffer, + size_t buflen, + int *errnop); +typedef NSS_STATUS (*__nss_endgrent)(void); +typedef NSS_STATUS (*__nss_gethostbyaddr_r)(const void *addr, + socklen_t addrlen, + int af, struct hostent *result, - char *buffer, size_t buflen, - int *errnop, int *h_errnop); + char *buffer, + size_t buflen, + int *errnop, + int *h_errnop); +typedef NSS_STATUS (*__nss_gethostbyname2_r)(const char *name, + int af, + struct hostent *result, + char *buffer, + size_t buflen, + int *errnop, + int *h_errnop); + +#define NWRAP_NSS_MODULE_SYMBOL_ENTRY(i) \ + union { \ + __nss_##i f; \ + void *obj; \ + } _nss_##i + +struct nwrap_nss_module_symbols { + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getpwnam_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getpwuid_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(setpwent); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getpwent_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(endpwent); + + NWRAP_NSS_MODULE_SYMBOL_ENTRY(initgroups); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getgrnam_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getgrgid_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(setgrent); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(getgrent_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(endgrent); + + NWRAP_NSS_MODULE_SYMBOL_ENTRY(gethostbyaddr_r); + NWRAP_NSS_MODULE_SYMBOL_ENTRY(gethostbyname2_r); }; struct nwrap_backend { @@ -419,7 +596,7 @@ struct nwrap_backend { const char *so_path; void *so_handle; struct nwrap_ops *ops; - struct nwrap_module_nss_fns *fns; + struct nwrap_nss_module_symbols *symbols; }; struct nwrap_vector; @@ -634,7 +811,7 @@ struct nwrap_libc { void *handle; void *nsl_handle; void *sock_handle; - struct nwrap_libc_fns *fns; + struct nwrap_libc_symbols symbols; }; struct nwrap_main { @@ -1023,7 +1200,7 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib) return handle; } -static void *_nwrap_load_lib_function(enum nwrap_lib lib, const char *fn_name) +static void *_nwrap_bind_symbol(enum nwrap_lib lib, const char *fn_name) { void *handle; void *func; @@ -1046,11 +1223,37 @@ static void *_nwrap_load_lib_function(enum nwrap_lib lib, const char *fn_name) return func; } -#define nwrap_load_lib_function(lib, fn_name) \ - if (nwrap_main_global->libc->fns->_libc_##fn_name == NULL) { \ - *(void **) (&nwrap_main_global->libc->fns->_libc_##fn_name) = \ - _nwrap_load_lib_function(lib, #fn_name); \ - } +#define nwrap_bind_symbol_libc(sym_name) \ + NWRAP_LOCK(libc_symbol_binding); \ + if (nwrap_main_global->libc->symbols._libc_##sym_name.obj == NULL) { \ + nwrap_main_global->libc->symbols._libc_##sym_name.obj = \ + _nwrap_bind_symbol(NWRAP_LIBC, #sym_name); \ + } \ + NWRAP_UNLOCK(libc_symbol_binding) + +#define nwrap_bind_symbol_libc_posix(sym_name) \ + NWRAP_LOCK(libc_symbol_binding); \ + if (nwrap_main_global->libc->symbols._libc_##sym_name.obj == NULL) { \ + nwrap_main_global->libc->symbols._libc_##sym_name.obj = \ + _nwrap_bind_symbol(NWRAP_LIBC, "__posix_" #sym_name); \ + } \ + NWRAP_UNLOCK(libc_symbol_binding) + +#define nwrap_bind_symbol_libnsl(sym_name) \ + NWRAP_LOCK(libc_symbol_binding); \ + if (nwrap_main_global->libc->symbols._libc_##sym_name.obj == NULL) { \ + nwrap_main_global->libc->symbols._libc_##sym_name.obj = \ + _nwrap_bind_symbol(NWRAP_LIBNSL, #sym_name); \ + } \ + NWRAP_UNLOCK(libc_symbol_binding) + +#define nwrap_bind_symbol_libsocket(sym_name) \ + NWRAP_LOCK(libc_symbol_binding); \ + if (nwrap_main_global->libc->symbols._libc_##sym_name.obj == NULL) { \ + nwrap_main_global->libc->symbols._libc_##sym_name.obj = \ + _nwrap_bind_symbol(NWRAP_LIBSOCKET, #sym_name); \ + } \ + NWRAP_UNLOCK(libc_symbol_binding) /* INTERNAL HELPER FUNCTIONS */ static void nwrap_lines_unload(struct nwrap_cache *const nwrap) @@ -1075,9 +1278,9 @@ static void nwrap_lines_unload(struct nwrap_cache *const nwrap) */ static struct passwd *libc_getpwnam(const char *name) { - nwrap_load_lib_function(NWRAP_LIBC, getpwnam); + nwrap_bind_symbol_libc(getpwnam); - return nwrap_main_global->libc->fns->_libc_getpwnam(name); + return nwrap_main_global->libc->symbols._libc_getpwnam.f(name); } #ifdef HAVE_GETPWNAM_R @@ -1088,27 +1291,24 @@ static int libc_getpwnam_r(const char *name, struct passwd **result) -- NSS Wrapper Repository