From a4b808b03590fcaace247ed007d035c6bee8e353 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Mon, 8 Dec 2008 12:11:28 +0000 Subject: [PATCH] server: Introduce another temporary buffer for debugging output. Organization: Straylight/Edgeware From: Mark Wooding 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 | 20 ++++++++++---------- server/tripe.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/server/servutil.c b/server/servutil.c index 1f6301a4..dbca451d 100644 --- a/server/servutil.c +++ b/server/servutil.c @@ -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 (""); - 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 (""); - 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@ --- * diff --git a/server/tripe.h b/server/tripe.h index 6cfffc52..483880a4 100644 --- a/server/tripe.h +++ b/server/tripe.h @@ -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*/); -- [mdw]