$NetBSD: patch-al,v 1.3 2007/03/09 14:46:08 obache Exp $ --- imtest/imtest.c.orig 2006-01-21 05:31:23.000000000 +0900 +++ imtest/imtest.c @@ -47,7 +47,9 @@ #include #include #include +#if !defined(__APPLE__) #include +#endif #include #include @@ -72,6 +74,10 @@ #include #include +#ifdef HAVE_SYS_PARAM_H +#include +#endif + #include #include @@ -886,6 +892,12 @@ imt_stat getauthline(struct sasl_cmd_t * } if (*str != '\r') { + /* trim CRLF */ + char *p = str + strlen(str) - 1; + if (p >= str && *p == '\n') *p-- = '\0'; + if (p >= str && *p == '\r') *p-- = '\0'; + + /* alloc space for decoded response */ len = strlen(str) + 1; *line = malloc(len); if ((*line) == NULL) {