Rev 601: when we get mappings back from a idmap script. store it into the permanent db in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Mon Jun 18 23:11:04 GMT 2007


------------------------------------------------------------
revno: 601
revision-id: tridge at samba.org-20070618231102-yosa0a9c5s1bna3r
parent: tridge at samba.org-20070617210000-tq41u51ojd7f7erk
committer: Andrew Tridgell <tridge at samba.org>
branch nick: s3-ctdb-tridge
timestamp: Tue 2007-06-19 09:11:02 +1000
message:
  when we get mappings back from a idmap script. store it into the permanent db
modified:
  source/nsswitch/idmap_tdb2.c   idmap_tdb2.c-20070531053925-e5x7av5etjs83rk0-1
=== modified file 'source/nsswitch/idmap_tdb2.c'
--- a/source/nsswitch/idmap_tdb2.c	2007-06-14 21:35:12 +0000
+++ b/source/nsswitch/idmap_tdb2.c	2007-06-18 23:11:02 +0000
@@ -602,6 +602,14 @@
 		DEBUG(10,("Record %s not found\n", keystr));
 		if (idmap_tdb2_state.idmap_script) {
 			ret = idmap_tdb2_script(ctx, map, "IDTOSID %s", keystr);
+			/* store it on shared storage */
+			if (NT_STATUS_IS_OK(ret)) {
+				fstring sidstr;
+				if (sid_to_string(sidstr, map->sid)) {
+					tdb2_store_bystring(keystr, string_term_tdb_data(sidstr), 
+							    TDB_REPLACE);
+				}
+			}
 		} else {
 			ret = NT_STATUS_NONE_MAPPED;
 		}
@@ -649,6 +657,14 @@
 		DEBUG(10,(__location__ " Record %s not found\n", keystr));
 		if (idmap_tdb2_state.idmap_script) {
 			ret = idmap_tdb2_script(ctx, map, "SIDTOID %s", keystr);
+			/* store it on shared storage */
+			if (NT_STATUS_IS_OK(ret)) {
+				fstring idstr;
+				snprintf(idstr, sizeof(idstr), "%cID %lu", 
+					 map->xid.type == ID_TYPE_UID?'U':'G',
+					 (unsigned long)map->xid.id);
+				tdb2_store_bystring(keystr, string_term_tdb_data(idstr), TDB_REPLACE);
+			}
 		} else {
 			ret = NT_STATUS_NONE_MAPPED;
 		}



More information about the samba-cvs mailing list