* samba/configure.in: Don't check for root permissions. Don't
call tests/trapdoor.c and tests/ftruncroot.c. * samba/tests/trapdoor.c: Remove. * samba/tests/ftruncroot.c: Likewise. * samba/tests/summary.c: Don't warn about trapdoor uid systems.
Этот коммит содержится в:
родитель
23162f96b9
Коммит
e30e6b8a5a
@ -1,5 +1,11 @@
|
||||
2001-02-07 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* samba/configure.in: Don't check for root permissions. Don't
|
||||
call tests/trapdoor.c and tests/ftruncroot.c.
|
||||
* samba/tests/trapdoor.c: Remove.
|
||||
* samba/tests/ftruncroot.c: Likewise.
|
||||
* samba/tests/summary.c: Don't warn about trapdoor uid systems.
|
||||
|
||||
* Make-mc.in: Don't link container.o into libvfs-mc.a - it's
|
||||
not used.
|
||||
|
||||
|
@ -822,15 +822,6 @@ if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
|
||||
AC_DEFINE(REPLACE_INET_NTOA)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
|
||||
AC_TRY_RUN([main() { exit(getuid() != 0); }],
|
||||
samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
|
||||
if test x"$samba_cv_HAVE_ROOT" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ROOT)
|
||||
else
|
||||
AC_MSG_WARN([running as non-root will disable some tests])
|
||||
fi
|
||||
|
||||
netmask=no;
|
||||
AC_CACHE_CHECK([for netmask ifconf],samba_cv_HAVE_NETMASK_IFCONF,[
|
||||
AC_TRY_RUN([
|
||||
@ -869,13 +860,6 @@ if test x"$samba_cv_HAVE_NETMASK_AIX" = x"yes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for trapdoor seteuid],samba_cv_HAVE_TRAPDOOR_UID,[
|
||||
AC_TRY_RUN([#include "${srcdir-.}/tests/trapdoor.c"],
|
||||
samba_cv_HAVE_TRAPDOOR_UID=no,samba_cv_HAVE_TRAPDOOR_UID=yes,:)])
|
||||
if test x"$samba_cv_HAVE_TRAPDOOR_UID" = x"yes"; then
|
||||
AC_DEFINE(HAVE_TRAPDOOR_UID)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for shared mmap],samba_cv_HAVE_SHARED_MMAP,[
|
||||
AC_TRY_RUN([#include "${srcdir-.}/tests/shared_mmap.c"],
|
||||
samba_cv_HAVE_SHARED_MMAP=yes,samba_cv_HAVE_SHARED_MMAP=no,samba_cv_HAVE_SHARED_MMAP=cross)])
|
||||
@ -884,13 +868,6 @@ if test x"$samba_cv_HAVE_SHARED_MMAP" = x"yes"; then
|
||||
AC_DEFINE(HAVE_MMAP)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for ftruncate needs root],samba_cv_FTRUNCATE_NEEDS_ROOT,[
|
||||
AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncroot.c"],
|
||||
samba_cv_FTRUNCATE_NEEDS_ROOT=yes,samba_cv_FTRUNCATE_NEEDS_ROOT=no,samba_cv_FTRUNCATE_NEEDS_ROOT=cross)])
|
||||
if test x"$samba_cv_FTRUNCATE_NEEDS_ROOT" = x"yes"; then
|
||||
AC_DEFINE(FTRUNCATE_NEEDS_ROOT)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[
|
||||
AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"],
|
||||
samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)])
|
||||
|
@ -1,67 +0,0 @@
|
||||
/* test whether ftruncte() can truncate a file as non-root */
|
||||
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define DATA "conftest.truncroot"
|
||||
|
||||
static int sys_waitpid(pid_t pid,int *status,int options)
|
||||
{
|
||||
#ifdef HAVE_WAITPID
|
||||
return waitpid(pid,status,options);
|
||||
#else /* USE_WAITPID */
|
||||
return wait4(pid, status, options, NULL);
|
||||
#endif /* USE_WAITPID */
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int fd;
|
||||
char buf[1024];
|
||||
pid_t pid;
|
||||
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr,"ERROR: This test must be run as root - assuming \
|
||||
ftruncate doesn't need root.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
|
||||
if(!fd)
|
||||
exit(1);
|
||||
|
||||
if(write(fd, buf, 1024) != 1024)
|
||||
exit(1);
|
||||
|
||||
if((pid = fork()) < 0)
|
||||
exit(1);
|
||||
|
||||
if(pid) {
|
||||
/* Parent. */
|
||||
int status = 1;
|
||||
if(sys_waitpid(pid, &status, 0) != pid) {
|
||||
unlink(DATA);
|
||||
exit(1);
|
||||
}
|
||||
unlink(DATA);
|
||||
exit(WEXITSTATUS(status));
|
||||
}
|
||||
|
||||
/* Child. */
|
||||
if(setuid(500) < 0)
|
||||
exit(1);
|
||||
|
||||
if(ftruncate(fd, 0) < 0) {
|
||||
if(errno == EPERM || errno == EACCES)
|
||||
exit(0);
|
||||
}
|
||||
exit(1);
|
||||
}
|
@ -11,10 +11,6 @@ main()
|
||||
printf("WARNING: no shared memory. Running with slow locking code\n");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TRAPDOOR_UID
|
||||
printf("WARNING: trapdoor uid system - Samba may not operate correctly\n");
|
||||
#endif
|
||||
|
||||
#if !(defined(HAVE_NETMASK_IFCONF) || defined(HAVE_NETMASK_IFREQ) || defined(HAVE_NETMASK_AIX))
|
||||
printf("WARNING: No automated netmask determination - use an interfaces line\n");
|
||||
#endif
|
||||
|
@ -1,67 +0,0 @@
|
||||
/* test for a trapdoor uid system */
|
||||
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
main()
|
||||
{
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr,"ERROR: This test must be run as root - assuming \
|
||||
non-trapdoor system\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if defined(HAVE_SETRESUID)
|
||||
if (setresuid(1,1,-1) != 0) exit(1);
|
||||
if (getuid() != 1) exit(1);
|
||||
if (geteuid() != 1) exit(1);
|
||||
if (setresuid(0,0,0) != 0) exit(1);
|
||||
if (getuid() != 0) exit(1);
|
||||
if (geteuid() != 0) exit(1);
|
||||
#elif defined(HAVE_SETREUID)
|
||||
/* Set real uid to 1. */
|
||||
if (setreuid(1,-1) != 0) exit(1);
|
||||
if (getuid() != 1) exit(1);
|
||||
/* Go back to root. */
|
||||
if (setreuid(0,-1) != 0) exit(1);
|
||||
if (getuid() != 0) exit(1);
|
||||
/* Now set euid to 1. */
|
||||
if (setreuid(-1,1) != 0) exit(1);
|
||||
if (geteuid() != 1) exit(1);
|
||||
/* Go back to root. */
|
||||
if (setreuid(0,0) != 0) exit(1);
|
||||
if (getuid() != 0) exit(1);
|
||||
if (geteuid() != 0) exit(1);
|
||||
#else
|
||||
if (seteuid(1) != 0) exit(1);
|
||||
if (geteuid() != 1) exit(1);
|
||||
if (seteuid(0) != 0) exit(1);
|
||||
if (geteuid() != 0) exit(1);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SETRESGID)
|
||||
if (setresgid(1,1,1) != 0) exit(1);
|
||||
if (getgid() != 1) exit(1);
|
||||
if (getegid() != 1) exit(1);
|
||||
if (setresgid(0,0,0) != 0) exit(1);
|
||||
if (getgid() != 0) exit(1);
|
||||
if (getegid() != 0) exit(1);
|
||||
#elif defined(HAVE_SETREGID)
|
||||
if (setregid(1,1) != 0) exit(1);
|
||||
if (getgid() != 1) exit(1);
|
||||
if (getegid() != 1) exit(1);
|
||||
if (setregid(0,0) != 0) exit(1);
|
||||
if (getgid() != 0) exit(1);
|
||||
if (getegid() != 0) exit(1);
|
||||
#else
|
||||
if (setegid(1) != 0) exit(1);
|
||||
if (getegid() != 1) exit(1);
|
||||
if (setegid(0) != 0) exit(1);
|
||||
if (getegid() != 0) exit(1);
|
||||
#endif
|
||||
|
||||
exit(0);
|
||||
}
|
Загрузка…
Ссылка в новой задаче
Block a user