Also remove the mem_ctx from the netsamlogon_cache_store() API.
Guenther, what should we be doing with the other fields in
the PAC_LOGON_INFO?
server_info,
&info3);
- netsamlogon_cache_store( mem_ctx, user_info->smb_name.str, &info3 );
+ netsamlogon_cache_store( user_info->smb_name.str, &info3 );
}
/* Note - once the cli stream is shutdown the mem_ctx used
username should be in UTF-8 format
***********************************************************************/
-BOOL netsamlogon_cache_store(TALLOC_CTX *mem_ctx, const char * username, NET_USER_INFO_3 *user)
+BOOL netsamlogon_cache_store( const char *username, NET_USER_INFO_3 *user )
{
TDB_DATA data;
fstring keystr;
BOOL result = False;
DOM_SID user_sid;
time_t t = time(NULL);
+ TALLOC_CTX *mem_ctx;
if (!netsamlogon_cache_init()) {
/* Prepare data */
+ if ( !(mem_ctx = TALLOC_P( NULL, int )) ) {
+ DEBUG(0,("netsamlogon_cache_store: talloc() failed!\n"));
+ return False;
+ }
+
prs_init( &ps, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
if ( !prs_uint32( "timestamp", &ps, 0, (uint32*)&t ) )
prs_mem_free( &ps );
}
+
+ TALLOC_FREE( mem_ctx );
return result;
}
uint32 t;
if (!netsamlogon_cache_init()) {
- DEBUG(0,("netsamlogon_cache_store: cannot open %s for write!\n", NETSAMLOGON_TDB));
+ DEBUG(0,("netsamlogon_cache_get: cannot open %s for write!\n", NETSAMLOGON_TDB));
return False;
}
} while ( (attempts < 2) && retry );
if (NT_STATUS_IS_OK(result)) {
- netsamlogon_cache_store(state->mem_ctx, name_user, &info3);
+ netsamlogon_cache_store(name_user, &info3);
wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3);
/* Check if the user is in the right group */
} while ( (attempts < 2) && retry );
if (NT_STATUS_IS_OK(result)) {
- netsamlogon_cache_store(state->mem_ctx, name_user, &info3);
+ netsamlogon_cache_store(name_user, &info3);
wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3);
/* Check if the user is in the right group */
return ERROR_NT(NT_STATUS_LOGON_FAILURE);
}
- if (pac_data) {
- logon_info = get_logon_info_from_pac(pac_data);
- }
-
DEBUG(3,("Ticket name is [%s]\n", client));
p = strchr_m(client, '@');
}
*p = 0;
+
+ /* save the PAC data if we have it */
+
+ if (pac_data) {
+ logon_info = get_logon_info_from_pac(pac_data);
+ netsamlogon_cache_store( client, &logon_info->info3 );
+ }
+
if (!strequal(p+1, lp_realm())) {
DEBUG(3,("Ticket for foreign realm %s@%s\n", client, p+1));
if (!lp_allow_trusted_domains()) {