automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Configure should failed in case format ustar and big UID are used


From: Petr Hracek
Subject: Configure should failed in case format ustar and big UID are used
Date: Wed, 20 Feb 2013 14:40:38 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

Hi,

after reading of ustar format (http://www.gnu.org/software/tar/manual/html_section/Formats.html)
I have made patch for m4/tar.m4 file against upstream:
In case that ustar format is used and uid or gid is bigger than 2^21
than configure will always failed

Patch is:
diff --git a/m4/tar.m4 b/m4/tar.m4
index ec8c83e..1eca282 100644
--- a/m4/tar.m4
+++ b/m4/tar.m4
@@ -81,6 +81,27 @@ do
   AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
   rm -rf conftest.dir
   if test -s conftest.tar; then
+    AC_CHECK_PROG([ID_TEST], id, [yes], [no])
+    if test x"$ID_TEST" = x"yes"; then
+      if test x"$1" = x"ustar" ; then
+         user_id=`id -u`
+         if test $? -eq 0; then
+           # Maximum allowed UID in case ustar format is 2097151
+           if test $user_id -ge 2097152; then
+ AC_MSG_ERROR([The uid is big and not allowed in case of ustar format. Change format in configure.ac],[2])
+             exit 1
+           fi
+         fi
+         group_id=`id -g`
+         if test $? -eq 0; then
+           # Maximum allowed GID in case ustar format is 2097151
+           if test $group_id -ge 2097152; then
+ AC_MSG_ERROR([The gid is big and not allowed in case of ustar format. Change format in configure.ac],[2])
+             exit 1
+           fi
+         fi
+      fi
+    fi
     AM_RUN_LOG([$am__untar <conftest.tar])
     grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
   fi

Please review it and let me now whether something is wrong.
If something will be wrong I will make a correction.
Tests where performed as on big uid as on big gid and both.

I have been looking for making test in that case, but found that useradd binary should be called
and I think that we do not what to do that.

--
S pozdravem / Best regards

Petr Hracek

Red Hat Czech s.r.o.
BaseOS Core Services Brno

Email: address@hidden
Web: www.cz.redhat.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]