Ignore:
Timestamp:
May 24, 2009, 7:45:16 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 branch to 3.3.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/winbindd/idmap_util.c

    r206 r222  
    1919
    2020#include "includes.h"
     21#include "winbindd.h"
     22#include "winbindd_proto.h"
    2123
    2224#undef DBGC_CLASS
     
    3739                  (unsigned long)uid, domname?domname:"NULL"));
    3840
    39         if (idmap_cache_find_uid2sid(uid, sid, &expired)) {
     41        if (winbindd_use_idmap_cache()
     42            && idmap_cache_find_uid2sid(uid, sid, &expired)) {
    4043                DEBUG(10, ("idmap_cache_find_uid2sid found %d%s\n", uid,
    4144                           expired ? " (expired)": ""));
     
    6467
    6568        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                }
    6974                DEBUG(10, ("uid [%lu] not mapped\n", (unsigned long)uid));
    7075                return NT_STATUS_NONE_MAPPED;
    7176        }
    7277
    73         idmap_cache_set_sid2uid(sid, uid);
     78        if (winbindd_use_idmap_cache()) {
     79                idmap_cache_set_sid2uid(sid, uid);
     80        }
    7481
    7582        return NT_STATUS_OK;
     
    9097                  (unsigned long)gid, domname?domname:"NULL"));
    9198
    92         if (idmap_cache_find_gid2sid(gid, sid, &expired)) {
     99        if (winbindd_use_idmap_cache()
     100            && idmap_cache_find_gid2sid(gid, sid, &expired)) {
    93101                DEBUG(10, ("idmap_cache_find_gid2sid found %d%s\n", gid,
    94102                           expired ? " (expired)": ""));
     
    117125
    118126        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                }
    122132                DEBUG(10, ("gid [%lu] not mapped\n", (unsigned long)gid));
    123133                return NT_STATUS_NONE_MAPPED;
    124134        }
    125135
    126         idmap_cache_set_sid2gid(sid, gid);
     136        if (winbindd_use_idmap_cache()) {
     137                idmap_cache_set_sid2gid(sid, gid);
     138        }
    127139
    128140        return NT_STATUS_OK;
     
    143155                  sid_string_dbg(sid), dom_name));
    144156
    145         if (idmap_cache_find_sid2uid(sid, uid, &expired)) {
     157        if (winbindd_use_idmap_cache()
     158            && idmap_cache_find_sid2uid(sid, uid, &expired)) {
    146159                DEBUG(10, ("idmap_cache_find_sid2uid found %d%s\n",
    147160                           (int)(*uid), expired ? " (expired)": ""));
     
    172185                                   map.xid.type,
    173186                                   map.xid.id));
    174                         idmap_cache_set_sid2uid(sid, -1);
     187                        if (winbindd_use_idmap_cache()) {
     188                                idmap_cache_set_sid2uid(sid, -1);
     189                        }
    175190                        return NT_STATUS_NONE_MAPPED;
    176191                }
     
    183198                 * could not answer our request. Fail.
    184199                 */
    185                 idmap_cache_set_sid2uid(sid, -1);
     200                if (winbindd_use_idmap_cache()) {
     201                        idmap_cache_set_sid2uid(sid, -1);
     202                }
    186203                return NT_STATUS_NONE_MAPPED;
    187204        }
     
    192209                DEBUG(10, ("idmap_new_mapping failed: %s\n",
    193210                           nt_errstr(ret)));
    194                 idmap_cache_set_sid2uid(sid, -1);
     211                if (winbindd_use_idmap_cache()) {
     212                        idmap_cache_set_sid2uid(sid, -1);
     213                }
    195214                return ret;
    196215        }
     
    198217done:
    199218        *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        }
    201222        return NT_STATUS_OK;
    202223}
     
    216237                  sid_string_dbg(sid), domname));
    217238
    218         if (idmap_cache_find_sid2gid(sid, gid, &expired)) {
     239        if (winbindd_use_idmap_cache()
     240            && idmap_cache_find_sid2gid(sid, gid, &expired)) {
    219241                DEBUG(10, ("idmap_cache_find_sid2gid found %d%s\n",
    220242                           (int)(*gid), expired ? " (expired)": ""));
     
    244266                                   map.xid.type,
    245267                                   map.xid.id));
    246                         idmap_cache_set_sid2gid(sid, -1);
     268                        if (winbindd_use_idmap_cache()) {
     269                                idmap_cache_set_sid2gid(sid, -1);
     270                        }
    247271                        return NT_STATUS_NONE_MAPPED;
    248272                }
     
    255279                 * could not answer our request. Fail.
    256280                 */
    257                 idmap_cache_set_sid2uid(sid, -1);
     281                if (winbindd_use_idmap_cache()) {
     282                        idmap_cache_set_sid2uid(sid, -1);
     283                }
    258284                return NT_STATUS_NONE_MAPPED;
    259285        }
     
    264290                DEBUG(10, ("idmap_new_mapping failed: %s\n",
    265291                           nt_errstr(ret)));
    266                 idmap_cache_set_sid2gid(sid, -1);
     292                if (winbindd_use_idmap_cache()) {
     293                        idmap_cache_set_sid2gid(sid, -1);
     294                }
    267295                return ret;
    268296        }
     
    270298done:
    271299        *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        }
    273303        return NT_STATUS_OK;
    274304}
Note: See TracChangeset for help on using the changeset viewer.