883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
44 lines
4.7 KiB
C
44 lines
4.7 KiB
C
/* Actual profile-5 snapshot and realm consumer, with synthetic immutable owner. */
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
typedef long LONG; typedef int64_t LONG64; typedef uint64_t ULONGLONG;
|
|
#define WINAPI
|
|
#define GW_WINE_WIRE_ABI 1
|
|
#define GW_WIRE_REALM_AT 3
|
|
#define GW_SOURCE_ONLY_PROFILE 5
|
|
struct gw_source_profile {uint32_t abi,size,kind,auth_port;char hostname[32];};
|
|
struct gw_native_realm {char name[128],address[256];unsigned wire_id,type,flags;};
|
|
struct gw_wire_call {unsigned abi,size,login,index;struct gw_native_realm realm;};
|
|
struct gw_wire_account_ui_state {uint32_t abi,size,generation,endpoint_kind;int32_t state,error,auth_result,discovery_result,server_proof_verified,realm_count,selected_index,transport_prepared,cancel;uint32_t auth_port,copied_realms;int32_t genuine_discovery;};
|
|
struct {int kind;} owned_endpoint={1};
|
|
struct {LONG64 request;LONG state,enabled,error;} gw_wire_account_ui_data;
|
|
struct {LONG state,error,auth_result,discovery_result,server_proof_verified,realm_count,selected_index,transport_prepared,cancel,auth_port;} gw_wire_auth_data;
|
|
struct gw_native_realm gw_wire_auth_realms[64],returned;
|
|
static int channel_lock,expired_flag,failed_invoke;static LONG active=1;static uint32_t credentials_generation=7,ui_auth_generation=7,profile_port=3725;static LONG profile_result=5;
|
|
static LONG64 InterlockedCompareExchange64(LONG64*p,LONG64 v,LONG64 c){LONG64 o=*p;if(o==c)*p=v;return o;}
|
|
static LONG InterlockedCompareExchange(LONG*p,LONG v,LONG c){LONG o=*p;if(o==c)*p=v;return o;}
|
|
static LONG InterlockedExchange(LONG*p,LONG v){LONG o=*p;*p=v;return o;}
|
|
static void AcquireSRWLockExclusive(int*p){(void)p;}static void ReleaseSRWLockExclusive(int*p){(void)p;}
|
|
LONG gw_source_profile_read(struct gw_source_profile*p){p->kind=5;p->auth_port=profile_port;return profile_result;}
|
|
LONG gw_source_profile_kind(void){return 5;}
|
|
static int expired(ULONGLONG start){(void)start;return expired_flag;}
|
|
static int invoke(struct gw_wire_call*c,unsigned op){if(failed_invoke||op!=GW_WIRE_REALM_AT)return 0;c->realm=returned;return 1;}
|
|
static int gw_engine_realm_endpoint_ipv4(const struct gw_native_realm*r,unsigned char a[4],uint16_t*p){unsigned x[4],port;char tail;if(sscanf(r->address,"%u.%u.%u.%u:%u%c",x,x+1,x+2,x+3,&port,&tail)!=5||!port||port>65535)return -1;for(int i=0;i<4;i++){if(x[i]>255)return -1;a[i]=(unsigned char)x[i];}*p=(uint16_t)port;return 0;}
|
|
int gw_private_source_realm_endpoint_eligible(unsigned kind,const unsigned char a[4],uint16_t port){return kind==5&&a[0]==192&&a[1]==168&&a[2]==22&&a[3]==7&&port==8111;}
|
|
#include "../native/wine_account_ui_header.inc"
|
|
#include "../native/wine_source_realm_consumer.inc"
|
|
static void need(int condition){if(!condition)exit(1);}
|
|
static void setup(void){memset(&gw_wire_auth_data,0,sizeof(gw_wire_auth_data));memset(&gw_wire_account_ui_data,0,sizeof(gw_wire_account_ui_data));memset(gw_wire_auth_realms,0,sizeof(gw_wire_auth_realms));strcpy(gw_wire_auth_realms[0].name,"Local");strcpy(gw_wire_auth_realms[0].address,"192.168.22.7:8111");gw_wire_auth_realms[0].wire_id=4;returned=gw_wire_auth_realms[0];gw_wire_auth_data.state=5;gw_wire_auth_data.server_proof_verified=1;gw_wire_auth_data.realm_count=1;gw_wire_auth_data.selected_index=-1;gw_wire_auth_data.auth_port=3725;gw_wire_account_ui_data.request=((LONG64)7<<32)|1;gw_wire_account_ui_data.state=1;gw_wire_account_ui_data.enabled=1;credentials_generation=ui_auth_generation=7;profile_port=3725;profile_result=5;owned_endpoint.kind=1;expired_flag=failed_invoke=0;}
|
|
int main(void){struct gw_wire_account_ui_state view;struct gw_wire_call auth={0};
|
|
setup();account_ui_header(&view);need(view.genuine_discovery==1&&view.auth_port==3725);need(gw_private_consume_source_realm(&auth,0)==1&&gw_wire_auth_data.selected_index==0);
|
|
setup();gw_wire_auth_data.auth_port=3724;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();profile_port=3726;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();credentials_generation=8;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();owned_endpoint.kind=0;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();profile_result=-1;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();gw_wire_auth_data.server_proof_verified=0;account_ui_header(&view);need(!view.genuine_discovery&&gw_private_consume_source_realm(&auth,0)==-1);
|
|
setup();strcpy(returned.address,"192.168.22.8:8111");need(gw_private_consume_source_realm(&auth,0)==-1);
|
|
puts("PASS profile-5 bound account snapshot and actual realm consumer");return 0;}
|