ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/misc.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/misc.c (file contents):
Revision 6784 by michael, Mon Nov 16 19:01:49 2015 UTC vs.
Revision 7152 by michael, Thu Jan 28 10:24:03 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2015 ircd-hybrid development team
4 > *  Copyright (c) 1997-2016 ircd-hybrid development team
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
# Line 99 | Line 99 | date_ctime(time_t lclock)
99   const char *
100   time_dissect(time_t duration)
101   {
102 <  static char buf[64];
102 >  static char buf[32];  /* 32 = sizeof("9999999999999999 days, 23:59:59") */
103    unsigned int days = 0, hours = 0, minutes = 0, seconds = 0;
104  
105 <  while (time >= 60 * 60 * 24)
105 >  while (duration >= 60 * 60 * 24)
106    {
107      duration -= 60 * 60 * 24;
108      ++days;
109    }
110  
111 <  while (time >= 60 * 60)
111 >  while (duration >= 60 * 60)
112    {
113      duration -= 60 * 60;
114      ++hours;
115    }
116  
117 <  while (time >= 60)
117 >  while (duration >= 60)
118    {
119      duration -= 60;
120      ++minutes;
# Line 127 | Line 127 | time_dissect(time_t duration)
127    return buf;
128   }
129  
130 < #ifdef HAVE_LIBCRYPTO
131 < const char *
132 < ssl_get_cipher(const SSL *ssl)
130 > void
131 > binary_to_hex(const unsigned char *bin, char *hex, unsigned int length)
132   {
133 <  static char buffer[IRCD_BUFSIZE];
135 <  int bits = 0;
133 >  static const char trans[] = "0123456789ABCDEF";
134  
135 <  SSL_CIPHER_get_bits(SSL_get_current_cipher(ssl), &bits);
135 >  for (const unsigned char *const end = bin + length; bin < end; ++bin)
136 >  {
137 >    *hex++ = trans[*bin >>  4];
138 >    *hex++ = trans[*bin & 0xf];
139 >  }
140  
141 <  snprintf(buffer, sizeof(buffer), "%s-%s-%d", SSL_get_version(ssl),
140 <           SSL_get_cipher(ssl), bits);
141 <  return buffer;
141 >  *hex = '\0';
142   }
143 #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)