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

Location:
branches/samba-3.3.x/source/winbindd
Files:
13 edited

Legend:

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

    r206 r222  
    305305        char *g_filter = NULL;
    306306
     307        /* initialize the status to avoid suprise */
     308        for (i = 0; ids[i]; i++) {
     309                ids[i]->status = ID_UNKNOWN;
     310        }
     311       
    307312        /* Only do query if we are online */
    308313        if (idmap_is_offline()) {
     
    517522        char *sidstr;
    518523
     524        /* initialize the status to avoid suprise */
     525        for (i = 0; ids[i]; i++) {
     526                ids[i]->status = ID_UNKNOWN;
     527        }
     528
    519529        /* Only do query if we are online */
    520530        if (idmap_is_offline()) {
  • branches/samba-3.3.x/source/winbindd/idmap_adex/idmap_adex.c

    r206 r222  
    160160        struct likewise_cell *cell;
    161161
     162        /* initialize the status to avoid suprise */
     163        for (i = 0; ids[i]; i++) {
     164                ids[i]->status = ID_UNKNOWN;
     165        }
     166       
    162167        nt_status = _idmap_adex_init(dom, NULL);
    163168        if (!NT_STATUS_IS_OK(nt_status))
     
    208213        struct likewise_cell *cell;
    209214
     215        /* initialize the status to avoid suprise */
     216        for (i = 0; ids[i]; i++) {
     217                ids[i]->status = ID_UNKNOWN;
     218        }
     219       
    210220        nt_status = _idmap_adex_init(dom, NULL);
    211221        if (!NT_STATUS_IS_OK(nt_status))
  • branches/samba-3.3.x/source/winbindd/idmap_hash/idmap_hash.c

    r206 r222  
    161161        int i;
    162162
     163        /* initialize the status to avoid suprise */
     164        for (i = 0; ids[i]; i++) {
     165                ids[i]->status = ID_UNKNOWN;
     166        }
     167       
    163168        nt_status = be_init(dom, NULL);
    164169        BAIL_ON_NTSTATUS_ERROR(nt_status);
     
    207212        int i;
    208213
     214        /* initialize the status to avoid suprise */
     215        for (i = 0; ids[i]; i++) {
     216                ids[i]->status = ID_UNKNOWN;
     217        }
     218       
    209219        nt_status = be_init(dom, NULL);
    210220        BAIL_ON_NTSTATUS_ERROR(nt_status);
  • branches/samba-3.3.x/source/winbindd/idmap_ldap.c

    r206 r222  
    936936        }
    937937
     938        for (i = 0; ids[i]; i++) {
     939                ids[i]->status = ID_UNKNOWN;
     940        }
     941
    938942again:
    939943        if (multi) {
     
    11571161        }
    11581162
     1163        for (i = 0; ids[i]; i++) {
     1164                ids[i]->status = ID_UNKNOWN;
     1165        }
     1166
    11591167again:
    11601168        if (multi) {
  • branches/samba-3.3.x/source/winbindd/idmap_nss.c

    r206 r222  
    4545        int i;
    4646
     47        /* initialize the status to avoid suprise */
     48        for (i = 0; ids[i]; i++) {
     49                ids[i]->status = ID_UNKNOWN;
     50        }
     51       
    4752        ctx = talloc_new(dom);
    4853        if ( ! ctx) {
     
    131136        int i;
    132137
     138        /* initialize the status to avoid suprise */
     139        for (i = 0; ids[i]; i++) {
     140                ids[i]->status = ID_UNKNOWN;
     141        }
     142       
    133143        ctx = talloc_new(dom);
    134144        if ( ! ctx) {
  • branches/samba-3.3.x/source/winbindd/idmap_rid.c

    r206 r222  
    172172        int i;
    173173
     174        /* initialize the status to avoid suprise */
     175        for (i = 0; ids[i]; i++) {
     176                ids[i]->status = ID_UNKNOWN;
     177        }
     178       
    174179        ridctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
    175180
     
    206211        int i;
    207212
     213        /* initialize the status to avoid suprise */
     214        for (i = 0; ids[i]; i++) {
     215                ids[i]->status = ID_UNKNOWN;
     216        }
     217       
    208218        ridctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
    209219
  • branches/samba-3.3.x/source/winbindd/idmap_tdb.c

    r206 r222  
    754754        int i;
    755755
     756        /* initialize the status to avoid suprise */
     757        for (i = 0; ids[i]; i++) {
     758                ids[i]->status = ID_UNKNOWN;
     759        }
     760
    756761        ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
    757762
     
    791796        NTSTATUS ret;
    792797        int i;
     798
     799        /* initialize the status to avoid suprise */
     800        for (i = 0; ids[i]; i++) {
     801                ids[i]->status = ID_UNKNOWN;
     802        }
    793803
    794804        ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
  • branches/samba-3.3.x/source/winbindd/idmap_tdb2.c

    r206 r222  
    640640        int i;
    641641
     642        /* initialize the status to avoid suprise */
     643        for (i = 0; ids[i]; i++) {
     644                ids[i]->status = ID_UNKNOWN;
     645        }
     646       
    642647        ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
    643648
     
    677682        int i;
    678683
     684        /* initialize the status to avoid suprise */
     685        for (i = 0; ids[i]; i++) {
     686                ids[i]->status = ID_UNKNOWN;
     687        }
     688       
    679689        ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
    680690
  • 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}
  • branches/samba-3.3.x/source/winbindd/winbindd.c

    r221 r222  
    2929#define DBGC_CLASS DBGC_WINBIND
    3030
    31 bool opt_nocache = False;
     31static bool opt_nocache = False;
    3232static bool interactive = False;
    3333
     
    995995                }
    996996        }
     997}
     998
     999bool winbindd_use_idmap_cache(void)
     1000{
     1001        return !opt_nocache;
     1002}
     1003
     1004bool winbindd_use_cache(void)
     1005{
     1006        return !opt_nocache;
    9971007}
    9981008
  • branches/samba-3.3.x/source/winbindd/winbindd_cache.c

    r221 r222  
    3434
    3535extern struct winbindd_methods reconnect_methods;
    36 extern bool opt_nocache;
    3736#ifdef HAVE_ADS
    3837extern struct winbindd_methods ads_methods;
     
    632631        struct cache_entry *centry;
    633632
    634         if (opt_nocache) {
     633        if (!winbindd_use_cache()) {
    635634                return NULL;
    636635        }
     
    834833        TDB_DATA key, data;
    835834
    836         if (opt_nocache) {
     835        if (!winbindd_use_cache()) {
    837836                return;
    838837        }
     
    28612860                wcache->tdb = NULL;
    28622861        }
    2863         if (opt_nocache)
     2862        if (!winbindd_use_cache()) {
    28642863                return;
     2864        }
    28652865
    28662866        /* when working offline we must not clear the cache on restart */
  • branches/samba-3.3.x/source/winbindd/winbindd_group.c

    r221 r222  
    2626#include "winbindd.h"
    2727
    28 extern bool opt_nocache;
    29 
    3028#undef DBGC_CLASS
    3129#define DBGC_CLASS DBGC_WINBIND
  • branches/samba-3.3.x/source/winbindd/winbindd_proto.h

    r206 r222  
    6868void winbind_check_sighup(const char *lfile);
    6969void winbind_check_sigterm(bool in_parent);
     70bool winbindd_use_idmap_cache(void);
     71bool winbindd_use_cache(void);
    7072int main(int argc, char **argv, char **envp);
    7173
Note: See TracChangeset for help on using the changeset viewer.