diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-10-26 13:40:18 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-10-26 13:40:18 +0000 |
commit | e688b2318033d7cc179bac591999729a37bf7138 (patch) | |
tree | a8615311fad5e9cd026081310ba262dc6d3a5c0e | |
parent | 0617aed7fc09c616342e9b0d35b7881d7c1472b1 (diff) | |
download | perl-e688b2318033d7cc179bac591999729a37bf7138.tar.gz |
Revert #4457 for more investigation.
p4raw-id: //depot/cfgperl@4460
-rwxr-xr-x | Configure | 8 | ||||
-rw-r--r-- | Porting/Glossary | 5 | ||||
-rw-r--r-- | Porting/config.sh | 5 | ||||
-rw-r--r-- | Porting/config_H | 8 | ||||
-rw-r--r-- | config_h.SH | 6 | ||||
-rw-r--r-- | embed.h | 8 | ||||
-rwxr-xr-x | embed.pl | 2 | ||||
-rw-r--r-- | perl.c | 53 | ||||
-rw-r--r-- | perl.h | 13 | ||||
-rw-r--r-- | pod/perldiag.pod | 6 | ||||
-rw-r--r-- | proto.h | 2 |
11 files changed, 41 insertions, 75 deletions
@@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Tue Oct 26 13:10:37 EET DST 1999 [metaconfig 3.0 PL70] +# Generated on Tue Oct 26 16:44:39 EET DST 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <<EOF @@ -370,7 +370,6 @@ d_phostname='' d_uname='' d_gethostprotos='' d_getlogin='' -d_getmnt='' d_getmntent='' d_getnbyaddr='' d_getnbyname='' @@ -8829,10 +8828,6 @@ eval $hasproto set getlogin d_getlogin eval $inlibc -: see if getmnt exists -set getmnt d_getmnt -eval $inlibc - : see if getmntent exists set getmntent d_getmntent eval $inlibc @@ -13606,7 +13601,6 @@ d_gethent='$d_gethent' d_gethname='$d_gethname' d_gethostprotos='$d_gethostprotos' d_getlogin='$d_getlogin' -d_getmnt='$d_getmnt' d_getmntent='$d_getmntent' d_getnbyaddr='$d_getnbyaddr' d_getnbyname='$d_getnbyname' diff --git a/Porting/Glossary b/Porting/Glossary index cff07b7851..876bfe937e 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -608,11 +608,6 @@ d_getlogin (d_getlogin.U): indicates to the C program that the getlogin() routine is available to get the login name. -d_getmnt (d_getmnt.U): - This variable conditionally defines the HAS_GETMNT symbol, which - indicates to the C program that the getmnt() routine is available - to retrieve one or more mount info blocks by filename. - d_getmntent (d_getmntent.U): This variable conditionally defines the HAS_GETMNTENT symbol, which indicates to the C program that the getmntent() routine is available diff --git a/Porting/config.sh b/Porting/config.sh index 6b8301cbf2..f3c46a27e8 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : . -# Configuration time: Tue Oct 26 13:20:35 EET DST 1999 +# Configuration time: Tue Oct 26 16:45:55 EET DST 1999 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -56,7 +56,7 @@ ccflags='-pthread -std -DLANGUAGE_C' ccsymbols='__LANGUAGE_C__=1 _LONGLONG=1 LANGUAGE_C=1 SYSTYPE_BSD=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Tue Oct 26 13:20:35 EET DST 1999' +cf_time='Tue Oct 26 16:45:55 EET DST 1999' chgrp='' chmod='' chown='' @@ -162,7 +162,6 @@ d_gethent='define' d_gethname='define' d_gethostprotos='define' d_getlogin='define' -d_getmnt='undef' d_getmntent='undef' d_getnbyaddr='define' d_getnbyname='define' diff --git a/Porting/config_H b/Porting/config_H index 710fa8fa56..345ec01318 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : . - * Configuration time: Tue Oct 26 13:20:35 EET DST 1999 + * Configuration time: Tue Oct 26 16:45:55 EET DST 1999 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -2190,12 +2190,6 @@ */ /*#define HAS_FTELLO / **/ -/* HAS_GETMNT: - * This symbol, if defined, indicates that the getmnt routine is - * available to get filesystem mount info by filename. - */ -/*#define HAS_GETMNT / **/ - /* HAS_GETMNTENT: * This symbol, if defined, indicates that the getmntent routine is * available to iterate through mounted file systems to get their info. diff --git a/config_h.SH b/config_h.SH index 2e87836c41..a0be5e36a5 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2204,12 +2204,6 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_ftello HAS_FTELLO /**/ -/* HAS_GETMNT: - * This symbol, if defined, indicates that the getmnt routine is - * available to get filesystem mount info by filename. - */ -#$d_getmnt HAS_GETMNT /**/ - /* HAS_GETMNTENT: * This symbol, if defined, indicates that the getmntent routine is * available to iterate through mounted file systems to get their info. @@ -841,7 +841,7 @@ #define usage S_usage #define validate_suid S_validate_suid # if defined(IAMSUID) -#define file_on_nosuid_fs S_file_on_nosuid_fs +#define fd_on_nosuid_fs S_fd_on_nosuid_fs # endif #define parse_body S_parse_body #define run_body S_run_body @@ -2193,7 +2193,7 @@ #define usage(a) S_usage(aTHX_ a) #define validate_suid(a,b,c) S_validate_suid(aTHX_ a,b,c) # if defined(IAMSUID) -#define file_on_nosuid_fs(a,b) S_file_on_nosuid_fs(aTHX_ a,b) +#define fd_on_nosuid_fs(a) S_fd_on_nosuid_fs(aTHX_ a) # endif #define parse_body(a) S_parse_body(aTHX_ a) #define run_body(a) S_run_body(aTHX_ a) @@ -4307,8 +4307,8 @@ #define S_validate_suid CPerlObj::S_validate_suid #define validate_suid S_validate_suid # if defined(IAMSUID) -#define S_file_on_nosuid_fs CPerlObj::S_file_on_nosuid_fs -#define file_on_nosuid_fs S_file_on_nosuid_fs +#define S_fd_on_nosuid_fs CPerlObj::S_fd_on_nosuid_fs +#define fd_on_nosuid_fs S_fd_on_nosuid_fs # endif #define S_parse_body CPerlObj::S_parse_body #define parse_body S_parse_body @@ -1860,7 +1860,7 @@ s |void |open_script |char *|bool|SV *|int *fd s |void |usage |char * s |void |validate_suid |char *|char*|int # if defined(IAMSUID) -s |int |file_on_nosuid_fs|int fd|char *path +s |int |fd_on_nosuid_fs|int fd # endif s |void* |parse_body |va_list args s |void* |run_body |va_list args @@ -2178,17 +2178,15 @@ sed %s -e \"/^[^#]/b\" \ #ifdef IAMSUID STATIC int -S_file_on_nosuid_fs(pTHX_ int fd, char *path) +S_fd_on_nosuid_fs(pTHX_ int fd) { int on_nosuid = 0; int check_okay = 0; /* - * Preferred order: fstatvfs(), fstatfs(), getmnt(), getmntent(). - * fstatvfs() is UNIX98 and uses the fd. - * fstatfs() is BSD 4.3+ and uses the fd. - * getmnt() is BSD 4.2 (4.1?) and uses the path. - * getmntent() is O(number-of-mounted-filesystems) and - * uses neither fd nor path and can hang. + * Preferred order: fstatvfs(), fstatfs(), getmntent(). + * fstatvfs() is UNIX98. + * fstatfs() is BSD. + * getmntent() is O(number-of-mounted-filesystems) and can hang. */ # ifdef HAS_FSTATVFS @@ -2196,18 +2194,22 @@ S_file_on_nosuid_fs(pTHX_ int fd, char *path) check_okay = fstatvfs(fd, &stfs) == 0; on_nosuid = check_okay && (stfs.f_flag & ST_NOSUID); # else -# ifdef PERL_MOUNT_NOSUID -# if defined(HAS_FSTATFS) && defined(HAS_STRUCT_STATFS_FLAGS) - struct statfs stfs; +# if defined(HAS_FSTATFS) && defined(HAS_STRUCT_STATFS_FLAGS) + struct statfs stfs; check_okay = fstatfs(fd, &stfs) == 0; +# undef PERL_MOUNT_NOSUID +# if !defined(PERL_MOUNT_NOSUID) && defined(MNT_NOSUID) +# define PERL_MOUNT_NOSUID MNT_NOSUID +# endif +# if !defined(PERL_MOUNT_NOSUID) && defined(MS_NOSUID) +# define PERL_MOUNT_NOSUID MS_NOSUID +# endif +# if !defined(PERL_MOUNT_NOSUID) && defined(M_NOSUID) +# define PERL_MOUNT_NOSUID M_NOSUID +# endif +# ifdef PERL_MOUNT_NOSUID on_nosuid = check_okay && (stfs.f_flags & PERL_MOUNT_NOSUID); -# else -# ifdef HAS_GETMNT - struct fs_data fsd; - check_okay = getmnt(0, &fsd, 0, NOSTAT_ONE, path) == 1; - on_nosuid = check_okay && (fsd.fd_req.flags & PERL_MOUNT_NOSUID); -# endif /* getmnt */ -# endif /* fstatfs */ +# endif # else # if defined(HAS_GETMNTENT) && defined(HAS_HASMNTOPT) && defined(MNTOPT_NOSUID) FILE *mtab = fopen("/etc/mtab", "r"); @@ -2215,24 +2217,25 @@ S_file_on_nosuid_fs(pTHX_ int fd, char *path) struct stat stb, fsb; if (mtab && (fstat(fd, &stb) == 0)) { - while ((entry = getmntent(mtab))) { - if (stat(entry->mnt_dir, &fsb) == 0 && fsb.st_dev == stb.st_dev) + while (entry = getmntent(mtab)) { + if (stat(entry->mnt_dir, &fsb) == 0 + && fsb.st_dev == stb.st_dev) { /* found the filesystem */ check_okay = 1; if (hasmntopt(entry, MNTOPT_NOSUID)) on_nosuid = 1; break; - } /* A single fs may well fail its stat(). Or hang :-( */ + } /* A single fs may well fail its stat(). */ } } if (mtab) fclose(mtab); -# endif /* getmntent */ -# endif /* PERL_MOUNT_NOSUID: fstatfs() or getmnt() */ -# endif /* fstatvfs */ +# endif /* mntent */ +# endif /* statfs */ +# endif /* statvfs */ if (!check_okay) - Perl_croak(aTHX_ "Can't check filesystem of script \"%s\" for nosuid", PL_origfilename); + Perl_croak(aTHX_ "Can't check filesystem of script \"%s\"", PL_origfilename); return on_nosuid; } #endif /* IAMSUID */ @@ -2306,7 +2309,7 @@ S_validate_suid(pTHX_ char *validarg, char *scriptname, int fdscript) if (PerlLIO_stat(SvPVX(GvSV(PL_curcop->cop_filegv)),&tmpstatbuf) < 0) Perl_croak(aTHX_ "Permission denied"); /* testing full pathname here */ #if defined(IAMSUID) && !defined(NO_NOSUID_CHECK) - if (file_on_nosuid_fs(PerlIO_fileno(PL_rsfp), scriptname)) + if (fd_on_nosuid_fs(PerlIO_fileno(PL_rsfp))) Perl_croak(aTHX_ "Permission denied"); #endif if (tmpstatbuf.st_dev != PL_statbuf.st_dev || @@ -3202,23 +3202,12 @@ typedef struct am_table_short AMTS; # include <sys/statvfs.h> /* for f?statvfs() */ #endif #ifdef I_SYS_MOUNT -# include <sys/mount.h> /* for *BSD f?statfs() or getmnt() */ +# include <sys/mount.h> /* for *BSD f?statfs() */ #endif #ifdef I_MNTENT # include <mntent.h> /* for getmntent() */ #endif -#undef PERL_MOUNT_NOSUID -#if !defined(PERL_MOUNT_NOSUID) && defined(MNT_NOSUID) -# define PERL_MOUNT_NOSUID MNT_NOSUID -#endif -#if !defined(PERL_MOUNT_NOSUID) && defined(MS_NOSUID) -# define PERL_MOUNT_NOSUID MS_NOSUID -#endif -#if !defined(PERL_MOUNT_NOSUID) && defined(M_NOSUID) -# define PERL_MOUNT_NOSUID M_NOSUID -#endif - #endif /* IAMSUID */ /* and finally... */ diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 3c0a212077..5b1c324a48 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -636,11 +636,9 @@ Something like this will reproduce the error: (F) You called C<perl -x/foo/bar>, but C</foo/bar> is not a directory that you can chdir to, possibly because it doesn't exist. -=item Can't check filesystem of script "%s" for nosuid +=item Can't check filesystem of script "%s" -(P) For some reason you can't check the filesystem of the script for nosuid -(whether the filesystem has been mounted to disallow the execution of suid -(and sgid) programs) +(P) For some reason you can't check the filesystem of the script for nosuid. =item Can't coerce %s to integer in %s @@ -817,7 +817,7 @@ STATIC void S_open_script(pTHX_ char *, bool, SV *, int *fd); STATIC void S_usage(pTHX_ char *); STATIC void S_validate_suid(pTHX_ char *, char*, int); # if defined(IAMSUID) -STATIC int S_file_on_nosuid_fs(pTHX_ int fd, char *path); +STATIC int S_fd_on_nosuid_fs(pTHX_ int fd); # endif STATIC void* S_parse_body(pTHX_ va_list args); STATIC void* S_run_body(pTHX_ va_list args); |