Commit 7d732267 authored by Alexandre Julliard's avatar Alexandre Julliard

server: Define a server-side structure for LUID_AND_ATTRIBUTES.

parent 83064d15
......@@ -364,11 +364,17 @@ struct filesystem_event
char name[1];
};
typedef struct
struct luid
{
unsigned int low_part;
int high_part;
} luid_t;
};
struct luid_attr
{
struct luid luid;
unsigned int attrs;
};
typedef struct
{
......@@ -4331,13 +4337,13 @@ struct adjust_token_privileges_request
obj_handle_t handle;
int disable_all;
int get_modified_state;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
};
struct adjust_token_privileges_reply
{
struct reply_header __header;
unsigned int len;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
char __pad_12[4];
};
......@@ -4351,7 +4357,7 @@ struct get_token_privileges_reply
{
struct reply_header __header;
unsigned int len;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
char __pad_12[4];
};
......@@ -4361,14 +4367,14 @@ struct check_token_privileges_request
struct request_header __header;
obj_handle_t handle;
int all_required;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
char __pad_20[4];
};
struct check_token_privileges_reply
{
struct reply_header __header;
int has_privileges;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
char __pad_12[4];
};
......@@ -4395,7 +4401,7 @@ struct filter_token_request
obj_handle_t handle;
unsigned int flags;
data_size_t privileges_size;
/* VARARG(privileges,LUID_AND_ATTRIBUTES,privileges_size); */
/* VARARG(privileges,luid_attr,privileges_size); */
/* VARARG(disable_sids,SID); */
};
struct filter_token_reply
......@@ -4420,7 +4426,7 @@ struct access_check_reply
unsigned int access_granted;
unsigned int access_status;
unsigned int privileges_len;
/* VARARG(privileges,LUID_AND_ATTRIBUTES); */
/* VARARG(privileges,luid_attr); */
char __pad_20[4];
};
......@@ -4732,7 +4738,7 @@ struct allocate_locally_unique_id_request
struct allocate_locally_unique_id_reply
{
struct reply_header __header;
luid_t luid;
struct luid luid;
};
......@@ -4904,8 +4910,8 @@ struct get_token_info_request
struct get_token_info_reply
{
struct reply_header __header;
luid_t token_id;
luid_t modified_id;
struct luid token_id;
struct luid modified_id;
unsigned int session_id;
int primary;
int impersonation_level;
......@@ -6246,7 +6252,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 739
#define SERVER_PROTOCOL_VERSION 740
/* ### protocol_version end ### */
......
......@@ -380,11 +380,17 @@ struct filesystem_event
char name[1];
};
typedef struct
struct luid
{
unsigned int low_part;
int high_part;
} luid_t;
};
struct luid_attr
{
struct luid luid;
unsigned int attrs;
};
typedef struct
{
......@@ -3084,10 +3090,10 @@ enum caret_state
obj_handle_t handle; /* handle to the token */
int disable_all; /* disable all privileges? */
int get_modified_state; /* get modified privileges? */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to enable/disable/remove */
VARARG(privileges,luid_attr); /* privileges to enable/disable/remove */
@REPLY
unsigned int len; /* total length in bytes required to store token privileges */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* modified privileges */
VARARG(privileges,luid_attr); /* modified privileges */
@END
/* Retrieves the set of privileges held by or available to a token */
......@@ -3095,17 +3101,17 @@ enum caret_state
obj_handle_t handle; /* handle to the token */
@REPLY
unsigned int len; /* total length in bytes required to store token privileges */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
VARARG(privileges,luid_attr); /* privileges held by or available to a token */
@END
/* Check the token has the required privileges */
@REQ(check_token_privileges)
obj_handle_t handle; /* handle to the token */
int all_required; /* are all the privileges required for the check to succeed? */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to check */
VARARG(privileges,luid_attr); /* privileges to check */
@REPLY
int has_privileges; /* does the token have the required privileges? */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
VARARG(privileges,luid_attr); /* privileges held by or available to a token */
@END
@REQ(duplicate_token)
......@@ -3122,7 +3128,7 @@ enum caret_state
obj_handle_t handle; /* handle to the token to duplicate */
unsigned int flags; /* flags */
data_size_t privileges_size; /* size of privileges */
VARARG(privileges,LUID_AND_ATTRIBUTES,privileges_size); /* privileges to remove from new token */
VARARG(privileges,luid_attr,privileges_size); /* privileges to remove from new token */
VARARG(disable_sids,SID); /* array of groups to remove from new token */
@REPLY
obj_handle_t new_handle; /* filtered handle */
......@@ -3137,7 +3143,7 @@ enum caret_state
unsigned int access_granted; /* access rights actually granted */
unsigned int access_status; /* was access granted? */
unsigned int privileges_len; /* length needed to store privileges */
VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges used during access check */
VARARG(privileges,luid_attr); /* privileges used during access check */
@END
@REQ(get_token_sid)
......@@ -3321,7 +3327,7 @@ struct handle_info
/* Allocate a locally-unique identifier */
@REQ(allocate_locally_unique_id)
@REPLY
luid_t luid;
struct luid luid;
@END
......@@ -3423,8 +3429,8 @@ struct handle_info
@REQ(get_token_info)
obj_handle_t handle; /* handle to the object */
@REPLY
luid_t token_id; /* locally-unique identifier of the token */
luid_t modified_id; /* locally-unique identifier of the modified version of the token */
struct luid token_id; /* locally-unique identifier of the token */
struct luid modified_id; /* locally-unique identifier of the modified version of the token */
unsigned int session_id; /* token session id */
int primary; /* is the token primary or impersonation? */
int impersonation_level; /* level of impersonation */
......
......@@ -2303,7 +2303,7 @@ DECL_HANDLER(load_registry)
if (!objattr) return;
if (!thread_single_check_privilege( current, &SeRestorePrivilege ))
if (!thread_single_check_privilege( current, SeRestorePrivilege ))
{
set_error( STATUS_PRIVILEGE_NOT_HELD );
return;
......@@ -2334,7 +2334,7 @@ DECL_HANDLER(unload_registry)
struct unicode_str name;
unsigned int access = 0;
if (!thread_single_check_privilege( current, &SeRestorePrivilege ))
if (!thread_single_check_privilege( current, SeRestorePrivilege ))
{
set_error( STATUS_PRIVILEGE_NOT_HELD );
return;
......@@ -2362,7 +2362,7 @@ DECL_HANDLER(save_registry)
{
struct key *key;
if (!thread_single_check_privilege( current, &SeBackupPrivilege ))
if (!thread_single_check_privilege( current, SeBackupPrivilege ))
{
set_error( STATUS_PRIVILEGE_NOT_HELD );
return;
......
......@@ -692,13 +692,13 @@ C_ASSERT( sizeof(int) == 4 );
C_ASSERT( sizeof(ioctl_code_t) == 4 );
C_ASSERT( sizeof(irp_params_t) == 32 );
C_ASSERT( sizeof(lparam_t) == 8 );
C_ASSERT( sizeof(luid_t) == 8 );
C_ASSERT( sizeof(mem_size_t) == 8 );
C_ASSERT( sizeof(mod_handle_t) == 8 );
C_ASSERT( sizeof(obj_handle_t) == 4 );
C_ASSERT( sizeof(process_id_t) == 4 );
C_ASSERT( sizeof(rectangle_t) == 16 );
C_ASSERT( sizeof(short int) == 2 );
C_ASSERT( sizeof(struct luid) == 8 );
C_ASSERT( sizeof(thread_id_t) == 4 );
C_ASSERT( sizeof(timeout_t) == 8 );
C_ASSERT( sizeof(unsigned char) == 1 );
......
......@@ -23,26 +23,26 @@
#include <sys/types.h>
extern const LUID SeIncreaseQuotaPrivilege;
extern const LUID SeSecurityPrivilege;
extern const LUID SeTakeOwnershipPrivilege;
extern const LUID SeLoadDriverPrivilege;
extern const LUID SeSystemProfilePrivilege;
extern const LUID SeSystemtimePrivilege;
extern const LUID SeProfileSingleProcessPrivilege;
extern const LUID SeIncreaseBasePriorityPrivilege;
extern const LUID SeCreatePagefilePrivilege;
extern const LUID SeBackupPrivilege;
extern const LUID SeRestorePrivilege;
extern const LUID SeShutdownPrivilege;
extern const LUID SeDebugPrivilege;
extern const LUID SeSystemEnvironmentPrivilege;
extern const LUID SeChangeNotifyPrivilege;
extern const LUID SeRemoteShutdownPrivilege;
extern const LUID SeUndockPrivilege;
extern const LUID SeManageVolumePrivilege;
extern const LUID SeImpersonatePrivilege;
extern const LUID SeCreateGlobalPrivilege;
extern const struct luid SeIncreaseQuotaPrivilege;
extern const struct luid SeSecurityPrivilege;
extern const struct luid SeTakeOwnershipPrivilege;
extern const struct luid SeLoadDriverPrivilege;
extern const struct luid SeSystemProfilePrivilege;
extern const struct luid SeSystemtimePrivilege;
extern const struct luid SeProfileSingleProcessPrivilege;
extern const struct luid SeIncreaseBasePriorityPrivilege;
extern const struct luid SeCreatePagefilePrivilege;
extern const struct luid SeBackupPrivilege;
extern const struct luid SeRestorePrivilege;
extern const struct luid SeShutdownPrivilege;
extern const struct luid SeDebugPrivilege;
extern const struct luid SeSystemEnvironmentPrivilege;
extern const struct luid SeChangeNotifyPrivilege;
extern const struct luid SeRemoteShutdownPrivilege;
extern const struct luid SeUndockPrivilege;
extern const struct luid SeManageVolumePrivilege;
extern const struct luid SeImpersonatePrivilege;
extern const struct luid SeCreateGlobalPrivilege;
extern const PSID security_world_sid;
extern const PSID security_local_user_sid;
......@@ -60,11 +60,11 @@ extern struct token *token_create_admin( unsigned primary, int impersonation_lev
extern int token_assign_label( struct token *token, PSID label );
extern struct token *token_duplicate( struct token *src_token, unsigned primary,
int impersonation_level, const struct security_descriptor *sd,
const LUID_AND_ATTRIBUTES *remove_privs, unsigned int remove_priv_count,
const struct luid_attr *remove_privs, unsigned int remove_priv_count,
const SID *remove_groups, unsigned int remove_group_count );
extern int token_check_privileges( struct token *token, int all_required,
const LUID_AND_ATTRIBUTES *reqprivs,
unsigned int count, LUID_AND_ATTRIBUTES *usedprivs);
const struct luid_attr *reqprivs,
unsigned int count, struct luid_attr *usedprivs );
extern const ACL *token_get_default_dacl( struct token *token );
extern const SID *token_get_user( struct token *token );
extern const SID *token_get_primary_group( struct token *token );
......@@ -91,10 +91,10 @@ extern void security_set_thread_token( struct thread *thread, obj_handle_t handl
extern const SID *security_unix_uid_to_sid( uid_t uid );
extern int check_object_access( struct token *token, struct object *obj, unsigned int *access );
static inline int thread_single_check_privilege( struct thread *thread, const LUID *priv)
static inline int thread_single_check_privilege( struct thread *thread, struct luid priv )
{
struct token *token = thread_get_impersonation_token( thread );
const LUID_AND_ATTRIBUTES privs = { *priv, 0 };
const struct luid_attr privs = { priv, 0 };
if (!token) return FALSE;
......
......@@ -457,7 +457,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
}
}
static void dump_luid( const char *prefix, const luid_t *luid )
static void dump_luid( const char *prefix, const struct luid *luid )
{
fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part );
}
......@@ -999,16 +999,15 @@ static void dump_varargs_properties( const char *prefix, data_size_t size )
remove_data( size );
}
static void dump_varargs_LUID_AND_ATTRIBUTES( const char *prefix, data_size_t size )
static void dump_varargs_luid_attr( const char *prefix, data_size_t size )
{
const LUID_AND_ATTRIBUTES *lat = cur_data;
const struct luid_attr *lat = cur_data;
data_size_t len = size / sizeof(*lat);
fprintf( stderr,"%s{", prefix );
while (len > 0)
{
fprintf( stderr, "{luid=%08x%08x,attr=%x}",
lat->Luid.HighPart, lat->Luid.LowPart, lat->Attributes );
fprintf( stderr, "{luid=%08x%08x,attrs=%x}", lat->luid.high_part, lat->luid.low_part, lat->attrs );
lat++;
if (--len) fputc( ',', stderr );
}
......@@ -3807,13 +3806,13 @@ static void dump_adjust_token_privileges_request( const struct adjust_token_priv
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", disable_all=%d", req->disable_all );
fprintf( stderr, ", get_modified_state=%d", req->get_modified_state );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_adjust_token_privileges_reply( const struct adjust_token_privileges_reply *req )
{
fprintf( stderr, " len=%08x", req->len );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_get_token_privileges_request( const struct get_token_privileges_request *req )
......@@ -3824,20 +3823,20 @@ static void dump_get_token_privileges_request( const struct get_token_privileges
static void dump_get_token_privileges_reply( const struct get_token_privileges_reply *req )
{
fprintf( stderr, " len=%08x", req->len );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_check_token_privileges_request( const struct check_token_privileges_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", all_required=%d", req->all_required );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_check_token_privileges_reply( const struct check_token_privileges_reply *req )
{
fprintf( stderr, " has_privileges=%d", req->has_privileges );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_duplicate_token_request( const struct duplicate_token_request *req )
......@@ -3859,7 +3858,7 @@ static void dump_filter_token_request( const struct filter_token_request *req )
fprintf( stderr, " handle=%04x", req->handle );
fprintf( stderr, ", flags=%08x", req->flags );
fprintf( stderr, ", privileges_size=%u", req->privileges_size );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", min(cur_size,req->privileges_size) );
dump_varargs_luid_attr( ", privileges=", min(cur_size,req->privileges_size) );
dump_varargs_SID( ", disable_sids=", cur_size );
}
......@@ -3881,7 +3880,7 @@ static void dump_access_check_reply( const struct access_check_reply *req )
fprintf( stderr, " access_granted=%08x", req->access_granted );
fprintf( stderr, ", access_status=%08x", req->access_status );
fprintf( stderr, ", privileges_len=%08x", req->privileges_len );
dump_varargs_LUID_AND_ATTRIBUTES( ", privileges=", cur_size );
dump_varargs_luid_attr( ", privileges=", cur_size );
}
static void dump_get_token_sid_request( const struct get_token_sid_request *req )
......
......@@ -49,7 +49,7 @@ my %formats =
"apc_result_t" => [ 40, 8, "&dump_apc_result" ],
"async_data_t" => [ 40, 8, "&dump_async_data" ],
"irp_params_t" => [ 32, 8, "&dump_irp_params" ],
"luid_t" => [ 8, 4, "&dump_luid" ],
"struct luid" => [ 8, 4, "&dump_luid" ],
"generic_map_t" => [ 16, 4, "&dump_generic_map" ],
"ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ],
"hw_input_t" => [ 40, 8, "&dump_hw_input" ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment