Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
df689d74
Commit
df689d74
authored
25 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Added a few comments.
Rev: src/security.c:1.16
parent
8933fbca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/security.c
+24
-4
24 additions, 4 deletions
src/security.c
with
24 additions
and
4 deletions
src/security.c
+
24
−
4
View file @
df689d74
...
...
@@ -32,6 +32,7 @@ static int valid_creds_object(struct object *o)
OBJ2CREDS
(
o
)
->
user
;
}
/* mixed call_with_creds(object(Creds) creds, mixed func, mixed ... args) */
static
void
f_call_with_creds
(
INT32
args
)
{
struct
object
*
o
;
...
...
@@ -40,7 +41,14 @@ static void f_call_with_creds(INT32 args)
{
case
T_INT
:
/* We might want allocate a bit for this so that we can
* disallow this
* disallow this.
* /hubbe
*
* YES, since if call_with_creds() is called from an object
* with NULL creds, you get back all permissions!
* Hmm, maybe it should only be allowed if current_object->prot
* is not NULL?
* /grubba 1999-07-07
*/
o
=
fp
->
current_object
->
prot
;
break
;
...
...
@@ -68,6 +76,7 @@ static void f_call_with_creds(INT32 args)
sp
--
;
}
/* object(Creds) get_current_creds() */
static
void
f_get_current_creds
(
INT32
args
)
{
pop_n_elems
(
args
);
...
...
@@ -80,6 +89,8 @@ static void f_get_current_creds(INT32 args)
/* Should be no need for special security for these. obj->creds
* should say what we can do with it.
*/
/* object(Creds) creds->get_default_creds() */
static
void
get_default_creds
(
INT32
args
)
{
pop_n_elems
(
args
);
...
...
@@ -89,12 +100,14 @@ static void get_default_creds(INT32 args)
push_int
(
0
);
}
/* void creds->set_default_creds(object(Creds) creds) */
static
void
set_default_creds
(
INT32
args
)
{
struct
object
*
o
;
INT_TYPE
may
,
data
;
CHECK_SECURITY_OR_ERROR
(
SECURITY_BIT_SECURITY
,
(
"set_default_creds: permission denied.
\n
"
));
CHECK_SECURITY_OR_ERROR
(
SECURITY_BIT_SECURITY
,
(
"set_default_creds: permission denied.
\n
"
));
get_all_args
(
"init_creds"
,
args
,
"%o"
,
&
o
);
...
...
@@ -103,12 +116,14 @@ static void set_default_creds(INT32 args)
pop_n_elems
(
args
);
}
/* void creds->create(object user, int allow_bits, int data_bits) */
static
void
creds_create
(
INT32
args
)
{
struct
object
*
o
;
INT_TYPE
may
,
data
;
CHECK_SECURITY_OR_ERROR
(
SECURITY_BIT_SECURITY
,
(
"creds_create: permission denied.
\n
"
));
CHECK_SECURITY_OR_ERROR
(
SECURITY_BIT_SECURITY
,
(
"creds_create: permission denied.
\n
"
));
get_all_args
(
"init_creds"
,
args
,
"%o%i%i"
,
&
o
,
&
may
,
&
data
);
if
(
THIS
->
user
)
...
...
@@ -120,6 +135,7 @@ static void creds_create(INT32 args)
pop_n_elems
(
args
);
}
/* object creds->get_user() */
static
void
creds_get_user
(
INT32
args
)
{
pop_n_elems
(
args
);
...
...
@@ -129,18 +145,21 @@ static void creds_get_user(INT32 args)
push_int
(
0
);
}
/* int creds->get_allow_bits() */
static
void
creds_get_allow_bits
(
INT32
args
)
{
pop_n_elems
(
args
);
push_int
(
THIS
->
may_always
);
}
/* int creds->get_data_bits() */
static
void
creds_get_data_bits
(
INT32
args
)
{
pop_n_elems
(
args
);
push_int
(
THIS
->
data_bits
);
}
/* void creds->apply(object|program|function|array|mapping|multiset o) */
static
void
creds_apply
(
INT32
args
)
{
if
(
args
<
0
||
sp
[
-
args
].
type
>
MAX_COMPLEX
)
...
...
@@ -159,6 +178,7 @@ static void creds_apply(INT32 args)
pop_n_elems
(
args
);
}
/* object(Creds) get_object_creds(object|program|function|array|mapping|multiset o) */
static
void
f_get_object_creds
(
INT32
args
)
{
struct
object
*
o
;
...
...
@@ -250,7 +270,7 @@ void init_pike_security(void)
/* function(mixed:object) */
ADD_EFUN
(
"get_object_creds"
,
f_get_object_creds
,
tFunc
(
tMix
,
tObj
),
OPT_EXTERNAL_DEPEND
);
#define CONST(X) add_integer_constant("BIT_" #X,SECURITY_BIT_
##X
,0)
#define CONST(X) add_integer_constant("BIT_" #X,
PIKE_CONCAT(
SECURITY_BIT_
,X)
,0)
CONST
(
INDEX
);
CONST
(
SET_INDEX
);
CONST
(
CALL
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment