Changeset 222 for branches/samba-3.3.x/source/winbindd/idmap_util.c
- Timestamp:
- May 24, 2009, 7:45:16 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/winbindd/idmap_util.c
r206 r222 19 19 20 20 #include "includes.h" 21 #include "winbindd.h" 22 #include "winbindd_proto.h" 21 23 22 24 #undef DBGC_CLASS … … 37 39 (unsigned long)uid, domname?domname:"NULL")); 38 40 39 if (idmap_cache_find_uid2sid(uid, sid, &expired)) { 41 if (winbindd_use_idmap_cache() 42 && idmap_cache_find_uid2sid(uid, sid, &expired)) { 40 43 DEBUG(10, ("idmap_cache_find_uid2sid found %d%s\n", uid, 41 44 expired ? " (expired)": "")); … … 64 67 65 68 if (map.status != ID_MAPPED) { 66 struct dom_sid null_sid; 67 ZERO_STRUCT(null_sid); 68 idmap_cache_set_sid2uid(&null_sid, uid); 69 if (winbindd_use_idmap_cache()) { 70 struct dom_sid null_sid; 71 ZERO_STRUCT(null_sid); 72 idmap_cache_set_sid2uid(&null_sid, uid); 73 } 69 74 DEBUG(10, ("uid [%lu] not mapped\n", (unsigned long)uid)); 70 75 return NT_STATUS_NONE_MAPPED; 71 76 } 72 77 73 idmap_cache_set_sid2uid(sid, uid); 78 if (winbindd_use_idmap_cache()) { 79 idmap_cache_set_sid2uid(sid, uid); 80 } 74 81 75 82 return NT_STATUS_OK; … … 90 97 (unsigned long)gid, domname?domname:"NULL")); 91 98 92 if (idmap_cache_find_gid2sid(gid, sid, &expired)) { 99 if (winbindd_use_idmap_cache() 100 && idmap_cache_find_gid2sid(gid, sid, &expired)) { 93 101 DEBUG(10, ("idmap_cache_find_gid2sid found %d%s\n", gid, 94 102 expired ? " (expired)": "")); … … 117 125 118 126 if (map.status != ID_MAPPED) { 119 struct dom_sid null_sid; 120 ZERO_STRUCT(null_sid); 121 idmap_cache_set_sid2uid(&null_sid, gid); 127 if (winbindd_use_idmap_cache()) { 128 struct dom_sid null_sid; 129 ZERO_STRUCT(null_sid); 130 idmap_cache_set_sid2uid(&null_sid, gid); 131 } 122 132 DEBUG(10, ("gid [%lu] not mapped\n", (unsigned long)gid)); 123 133 return NT_STATUS_NONE_MAPPED; 124 134 } 125 135 126 idmap_cache_set_sid2gid(sid, gid); 136 if (winbindd_use_idmap_cache()) { 137 idmap_cache_set_sid2gid(sid, gid); 138 } 127 139 128 140 return NT_STATUS_OK; … … 143 155 sid_string_dbg(sid), dom_name)); 144 156 145 if (idmap_cache_find_sid2uid(sid, uid, &expired)) { 157 if (winbindd_use_idmap_cache() 158 && idmap_cache_find_sid2uid(sid, uid, &expired)) { 146 159 DEBUG(10, ("idmap_cache_find_sid2uid found %d%s\n", 147 160 (int)(*uid), expired ? " (expired)": "")); … … 172 185 map.xid.type, 173 186 map.xid.id)); 174 idmap_cache_set_sid2uid(sid, -1); 187 if (winbindd_use_idmap_cache()) { 188 idmap_cache_set_sid2uid(sid, -1); 189 } 175 190 return NT_STATUS_NONE_MAPPED; 176 191 } … … 183 198 * could not answer our request. Fail. 184 199 */ 185 idmap_cache_set_sid2uid(sid, -1); 200 if (winbindd_use_idmap_cache()) { 201 idmap_cache_set_sid2uid(sid, -1); 202 } 186 203 return NT_STATUS_NONE_MAPPED; 187 204 } … … 192 209 DEBUG(10, ("idmap_new_mapping failed: %s\n", 193 210 nt_errstr(ret))); 194 idmap_cache_set_sid2uid(sid, -1); 211 if (winbindd_use_idmap_cache()) { 212 idmap_cache_set_sid2uid(sid, -1); 213 } 195 214 return ret; 196 215 } … … 198 217 done: 199 218 *uid = (uid_t)map.xid.id; 200 idmap_cache_set_sid2uid(sid, *uid); 219 if (winbindd_use_idmap_cache()) { 220 idmap_cache_set_sid2uid(sid, *uid); 221 } 201 222 return NT_STATUS_OK; 202 223 } … … 216 237 sid_string_dbg(sid), domname)); 217 238 218 if (idmap_cache_find_sid2gid(sid, gid, &expired)) { 239 if (winbindd_use_idmap_cache() 240 && idmap_cache_find_sid2gid(sid, gid, &expired)) { 219 241 DEBUG(10, ("idmap_cache_find_sid2gid found %d%s\n", 220 242 (int)(*gid), expired ? " (expired)": "")); … … 244 266 map.xid.type, 245 267 map.xid.id)); 246 idmap_cache_set_sid2gid(sid, -1); 268 if (winbindd_use_idmap_cache()) { 269 idmap_cache_set_sid2gid(sid, -1); 270 } 247 271 return NT_STATUS_NONE_MAPPED; 248 272 } … … 255 279 * could not answer our request. Fail. 256 280 */ 257 idmap_cache_set_sid2uid(sid, -1); 281 if (winbindd_use_idmap_cache()) { 282 idmap_cache_set_sid2uid(sid, -1); 283 } 258 284 return NT_STATUS_NONE_MAPPED; 259 285 } … … 264 290 DEBUG(10, ("idmap_new_mapping failed: %s\n", 265 291 nt_errstr(ret))); 266 idmap_cache_set_sid2gid(sid, -1); 292 if (winbindd_use_idmap_cache()) { 293 idmap_cache_set_sid2gid(sid, -1); 294 } 267 295 return ret; 268 296 } … … 270 298 done: 271 299 *gid = map.xid.id; 272 idmap_cache_set_sid2gid(sid, *gid); 300 if (winbindd_use_idmap_cache()) { 301 idmap_cache_set_sid2gid(sid, *gid); 302 } 273 303 return NT_STATUS_OK; 274 304 }
Note:
See TracChangeset
for help on using the changeset viewer.