mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
* nscd/nscd.h (struct database_dyn): Add propagate field.
* nscd/nscd_conf.c (nscd_parse_file): Parse auto-propagate lines. * nscd/nscd.conf: Add auto-propagate lines. * nscd/connections.c (dbs): Initialize .propagate fields. * nscd/grpcache.c (cache_addgr): Do not add ID entry for name lookups and vice versa if propagation is disabled for the database. * nscd/pwdcache.c (cache_addpw): Likewise.
This commit is contained in:
parent
1f063dcadb
commit
797ed6f7e1
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2006-04-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* nscd/nscd.h (struct database_dyn): Add propagate field.
|
||||||
|
* nscd/nscd_conf.c (nscd_parse_file): Parse auto-propagate lines.
|
||||||
|
* nscd/nscd.conf: Add auto-propagate lines.
|
||||||
|
* nscd/connections.c (dbs): Initialize .propagate fields.
|
||||||
|
* nscd/grpcache.c (cache_addgr): Do not add ID entry for name lookups
|
||||||
|
and vice versa if propagation is disabled for the database.
|
||||||
|
* nscd/pwdcache.c (cache_addpw): Likewise.
|
||||||
|
|
||||||
2006-04-26 James Antill <james.antill@redhat.com>
|
2006-04-26 James Antill <james.antill@redhat.com>
|
||||||
Ulrich Drepper <drepper@redhat.com>
|
Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
|
.propagate = 1,
|
||||||
.shared = 0,
|
.shared = 0,
|
||||||
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
||||||
.filename = "/etc/passwd",
|
.filename = "/etc/passwd",
|
||||||
@ -119,6 +120,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
|
.propagate = 1,
|
||||||
.shared = 0,
|
.shared = 0,
|
||||||
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
||||||
.filename = "/etc/group",
|
.filename = "/etc/group",
|
||||||
@ -135,6 +137,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
|
.propagate = 0, /* Not used. */
|
||||||
.shared = 0,
|
.shared = 0,
|
||||||
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
.max_db_size = DEFAULT_MAX_DB_SIZE,
|
||||||
.filename = "/etc/hosts",
|
.filename = "/etc/hosts",
|
||||||
|
@ -342,10 +342,10 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
marked with FIRST first. Otherwise we end up with
|
marked with FIRST first. Otherwise we end up with
|
||||||
dangling "pointers" in case a latter hash entry cannot be
|
dangling "pointers" in case a latter hash entry cannot be
|
||||||
added. */
|
added. */
|
||||||
bool first = req->type == GETGRBYNAME;
|
bool first = true;
|
||||||
|
|
||||||
/* If the request was by GID, add that entry first. */
|
/* If the request was by GID, add that entry first. */
|
||||||
if (req->type != GETGRBYNAME)
|
if (req->type == GETGRBYGID)
|
||||||
{
|
{
|
||||||
if (cache_add (GETGRBYGID, cp, key_offset, &dataset->head, true,
|
if (cache_add (GETGRBYGID, cp, key_offset, &dataset->head, true,
|
||||||
db, owner) < 0)
|
db, owner) < 0)
|
||||||
@ -355,12 +355,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
dataset->head.usable = false;
|
dataset->head.usable = false;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
/* If the key is different from the name add a separate entry. */
|
/* If the key is different from the name add a separate entry. */
|
||||||
else if (strcmp (key_copy, gr_name) != 0)
|
else if (strcmp (key_copy, gr_name) != 0)
|
||||||
{
|
{
|
||||||
if (cache_add (GETGRBYNAME, key_copy, key_len + 1,
|
if (cache_add (GETGRBYNAME, key_copy, key_len + 1,
|
||||||
&dataset->head, first, db, owner) < 0)
|
&dataset->head, true, db, owner) < 0)
|
||||||
{
|
{
|
||||||
/* Could not allocate memory. Make sure the data gets
|
/* Could not allocate memory. Make sure the data gets
|
||||||
discarded. */
|
discarded. */
|
||||||
@ -372,11 +374,13 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We have to add the value for both, byname and byuid. */
|
/* We have to add the value for both, byname and byuid. */
|
||||||
if (__builtin_expect (cache_add (GETGRBYNAME, gr_name, gr_name_len,
|
if ((req->type == GETGRBYNAME || db->propagate)
|
||||||
&dataset->head, first, db, owner)
|
&& __builtin_expect (cache_add (GETGRBYNAME, gr_name,
|
||||||
== 0, 1))
|
gr_name_len,
|
||||||
|
&dataset->head, first, db, owner)
|
||||||
|
== 0, 1))
|
||||||
{
|
{
|
||||||
if (req->type == GETGRBYNAME)
|
if (req->type == GETGRBYNAME && db->propagate)
|
||||||
(void) cache_add (GETGRBYGID, cp, key_offset, &dataset->head,
|
(void) cache_add (GETGRBYGID, cp, key_offset, &dataset->head,
|
||||||
req->type != GETGRBYNAME, db, owner);
|
req->type != GETGRBYNAME, db, owner);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
# check-files <service> <yes|no>
|
# check-files <service> <yes|no>
|
||||||
# persistent <service> <yes|no>
|
# persistent <service> <yes|no>
|
||||||
# shared <service> <yes|no>
|
# shared <service> <yes|no>
|
||||||
# max-db-szie <service> <number bytes>
|
# max-db-size <service> <number bytes>
|
||||||
|
* auto-propagate <service> <yes|no>
|
||||||
#
|
#
|
||||||
# Currently supported cache names (services): passwd, group, hosts
|
# Currently supported cache names (services): passwd, group, hosts
|
||||||
#
|
#
|
||||||
@ -47,6 +48,7 @@
|
|||||||
persistent passwd yes
|
persistent passwd yes
|
||||||
shared passwd yes
|
shared passwd yes
|
||||||
max-db-size passwd 33554432
|
max-db-size passwd 33554432
|
||||||
|
auto-propagate passwd yes
|
||||||
|
|
||||||
enable-cache group yes
|
enable-cache group yes
|
||||||
positive-time-to-live group 3600
|
positive-time-to-live group 3600
|
||||||
@ -56,6 +58,7 @@
|
|||||||
persistent group yes
|
persistent group yes
|
||||||
shared group yes
|
shared group yes
|
||||||
max-db-size group 33554432
|
max-db-size group 33554432
|
||||||
|
auto-propagate group yes
|
||||||
|
|
||||||
enable-cache hosts yes
|
enable-cache hosts yes
|
||||||
positive-time-to-live hosts 3600
|
positive-time-to-live hosts 3600
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005
|
/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
||||||
@ -63,6 +63,7 @@ struct database_dyn
|
|||||||
int check_file;
|
int check_file;
|
||||||
int persistent;
|
int persistent;
|
||||||
int shared;
|
int shared;
|
||||||
|
int propagate;
|
||||||
size_t max_db_size;
|
size_t max_db_size;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
const char *db_filename;
|
const char *db_filename;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
/* Copyright (c) 1998,2000,2003,2004,2005,2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
|
||||||
|
|
||||||
@ -256,6 +256,17 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb])
|
|||||||
else
|
else
|
||||||
error (0, 0, _("Must specify value for restart-interval option"));
|
error (0, 0, _("Must specify value for restart-interval option"));
|
||||||
}
|
}
|
||||||
|
else if (strcmp (entry, "auto-propagate") == 0)
|
||||||
|
{
|
||||||
|
int idx = find_db (arg1);
|
||||||
|
if (idx >= 0)
|
||||||
|
{
|
||||||
|
if (strcmp (arg2, "no") == 0)
|
||||||
|
dbs[idx].propagate = 0;
|
||||||
|
else if (strcmp (arg2, "yes") == 0)
|
||||||
|
dbs[idx].propagate = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
error (0, 0, _("Unknown option: %s %s %s"), entry, arg1, arg2);
|
error (0, 0, _("Unknown option: %s %s %s"), entry, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
@ -338,10 +338,10 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
marked with FIRST first. Otherwise we end up with
|
marked with FIRST first. Otherwise we end up with
|
||||||
dangling "pointers" in case a latter hash entry cannot be
|
dangling "pointers" in case a latter hash entry cannot be
|
||||||
added. */
|
added. */
|
||||||
bool first = req->type == GETPWBYNAME;
|
bool first = true;
|
||||||
|
|
||||||
/* If the request was by UID, add that entry first. */
|
/* If the request was by UID, add that entry first. */
|
||||||
if (req->type != GETPWBYNAME)
|
if (req->type == GETPWBYUID)
|
||||||
{
|
{
|
||||||
if (cache_add (GETPWBYUID, cp, key_offset, &dataset->head, true,
|
if (cache_add (GETPWBYUID, cp, key_offset, &dataset->head, true,
|
||||||
db, owner) < 0)
|
db, owner) < 0)
|
||||||
@ -351,12 +351,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
dataset->head.usable = false;
|
dataset->head.usable = false;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
/* If the key is different from the name add a separate entry. */
|
/* If the key is different from the name add a separate entry. */
|
||||||
else if (strcmp (key_copy, dataset->strdata) != 0)
|
else if (strcmp (key_copy, dataset->strdata) != 0)
|
||||||
{
|
{
|
||||||
if (cache_add (GETPWBYNAME, key_copy, key_len + 1,
|
if (cache_add (GETPWBYNAME, key_copy, key_len + 1,
|
||||||
&dataset->head, first, db, owner) < 0)
|
&dataset->head, true, db, owner) < 0)
|
||||||
{
|
{
|
||||||
/* Could not allocate memory. Make sure the data gets
|
/* Could not allocate memory. Make sure the data gets
|
||||||
discarded. */
|
discarded. */
|
||||||
@ -368,11 +370,12 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We have to add the value for both, byname and byuid. */
|
/* We have to add the value for both, byname and byuid. */
|
||||||
if (__builtin_expect (cache_add (GETPWBYNAME, dataset->strdata,
|
if ((req->type == GETPWBYNAME || db->propagate)
|
||||||
pw_name_len, &dataset->head, first,
|
&& __builtin_expect (cache_add (GETPWBYNAME, dataset->strdata,
|
||||||
db, owner) == 0, 1))
|
pw_name_len, &dataset->head,
|
||||||
|
first, db, owner) == 0, 1))
|
||||||
{
|
{
|
||||||
if (req->type == GETPWBYNAME)
|
if (req->type == GETPWBYNAME && db->propagate)
|
||||||
(void) cache_add (GETPWBYUID, cp, key_offset, &dataset->head,
|
(void) cache_add (GETPWBYUID, cp, key_offset, &dataset->head,
|
||||||
req->type != GETPWBYNAME, db, owner);
|
req->type != GETPWBYNAME, db, owner);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user