static void clear_capability(void);
static int have_capability(void);
static int send_imap_command(netsec_context *, int noflush, char **errstr,
- const char *fmt, ...);
+ const char *fmt, ...) CHECK_PRINTF(4, 5);
static int get_imap_response(netsec_context *, const char *token,
char **tokenresp, char **status, int failerr,
char **errstr);
static void ts_report(const char *str, struct timeval *tv);
-static void add_msg(int queue, const char *fmt, ...);
+static void add_msg(int queue, const char *fmt, ...) CHECK_PRINTF(2, 3);
static bool timestamp = false;
if (initialtls || tls) {
if (netsec_set_tls(nsc, 1, 0, &errstr) != OK)
- adios(NULL, errstr);
+ adios(NULL, "%s", errstr);
if (initialtls && netsec_negotiate_tls(nsc, &errstr) != OK)
- adios(NULL, errstr);
+ adios(NULL, "%s", errstr);
}
if (sasl) {
if (netsec_set_sasl_params(nsc, "imap", saslmech, imap_sasl_callback,
nsc, &errstr) != OK)
- adios(NULL, errstr);
+ adios(NULL, "%s", errstr);
}
if ((cp = netsec_readline(nsc, &len, &errstr)) == NULL) {
- adios(NULL, errstr);
+ adios(NULL, "%s", errstr);
}
if (has_prefix(cp, "* BYE")) {
goto finish;
}
if (netsec_negotiate_tls(nsc, &errstr) != OK) {
- adios(NULL, errstr);
+ adios(NULL, "%s", errstr);
}
}
}
for (i = 0; caplist[i] != NULL; i++) {
- if (has_prefix(caplist[i], "AUTH=") && caplist[i] + 5 != '\0') {
+ if (has_prefix(caplist[i], "AUTH=") && *(caplist[i] + 5) != '\0') {
if (saslmechs) {
saslmechs = add(" ", saslmechs);
}
}
}
- free(caplist);
free(str);
}
*/
case NETSEC_SASL_FINISH:
+ line = NULL;
if (get_imap_response(nsc, NULL, NULL, &line, 1, errstr) != OK)
return NOTOK;
/*
* parse it.
*/
- if (has_prefix(line, "OK [CAPABILITY ")) {
+ if (line && has_prefix(line, "OK [CAPABILITY ")) {
char *p = line + 15, *q;
q = strchr(p, ']');
if (has_prefix(line, cmdqueue->tag)) {
cmd = cmdqueue;
if (timestamp)
- ts_report("Command execution time:", &cmd->start);
+ ts_report("Command execution time", &cmd->start);
cmdqueue = cmd->next;
free(cmd);
} else {