summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-06-25 19:01:17 +0000
committerJeremy Allison <jra@samba.org>2003-06-25 19:01:17 +0000
commit0118f6b41757897dc087f79da53d3fe2f4f42e7e (patch)
treed8461e275fe5c70e222f4f2cd8936cadd562cf6a /source3
parent72876b79c9b3f0ab3cda6de42d5c8995aadd687e (diff)
downloadsamba-0118f6b41757897dc087f79da53d3fe2f4f42e7e.tar.gz
samba-0118f6b41757897dc087f79da53d3fe2f4f42e7e.tar.bz2
samba-0118f6b41757897dc087f79da53d3fe2f4f42e7e.zip
Ensure idmap backends are added in the correct order (DLIST_ADD puts
things at the *front* of the list). Add more debug. Still broken.. :-(. Jeremy. (This used to be commit dd9251e6f51f229ca1fab23d9b06f5bb68644fab)
Diffstat (limited to 'source3')
-rw-r--r--source3/sam/idmap.c4
-rw-r--r--source3/sam/idmap_tdb.c8
-rw-r--r--source3/sam/idmap_winbind.c22
3 files changed, 26 insertions, 8 deletions
diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c
index d2f68acf60..7b4261169f 100644
--- a/source3/sam/idmap.c
+++ b/source3/sam/idmap.c
@@ -59,7 +59,7 @@ static struct idmap_methods *get_methods(const char *name)
NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods *methods)
{
- struct idmap_function_entry *entry;
+ struct idmap_function_entry *entry, *tmp;
if ((version != SMB_IDMAP_INTERFACE_VERSION)) {
DEBUG(0, ("Failed to register idmap module.\n"
@@ -84,7 +84,7 @@ NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods
entry->name = smb_xstrdup(name);
entry->methods = methods;
- DLIST_ADD(backends, entry);
+ DLIST_ADD_END(backends, entry, tmp);
DEBUG(5, ("Successfully added idmap backend '%s'\n", name));
return NT_STATUS_OK;
}
diff --git a/source3/sam/idmap_tdb.c b/source3/sam/idmap_tdb.c
index f7f9f02003..7fca658792 100644
--- a/source3/sam/idmap_tdb.c
+++ b/source3/sam/idmap_tdb.c
@@ -173,11 +173,15 @@ static NTSTATUS internal_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID
key.dptr = keystr;
key.dsize = strlen(keystr) + 1;
- DEBUG(10,("internal_get_id_from_sid: fetching record %s\n", keystr ));
+ DEBUG(10,("internal_get_id_from_sid: fetching record %s of type 0x%x\n", keystr, type ));
data = tdb_fetch(idmap_tdb, key);
- if (!data.dptr)
+ if (!data.dptr) {
+ DEBUG(10,("internal_get_id_from_sid: record %s not found\n", keystr ));
return ret;
+ } else {
+ DEBUG(10,("internal_get_id_from_sid: record %s -> %s\n", keystr, data.dptr ));
+ }
if (type == ID_EMPTY || type == ID_USERID) {
fstring scanstr;
diff --git a/source3/sam/idmap_winbind.c b/source3/sam/idmap_winbind.c
index d15d8f20a1..6c0d80ab1c 100644
--- a/source3/sam/idmap_winbind.c
+++ b/source3/sam/idmap_winbind.c
@@ -46,10 +46,14 @@ static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
case ID_USERID:
request.data.uid = id.uid;
operation = WINBINDD_UID_TO_SID;
+ DEBUG(10,("db_get_sid_from_id: asking winbindd uid %u -> sid\n",
+ (unsigned int)id.uid ));
break;
case ID_GROUPID:
request.data.gid = id.gid;
operation = WINBINDD_GID_TO_SID;
+ DEBUG(10,("db_get_sid_from_id: asking winbindd gid %u -> sid\n",
+ (unsigned int)id.gid ));
break;
default:
return NT_STATUS_INVALID_PARAMETER;
@@ -58,6 +62,7 @@ static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
/* Make The Request */
result = winbindd_request(operation, &request, &response);
if (result == NSS_STATUS_SUCCESS) {
+ DEBUG(10,("db_get_sid_from_id: winbindd replied ok (%s)\n", response.data.sid.sid ));
if (!string_to_sid(sid, response.data.sid.sid)) {
return NT_STATUS_INVALID_SID;
}
@@ -66,6 +71,8 @@ static NTSTATUS db_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
sid_copy(sid, &global_sid_NULL);
}
+ DEBUG(10,("db_get_sid_from_id: winbindd lookup fail\n"));
+
return NT_STATUS_UNSUCCESSFUL;
}
@@ -86,32 +93,40 @@ static NTSTATUS db_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid)
ZERO_STRUCT(request);
ZERO_STRUCT(response);
+ sid_to_string(sid_str, sid);
+ fstrcpy(request.data.sid, sid_str);
+
switch (*id_type & ID_TYPEMASK) {
case ID_USERID:
operation = WINBINDD_SID_TO_UID;
+ DEBUG(10,("db_get_id_from_sid: asking winbindd %s -> uid\n",
+ sid_str ));
break;
case ID_GROUPID:
operation = WINBINDD_SID_TO_GID;
+ DEBUG(10,("db_get_id_from_sid: asking winbindd %s -> gid\n",
+ sid_str ));
break;
default:
return NT_STATUS_INVALID_PARAMETER;
}
- sid_to_string(sid_str, sid);
- fstrcpy(request.data.sid, sid_str);
-
/* Make The Request */
result = winbindd_request(operation, &request, &response);
if (result == NSS_STATUS_SUCCESS) {
if (operation == WINBINDD_SID_TO_UID) {
(*id).uid = response.data.uid;
+ DEBUG(10,("db_get_id_from_sid: winbindd replied ok (%u)\n", response.data.uid));
} else {
(*id).gid = response.data.gid;
+ DEBUG(10,("db_get_id_from_sid: winbindd replied ok (%u)\n", response.data.gid ));
}
return NT_STATUS_OK;
}
+ DEBUG(10,("db_get_id_from_sid: winbindd lookup fail\n"));
+
return NT_STATUS_UNSUCCESSFUL;
}
@@ -149,4 +164,3 @@ NTSTATUS idmap_winbind_init(void)
{
return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "winbind", &winbind_methods);
}
-