~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to pstack/bucomm.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120222223355-or06x1euyk8n0ldi
Tags: 5.1.61-0ubuntu0.10.04.1
* SECURITY UPDATE: Update to 5.1.61 to fix multiple security issues
  (LP: #937869)
  - http://www.oracle.com/technetwork/topics/security/cpujan2012-366304.html
  - CVE-2011-2262
  - CVE-2012-0075
  - CVE-2012-0112
  - CVE-2012-0113
  - CVE-2012-0114
  - CVE-2012-0115
  - CVE-2012-0116
  - CVE-2012-0117
  - CVE-2012-0118
  - CVE-2012-0119
  - CVE-2012-0120
  - CVE-2012-0484
  - CVE-2012-0485
  - CVE-2012-0486
  - CVE-2012-0487
  - CVE-2012-0488
  - CVE-2012-0489
  - CVE-2012-0490
  - CVE-2012-0491
  - CVE-2012-0492
  - CVE-2012-0493
  - CVE-2012-0494
  - CVE-2012-0495
  - CVE-2012-0496
* Dropped patches unnecessary with 5.1.61:
  - debian/patches/90_mysql_safer_strmov.dpatch
  - debian/patches/51_ssl_test_certs.dpatch
  - debian/patches/52_CVE-2009-4030.dpatch
  - debian/patches/53_CVE-2009-4484.dpatch
  - debian/patches/54_CVE-2008-7247.dpatch
  - debian/patches/55_CVE-2010-1621.dpatch
  - debian/patches/56_CVE-2010-1850.dpatch
  - debian/patches/57_CVE-2010-1849.dpatch
  - debian/patches/58_CVE-2010-1848.dpatch
  - debian/patches/59_CVE-2010-1626.dpatch
  - debian/patches/60_CVE-2010-2008.dpatch
  - debian/patches/60_CVE-2010-3677.dpatch
  - debian/patches/60_CVE-2010-3678.dpatch
  - debian/patches/60_CVE-2010-3679.dpatch
  - debian/patches/60_CVE-2010-3680.dpatch
  - debian/patches/60_CVE-2010-3681.dpatch
  - debian/patches/60_CVE-2010-3682.dpatch
  - debian/patches/60_CVE-2010-3683.dpatch
  - debian/patches/60_CVE-2010-3833.dpatch
  - debian/patches/60_CVE-2010-3834.dpatch
  - debian/patches/60_CVE-2010-3835.dpatch
  - debian/patches/60_CVE-2010-3836.dpatch
  - debian/patches/60_CVE-2010-3837.dpatch
  - debian/patches/60_CVE-2010-3838.dpatch
  - debian/patches/60_CVE-2010-3839.dpatch
  - debian/patches/60_CVE-2010-3840.dpatch
  - debian/patches/61_disable_longfilename_test.dpatch
  - debian/patches/62_alter_table_fix.dpatch
  - debian/patches/63_cherrypick-upstream-49479.dpatch
  - debian/patches/10_readline_build_fix.dpatch
* debian/mysql-client-5.1.docs: removed EXCEPTIONS-CLIENT file
* debian/mysql-server-5.1.docs,debian/libmysqlclient16.docs,
  debian/libmysqlclient-dev.docs: removed, no longer necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* bucomm.c -- Bin Utils COMmon code.
2
 
   Copyright (C) 1991, 92, 93, 94, 95, 1997 Free Software Foundation, Inc.
3
 
 
4
 
   This file is part of GNU Binutils.
5
 
 
6
 
   This program is free software; you can redistribute it and/or modify
7
 
   it under the terms of the GNU General Public License as published by
8
 
   the Free Software Foundation; either version 2 of the License, or
9
 
   (at your option) any later version.
10
 
 
11
 
   This program is distributed in the hope that it will be useful,
12
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
   GNU General Public License for more details.
15
 
 
16
 
   You should have received a copy of the GNU General Public License
17
 
   along with this program; if not, write to the Free Software
18
 
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
 
   02111-1307, USA.  */
20
 
 
21
 
/* We might put this in a library someday so it could be dynamically
22
 
   loaded, but for now it's not necessary.  */
23
 
 
24
 
#include <bfd.h>
25
 
#include <libiberty.h>
26
 
#include "bucomm.h"
27
 
 
28
 
#include <sys/stat.h>
29
 
#include <time.h>               /* ctime, maybe time_t */
30
 
 
31
 
#ifdef ANSI_PROTOTYPES
32
 
#include <stdarg.h>
33
 
#else
34
 
#include <varargs.h>
35
 
#endif
36
 
 
37
 
/* Error reporting */
38
 
 
39
 
char *program_name;
40
 
 
41
 
void
42
 
bfd_nonfatal (string)
43
 
     CONST char *string;
44
 
{
45
 
  CONST char *errmsg = bfd_errmsg (bfd_get_error ());
46
 
 
47
 
  if (string)
48
 
    fprintf (stderr, "%s: %s: %s\n", program_name, string, errmsg);
49
 
  else
50
 
    fprintf (stderr, "%s: %s\n", program_name, errmsg);
51
 
}
52
 
 
53
 
void
54
 
bfd_fatal (string)
55
 
     CONST char *string;
56
 
{
57
 
  bfd_nonfatal (string);
58
 
  xexit (1);
59
 
}
60
 
 
61
 
#ifdef ANSI_PROTOTYPES
62
 
void
63
 
fatal (const char *format, ...)
64
 
{
65
 
  va_list args;
66
 
 
67
 
  fprintf (stderr, "%s: ", program_name);
68
 
  va_start (args, format);
69
 
  vfprintf (stderr, format, args);
70
 
  va_end (args);
71
 
  putc ('\n', stderr);
72
 
  xexit (1);
73
 
}
74
 
#else
75
 
void 
76
 
fatal (va_alist)
77
 
     va_dcl
78
 
{
79
 
  char *Format;
80
 
  va_list args;
81
 
 
82
 
  fprintf (stderr, "%s: ", program_name);
83
 
  va_start (args);
84
 
  Format = va_arg (args, char *);
85
 
  vfprintf (stderr, Format, args);
86
 
  va_end (args);
87
 
  putc ('\n', stderr);
88
 
  xexit (1);
89
 
}
90
 
#endif
91
 
 
92
 
/* Set the default BFD target based on the configured target.  Doing
93
 
   this permits the binutils to be configured for a particular target,
94
 
   and linked against a shared BFD library which was configured for a
95
 
   different target.  */
96
 
 
97
 
#define TARGET  "elf32-i386"    /* FIXME: hard-coded! */
98
 
void
99
 
set_default_bfd_target ()
100
 
{
101
 
  /* The macro TARGET is defined by Makefile.  */
102
 
  const char *target = TARGET;
103
 
 
104
 
  if (! bfd_set_default_target (target))
105
 
    {
106
 
      char *errmsg;
107
 
 
108
 
      errmsg = (char *) xmalloc (100 + strlen (target));
109
 
      sprintf (errmsg, "can't set BFD default target to `%s'", target);
110
 
      bfd_fatal (errmsg);
111
 
    }
112
 
}
113
 
 
114
 
/* After a false return from bfd_check_format_matches with
115
 
   bfd_get_error () == bfd_error_file_ambiguously_recognized, print
116
 
   the possible matching targets.  */
117
 
 
118
 
void
119
 
list_matching_formats (p)
120
 
     char **p;
121
 
{
122
 
  fprintf(stderr, "%s: Matching formats:", program_name);
123
 
  while (*p)
124
 
    fprintf(stderr, " %s", *p++);
125
 
  fprintf(stderr, "\n");
126
 
}
127
 
 
128
 
/* List the supported targets.  */
129
 
 
130
 
void
131
 
list_supported_targets (name, f)
132
 
     const char *name;
133
 
     FILE *f;
134
 
{
135
 
  extern bfd_target *bfd_target_vector[];
136
 
  int t;
137
 
 
138
 
  if (name == NULL)
139
 
    fprintf (f, "Supported targets:");
140
 
  else
141
 
    fprintf (f, "%s: supported targets:", name);
142
 
  for (t = 0; bfd_target_vector[t] != NULL; t++)
143
 
    fprintf (f, " %s", bfd_target_vector[t]->name);
144
 
  fprintf (f, "\n");
145
 
}
146
 
 
147
 
/* Display the archive header for an element as if it were an ls -l listing:
148
 
 
149
 
   Mode       User\tGroup\tSize\tDate               Name */
150
 
 
151
 
void
152
 
print_arelt_descr (file, abfd, verbose)
153
 
     FILE *file;
154
 
     bfd *abfd;
155
 
     boolean verbose;
156
 
{
157
 
  struct stat buf;
158
 
 
159
 
  if (verbose)
160
 
    {
161
 
      if (bfd_stat_arch_elt (abfd, &buf) == 0)
162
 
        {
163
 
          char modebuf[11];
164
 
          char timebuf[40];
165
 
          time_t when = buf.st_mtime;
166
 
          CONST char *ctime_result = (CONST char *) ctime (&when);
167
 
 
168
 
          /* POSIX format:  skip weekday and seconds from ctime output.  */
169
 
          sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
170
 
 
171
 
          mode_string (buf.st_mode, modebuf);
172
 
          modebuf[10] = '\0';
173
 
          /* POSIX 1003.2/D11 says to skip first character (entry type).  */
174
 
          fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
175
 
                   (long) buf.st_uid, (long) buf.st_gid,
176
 
                   (long) buf.st_size, timebuf);
177
 
        }
178
 
    }
179
 
 
180
 
  fprintf (file, "%s\n", bfd_get_filename (abfd));
181
 
}
182
 
 
183
 
/* Return the name of a temporary file in the same directory as FILENAME.  */
184
 
 
185
 
char *
186
 
make_tempname (filename)
187
 
     char *filename;
188
 
{
189
 
  static char template[] = "stXXXXXX";
190
 
  char *tmpname;
191
 
  char *slash = strrchr (filename, '/');
192
 
 
193
 
#if defined (__DJGPP__) || defined (__GO32__) || defined (_WIN32)
194
 
  if (slash == NULL)
195
 
    slash = strrchr (filename, '\\');
196
 
#endif
197
 
 
198
 
  if (slash != (char *) NULL)
199
 
    {
200
 
      char c;
201
 
 
202
 
      c = *slash;
203
 
      *slash = 0;
204
 
      tmpname = xmalloc (strlen (filename) + sizeof (template) + 1);
205
 
      strcpy (tmpname, filename);
206
 
      strcat (tmpname, "/");
207
 
      strcat (tmpname, template);
208
 
      mkstemp (tmpname);
209
 
      *slash = c;
210
 
    }
211
 
  else
212
 
    {
213
 
      tmpname = xmalloc (sizeof (template));
214
 
      strcpy (tmpname, template);
215
 
      mkstemp (tmpname);
216
 
    }
217
 
  return tmpname;
218
 
}
219
 
 
220
 
/* Parse a string into a VMA, with a fatal error if it can't be
221
 
   parsed.  */
222
 
 
223
 
bfd_vma
224
 
parse_vma (s, arg)
225
 
     const char *s;
226
 
     const char *arg;
227
 
{
228
 
  bfd_vma ret;
229
 
  const char *end;
230
 
 
231
 
  ret = bfd_scan_vma (s, &end, 0);
232
 
  if (*end != '\0')
233
 
    {
234
 
      fprintf (stderr, "%s: %s: bad number: %s\n", program_name, arg, s);
235
 
      exit (1);
236
 
    }
237
 
  return ret;
238
 
}