Accepting request 35735 from Archiving
checked in (request 35735) OBS-URL: https://build.opensuse.org/request/show/35735 OBS-URL: https://build.opensuse.org/package/show/Archiving/cpio?expand=0&rev=20
This commit is contained in:
parent
abb8c85948
commit
4b644cb704
139
cpio-2.10-chmodRaceC.patch
Normal file
139
cpio-2.10-chmodRaceC.patch
Normal file
@ -0,0 +1,139 @@
|
||||
--- src/copypass.c
|
||||
+++ src/copypass.c
|
||||
@@ -239,15 +239,23 @@ process_copy_pass ()
|
||||
cdf_flag = 1;
|
||||
}
|
||||
#endif
|
||||
- res = mkdir (output_name.ds_string, in_file_stat.st_mode);
|
||||
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
|
||||
|
||||
}
|
||||
else
|
||||
- res = 0;
|
||||
+ {
|
||||
+ if (!no_chown_flag && (out_file_stat.st_mode & 077) != 0
|
||||
+ && chmod (output_name.ds_string, out_file_stat.st_mode & 07700) < 0)
|
||||
+ {
|
||||
+ error (0, errno, "%s: chmod", output_name.ds_string);
|
||||
+ continue;
|
||||
+ }
|
||||
+ res = 0;
|
||||
+ }
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (output_name.ds_string);
|
||||
- res = mkdir (output_name.ds_string, in_file_stat.st_mode);
|
||||
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -290,12 +298,12 @@ process_copy_pass ()
|
||||
|
||||
if (link_res < 0)
|
||||
{
|
||||
- res = mknod (output_name.ds_string, in_file_stat.st_mode,
|
||||
+ res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
|
||||
in_file_stat.st_rdev);
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (output_name.ds_string);
|
||||
- res = mknod (output_name.ds_string, in_file_stat.st_mode,
|
||||
+ res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
|
||||
in_file_stat.st_rdev);
|
||||
}
|
||||
if (res < 0)
|
||||
--- src/copyin.c
|
||||
+++ src/copyin.c
|
||||
@@ -186,11 +186,12 @@ list_file(struct cpio_file_stat* file_hd
|
||||
|
||||
static int
|
||||
try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
|
||||
- int *existing_dir)
|
||||
+ int *existing_dir, mode_t *existing_mode)
|
||||
{
|
||||
struct stat file_stat;
|
||||
|
||||
*existing_dir = false;
|
||||
+ *existing_mode = 0;
|
||||
if (lstat (file_hdr->c_name, &file_stat) == 0)
|
||||
{
|
||||
if (S_ISDIR (file_stat.st_mode)
|
||||
@@ -200,6 +201,7 @@ try_existing_file (struct cpio_file_stat
|
||||
we are trying to create, don't complain about
|
||||
it. */
|
||||
*existing_dir = true;
|
||||
+ *existing_mode = file_stat.st_mode;
|
||||
return 0;
|
||||
}
|
||||
else if (!unconditional_flag
|
||||
@@ -567,7 +569,7 @@ copyin_regular_file (struct cpio_file_st
|
||||
}
|
||||
|
||||
static void
|
||||
-copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir)
|
||||
+copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir, mode_t existing_mode)
|
||||
{
|
||||
int res; /* Result of various function calls. */
|
||||
#ifdef HPUX_CDF
|
||||
@@ -610,14 +612,22 @@ copyin_directory (struct cpio_file_stat
|
||||
cdf_flag = 1;
|
||||
}
|
||||
#endif
|
||||
- res = mkdir (file_hdr->c_name, file_hdr->c_mode);
|
||||
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
|
||||
}
|
||||
else
|
||||
- res = 0;
|
||||
+ {
|
||||
+ if (!no_chown_flag && (existing_mode & 077) != 0
|
||||
+ && chmod (file_hdr->c_name, existing_mode & 07700) < 0)
|
||||
+ {
|
||||
+ error (0, errno, "%s: chmod", file_hdr->c_name);
|
||||
+ return;
|
||||
+ }
|
||||
+ res = 0;
|
||||
+ }
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (file_hdr->c_name);
|
||||
- res = mkdir (file_hdr->c_name, file_hdr->c_mode);
|
||||
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -692,12 +702,12 @@ copyin_device (struct cpio_file_stat* fi
|
||||
return;
|
||||
}
|
||||
|
||||
- res = mknod (file_hdr->c_name, file_hdr->c_mode,
|
||||
+ res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
|
||||
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (file_hdr->c_name);
|
||||
- res = mknod (file_hdr->c_name, file_hdr->c_mode,
|
||||
+ res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
|
||||
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
|
||||
}
|
||||
if (res < 0)
|
||||
@@ -772,9 +782,10 @@ static void
|
||||
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
{
|
||||
int existing_dir=0;
|
||||
+ mode_t existing_mode;
|
||||
|
||||
if (!to_stdout_option
|
||||
- && try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
|
||||
+ && try_existing_file (file_hdr, in_file_des, &existing_dir, &existing_mode) < 0)
|
||||
return;
|
||||
|
||||
/* Do the real copy or link. */
|
||||
@@ -785,7 +796,7 @@ copyin_file (struct cpio_file_stat* file
|
||||
break;
|
||||
|
||||
case CP_IFDIR:
|
||||
- copyin_directory (file_hdr, existing_dir);
|
||||
+ copyin_directory(file_hdr, existing_dir, existing_mode);
|
||||
break;
|
||||
|
||||
case CP_IFCHR:
|
@ -2,24 +2,22 @@ Index: src/copyin.c
|
||||
===================================================================
|
||||
--- src/copyin.c.orig
|
||||
+++ src/copyin.c
|
||||
@@ -1484,7 +1484,20 @@ process_copy_in ()
|
||||
@@ -1565,6 +1565,19 @@ process_copy_in ()
|
||||
if (dot_flag)
|
||||
fputc ('\n', stderr);
|
||||
|
||||
apply_delayed_set_stat ();
|
||||
-
|
||||
+
|
||||
+ if (tty_in)
|
||||
+ {
|
||||
+ fclose(tty_in);
|
||||
+ }
|
||||
+ {
|
||||
+ fclose(tty_in);
|
||||
+ }
|
||||
+ if (tty_out)
|
||||
+ {
|
||||
+ fclose(tty_out);
|
||||
+ }
|
||||
+ {
|
||||
+ fclose(tty_out);
|
||||
+ }
|
||||
+ if (rename_in)
|
||||
+ {
|
||||
+ fclose(rename_in);
|
||||
+ }
|
||||
+ {
|
||||
+ fclose(rename_in);
|
||||
+ }
|
||||
+
|
||||
if (append_flag)
|
||||
return;
|
@ -1,17 +1,12 @@
|
||||
Index: src/mt.c
|
||||
===================================================================
|
||||
--- src/mt.c.orig
|
||||
--- src/mt.c
|
||||
+++ src/mt.c
|
||||
@@ -413,11 +413,18 @@ parse_opt (int key, char *arg, struct ar
|
||||
{
|
||||
tapedev = getenv ("TAPE");
|
||||
if (tapedev == NULL)
|
||||
@@ -664,11 +664,20 @@
|
||||
{
|
||||
tapedev = getenv ("TAPE");
|
||||
if (tapedev == NULL)
|
||||
-#ifdef DEFTAPE /* From sys/mtio.h. */
|
||||
- tapedev = DEFTAPE;
|
||||
- tapedev = DEFTAPE;
|
||||
-#else
|
||||
- error (MT_EXIT_INVOP, 0, _("no tape device specified"));
|
||||
-#endif
|
||||
+
|
||||
+/* Suse doesn't have /dev/tape as link to /dev/nst0 any more.
|
||||
+Instead it uses udev and creates different names in /dev/tape/by-id/ directory.
|
||||
+If it is SCSI tape storage then it creates /dev/tape/by-id/scsi--nst
|
||||
@ -23,6 +18,10 @@ Index: src/mt.c
|
||||
+/* #ifdef DEFTAPE * From sys/mtio.h. * */
|
||||
+# define DEFSUSETAPE "/dev/nst0"
|
||||
+ tapedev = DEFSUSETAPE;
|
||||
}
|
||||
break;
|
||||
|
||||
+/* #else
|
||||
error (1, 0, _("no tape device specified"));
|
||||
-#endif
|
||||
+#endif */
|
||||
}
|
||||
|
||||
#ifdef MTDENS
|
@ -1,13 +1,163 @@
|
||||
Redhat-bugzilla: 430835
|
||||
|
||||
* revert make_path code to previous state, which worked better
|
||||
* this can be dropped when permission issues are solved in upstream
|
||||
|
||||
|
||||
diff -up cpio-2.9/src/extern.h.dir_perm cpio-2.9/src/extern.h
|
||||
--- cpio-2.9/src/extern.h.dir_perm 2007-06-28 14:59:38.000000000 +0200
|
||||
+++ cpio-2.9/src/extern.h 2008-03-03 11:57:43.000000000 +0100
|
||||
@@ -140,8 +140,8 @@ void process_args (int argc, char *argv[
|
||||
--- cpio-2.9/src/copyin.c
|
||||
+++ cpio-2.9/src/copyin.c
|
||||
@@ -186,12 +186,11 @@
|
||||
|
||||
static int
|
||||
try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
|
||||
- int *existing_dir, mode_t *existing_mode)
|
||||
+ int *existing_dir)
|
||||
{
|
||||
struct stat file_stat;
|
||||
|
||||
*existing_dir = false;
|
||||
- *existing_mode = 0;
|
||||
if (lstat (file_hdr->c_name, &file_stat) == 0)
|
||||
{
|
||||
if (S_ISDIR (file_stat.st_mode)
|
||||
@@ -201,7 +200,6 @@
|
||||
we are trying to create, don't complain about
|
||||
it. */
|
||||
*existing_dir = true;
|
||||
- *existing_mode = file_stat.st_mode;
|
||||
return 0;
|
||||
}
|
||||
else if (!unconditional_flag
|
||||
@@ -569,7 +567,7 @@
|
||||
}
|
||||
|
||||
static void
|
||||
-copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir, mode_t existing_mode)
|
||||
+copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir)
|
||||
{
|
||||
int res; /* Result of various function calls. */
|
||||
#ifdef HPUX_CDF
|
||||
@@ -612,22 +610,14 @@
|
||||
cdf_flag = 1;
|
||||
}
|
||||
#endif
|
||||
- res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
|
||||
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode);
|
||||
}
|
||||
else
|
||||
- {
|
||||
- if (!no_chown_flag && (existing_mode & 077) != 0
|
||||
- && chmod (file_hdr->c_name, existing_mode & 07700) < 0)
|
||||
- {
|
||||
- error (0, errno, "%s: chmod", file_hdr->c_name);
|
||||
- return;
|
||||
- }
|
||||
- res = 0;
|
||||
- }
|
||||
+ res = 0;
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (file_hdr->c_name);
|
||||
- res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
|
||||
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode);
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -702,12 +692,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
|
||||
+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
|
||||
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (file_hdr->c_name);
|
||||
- res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
|
||||
+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
|
||||
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
|
||||
}
|
||||
if (res < 0)
|
||||
@@ -782,10 +772,9 @@
|
||||
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
{
|
||||
int existing_dir=0;
|
||||
- mode_t existing_mode;
|
||||
|
||||
if (!to_stdout_option
|
||||
- && try_existing_file (file_hdr, in_file_des, &existing_dir, &existing_mode) < 0)
|
||||
+ && try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
|
||||
return;
|
||||
|
||||
/* Do the real copy or link. */
|
||||
@@ -796,7 +785,7 @@
|
||||
break;
|
||||
|
||||
case CP_IFDIR:
|
||||
- copyin_directory(file_hdr, existing_dir, existing_mode);
|
||||
+ copyin_directory (file_hdr, existing_dir);
|
||||
break;
|
||||
|
||||
case CP_IFCHR:
|
||||
@@ -1576,8 +1565,6 @@
|
||||
if (dot_flag)
|
||||
fputc ('\n', stderr);
|
||||
|
||||
- apply_delayed_set_stat ();
|
||||
-
|
||||
if (append_flag)
|
||||
return;
|
||||
|
||||
--- cpio-2.9/src/copypass.c
|
||||
+++ cpio-2.9/src/copypass.c
|
||||
@@ -239,23 +239,15 @@
|
||||
cdf_flag = 1;
|
||||
}
|
||||
#endif
|
||||
- res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
|
||||
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode);
|
||||
|
||||
}
|
||||
else
|
||||
- {
|
||||
- if (!no_chown_flag && (out_file_stat.st_mode & 077) != 0
|
||||
- && chmod (output_name.ds_string, out_file_stat.st_mode & 07700) < 0)
|
||||
- {
|
||||
- error (0, errno, "%s: chmod", output_name.ds_string);
|
||||
- continue;
|
||||
- }
|
||||
- res = 0;
|
||||
- }
|
||||
+ res = 0;
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (output_name.ds_string);
|
||||
- res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
|
||||
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode);
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -298,12 +290,12 @@
|
||||
|
||||
if (link_res < 0)
|
||||
{
|
||||
- res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
|
||||
+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
|
||||
in_file_stat.st_rdev);
|
||||
if (res < 0 && create_dir_flag)
|
||||
{
|
||||
create_all_directories (output_name.ds_string);
|
||||
- res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
|
||||
+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
|
||||
in_file_stat.st_rdev);
|
||||
}
|
||||
if (res < 0)
|
||||
@@ -373,8 +365,6 @@
|
||||
if (dot_flag)
|
||||
fputc ('\n', stderr);
|
||||
|
||||
- apply_delayed_set_stat ();
|
||||
-
|
||||
if (!quiet_flag)
|
||||
{
|
||||
size_t blocks = (output_bytes + io_block_size - 1) / io_block_size;
|
||||
--- cpio-2.9/src/extern.h
|
||||
+++ cpio-2.9/src/extern.h
|
||||
@@ -140,8 +140,8 @@
|
||||
void initialize_buffers (void);
|
||||
|
||||
/* makepath.c */
|
||||
@ -18,36 +168,9 @@ diff -up cpio-2.9/src/extern.h.dir_perm cpio-2.9/src/extern.h
|
||||
|
||||
/* tar.c */
|
||||
void write_out_tar_header (struct cpio_file_stat *file_hdr, int out_des);
|
||||
diff -up cpio-2.9/src/util.c.dir_perm cpio-2.9/src/util.c
|
||||
--- cpio-2.9/src/util.c.dir_perm 2007-06-28 15:04:51.000000000 +0200
|
||||
+++ cpio-2.9/src/util.c 2008-03-03 11:45:00.000000000 +0100
|
||||
@@ -618,14 +618,7 @@ create_all_directories (char *name)
|
||||
error (2, 0, _("virtual memory exhausted"));
|
||||
|
||||
if (dir[0] != '.' || dir[1] != '\0')
|
||||
- {
|
||||
- const char *fmt;
|
||||
- if (warn_option & CPIO_WARN_INTERDIR)
|
||||
- fmt = _("Creating intermediate directory `%s'");
|
||||
- else
|
||||
- fmt = NULL;
|
||||
- make_path (dir, -1, -1, fmt);
|
||||
- }
|
||||
+ make_path (dir, mode, 0700, -1, -1, (char *) NULL);
|
||||
|
||||
free (dir);
|
||||
}
|
||||
diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
--- cpio-2.9/src/makepath.c.dir_perm 2007-06-28 15:09:47.000000000 +0200
|
||||
+++ cpio-2.9/src/makepath.c 2008-03-03 11:45:00.000000000 +0100
|
||||
@@ -29,15 +29,14 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
-#include "cpiohdr.h"
|
||||
-#include "dstring.h"
|
||||
-#include "extern.h"
|
||||
|
||||
--- cpio-2.9/src/makepath.c
|
||||
+++ cpio-2.9/src/makepath.c
|
||||
@@ -36,8 +36,10 @@
|
||||
/* Ensure that the directory ARGPATH exists.
|
||||
Remove any trailing slashes from ARGPATH before calling this function.
|
||||
|
||||
@ -117,7 +240,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
while (*slash == '/')
|
||||
slash++;
|
||||
while ((slash = strchr (slash, '/')))
|
||||
@@ -91,9 +112,10 @@ make_path (char *argpath,
|
||||
@@ -91,9 +112,10 @@
|
||||
*(slash -1) = '\0';
|
||||
}
|
||||
#endif
|
||||
@ -129,7 +252,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@@ -101,18 +123,24 @@ make_path (char *argpath,
|
||||
@@ -101,18 +123,24 @@
|
||||
if (verbose_fmt_string != NULL)
|
||||
error (0, 0, verbose_fmt_string, dirpath);
|
||||
|
||||
@ -164,7 +287,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
#ifdef HPUX_CDF
|
||||
if (iscdf)
|
||||
{
|
||||
@@ -129,6 +157,7 @@ make_path (char *argpath,
|
||||
@@ -129,6 +157,7 @@
|
||||
else if (!S_ISDIR (stats.st_mode))
|
||||
{
|
||||
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
|
||||
@ -172,7 +295,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -143,7 +172,7 @@ make_path (char *argpath,
|
||||
@@ -143,7 +172,7 @@
|
||||
/* We're done making leading directories.
|
||||
Make the final component of the path. */
|
||||
|
||||
@ -181,7 +304,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
{
|
||||
/* In some cases, if the final component in dirpath was `.' then we
|
||||
just got an EEXIST error from that last mkdir(). If that's
|
||||
@@ -153,24 +182,51 @@ make_path (char *argpath,
|
||||
@@ -153,24 +182,51 @@
|
||||
(!S_ISDIR (stats.st_mode) ) )
|
||||
{
|
||||
error (0, errno, _("cannot make directory `%s'"), dirpath);
|
||||
@ -245,7 +368,7 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,10 +235,33 @@ make_path (char *argpath,
|
||||
@@ -179,10 +235,33 @@
|
||||
if (!S_ISDIR (stats.st_mode))
|
||||
{
|
||||
error (0, 0, _("`%s' exists but is not a directory"), dirpath);
|
||||
@ -279,3 +402,21 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
|
||||
+ umask (oldmask);
|
||||
return retval;
|
||||
}
|
||||
--- cpio-2.9/src/util.c
|
||||
+++ cpio-2.9/src/util.c
|
||||
@@ -618,14 +618,7 @@
|
||||
error (2, 0, _("virtual memory exhausted"));
|
||||
|
||||
if (dir[0] != '.' || dir[1] != '\0')
|
||||
- {
|
||||
- const char *fmt;
|
||||
- if (warn_option & CPIO_WARN_INTERDIR)
|
||||
- fmt = _("Creating intermediate directory `%s'");
|
||||
- else
|
||||
- fmt = NULL;
|
||||
- make_path (dir, -1, -1, fmt);
|
||||
- }
|
||||
+ make_path (dir, mode, 0700, -1, -1, (char *) NULL);
|
||||
|
||||
free (dir);
|
||||
}
|
52
cpio-2.10-heap_overflow_in_rtapelib.patch
Normal file
52
cpio-2.10-heap_overflow_in_rtapelib.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 9bc39283e4cc6ab9e5913ccbf766998eab4ff093 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
Date: Mon, 01 Mar 2010 08:49:03 +0000
|
||||
Subject: Bugfixes in rtapelib
|
||||
|
||||
* lib/rmt.h (rmtcreat): Use fcntl O_ macros insead of
|
||||
their hardcoded values.
|
||||
* lib/rtapelib.c (rmt_read__,rmt_ioctl__): Prevent
|
||||
potential overflow.
|
||||
---
|
||||
diff --git a/lib/rmt.h b/lib/rmt.h
|
||||
index 50f037c..2ce9dc5 100644
|
||||
--- a/lib/rmt.h
|
||||
+++ b/lib/rmt.h
|
||||
@@ -61,7 +61,7 @@ extern bool force_local_option;
|
||||
|
||||
#define rmtcreat(dev_name, mode, command) \
|
||||
(_remdev (dev_name) \
|
||||
- ? rmt_open__ (dev_name, 1 | O_CREAT, __REM_BIAS, command) \
|
||||
+ ? rmt_open__ (dev_name, O_CREAT | O_WRONLY, __REM_BIAS, command) \
|
||||
: creat (dev_name, mode))
|
||||
|
||||
#define rmtlstat(dev_name, muffer) \
|
||||
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
|
||||
index 02ad1e7..cb645db 100644
|
||||
--- a/lib/rtapelib.c
|
||||
+++ b/lib/rtapelib.c
|
||||
@@ -573,7 +573,8 @@ rmt_read__ (int handle, char *buffer, size_t length)
|
||||
|
||||
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
|
||||
if (do_command (handle, command_buffer) == -1
|
||||
- || (status = get_status (handle)) == SAFE_READ_ERROR)
|
||||
+ || (status = get_status (handle)) == SAFE_READ_ERROR
|
||||
+ || status > length)
|
||||
return SAFE_READ_ERROR;
|
||||
|
||||
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
|
||||
@@ -709,6 +710,12 @@ rmt_ioctl__ (int handle, int operation, char *argument)
|
||||
|| (status = get_status (handle), status == -1))
|
||||
return -1;
|
||||
|
||||
+ if (status > sizeof (struct mtop))
|
||||
+ {
|
||||
+ errno = EOVERFLOW;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
for (; status > 0; status -= counter, argument += counter)
|
||||
{
|
||||
counter = safe_read (READ_SIDE (handle), argument, status);
|
||||
--
|
||||
cgit v0.8.2.1
|
8
cpio-2.10-include_fatal_c.patch
Normal file
8
cpio-2.10-include_fatal_c.patch
Normal file
@ -0,0 +1,8 @@
|
||||
--- lib/Makefile.am.orig 2009-07-09 09:41:26.000000000 +0200
|
||||
+++ lib/Makefile.am 2009-07-09 09:41:17.000000000 +0200
|
||||
@@ -37,4 +37,5 @@
|
||||
sysdep.c\
|
||||
system.h\
|
||||
error.c\
|
||||
+ ../src/fatal.c \
|
||||
names.c
|
@ -103,7 +103,7 @@ Index: src/Makefile.am
|
||||
===================================================================
|
||||
--- src/Makefile.am.orig
|
||||
+++ src/Makefile.am
|
||||
@@ -19,7 +19,7 @@
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
INCLUDES=-I. -I.. -I$(top_srcdir)/gnu -I$(top_builddir)/gnu -I$(top_srcdir)/lib -I$(top_builddir)/lib
|
||||
|
||||
@ -116,16 +116,16 @@ Index: src/copyin.c
|
||||
===================================================================
|
||||
--- src/copyin.c.orig
|
||||
+++ src/copyin.c
|
||||
@@ -689,7 +689,7 @@ copyin_link(struct cpio_file_stat *file_
|
||||
@@ -771,7 +771,7 @@ copyin_link(struct cpio_file_stat *file_
|
||||
static void
|
||||
copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
|
||||
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
|
||||
{
|
||||
- int existing_dir;
|
||||
+ int existing_dir=0;
|
||||
|
||||
if (!to_stdout_option
|
||||
&& try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
|
||||
@@ -1278,6 +1278,7 @@ process_copy_in ()
|
||||
@@ -1360,6 +1360,7 @@ process_copy_in ()
|
||||
int in_file_des; /* Input file descriptor. */
|
||||
char skip_file; /* Flag for use with patterns. */
|
||||
int i; /* Loop index variable. */
|
||||
@ -133,7 +133,7 @@ Index: src/copyin.c
|
||||
|
||||
newdir_umask = umask (0); /* Reset umask to preserve modes of
|
||||
created files */
|
||||
@@ -1386,8 +1387,10 @@ process_copy_in ()
|
||||
@@ -1468,8 +1469,10 @@ process_copy_in ()
|
||||
for (i = 0; i < num_patterns
|
||||
&& skip_file == copy_matching_files; i++)
|
||||
{
|
||||
@ -149,7 +149,7 @@ Index: src/mt.c
|
||||
===================================================================
|
||||
--- src/mt.c.orig
|
||||
+++ src/mt.c
|
||||
@@ -18,6 +18,10 @@
|
||||
@@ -17,6 +17,10 @@
|
||||
02110-1301 USA
|
||||
*/
|
||||
|
||||
@ -160,7 +160,7 @@ Index: src/mt.c
|
||||
|
||||
/* If -f is not given, the environment variable TAPE is used;
|
||||
if that is not set, a default device defined in sys/mtio.h is used.
|
||||
@@ -52,9 +56,51 @@
|
||||
@@ -51,9 +55,51 @@
|
||||
retension Rewind the tape, then wind it to the end of the reel,
|
||||
then rewind it again.
|
||||
erase Erase the tape.
|
||||
@ -212,9 +212,9 @@ Index: src/mt.c
|
||||
#include <system.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -90,6 +136,110 @@
|
||||
#define MT_EXIT_INVOP 1
|
||||
#define MT_EXIT_FAILURE 2
|
||||
@@ -105,6 +151,85 @@ int atoi ();
|
||||
void exit ();
|
||||
#endif
|
||||
|
||||
+#if defined(linux) || defined(__linux)
|
||||
+#define MTDATCOMP 1000 /* Random unused number. */
|
||||
@ -294,36 +294,11 @@ Index: src/mt.c
|
||||
+ {-1, NULL}};
|
||||
+#endif
|
||||
+
|
||||
+char *cbnames[] =
|
||||
+{
|
||||
+#ifdef MT_ST_BOOLEANS
|
||||
+ "stoptions",
|
||||
+#endif
|
||||
+#ifdef MT_ST_WRITE_THRESHOLD
|
||||
+ "stwrthreshold",
|
||||
+#endif
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+int count_bits[] =
|
||||
+{
|
||||
+#ifdef MT_ST_BOOLEANS
|
||||
+ MT_ST_BOOLEANS,
|
||||
+#endif
|
||||
+#ifdef MT_ST_WRITE_THRESHOLD
|
||||
+ MT_ST_WRITE_THRESHOLD,
|
||||
+#endif
|
||||
+ 0
|
||||
+};
|
||||
+
|
||||
+#ifdef MT_TAPE_INFO
|
||||
+ struct mt_tape_info tapes[] = MT_TAPE_INFO;
|
||||
+#endif
|
||||
+
|
||||
char const * const opnames[] =
|
||||
char *opnames[] =
|
||||
{
|
||||
"eof",
|
||||
@@ -108,6 +258,8 @@ char const * const opnames[] =
|
||||
"eof", "weof", "fsf", "bsf", "fsr", "bsr",
|
||||
@@ -114,6 +239,8 @@ char *opnames[] =
|
||||
#endif
|
||||
#ifdef MTEOM
|
||||
"eom",
|
||||
@ -332,7 +307,7 @@ Index: src/mt.c
|
||||
#endif
|
||||
#ifdef MTRETEN
|
||||
"retension",
|
||||
@@ -122,6 +274,39 @@ char const * const opnames[] =
|
||||
@@ -128,6 +255,39 @@ char *opnames[] =
|
||||
#ifdef MTSEEK
|
||||
"seek",
|
||||
#endif
|
||||
@ -372,7 +347,7 @@ Index: src/mt.c
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -144,6 +329,8 @@ short operations[] =
|
||||
@@ -141,6 +301,8 @@ short operations[] =
|
||||
#endif
|
||||
#ifdef MTEOM
|
||||
MTEOM,
|
||||
@ -381,7 +356,7 @@ Index: src/mt.c
|
||||
#endif
|
||||
#ifdef MTRETEN
|
||||
MTRETEN,
|
||||
@@ -158,6 +345,39 @@ short operations[] =
|
||||
@@ -155,9 +317,69 @@ short operations[] =
|
||||
#ifdef MTSEEK
|
||||
MTSEEK,
|
||||
#endif
|
||||
@ -418,35 +393,63 @@ Index: src/mt.c
|
||||
+#ifdef MTDENS
|
||||
+ MTDENS,
|
||||
+#endif
|
||||
0
|
||||
};
|
||||
|
||||
ARGMATCH_VERIFY (opnames, operations);
|
||||
@@ -286,10 +506,23 @@ void
|
||||
+char *cbnames[] =
|
||||
+{
|
||||
+#ifdef MT_ST_BOOLEANS
|
||||
+ "stoptions",
|
||||
+#endif
|
||||
+#ifdef MT_ST_WRITE_THRESHOLD
|
||||
+ "stwrthreshold",
|
||||
+#endif
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+int count_bits[] =
|
||||
+{
|
||||
+#ifdef MT_ST_BOOLEANS
|
||||
+ MT_ST_BOOLEANS,
|
||||
+#endif
|
||||
+#ifdef MT_ST_WRITE_THRESHOLD
|
||||
+ MT_ST_WRITE_THRESHOLD,
|
||||
+#endif
|
||||
+ 0
|
||||
+};
|
||||
+
|
||||
+#ifdef MT_TAPE_INFO
|
||||
+ struct mt_tape_info tapes[] = MT_TAPE_INFO;
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
struct option longopts[] =
|
||||
{
|
||||
{"file", 1, NULL, 'f'},
|
||||
@@ -200,10 +422,22 @@ void
|
||||
print_status (char *dev, int desc)
|
||||
{
|
||||
struct mtget status;
|
||||
-
|
||||
+ #ifdef MT_TAPE_INFO
|
||||
+ struct mt_tape_info *mt;
|
||||
+ #endif
|
||||
+
|
||||
if (rmtioctl (desc, MTIOCGET, (char*)&status) == -1)
|
||||
error (MT_EXIT_FAILURE, errno, _("%s: rmtioctl failed"), dev);
|
||||
+#ifdef MT_TAPE_INFO
|
||||
+ struct mt_tape_info *mt;
|
||||
+#endif
|
||||
|
||||
+ #ifdef MT_TAPE_INFO
|
||||
+ for (mt = tapes; mt->t_type; mt++)
|
||||
+ if (mt->t_type == status.mt_type) break;
|
||||
+ if (mt->t_type != 0)
|
||||
+ {
|
||||
+ printf ("drive type = %s\n", mt->t_name);
|
||||
+ }
|
||||
+ else
|
||||
+ #endif
|
||||
+
|
||||
if (rmtioctl (desc, MTIOCGET, (char*)&status) == -1)
|
||||
error (2, errno, _("%s: rmtioctl failed"), dev);
|
||||
|
||||
+#ifdef MT_TAPE_INFO
|
||||
+ for (mt = tapes; mt->t_type; mt++)
|
||||
+ if (mt->t_type == status.mt_type) break;
|
||||
+ if (mt->t_type != 0)
|
||||
+ {
|
||||
+ printf ("drive type = %s\n", mt->t_name);
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
printf ("drive type = %d\n", (int) status.mt_type);
|
||||
#if defined(hpux) || defined(__hpux)
|
||||
printf ("drive status (high) = %d\n", (int) status.mt_dsreg1);
|
||||
@@ -303,7 +536,177 @@ print_status (char *dev, int desc)
|
||||
@@ -217,7 +451,177 @@ print_status (char *dev, int desc)
|
||||
printf ("file number = %d\n", (int) status.mt_fileno);
|
||||
printf ("block number = %d\n", (int) status.mt_blkno);
|
||||
#endif
|
||||
@ -603,7 +606,7 @@ Index: src/mt.c
|
||||
+ printf("Compression off.\n");
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
+#ifdef MTTELL
|
||||
@ -618,24 +621,24 @@ Index: src/mt.c
|
||||
+ error (2, errno, "%s", dev);
|
||||
+ printf("At block %ld.\n", position.mt_blkno);
|
||||
+
|
||||
}
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
|
||||
void
|
||||
fatal_exit ()
|
||||
@@ -314,7 +717,7 @@ fatal_exit ()
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
- int tapedesc;
|
||||
+ int tapedesc,i;
|
||||
usage (FILE *fp,int status)
|
||||
@@ -276,7 +680,7 @@ main (int argc, char **argv)
|
||||
if (optind == argc)
|
||||
usage (stderr, 1);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
@@ -327,13 +730,32 @@ main (int argc, char **argv)
|
||||
if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER, NULL, NULL))
|
||||
exit (MT_EXIT_INVOP);
|
||||
- i = argmatch (argv[optind], opnames);
|
||||
+ i = argmatch (argv[optind], opnames,NULL,0);
|
||||
if (i < 0)
|
||||
{
|
||||
argmatch_invalid ("tape operation", argv[optind], i);
|
||||
@@ -308,10 +712,29 @@ main (int argc, char **argv)
|
||||
#endif
|
||||
}
|
||||
|
||||
+#ifdef MTDENS
|
||||
+ if (operation == MTDENS)
|
||||
@ -647,28 +650,24 @@ Index: src/mt.c
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
switch (operation)
|
||||
{
|
||||
case MTWEOF:
|
||||
if ( (operation == MTWEOF)
|
||||
#ifdef MTERASE
|
||||
case MTERASE:
|
||||
|| (operation == MTERASE)
|
||||
#endif
|
||||
- tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
|
||||
+#ifdef MTWSM
|
||||
+ case MTWSM:
|
||||
+ || (operation == MTWSM)
|
||||
+#endif
|
||||
+#ifdef MTSETDRVBUFFER
|
||||
+ case MTSETDRVBUFFER:
|
||||
+ || (operation == MTSETDRVBUFFER)
|
||||
+#endif
|
||||
+#ifdef MTDATCOMP
|
||||
+ case MTDATCOMP:
|
||||
+ || (operation == MTDATCOMP)
|
||||
+#endif
|
||||
+ tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -344,6 +766,17 @@ main (int argc, char **argv)
|
||||
error (MT_EXIT_INVOP, errno, _("%s: rmtopen failed"), tapedev);
|
||||
)
|
||||
tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
|
||||
else
|
||||
@@ -320,6 +743,17 @@ main (int argc, char **argv)
|
||||
error (1, errno, _("%s: rmtopen failed"), tapedev);
|
||||
check_type (tapedev, tapedesc);
|
||||
|
||||
+#ifdef MTDATCOMP
|
||||
@ -685,11 +684,11 @@ Index: src/mt.c
|
||||
if (operation == MTASF)
|
||||
{
|
||||
perform_operation (tapedev, tapedesc, MTREW, 1);
|
||||
@@ -352,6 +785,7 @@ main (int argc, char **argv)
|
||||
@@ -328,6 +762,7 @@ main (int argc, char **argv)
|
||||
perform_operation (tapedev, tapedesc, operation, count);
|
||||
if (operation == MTNOP)
|
||||
print_status (tapedev, tapedesc);
|
||||
+ }
|
||||
|
||||
if (rmtclose (tapedesc) == -1)
|
||||
error (MT_EXIT_FAILURE, errno, _("%s: rmtclose failed"), tapedev);
|
||||
error (2, errno, _("%s: rmtclose failed"), tapedev);
|
@ -1,26 +1,20 @@
|
||||
Index: src/mt.c
|
||||
===================================================================
|
||||
--- src/mt.c.orig
|
||||
--- src/mt.c
|
||||
+++ src/mt.c
|
||||
@@ -723,11 +723,11 @@ main (int argc, char **argv)
|
||||
#ifdef MTDATCOMP
|
||||
case MTDATCOMP:
|
||||
@@ -694,9 +694,9 @@
|
||||
|| (operation == MTDATCOMP)
|
||||
#endif
|
||||
- tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
|
||||
+ tapedesc = rmtopen (tapedev, O_WRONLY | O_NONBLOCK, 0, rsh_command_option);
|
||||
break;
|
||||
|
||||
default:
|
||||
- tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option);
|
||||
+ tapedesc = rmtopen (tapedev, O_RDONLY | O_NONBLOCK, 0, rsh_command_option);
|
||||
}
|
||||
|
||||
)
|
||||
- tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
|
||||
+ tapedesc = rmtopen (tapedev, O_WRONLY | O_NONBLOCK, 0, rsh_command_option);
|
||||
else
|
||||
- tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option);
|
||||
+ tapedesc = rmtopen (tapedev, O_RDONLY | O_NONBLOCK, 0, rsh_command_option);
|
||||
if (tapedesc == -1)
|
||||
Index: src/util.c
|
||||
===================================================================
|
||||
--- src/util.c.orig
|
||||
error (1, errno, _("%s: rmtopen failed"), tapedev);
|
||||
check_type (tapedev, tapedesc);
|
||||
--- src/util.c
|
||||
+++ src/util.c
|
||||
@@ -767,14 +767,14 @@ open_archive (char *file)
|
||||
@@ -753,14 +753,14 @@
|
||||
copy_in = process_copy_in;
|
||||
|
||||
if (copy_function == copy_in)
|
3
cpio-2.10.tar.bz2
Normal file
3
cpio-2.10.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:def23150e4e081599ecb013736f4403617fefbb6f6e6806dc6a98129913d79d5
|
||||
size 951395
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bb820bfd96e74fc6ce43104f06fe733178517e7f5d1cdee553773e8eff7d5bbd
|
||||
size 1018483
|
15
cpio.changes
15
cpio.changes
@ -1,18 +1,3 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 12 16:34:39 UTC 2010 - mseben@novell.com
|
||||
|
||||
- updated to 2.11
|
||||
* Fix mt build.
|
||||
* In copy-in mode, if directory attributes do not permit writing to it,
|
||||
setting them is delayed until the end of run. This allows to
|
||||
correctly extract files in such directories.
|
||||
* In copy-in mode, permissions of a directory are restored if it
|
||||
appears in the file list after files in it (e.g. in listings
|
||||
produced by find . -depth). This fixes debian bug #458079.
|
||||
* Fix possible memory overflow in the rmt client code (CVE-2010-0624).
|
||||
- deprecated heap_overflow_in_rtapelib.patch,chmodRaceC.patch and
|
||||
include_fatal_c.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 3 09:29:23 UTC 2010 - mseben@novell.com
|
||||
|
||||
|
30
cpio.spec
30
cpio.spec
@ -23,24 +23,29 @@ Url: http://www.gnu.org/software/cpio/cpio.html
|
||||
License: GPLv3
|
||||
Group: Productivity/Archiving/Compression
|
||||
AutoReqProv: on
|
||||
Version: 2.11
|
||||
Version: 2.10
|
||||
Release: 6
|
||||
Summary: A Backup and Archiving Utility
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Patch2: %{name}-use_new_ascii_format.patch
|
||||
#oouch what a ...?! pieces of code grabed from mt_st package to add missing functionality (e.g. density info)
|
||||
Patch3: %{name}-mt.patch
|
||||
Patch4: %{name}-use_sbin_rmt.patch
|
||||
Patch5: %{name}-open_nonblock.patch
|
||||
Patch2: %{name}-%{version}-use_new_ascii_format.patch
|
||||
Patch3: %{name}-%{version}-mt.patch
|
||||
Patch4: %{name}-%{version}-use_sbin_rmt.patch
|
||||
Patch5: %{name}-%{version}-open_nonblock.patch
|
||||
Patch7: %{name}-%{version}-chmodRaceC.patch
|
||||
#patch dir_perm reverts some things which were added by patch #7 chmodRaceC
|
||||
Patch14: %{name}-dir_perm.patch
|
||||
Patch15: %{name}-eof_tape_handling.patch
|
||||
Patch14: %{name}-%{version}-dir_perm.patch
|
||||
Patch15: %{name}-%{version}-eof_tape_handling.patch
|
||||
# make posibble to have device nodes with major number > 127
|
||||
# Red Hat Bugzilla #450109
|
||||
Patch17: %{name}-dev_number.patch
|
||||
Patch18: %{name}-default_tape_dev.patch
|
||||
Patch17: %{name}-%{version}-dev_number.patch
|
||||
Patch18: %{name}-%{version}-default_tape_dev.patch
|
||||
#PATCH-FIX-UPSTREAM include_fatal_c.patch fix undefined ref in mt build
|
||||
Patch19: %{name}-%{version}-include_fatal_c.patch
|
||||
#PATCH-FIX-UPSTREAM cpio-2.10-close_files_after_copy.patch
|
||||
Patch20: %{name}-close_files_after_copy.patch
|
||||
Patch20: %{name}-%{version}-close_files_after_copy.patch
|
||||
#fix possible heap overflow in rtapelib.c bnc#579475
|
||||
Patch21: %{name}-%{version}-heap_overflow_in_rtapelib.patch
|
||||
PreReq: %install_info_prereq
|
||||
PreReq: %install_info_prereq
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Requires: %{name}-lang = %{version}
|
||||
@ -71,11 +76,14 @@ Authors:
|
||||
%patch3
|
||||
%patch4
|
||||
%patch5
|
||||
%patch7
|
||||
%patch14 -p1
|
||||
%patch15
|
||||
%patch17
|
||||
%patch18
|
||||
%patch19
|
||||
%patch20
|
||||
%patch21 -p1
|
||||
#chmod 755 .
|
||||
#chmod u+w *
|
||||
#chmod a+r *
|
||||
|
Loading…
Reference in New Issue
Block a user