mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
nwrap: Add support for getspnam()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
608fa2063a
commit
088887bda9
@ -2569,6 +2569,31 @@ static void nwrap_files_endspent(void)
|
||||
nwrap_sp_global.idx = 0;
|
||||
}
|
||||
|
||||
static struct spwd *nwrap_files_getspnam(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
NWRAP_LOG(NWRAP_LOG_DEBUG, "Lookup user %s in files", name);
|
||||
|
||||
nwrap_files_cache_reload(nwrap_sp_global.cache);
|
||||
|
||||
for (i=0; i<nwrap_sp_global.num; i++) {
|
||||
if (strcmp(nwrap_sp_global.list[i].sp_namp, name) == 0) {
|
||||
NWRAP_LOG(NWRAP_LOG_DEBUG, "user[%s] found", name);
|
||||
return &nwrap_sp_global.list[i];
|
||||
}
|
||||
NWRAP_LOG(NWRAP_LOG_DEBUG,
|
||||
"user[%s] does not match [%s]",
|
||||
name,
|
||||
nwrap_sp_global.list[i].sp_namp);
|
||||
}
|
||||
|
||||
NWRAP_LOG(NWRAP_LOG_DEBUG, "user[%s] not found\n", name);
|
||||
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* misc functions */
|
||||
static int nwrap_files_initgroups(struct nwrap_backend *b,
|
||||
const char *user,
|
||||
@ -4088,6 +4113,20 @@ void endspent(void)
|
||||
nwrap_endspent();
|
||||
}
|
||||
|
||||
static struct spwd *nwrap_getspnam(const char *name)
|
||||
{
|
||||
return nwrap_files_getspnam(name);
|
||||
}
|
||||
|
||||
struct spwd *getspnam(const char *name)
|
||||
{
|
||||
if (!nss_wrapper_shadow_enabled()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return nwrap_getspnam(name);
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* NETDB
|
||||
**********************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user