[6/7] server: default_set_sd is used during object creation, however the "current" thread might be unset in some cases, check if a current thread exists before using it.
Joris van der Wel
joris at jorisvanderwel.com
Thu Jun 26 15:08:10 CDT 2014
server: default_set_sd is used during object creation, however the
"current" thread might be unset in some cases, check if a current thread
exists before using it.
Note: this issue does not trigger at the moment because creating an object
with a NULL sd does not call this method (see next commit)
---
server/object.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140626/fab1c4cf/attachment.html>
-------------- next part --------------
From d206f5ab24c1683c2f5795482a532a2585529e75 Mon Sep 17 00:00:00 2001
From: Joris van der Wel <joris at jorisvanderwel.com>
Date: Thu, 26 Jun 2014 21:54:49 +0200
Subject: =?UTF-8?q?server:=20default=5Fset=5Fsd=20is=20used=20during=20obj?=
=?UTF-8?q?ect=20creation,=20however=20the=20"current"=20thread=20might=20?=
=?UTF-8?q?be=20unset=20in=20some=20cases,=20check=20if=20a=20current=20th?=
=?UTF-8?q?read=20exists=20before=20using=20it.=0ANote:=20this=20issue=20d?=
=?UTF-8?q?oes=20not=20trigger=20at=20the=20moment=20because=20creating=20?=
=?UTF-8?q?an=20object=20with=20a=20NULL=20sd=20does=20not=20call=20this?=
=?UTF-8?q?=20method=20(see=20next=20commit)?=
---
server/object.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/server/object.c b/server/object.c
index d13ca09..ad52b4d 100644
--- a/server/object.c
+++ b/server/object.c
@@ -431,6 +431,7 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
const SID *owner, *group;
const ACL *sacl, *dacl;
char *ptr;
+ struct token *token = current ? current->process->token : NULL;
if (!set_info) return 1;
@@ -449,9 +450,9 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
{
new_sd.owner_len = obj->sd->owner_len;
}
- else
+ else if (token)
{
- owner = token_get_user( current->process->token );
+ owner = token_get_user( token );
new_sd.owner_len = security_sid_len( owner );
}
}
@@ -468,9 +469,9 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
{
new_sd.group_len = obj->sd->group_len;
}
- else
+ else if (token)
{
- group = token_get_primary_group( current->process->token );
+ group = token_get_primary_group( token );
new_sd.group_len = security_sid_len( group );
}
}
@@ -505,9 +506,9 @@ int default_set_sd( struct object *obj, const struct security_descriptor *sd,
if (present)
new_sd.dacl_len = obj->sd->dacl_len;
- else
+ else if (token)
{
- dacl = token_get_default_dacl( current->process->token );
+ dacl = token_get_default_dacl( token );
new_sd.dacl_len = dacl->AclSize;
}
}
--
1.8.1.msysgit.1
More information about the wine-patches
mailing list