summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-04-20 10:37:24 +0200
committerMichael Adam <obnox@samba.org>2012-04-20 23:17:36 +0200
commit499e7372bea051fa08c078d02175d6ea1e6ce8f9 (patch)
tree9bef72d318c50c8c14f5493aee483cf4ca10f152 /source3
parentc89affbd8da230cae6df25558fe621510690392c (diff)
downloadsamba-499e7372bea051fa08c078d02175d6ea1e6ce8f9.tar.gz
samba-499e7372bea051fa08c078d02175d6ea1e6ce8f9.tar.bz2
samba-499e7372bea051fa08c078d02175d6ea1e6ce8f9.zip
s3:id_cache: do not use the in-memory idmap cache (it is going to be removed)
This also removes the ID_CACHE_FLUSH message.
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/id_cache.c90
-rw-r--r--source3/librpc/idl/messaging.idl2
-rw-r--r--source3/smbd/server.c13
-rw-r--r--source3/utils/smbcontrol.c9
4 files changed, 4 insertions, 110 deletions
diff --git a/source3/lib/id_cache.c b/source3/lib/id_cache.c
index 23dcce1eb4..e6e345741c 100644
--- a/source3/lib/id_cache.c
+++ b/source3/lib/id_cache.c
@@ -64,58 +64,6 @@ bool id_cache_ref_parse(const char* str, struct id_cache_ref* id)
return false;
}
-static bool delete_uid_cache(uid_t puid)
-{
- DATA_BLOB uid = data_blob_const(&puid, sizeof(puid));
- DATA_BLOB sid;
-
- if (!memcache_lookup(NULL, UID_SID_CACHE, uid, &sid)) {
- DEBUG(3, ("UID %d is not memcached!\n", (int)puid));
- return false;
- }
- DEBUG(3, ("Delete mapping UID %d <-> %s from memcache\n", (int)puid,
- sid_string_dbg((struct dom_sid*)sid.data)));
- memcache_delete(NULL, SID_UID_CACHE, sid);
- memcache_delete(NULL, UID_SID_CACHE, uid);
- return true;
-}
-
-static bool delete_gid_cache(gid_t pgid)
-{
- DATA_BLOB gid = data_blob_const(&pgid, sizeof(pgid));
- DATA_BLOB sid;
- if (!memcache_lookup(NULL, GID_SID_CACHE, gid, &sid)) {
- DEBUG(3, ("GID %d is not memcached!\n", (int)pgid));
- return false;
- }
- DEBUG(3, ("Delete mapping GID %d <-> %s from memcache\n", (int)pgid,
- sid_string_dbg((struct dom_sid*)sid.data)));
- memcache_delete(NULL, SID_GID_CACHE, sid);
- memcache_delete(NULL, GID_SID_CACHE, gid);
- return true;
-}
-
-static bool delete_sid_cache(const struct dom_sid* psid)
-{
- DATA_BLOB sid = data_blob_const(psid, ndr_size_dom_sid(psid, 0));
- DATA_BLOB id;
- if (memcache_lookup(NULL, SID_GID_CACHE, sid, &id)) {
- DEBUG(3, ("Delete mapping %s <-> GID %d from memcache\n",
- sid_string_dbg(psid), *(int*)id.data));
- memcache_delete(NULL, SID_GID_CACHE, sid);
- memcache_delete(NULL, GID_SID_CACHE, id);
- } else if (memcache_lookup(NULL, SID_UID_CACHE, sid, &id)) {
- DEBUG(3, ("Delete mapping %s <-> UID %d from memcache\n",
- sid_string_dbg(psid), *(int*)id.data));
- memcache_delete(NULL, SID_UID_CACHE, sid);
- memcache_delete(NULL, UID_SID_CACHE, id);
- } else {
- DEBUG(3, ("SID %s is not memcached!\n", sid_string_dbg(psid)));
- return false;
- }
- return true;
-}
-
static bool delete_getpwnam_cache(const char *username)
{
DATA_BLOB name = data_blob_string_const_null(username);
@@ -125,32 +73,16 @@ static bool delete_getpwnam_cache(const char *username)
return true;
}
-static void flush_gid_cache(void)
-{
- DEBUG(3, ("Flush GID <-> SID memcache\n"));
- memcache_flush(NULL, SID_GID_CACHE);
- memcache_flush(NULL, GID_SID_CACHE);
-}
-
-static void flush_uid_cache(void)
-{
- DEBUG(3, ("Flush UID <-> SID memcache\n"));
- memcache_flush(NULL, SID_UID_CACHE);
- memcache_flush(NULL, UID_SID_CACHE);
-}
void id_cache_delete_from_cache(const struct id_cache_ref* id)
{
switch(id->type) {
case UID:
- delete_uid_cache(id->id.uid);
idmap_cache_del_uid(id->id.uid);
break;
case GID:
- delete_gid_cache(id->id.gid);
idmap_cache_del_gid(id->id.gid);
break;
case SID:
- delete_sid_cache(&id->id.sid);
idmap_cache_del_sid(&id->id.sid);
break;
case USERNAME:
@@ -160,27 +92,6 @@ void id_cache_delete_from_cache(const struct id_cache_ref* id)
}
}
-
-void id_cache_flush_message(struct messaging_context *msg_ctx,
- void* private_data,
- uint32_t msg_type,
- struct server_id server_id,
- DATA_BLOB* data)
-{
- const char *msg = data ? (const char *)data->data : NULL;
-
- if ((msg == NULL) || (msg[0] == '\0')) {
- flush_gid_cache();
- flush_uid_cache();
- } else if (strncmp(msg, "GID", 3)) {
- flush_gid_cache();
- } else if (strncmp(msg, "UID", 3)) {
- flush_uid_cache();
- } else {
- DEBUG(0, ("Invalid argument: %s\n", msg));
- }
-}
-
void id_cache_delete_message(struct messaging_context *msg_ctx,
void *private_data,
uint32_t msg_type,
@@ -200,6 +111,5 @@ void id_cache_delete_message(struct messaging_context *msg_ctx,
void id_cache_register_msgs(struct messaging_context *ctx)
{
- messaging_register(ctx, NULL, ID_CACHE_FLUSH, id_cache_flush_message);
messaging_register(ctx, NULL, ID_CACHE_DELETE, id_cache_delete_message);
}
diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index 24c280b594..5493d75f65 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -35,7 +35,7 @@ interface messaging
MSG_REQ_DMALLOC_LOG_CHANGED = 0x000C,
MSG_SHUTDOWN = 0x000D,
- ID_CACHE_FLUSH = 0x000E,
+ /* ID_CACHE_FLUSH = 0x000E, obsoleted */
ID_CACHE_DELETE = 0x000F,
ID_CACHE_KILL = 0x0010,
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 912d7a129b..363203e515 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -248,17 +248,6 @@ static void smbd_parent_id_cache_kill(struct messaging_context *msg_ctx,
messaging_send_to_children(msg_ctx, msg_type, data);
}
-static void smbd_parent_id_cache_flush(struct messaging_context *ctx,
- void* data,
- uint32_t msg_type,
- struct server_id srv_id,
- DATA_BLOB* msg_data)
-{
- id_cache_flush_message(ctx, data, msg_type, srv_id, msg_data);
-
- messaging_send_to_children(ctx, msg_type, msg_data);
-}
-
static void smbd_parent_id_cache_delete(struct messaging_context *ctx,
void* data,
uint32_t msg_type,
@@ -912,8 +901,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
smb_parent_force_tdis);
messaging_register(msg_ctx, NULL,
- ID_CACHE_FLUSH, smbd_parent_id_cache_flush);
- messaging_register(msg_ctx, NULL,
ID_CACHE_DELETE, smbd_parent_id_cache_delete);
messaging_register(msg_ctx, NULL,
ID_CACHE_KILL, smbd_parent_id_cache_kill);
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 95c56b03c8..edfe98dbf4 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -181,8 +181,8 @@ static bool do_idmap(struct tevent_context *ev,
{
static const char* usage = "Usage: "
"smbcontrol <dest> idmap <cmd> [arg]\n"
- "\tcmd:\tflush [gid|uid]\n"
- "\t\tdelete \"UID <uid>\"|\"GID <gid>\"|<sid>\n"
+ "\tcmd:"
+ "\tdelete \"UID <uid>\"|\"GID <gid>\"|<sid>\n"
"\t\tkill \"UID <uid>\"|\"GID <gid>\"|<sid>\n";
const char* arg = NULL;
int arglen = 0;
@@ -200,10 +200,7 @@ static bool do_idmap(struct tevent_context *ev,
return false;
}
- if (strcmp(argv[1], "flush") == 0) {
- msg_type = ID_CACHE_FLUSH;
- }
- else if (strcmp(argv[1], "delete") == 0) {
+ if (strcmp(argv[1], "delete") == 0) {
msg_type = ID_CACHE_DELETE;
}
else if (strcmp(argv[1], "kill") == 0) {