ReactOS  0.4.15-dev-5142-g967f5b9
clictx.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for clictx.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

AUTHZAPI BOOL WINAPI AuthzInitializeContextFromSid (IN DWORD Flags, IN PSID UserSid, IN AUTHZ_RESOURCE_MANAGER_HANDLE AuthzResourceManager, IN PLARGE_INTEGER pExpirationTime, IN LUID Identifier, IN PVOID DynamicGroupArgs, OUT PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext)
 
AUTHZAPI BOOL WINAPI AuthzGetInformationFromContext (IN AUTHZ_CLIENT_CONTEXT_HANDLE hAuthzClientContext, IN AUTHZ_CONTEXT_INFORMATION_CLASS InfoClass, IN DWORD BufferSize, OUT PDWORD pSizeRequired, OUT PVOID Buffer)
 
AUTHZAPI BOOL WINAPI AuthzFreeContext (IN AUTHZ_CLIENT_CONTEXT_HANDLE AuthzClientContext)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 31 of file clictx.c.

Function Documentation

◆ AuthzFreeContext()

AUTHZAPI BOOL WINAPI AuthzFreeContext ( IN AUTHZ_CLIENT_CONTEXT_HANDLE  AuthzClientContext)

Definition at line 213 of file clictx.c.

214 {
215  BOOL Ret = FALSE;
216 
217  if (AuthzClientContext != NULL)
218  {
219  PAUTHZ_CLIENT_CONTEXT ClientCtx = (PAUTHZ_CLIENT_CONTEXT)AuthzClientContext;
220 
221  VALIDATE_CLIENTCTX_HANDLE(AuthzClientContext);
222 
223  if (ClientCtx->UserSid != NULL)
224  {
225  LocalFree((HLOCAL)ClientCtx->UserSid);
226  }
227 
228  LocalFree((HLOCAL)ClientCtx);
229  Ret = TRUE;
230  }
231  else
233 
234  return Ret;
235 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define VALIDATE_CLIENTCTX_HANDLE(handle)
Definition: precomp.h:27
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _AUTHZ_CLIENT_CONTEXT * PAUTHZ_CLIENT_CONTEXT
#define SetLastError(x)
Definition: compat.h:611
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112

◆ AuthzGetInformationFromContext()

AUTHZAPI BOOL WINAPI AuthzGetInformationFromContext ( IN AUTHZ_CLIENT_CONTEXT_HANDLE  hAuthzClientContext,
IN AUTHZ_CONTEXT_INFORMATION_CLASS  InfoClass,
IN DWORD  BufferSize,
OUT PDWORD  pSizeRequired,
OUT PVOID  Buffer 
)

Definition at line 111 of file clictx.c.

116 {
117  BOOL Ret = FALSE;
118 
119  if (hAuthzClientContext != NULL && pSizeRequired != NULL)
120  {
121  PAUTHZ_CLIENT_CONTEXT ClientCtx = (PAUTHZ_CLIENT_CONTEXT)hAuthzClientContext;
122 
123  VALIDATE_CLIENTCTX_HANDLE(hAuthzClientContext);
124 
125  switch (InfoClass)
126  {
128  {
129  DWORD SidLen = GetLengthSid(ClientCtx->UserSid);
130  *pSizeRequired = SidLen;
131  if (BufferSize < SidLen)
132  {
134  }
135  else
136  {
137  Ret = CopySid(SidLen,
138  (PSID)Buffer,
139  ClientCtx->UserSid);
140  }
141  break;
142  }
143 
146  break;
147 
150  break;
151 
154  break;
155 
157  *pSizeRequired = sizeof(LARGE_INTEGER);
158  if (BufferSize < sizeof(LARGE_INTEGER) || Buffer == NULL)
159  {
161  }
162  else
163  {
164  *((PLARGE_INTEGER)Buffer) = ClientCtx->ExpirationTime;
165  Ret = TRUE;
166  }
167  break;
168 
170  *pSizeRequired = sizeof(AUTHZ_CLIENT_CONTEXT_HANDLE);
172  {
174  }
175  else
176  {
178  Ret = TRUE;
179  }
180  break;
181 
183  *pSizeRequired = sizeof(LUID);
184  if (BufferSize < sizeof(LUID) || Buffer == NULL)
185  {
187  }
188  else
189  {
190  *((PLUID)Buffer) = ClientCtx->Luid;
191  Ret = TRUE;
192  }
193  break;
194 
195  default:
197  break;
198  }
199  }
200  else
202 
203  return Ret;
204 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
LARGE_INTEGER ExpirationTime
Definition: precomp.h:58
struct _LUID * PLUID
#define VALIDATE_CLIENTCTX_HANDLE(handle)
Definition: precomp.h:27
struct _LUID LUID
#define FALSE
Definition: types.h:117
HANDLE AUTHZ_CLIENT_CONTEXT_HANDLE
Definition: authz.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: bufpool.h:45
HANDLE * PAUTHZ_CLIENT_CONTEXT_HANDLE
Definition: authz.h:45
struct _AUTHZ_CLIENT_CONTEXT * PAUTHZ_CLIENT_CONTEXT
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:921
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
union _LARGE_INTEGER LARGE_INTEGER
AUTHZ_CLIENT_CONTEXT_HANDLE ServerContext
Definition: precomp.h:59
#define NULL
Definition: types.h:112
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
Definition: security.c:714
union _LARGE_INTEGER * PLARGE_INTEGER
Definition: file.c:85
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

◆ AuthzInitializeContextFromSid()

AUTHZAPI BOOL WINAPI AuthzInitializeContextFromSid ( IN DWORD  Flags,
IN PSID  UserSid,
IN AUTHZ_RESOURCE_MANAGER_HANDLE  AuthzResourceManager,
IN PLARGE_INTEGER  pExpirationTime,
IN LUID  Identifier,
IN PVOID  DynamicGroupArgs,
OUT PAUTHZ_CLIENT_CONTEXT_HANDLE  pAuthzClientContext 
)

Definition at line 40 of file clictx.c.

47 {
48  BOOL Ret = FALSE;
49 
50  if (AuthzResourceManager != NULL && pExpirationTime != NULL && pAuthzClientContext != NULL &&
51  UserSid != NULL && IsValidSid(UserSid) && !(Flags & (AUTHZ_SKIP_TOKEN_GROUPS | AUTHZ_REQUIRE_S4U_LOGON)))
52  {
53  PAUTHZ_CLIENT_CONTEXT ClientCtx;
54  //PAUTHZ_RESMAN ResMan = (PAUTHZ_RESMAN)AuthzResourceManager;
55 
56  VALIDATE_RESMAN_HANDLE(AuthzResourceManager);
57 
59  sizeof(AUTHZ_CLIENT_CONTEXT));
60  if (ClientCtx != NULL)
61  {
62  DWORD SidLen;
63 
64  /* initialize the client context structure */
65 #if DBG
66  ClientCtx->Tag = CLIENTCTX_TAG;
67 #endif
68 
69  /* simply copy the SID */
70  SidLen = GetLengthSid(UserSid);
71  ClientCtx->UserSid = (PSID)LocalAlloc(LMEM_FIXED,
72  SidLen);
73  if (ClientCtx->UserSid == NULL)
74  {
75  LocalFree((HLOCAL)ClientCtx);
76  goto FailNoMemory;
77  }
78  CopySid(SidLen,
79  ClientCtx->UserSid,
80  UserSid);
81 
82  ClientCtx->AuthzResourceManager = AuthzResourceManager;
83  ClientCtx->Luid = Identifier;
84  ClientCtx->ExpirationTime.QuadPart = (pExpirationTime != NULL ? pExpirationTime->QuadPart : 0);
85  ClientCtx->ServerContext = NULL; /* FIXME */
86  ClientCtx->DynamicGroupArgs = DynamicGroupArgs;
87 
88  /* return the client context handle */
89  *pAuthzClientContext = (AUTHZ_CLIENT_CONTEXT_HANDLE)ClientCtx;
90  Ret = TRUE;
91  }
92  else
93  {
94 FailNoMemory:
96  }
97  }
98  else
100 
101  return Ret;
102 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
AUTHZ_RESOURCE_MANAGER_HANDLE AuthzResourceManager
Definition: precomp.h:56
LARGE_INTEGER ExpirationTime
Definition: precomp.h:58
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define FALSE
Definition: types.h:117
HANDLE AUTHZ_CLIENT_CONTEXT_HANDLE
Definition: authz.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID DynamicGroupArgs
Definition: precomp.h:60
#define AUTHZ_REQUIRE_S4U_LOGON
Definition: authz.h:36
struct _AUTHZ_CLIENT_CONTEXT * PAUTHZ_CLIENT_CONTEXT
#define LMEM_FIXED
Definition: winbase.h:365
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:921
#define VALIDATE_RESMAN_HANDLE(handle)
Definition: precomp.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
struct _SID * PSID
Definition: eventlog.c:35
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define AUTHZ_SKIP_TOKEN_GROUPS
Definition: authz.h:35
AUTHZ_CLIENT_CONTEXT_HANDLE ServerContext
Definition: precomp.h:59
#define NULL
Definition: types.h:112
BOOL WINAPI IsValidSid(PSID pSid)
Definition: security.c:821
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
Definition: security.c:714
LONGLONG QuadPart
Definition: typedefs.h:114