~andersk/ubuntu/oneiric/openssl/spurious-reboot

« back to all changes in this revision

Viewing changes to crypto/err/err_prn.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-01 23:51:53 UTC
  • mfrom: (11.1.20 sid)
  • Revision ID: james.westby@ubuntu.com-20110501235153-bjcxitndquaezb68
Tags: 1.0.0d-2ubuntu1
* Resynchronise with Debian (LP: #675566).  Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification bubble on libssl1.0.0
      upgrade.
    + Use a different priority for libssl1.0.0/restart-services depending
      on whether a desktop, or server dist-upgrade is being performed.
  - debian/{libssl1.0.0-udeb.dirs, control, rules}: Create
    libssl1.0.0-udeb, for the benefit of wget-udeb (no wget-udeb package
    in Debian).
  - debian/{libcrypto1.0.0-udeb.dirs, libssl1.0.0.dirs, libssl1.0.0.files,
    rules}: Move runtime libraries to /lib, for the benefit of
    wpasupplicant.
  - debian/patches/aesni.patch: Backport Intel AES-NI support, now from
    http://rt.openssl.org/Ticket/Display.html?id=2065 rather than the
    0.9.8 variant.
  - debian/patches/Bsymbolic-functions.patch: Link using
    -Bsymbolic-functions.
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths under
    .pc.
  - debian/rules:
    + Don't run 'make test' when cross-building.
    + Use host compiler when cross-building.  Patch from Neil Williams.
    + Don't build for processors no longer supported: i486, i586 (on
      i386), v8 (on sparc).
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
* Update architectures affected by Bsymbolic-functions.patch.
* Drop debian/patches/no-sslv2.patch; Debian now adds the 'no-ssl2'
  configure option, which compiles out SSLv2 support entirely, so this is
  no longer needed.
* Drop openssl-doc in favour of the libssl-doc package introduced by
  Debian.  Add Conflicts/Replaces until the next LTS release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        const char *file,*data;
73
73
        int line,flags;
74
74
        unsigned long es;
 
75
        CRYPTO_THREADID cur;
75
76
 
76
 
        es=CRYPTO_thread_id();
 
77
        CRYPTO_THREADID_current(&cur);
 
78
        es=CRYPTO_THREADID_hash(&cur);
77
79
        while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
78
80
                {
79
81
                ERR_error_string_n(l, buf, sizeof buf);
100
102
        }
101
103
#endif
102
104
 
103
 
void ERR_error_string_n(unsigned long e, char *buf, size_t len)
104
 
        {
105
 
        char lsbuf[64], fsbuf[64], rsbuf[64];
106
 
        const char *ls,*fs,*rs;
107
 
        unsigned long l,f,r;
108
 
 
109
 
        l=ERR_GET_LIB(e);
110
 
        f=ERR_GET_FUNC(e);
111
 
        r=ERR_GET_REASON(e);
112
 
 
113
 
        ls=ERR_lib_error_string(e);
114
 
        fs=ERR_func_error_string(e);
115
 
        rs=ERR_reason_error_string(e);
116
 
 
117
 
        if (ls == NULL) 
118
 
                BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
119
 
        if (fs == NULL)
120
 
                BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f);
121
 
        if (rs == NULL)
122
 
                BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r);
123
 
 
124
 
        BIO_snprintf(buf, len,"error:%08lX:%s:%s:%s", e, ls?ls:lsbuf, 
125
 
                fs?fs:fsbuf, rs?rs:rsbuf);
126
 
        if (strlen(buf) == len-1)
127
 
                {
128
 
                /* output may be truncated; make sure we always have 5 
129
 
                 * colon-separated fields, i.e. 4 colons ... */
130
 
#define NUM_COLONS 4
131
 
                if (len > NUM_COLONS) /* ... if possible */
132
 
                        {
133
 
                        int i;
134
 
                        char *s = buf;
135
 
                        
136
 
                        for (i = 0; i < NUM_COLONS; i++)
137
 
                                {
138
 
                                char *colon = strchr(s, ':');
139
 
                                if (colon == NULL || colon > &buf[len-1] - NUM_COLONS + i)
140
 
                                        {
141
 
                                        /* set colon no. i at last possible position
142
 
                                         * (buf[len-1] is the terminating 0)*/
143
 
                                        colon = &buf[len-1] - NUM_COLONS + i;
144
 
                                        *colon = ':';
145
 
                                        }
146
 
                                s = colon + 1;
147
 
                                }
148
 
                        }
149
 
                }
150
 
        }
151
 
 
152
 
/* BAD for multi-threading: uses a local buffer if ret == NULL */
153
 
/* ERR_error_string_n should be used instead for ret != NULL
154
 
 * as ERR_error_string cannot know how large the buffer is */
155
 
char *ERR_error_string(unsigned long e, char *ret)
156
 
        {
157
 
        static char buf[256];
158
 
 
159
 
        if (ret == NULL) ret=buf;
160
 
        ERR_error_string_n(e, ret, 256);
161
 
 
162
 
        return ret;
163
 
        }
 
105
static int print_bio(const char *str, size_t len, void *bp)
 
106
        {
 
107
        return BIO_write((BIO *)bp, str, len);
 
108
        }
 
109
void ERR_print_errors(BIO *bp)
 
110
        {
 
111
        ERR_print_errors_cb(print_bio, bp);
 
112
        }
 
113
 
 
114