libsmb/samlogon_cache.c

ソースコードを見る。

関数

BOOL netsamlogon_cache_init (void)
BOOL netsamlogon_cache_shutdown (void)
void netsamlogon_clear_cached_user (TDB_CONTEXT *tdb, NET_USER_INFO_3 *user)
BOOL netsamlogon_cache_store (const char *username, NET_USER_INFO_3 *user)
NET_USER_INFO_3netsamlogon_cache_get (TALLOC_CTX *mem_ctx, const DOM_SID *user_sid)

変数

static TDB_CONTEXTnetsamlogon_tdb = NULL


関数

BOOL netsamlogon_cache_init ( void   ) 

samlogon_cache.c34 行で定義されています。

参照先 lock_path()netsamlogon_tdbtdb_open_log().

参照元 main()netsamlogon_cache_get()netsamlogon_cache_store().

00035 {
00036         if (!netsamlogon_tdb) {
00037                 netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
00038                                                    TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
00039         }
00040 
00041         return (netsamlogon_tdb != NULL);
00042 }

BOOL netsamlogon_cache_shutdown ( void   ) 

samlogon_cache.c49 行で定義されています。

参照先 netsamlogon_tdbtdb_close().

00050 {
00051         if(netsamlogon_tdb)
00052                 return (tdb_close(netsamlogon_tdb) == 0);
00053                 
00054         return True;
00055 }

void netsamlogon_clear_cached_user ( TDB_CONTEXT tdb,
NET_USER_INFO_3 user 
)

samlogon_cache.c60 行で定義されています。

参照先 net_user_info_3::dom_sidfstr_sprintf()lock_path()DOM_SID2::sidsid_append_rid()sid_copy()sid_to_string()string_tdb_data()tdbtdb_close()tdb_delete()tdb_open_log()net_user_info_3::user_rid.

参照元 wcache_invalidate_samlogon().

00061 {
00062         BOOL got_tdb = False;
00063         DOM_SID sid;
00064         fstring key_str, sid_string;
00065 
00066         /* We may need to call this function from smbd which will not have
00067            winbindd_cache.tdb open.  Open the tdb if a NULL is passed. */
00068 
00069         if (!tdb) {
00070                 tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 
00071                                    WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE,
00072                                    TDB_DEFAULT, O_RDWR, 0600);
00073                 if (!tdb) {
00074                         DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n"));
00075                         return;
00076                 }
00077                 got_tdb = True;
00078         }
00079 
00080         sid_copy(&sid, &user->dom_sid.sid);
00081         sid_append_rid(&sid, user->user_rid);
00082 
00083         /* Clear U/SID cache entry */
00084 
00085         fstr_sprintf(key_str, "U/%s", sid_to_string(sid_string, &sid));
00086 
00087         DEBUG(10, ("netsamlogon_clear_cached_user: clearing %s\n", key_str));
00088 
00089         tdb_delete(tdb, string_tdb_data(key_str));
00090 
00091         /* Clear UG/SID cache entry */
00092 
00093         fstr_sprintf(key_str, "UG/%s", sid_to_string(sid_string, &sid));
00094 
00095         DEBUG(10, ("netsamlogon_clear_cached_user: clearing %s\n", key_str));
00096 
00097         tdb_delete(tdb, string_tdb_data(key_str));
00098 
00099         if (got_tdb)
00100                 tdb_close(tdb);
00101 }

BOOL netsamlogon_cache_store ( const char *  username,
NET_USER_INFO_3 user 
)

samlogon_cache.c108 行で定義されています。

参照先 UNISTR2::buffernet_user_info_3::dom_sidTDB_DATA::dptrTDB_DATA::dsizenet_user_info_3::hdr_user_nameinit_uni_hdr()init_unistr2()net_io_user_info3()netsamlogon_cache_init()netsamlogon_tdbprs_init()prs_mem_free()resultDOM_SID2::sidsid_append_rid()sid_copy()sid_string_static()ttdb_store_bystring()UNI_STR_TERMINATEnet_user_info_3::uni_user_namenet_user_info_3::user_rid.

参照元 domain_client_validate()reply_spnego_kerberos()winbindd_dual_pam_auth()winbindd_dual_pam_auth_crap()winbindd_store_creds().

00109 {
00110         TDB_DATA        data;
00111         fstring         keystr;
00112         prs_struct      ps;
00113         BOOL            result = False;
00114         DOM_SID         user_sid;
00115         time_t          t = time(NULL);
00116         TALLOC_CTX      *mem_ctx;
00117         
00118 
00119         if (!netsamlogon_cache_init()) {
00120                 DEBUG(0,("netsamlogon_cache_store: cannot open %s for write!\n", NETSAMLOGON_TDB));
00121                 return False;
00122         }
00123 
00124         sid_copy( &user_sid, &user->dom_sid.sid );
00125         sid_append_rid( &user_sid, user->user_rid );
00126 
00127         /* Prepare key as DOMAIN-SID/USER-RID string */
00128         slprintf(keystr, sizeof(keystr), "%s", sid_string_static(&user_sid));
00129 
00130         DEBUG(10,("netsamlogon_cache_store: SID [%s]\n", keystr));
00131         
00132         /* only Samba fills in the username, not sure why NT doesn't */
00133         /* so we fill it in since winbindd_getpwnam() makes use of it */
00134         
00135         if ( !user->uni_user_name.buffer ) {
00136                 init_unistr2( &user->uni_user_name, username, UNI_STR_TERMINATE );
00137                 init_uni_hdr( &user->hdr_user_name, &user->uni_user_name );
00138         }
00139                 
00140         /* Prepare data */
00141         
00142         if ( !(mem_ctx = TALLOC_P( NULL, int )) ) {
00143                 DEBUG(0,("netsamlogon_cache_store: talloc() failed!\n"));
00144                 return False;
00145         }
00146 
00147         prs_init( &ps, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
00148         
00149         {
00150                 uint32 ts = (uint32)t;
00151                 if ( !prs_uint32( "timestamp", &ps, 0, &ts ) )
00152                         return False;
00153         }
00154         
00155         if ( net_io_user_info3("", user, &ps, 0, 3, 0) ) 
00156         {
00157                 data.dsize = prs_offset( &ps );
00158                 data.dptr = prs_data_p( &ps );
00159 
00160                 if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) != -1)
00161                         result = True;
00162                 
00163                 prs_mem_free( &ps );
00164         }
00165 
00166         TALLOC_FREE( mem_ctx );
00167                 
00168         return result;
00169 }

NET_USER_INFO_3* netsamlogon_cache_get ( TALLOC_CTX mem_ctx,
const DOM_SID user_sid 
)

samlogon_cache.c176 行で定義されています。

参照先 TDB_DATA::dptrTDB_DATA::dsizenet_io_user_info3()netsamlogon_cache_init()netsamlogon_tdbprs_init()prs_mem_free()resultsid_string_static()ttalloc_init()tdb_delete()tdb_fetch().

参照元 lookup_usergroups_cached()query_user()winbindd_get_creds().


変数

TDB_CONTEXT* netsamlogon_tdb = NULL [static]

samlogon_cache.c28 行で定義されています。

参照元 netsamlogon_cache_get()netsamlogon_cache_init()netsamlogon_cache_shutdown()netsamlogon_cache_store().


Sambaに対してSat Aug 29 21:23:49 2009に生成されました。  doxygen 1.4.7