#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#if defined(STDC_HEADERS)
#include <stdlib.h>
-#endif
#include "fetchmail.h"
#include "socket.h"
-#include "i18n.h"
-#include "md5.h"
+#include "gettext.h"
+#include "fm_md5.h"
-#if OPIE_ENABLE
+#ifdef OPIE_ENABLE
+#ifdef __cplusplus
+extern "C" {
+#endif
#include <opie.h>
+#ifdef __cplusplus
+}
+#endif
-int do_otp(int sock, char *command, struct query *ctl)
+int do_otp(int sock, const char *command, struct query *ctl)
{
int i, rval;
- int result;
char buffer[128];
char challenge[OPIE_CHALLENGE_MAX+1+8];
char response[OPIE_RESPONSE_MAX+1];
gen_send(sock, "%s X-OTP", command);
- if (rval = gen_recv(sock, buffer, sizeof(buffer)))
+ if ((rval = gen_recv(sock, buffer, sizeof(buffer))))
return rval;
if (strncmp(buffer, "+", 1)) {
to64frombits(buffer, ctl->remotename, strlen(ctl->remotename));
suppress_tags = TRUE;
- gen_send(sock, buffer, sizeof(buffer));
+ gen_send(sock, "%s", buffer);
suppress_tags = FALSE;
- if (rval = gen_recv(sock, buffer, sizeof(buffer)))
+ if ((rval = gen_recv(sock, buffer, sizeof(buffer))))
return rval;
memset(challenge, '\0', sizeof(challenge));
to64frombits(buffer, response, strlen(response));
suppress_tags = TRUE;
- gen_send(sock, buffer, strlen(buffer));
+ gen_send(sock, "%s", buffer);
suppress_tags = FALSE;
- if (rval = gen_recv(sock, buffer, sizeof(buffer)))
+ if ((rval = gen_recv(sock, buffer, sizeof(buffer))))
return rval;
- if (result)
- return PS_SUCCESS;
- else
- return PS_AUTHFAIL;
-};
+ return PS_SUCCESS;
+}
#endif /* OPIE_ENABLE */
/* opie.c ends here */