/* Do the permissions allow some operation? Assumes statcache already set. */
#ifndef VMS /* VMS' cando is in vms.c */
I32
-Perl_cando(pTHX_ I32 bit, I32 effective, register struct stat *statbufp)
+Perl_cando(pTHX_ I32 bit, Uid_t effective, register struct stat *statbufp)
+/* Note: we use `effective' both for uids and gids. */
{
#ifdef DOSISH
/* [Comments and code from Len Reed]
if (statbufp->st_mode & bit)
return TRUE; /* ok as "user" */
}
- else if (ingroup((I32)statbufp->st_gid,effective)) {
+ else if (ingroup(statbufp->st_gid,effective)) {
if (statbufp->st_mode & bit >> 3)
return TRUE; /* ok as "group" */
}
}
#endif /* ! VMS */
-I32
-Perl_ingroup(pTHX_ I32 testgid, I32 effective)
+bool
+Perl_ingroup(pTHX_ Gid_t testgid, Uid_t effective)
{
if (testgid == (effective ? PL_egid : PL_gid))
return TRUE;
p |int |block_start |int full
p |void |boot_core_UNIVERSAL
p |void |call_list |I32 oldscope|AV* av_list
-p |I32 |cando |I32 bit|I32 effective|Stat_t* statbufp
+p |I32 |cando |I32 bit|Uid_t effective|Stat_t* statbufp
p |U32 |cast_ulong |NV f
p |I32 |cast_i32 |NV f
p |IV |cast_iv |NV f
p |void |hv_undef |HV* tb
p |I32 |ibcmp |const char* a|const char* b|I32 len
p |I32 |ibcmp_locale |const char* a|const char* b|I32 len
-p |I32 |ingroup |I32 testgid|I32 effective
+p |bool |ingroup |Gid_t testgid|Uid_t effective
p |void |init_debugger
p |void |init_stacks
p |U32 |intro_my
PERLVAR(Istrtab_mutex, perl_mutex) /* Mutex for string table access */
#endif /* USE_THREADS */
-PERLVAR(Iuid, int) /* current real user id */
-PERLVAR(Ieuid, int) /* current effective user id */
-PERLVAR(Igid, int) /* current real group id */
-PERLVAR(Iegid, int) /* current effective group id */
+PERLVAR(Iuid, Uid_t) /* current real user id */
+PERLVAR(Ieuid, Uid_t) /* current effective user id */
+PERLVAR(Igid, Gid_t) /* current real group id */
+PERLVAR(Iegid, Gid_t) /* current effective group id */
PERLVAR(Inomemok, bool) /* let malloc context handle nomem */
PERLVAR(Ian, U32) /* malloc sequence number */
PERLVAR(Icop_seqmax, U32) /* statement sequence number */
if (PL_uid == PL_euid) /* special case $< = $> */
(void)PerlProc_setuid(PL_uid);
else {
- PL_uid = (I32)PerlProc_getuid();
+ PL_uid = PerlProc_getuid();
Perl_croak(aTHX_ "setruid() not implemented");
}
#endif
#endif
#endif
- PL_uid = (I32)PerlProc_getuid();
+ PL_uid = PerlProc_getuid();
PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case '>':
if (PL_euid == PL_uid) /* special case $> = $< */
PerlProc_setuid(PL_euid);
else {
- PL_euid = (I32)PerlProc_geteuid();
+ PL_euid = rlProc_geteuid();
Perl_croak(aTHX_ "seteuid() not implemented");
}
#endif
#endif
#endif
- PL_euid = (I32)PerlProc_geteuid();
+ PL_euid = PerlProc_geteuid();
PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case '(':
if (PL_gid == PL_egid) /* special case $( = $) */
(void)PerlProc_setgid(PL_gid);
else {
- PL_gid = (I32)PerlProc_getgid();
+ PL_gid = PerlProc_getgid();
Perl_croak(aTHX_ "setrgid() not implemented");
}
#endif
#endif
#endif
- PL_gid = (I32)PerlProc_getgid();
+ PL_gid = PerlProc_getgid();
PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case ')':
if (PL_egid == PL_gid) /* special case $) = $( */
(void)PerlProc_setgid(PL_egid);
else {
- PL_egid = (I32)PerlProc_getegid();
+ PL_egid = PerlProc_getegid();
Perl_croak(aTHX_ "setegid() not implemented");
}
#endif
#endif
#endif
- PL_egid = (I32)PerlProc_getegid();
+ PL_egid = PerlProc_getegid();
PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case ':':
STATIC void
S_init_ids(pTHX)
{
- PL_uid = (int)PerlProc_getuid();
- PL_euid = (int)PerlProc_geteuid();
- PL_gid = (int)PerlProc_getgid();
- PL_egid = (int)PerlProc_getegid();
+ PL_uid = PerlProc_getuid();
+ PL_euid = PerlProc_geteuid();
+ PL_gid = PerlProc_getgid();
+ PL_egid = PerlProc_getegid();
#ifdef VMS
PL_uid |= PL_gid << 16;
PL_euid |= PL_egid << 16;
#undef Perl_cando
I32
-Perl_cando(pTHXo_ I32 bit, I32 effective, Stat_t* statbufp)
+Perl_cando(pTHXo_ I32 bit, Uid_t effective, Stat_t* statbufp)
{
return ((CPerlObj*)pPerl)->Perl_cando(bit, effective, statbufp);
}
}
#undef Perl_ingroup
-I32
-Perl_ingroup(pTHXo_ I32 testgid, I32 effective)
+bool
+Perl_ingroup(pTHXo_ Gid_t testgid, Uid_t effective)
{
return ((CPerlObj*)pPerl)->Perl_ingroup(testgid, effective);
}
}
# endif /* HAS_SETREUID */
#endif /* HAS_SETRESUID */
- PL_uid = (int)PerlProc_getuid();
- PL_euid = (int)PerlProc_geteuid();
+ PL_uid = PerlProc_getuid();
+ PL_euid = PerlProc_geteuid();
}
if (PL_delaymagic & DM_GID) {
#ifdef HAS_SETRESGID
}
# endif /* HAS_SETREGID */
#endif /* HAS_SETRESGID */
- PL_gid = (int)PerlProc_getgid();
- PL_egid = (int)PerlProc_getegid();
+ PL_gid = PerlProc_getgid();
+ PL_egid = PerlProc_getegid();
}
PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
}
VIRTUAL int Perl_block_start(pTHX_ int full);
VIRTUAL void Perl_boot_core_UNIVERSAL(pTHX);
VIRTUAL void Perl_call_list(pTHX_ I32 oldscope, AV* av_list);
-VIRTUAL I32 Perl_cando(pTHX_ I32 bit, I32 effective, Stat_t* statbufp);
+VIRTUAL I32 Perl_cando(pTHX_ I32 bit, Uid_t effective, Stat_t* statbufp);
VIRTUAL U32 Perl_cast_ulong(pTHX_ NV f);
VIRTUAL I32 Perl_cast_i32(pTHX_ NV f);
VIRTUAL IV Perl_cast_iv(pTHX_ NV f);
VIRTUAL void Perl_hv_undef(pTHX_ HV* tb);
VIRTUAL I32 Perl_ibcmp(pTHX_ const char* a, const char* b, I32 len);
VIRTUAL I32 Perl_ibcmp_locale(pTHX_ const char* a, const char* b, I32 len);
-VIRTUAL I32 Perl_ingroup(pTHX_ I32 testgid, I32 effective);
+VIRTUAL bool Perl_ingroup(pTHX_ Gid_t testgid, Uid_t effective);
VIRTUAL void Perl_init_debugger(pTHX);
VIRTUAL void Perl_init_stacks(pTHX);
VIRTUAL U32 Perl_intro_my(pTHX);
STATIC regnode* S_reganode(pTHX_ U8, U32);
STATIC regnode* S_regatom(pTHX_ I32 *);
STATIC regnode* S_regbranch(pTHX_ I32 *, I32);
-STATIC void S_regc(pTHX_ U8, char *);
STATIC void S_reguni(pTHX_ UV, char *, I32*);
STATIC regnode* S_regclass(pTHX);
STATIC regnode* S_regclassutf8(pTHX);