Ignore:
Timestamp:
May 20, 2009, 6:46:53 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/libsmb/samlogon_cache.c

    r136 r204  
    6060***********************************************************************/
    6161
    62 void netsamlogon_clear_cached_user(TDB_CONTEXT *tdb, struct netr_SamInfo3 *info3)
    63 {
    64         bool got_tdb = false;
    65         DOM_SID sid;
    66         fstring key_str, sid_string;
    67 
    68         /* We may need to call this function from smbd which will not have
    69            winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
    70 
    71         if (!tdb) {
    72                 tdb = tdb_open_log(lock_path("winbindd_cache.tdb"),
    73                                    WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
    74                                    TDB_DEFAULT, O_RDWR, 0600);
    75                 if (!tdb) {
    76                         DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n"));
    77                         return;
    78                 }
    79                 got_tdb = true;
    80         }
    81 
    82         sid_copy(&sid, info3->base.domain_sid);
    83         sid_append_rid(&sid, info3->base.rid);
    84 
    85         /* Clear U/SID cache entry */
    86 
    87         fstr_sprintf(key_str, "U/%s", sid_to_fstring(sid_string, &sid));
    88 
    89         DEBUG(10, ("netsamlogon_clear_cached_user: clearing %s\n", key_str));
    90 
    91         tdb_delete(tdb, string_tdb_data(key_str));
    92 
    93         /* Clear UG/SID cache entry */
    94 
    95         fstr_sprintf(key_str, "UG/%s", sid_to_fstring(sid_string, &sid));
    96 
    97         DEBUG(10, ("netsamlogon_clear_cached_user: clearing %s\n", key_str));
    98 
    99         tdb_delete(tdb, string_tdb_data(key_str));
    100 
    101         if (got_tdb) {
    102                 tdb_close(tdb);
    103         }
     62void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3)
     63{
     64        DOM_SID user_sid;
     65        fstring keystr, tmp;
     66
     67        if (!info3) {
     68                return;
     69        }
     70
     71        if (!netsamlogon_cache_init()) {
     72                DEBUG(0,("netsamlogon_clear_cached_user: cannot open "
     73                        "%s for write!\n",
     74                        NETSAMLOGON_TDB));
     75                return;
     76        }
     77        sid_copy(&user_sid, info3->base.domain_sid);
     78        sid_append_rid(&user_sid, info3->base.rid);
     79
     80        /* Prepare key as DOMAIN-SID/USER-RID string */
     81        slprintf(keystr, sizeof(keystr), "%s", sid_to_fstring(tmp, &user_sid));
     82
     83        DEBUG(10,("netsamlogon_clear_cached_user: SID [%s]\n", keystr));
     84
     85        tdb_delete_bystring(netsamlogon_tdb, keystr);
    10486}
    10587
Note: See TracChangeset for help on using the changeset viewer.