chiark / gitweb /
server: Introduce another temporary buffer for debugging output.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 8 Dec 2008 12:11:28 +0000 (12:11 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 8 Dec 2008 20:11:32 +0000 (20:11 +0000)
Debugging output trashed important things like hashes in buf_t.
Introduce a new buf_u and use that in functions like mpstr and gestr.

server/servutil.c
server/tripe.h

index 1f6301a4d14171e7928ddcf71151ede24b761c6e..dbca451d4ca920b9447359a3676aef6810f2cf2e 100644 (file)
@@ -30,7 +30,7 @@
 
 /*----- Global variables --------------------------------------------------*/
 
-octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ];
+octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ], buf_u[PKBUFSZ];
 
 /*----- Main code ---------------------------------------------------------*/
 
@@ -41,14 +41,14 @@ octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ];
  * Returns:    A pointer to the integer's textual representation.
  *
  * Use:                Converts a multiprecision integer to a string.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 const char *mpstr(mp *m)
 {
-  if (mp_writestring(m, (char *)buf_t, sizeof(buf_t), 10))
+  if (mp_writestring(m, (char *)buf_u, sizeof(buf_u), 10))
     return ("<failed>");
-  return ((const char *)buf_t);
+  return ((const char *)buf_u);
 }
 
 /* --- @gestr@ --- *
@@ -59,14 +59,14 @@ const char *mpstr(mp *m)
  * Returns:    A pointer to the element's textual representation.
  *
  * Use:                Converts a group element to a string.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 const char *gestr(group *g, ge *x)
 {
-  if (group_writestring(g, x, (char *)buf_t, sizeof(buf_t)))
+  if (group_writestring(g, x, (char *)buf_u, sizeof(buf_u)))
     return ("<failed>");
-  return ((const char *)buf_t);
+  return ((const char *)buf_u);
 }
 
 /* --- @timestr@ --- *
@@ -76,7 +76,7 @@ const char *gestr(group *g, ge *x)
  * Returns:    A pointer to a textual representation of the time.
  *
  * Use:                Converts a time to a textual representation.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 const char *timestr(time_t t)
@@ -85,8 +85,8 @@ const char *timestr(time_t t)
   if (!t)
     return ("NEVER");
   tm = localtime(&t);
-  strftime((char *)buf_t, sizeof(buf_t), "%Y-%m-%dT%H:%M:%S", tm);
-  return ((const char *)buf_t);
+  strftime((char *)buf_u, sizeof(buf_u), "%Y-%m-%dT%H:%M:%S", tm);
+  return ((const char *)buf_u);
 }
 
 /* --- @mystrieq@ --- *
index 6cfffc526530867f7628d8380e152d0a54ee4adf..483880a4d407520a4fecef106178928be6f05400 100644 (file)
@@ -491,7 +491,7 @@ extern group *gg;                   /* The group we work in */
 extern size_t indexsz;                 /* Size of exponent for the group */
 extern mp *kpriv;                      /* Our private key */
 extern ge *kpub;                       /* Our public key */
-extern octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ];
+extern octet buf_i[PKBUFSZ], buf_o[PKBUFSZ], buf_t[PKBUFSZ], buf_u[PKBUFSZ];
 extern const tunnel_ops *tunnels[];    /* Table of tunnels (0-term) */
 extern const tunnel_ops *tun_default;  /* Default tunnel to use */
 
@@ -1236,7 +1236,7 @@ extern const tunnel_ops tun_slip;
  * Returns:    A pointer to the integer's textual representation.
  *
  * Use:                Converts a multiprecision integer to a string.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 extern const char *mpstr(mp */*m*/);
@@ -1249,7 +1249,7 @@ extern const char *mpstr(mp */*m*/);
  * Returns:    A pointer to the element's textual representation.
  *
  * Use:                Converts a group element to a string.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 extern const char *gestr(group */*g*/, ge */*x*/);
@@ -1261,7 +1261,7 @@ extern const char *gestr(group */*g*/, ge */*x*/);
  * Returns:    A pointer to a textual representation of the time.
  *
  * Use:                Converts a time to a textual representation.  Corrupts
- *             @buf_t@.
+ *             @buf_u@.
  */
 
 extern const char *timestr(time_t /*t*/);