From ca7a083e7d3698a6b957932fcaed65d7fd5daf71 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 22 Jul 2003 20:22:39 +0000 Subject: [PATCH] Updated some binkp code to new specs --- ChangeLog | 3 +++ mbcico/binkp.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bd84d39..ce0ff481 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ v0.37.5 12-Jul-2003 common.a: Node locking tests for non-stale lockfiles older then 6 hours. + mbcico: + Implemented CRAM rev.4 change in binkp driver. + v0.37.4 10-May-2003 - 12-Jul-2003 diff --git a/mbcico/binkp.c b/mbcico/binkp.c index cc7c1854..81f0deb0 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -218,7 +218,7 @@ int resync(off_t off) /* - * Translate filename to binkp filename, unsafe characters are escaped. + * Translate string to binkp escaped string, unsafe characters are escaped. */ char *unix2binkp(char *fn) { @@ -248,7 +248,7 @@ char *unix2binkp(char *fn) /* - * Translate escaped binkp filename to unix. + * Translate escaped binkp string to normal string. */ char *binkp2unix(char *fn) { @@ -263,12 +263,28 @@ char *binkp2unix(char *fn) while (*p) { if (p[0] == '\\') { p++; - hex[0] = *p++; - hex[1] = *p; - hex[2] = '\0'; - sscanf(hex, "%2x", &c); - *q++ = c; - *q = '\0'; + if (*p == '\\') { + /* + * A backslash is transmitted + */ + *q++ = '\\'; + *q = '\0'; + } else { + /* + * If remote sends \x0a method instead of \0a, eat the x character + */ + if ((*p == 'x') || (*p == 'X')) + p++; + /* + * Decode hex characters + */ + hex[0] = *p++; + hex[1] = *p; + hex[2] = '\0'; + sscanf(hex, "%2x", &c); + *q++ = c; + *q = '\0'; + } } else { *q++ = *p; *q = '\0'; @@ -880,7 +896,7 @@ SM_STATE(pwdack) if (inbound) free(inbound); inbound = xstrcpy(CFG.pinbound); - binkp_send_control(MM_OK, ""); + binkp_send_control(MM_OK, "secure"); SM_SUCCESS; } } else {