#include <lib-lib/file.h>
#include <lib-lib/macros.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-lib/rx.h>
#include <lib-sys/unix.h>
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-sys/unix.h>
m_strcpy(command, sizeof(command), entry->composecommand);
if (rfc1524_expand_filename (entry->nametemplate,
a->filename, newfile, sizeof (newfile))) {
- debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
if (safe_symlink (a->filename, newfile) == -1) {
if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
!= M_YES)
m_strcpy(command, sizeof(command), entry->editcommand);
if (rfc1524_expand_filename (entry->nametemplate,
a->filename, newfile, sizeof (newfile))) {
- debug_print (1, ("oldfile: %s\t newfile: %s\n", a->filename, newfile));
- if (safe_symlink (a->filename, newfile) == -1) {
+ if (safe_symlink (a->filename, newfile) == -1) {
if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES)
!= M_YES)
goto bailout;
n == TYPEMULTIPART ? "multipart" :
n == TYPETEXT ? "text" :
n == TYPEVIDEO ? "video" : "other", tmp.subtype);
- debug_print (1, ("\"%s\" -> %s\n", b->filename, type));
}
if (tmp.subtype)
p_delete(&tmp.subtype);
rfc1524_entry *entry;
int piped = FALSE;
- debug_print (2, ("Using mailcap...\n"));
-
entry = rfc1524_new_entry ();
rfc1524_mailcap_lookup (a, type, entry, M_PRINT);
if (rfc1524_expand_filename (entry->nametemplate, a->filename,
mutt_mktemp (newfile);
if (mutt_decode_save_attachment (fp, a, newfile, M_PRINTING, 0) == 0) {
- debug_print (2, ("successfully decoded %s type attachment to %s\n",
- type, newfile));
-
if ((ifp = fopen (newfile, "r")) == NULL) {
mutt_perror ("fopen");
goto bail0;
}
- debug_print (2, ("successfully opened %s read-only\n", newfile));
-
mutt_endwin (NULL);
if ((thepid =
mutt_create_filter (NONULL (PrintCmd), &fpout, NULL, NULL)) < 0) {
goto bail0;
}
- debug_print (2, ("Filter created.\n"));
-
mutt_copy_stream (ifp, fpout);
safe_fclose (&fpout);
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
#include <lib-lib/ascii.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
(option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
CH_DECODE | CH_FROM);
if (res == 0 && (ferror(fpout) || feof(fpout))) {
- debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
res = -1;
}
#include <lib-lib/str.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "mx.h"
char imap_path[LONG_STRING];
- debug_print (2, ("completing %s\n", s));
-
#ifdef USE_NNTP
if (option (OPTNEWS)) {
string_list_t *l = CurrentNewsSrv->list;
}
if (dirp == NULL) {
- debug_print (1, ("%s: %s (errno %d).\n", exp_dirpart, strerror (errno), errno));
return (-1);
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/mutt_signal.h>
#include <lib-sys/unix.h>
cmd = get_compression_cmd (ci->open, ctx);
if (cmd == NULL)
return (-1);
- debug_print (2, ("DecompressCmd: '%s'\n", cmd));
if ((fp = fopen (ctx->realpath, "r")) == NULL) {
mutt_perror (ctx->realpath);
/* close a compressed mailbox */
void mutt_fast_close_compressed (CONTEXT * ctx)
{
- debug_print (2, ("called on '%s'\n", ctx->path));
-
if (ctx->compressinfo) {
if (ctx->fp)
fclose (ctx->fp);
return (-1);
}
- debug_print (2, ("CompressCommand: '%s'\n", cmd));
-
endwin ();
fflush (stdout);
sprintf (echo_cmd, _("echo Compressing %s..."), ctx->realpath);
char *cmd;
COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo;
- debug_print (2, ("called on '%s'\n", ctx->path));
-
if (!(ctx->append && ((append = get_append_command (ctx->realpath, ctx))
|| (append = ci->close)))) { /* if we can not or should not append,
* we only have to remove the compressed info, because sync was already
return (-1);
}
- debug_print (2, ("CompressCmd: '%s'\n", cmd));
-
endwin ();
fflush (stdout);
dnl -- end socket --
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging support]),
- [ if test x$enableval = xyes ; then
- AC_DEFINE(DEBUG,1,[ Define to enable debugging info. ])
- fi
- ])
-
AC_ARG_ENABLE(flock, AC_HELP_STRING([--enable-flock], [Use flock() to lock files]),
[if test $enableval = yes; then
AC_DEFINE(USE_FLOCK,1, [ Define to use flock() to lock mailboxes. ])
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/ascii.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
*/
if (flags & CH_REORDER) {
for (t = HeaderOrderList; t; t = t->next) {
- debug_print (1, ("Reorder list: %s\n", t->data));
hdr_count++;
}
}
- debug_print (1, ("WEED is %s\n", (flags & CH_WEED) ? "Set" : "Not"));
-
headers = p_new(char *, hdr_count);
/* Read all the headers into the array */
if (flags & CH_REORDER) {
for (t = HeaderOrderList, x = 0; (t); t = t->next, x++) {
if (!ascii_strncasecmp (buf, t->data, m_strlen(t->data))) {
- debug_print (2, ("Reorder: %s matches %s\n", t->data, buf));
break;
}
}
} /* If beginning of header */
if (!ignore) {
- debug_print (2, ("Reorder: x = %d; hdr_count = %d\n", x, hdr_count));
if (!this_one)
this_one = m_strdup(buf);
/* we do want to see all lines if this header doesn't feature
if (copy_delete_attach (body, fpin, fpout, date))
return -1;
-#ifdef DEBUG
- {
- off_t fail = ((ftello (fpout) - new_offset) - new_length);
-
- if (fail) {
- mutt_error ("The length calculation was wrong by %ld bytes", fail);
- new_length += fail;
- mutt_sleep (1);
- }
- }
-#endif
-
/* Update original message if we are sync'ing a mailfolder */
if (flags & M_CM_UPDATE) {
hdr->attach_del = 0;
_mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags,
chflags)) == 0 && (ferror (fpout)
|| feof (fpout))) {
- debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
r = -1;
}
mx_close_message (&msg);
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
if (!*s)
return 0;
- debug_print (3, ("parsing: %s\n", s));
-
if (!is_day_name (s)) {
const char *p;
ssize_t len;
len = pathlen - 1;
memcpy (path, s, len);
path[len] = 0;
- debug_print (3, ("got return path: %s\n", path));
}
s = vskipspaces(p + 1);
return 0;
if (!is_day_name (s)) {
- debug_print (1, ("expected weekday, got: %s\n", s));
return 0;
}
}
return 0;
tm.tm_year = yr > 1900 ? yr - 1900 : (yr < 70 ? yr + 100 : yr);
- debug_print (3, ("month=%d, day=%d, hr=%d, min=%d, sec=%d, yr=%d.\n",
- tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
- tm.tm_year));
-
tm.tm_isdst = -1;
if (tp)
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
buf[i++] = ch;
}
if (i != 4) {
- debug_print (2, ("didn't get a multiple of 4 chars.\n"));
break;
}
#include <lib-lib/mem.h>
#include <lib-hash/hash.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
#include <lib-lib/macros.h>
#include <lib-lib/ascii.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "alias.h"
mutt_edit_file (editor, path);
stat (path, &st);
if (mtime == st.st_mtime) {
- debug_print (1, ("temp file was not modified.\n"));
/* the file has not changed! */
mutt_unlink (path);
return;
#endif
#include <lib-lib/mem.h>
-#include <lib-lib/debug.h>
#include <lib-lib/macros.h>
#include <lib-lib/ascii.h>
if (!method[0])
continue;
- debug_print (2, ("Trying method %s\n", method));
authenticator = imap_authenticators;
while (authenticator->authenticate) {
}
else {
/* Fall back to default: any authenticator */
- debug_print (2, ("Using any available method.\n"));
authenticator = imap_authenticators;
while (authenticator->authenticate) {
#include "auth.h"
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
/* this is basically a stripped-down version of the cram-md5 method. */
imap_auth_res_t imap_auth_anon (IMAP_DATA * idata, const char *method __attribute__ ((unused)))
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_RESPOND) {
- debug_print (1, ("Invalid response from server.\n"));
goto bail;
}
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_OK) {
- debug_print (1, ("Error receiving server response.\n"));
goto bail;
}
#define MD5_DIGEST_LEN 16
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-hash/hash.h>
/* forward declarations */
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_RESPOND) {
- debug_print (1, ("Invalid response from server: %s\n", ibuf));
goto bail;
}
if ((len = mutt_from_base64 (obuf, idata->cmd.buf + 2)) == -1) {
- debug_print (1, ("Error decoding base64 response.\n"));
goto bail;
}
obuf[len] = '\0';
- debug_print (2, ("CRAM challenge: %s\n", obuf));
/* The client makes note of the data and then responds with a string
* consisting of the user name, a space, and a 'digest'. The latter is
hmac_response[9], hmac_response[10], hmac_response[11],
hmac_response[12], hmac_response[13], hmac_response[14],
hmac_response[15]);
- debug_print (2, ("CRAM response: %s\n", obuf));
/* XXX - ibuf must be long enough to store the base64 encoding of obuf,
* plus the additional debris
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_OK) {
- debug_print (1, ("Error receiving server response.\n"));
goto bail;
}
#include "auth.h"
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <netinet/in.h>
maj_stat = gss_import_name (&min_stat, &request_buf, gss_nt_service_name,
&target_name);
if (maj_stat != GSS_S_COMPLETE) {
- debug_print (2, ("Couldn't get service name for [%s]\n", buf1));
return IMAP_AUTH_UNAVAIL;
}
-#ifdef DEBUG
- else if (DebugLevel >= 2) {
- maj_stat = gss_display_name (&min_stat, target_name, &request_buf,
- &mech_name);
- debug_print (2, ("Using service name [%s]\n",
- (char *) request_buf.value));
- maj_stat = gss_release_buffer (&min_stat, &request_buf);
- }
-#endif
+
/* Acquire initial credentials - without a TGT GSSAPI is UNAVAIL */
sec_token = GSS_C_NO_BUFFER;
context = GSS_C_NO_CONTEXT;
&send_token, (unsigned int *) &cflags,
NULL);
if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
- debug_print (1, ("Error acquiring credentials - no TGT?\n"));
gss_release_name (&min_stat, &target_name);
return IMAP_AUTH_UNAVAIL;
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_RESPOND) {
- debug_print (2, ("Invalid response from server: %s\n", buf1));
gss_release_name (&min_stat, &target_name);
goto bail;
}
/* now start the security context initialisation loop... */
- debug_print (2, ("Sending credentials\n"));
mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
sizeof (buf1) - 2);
gss_release_buffer (&min_stat, &send_token);
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_RESPOND) {
- debug_print (1, ("Error receiving server response.\n"));
gss_release_name (&min_stat, &target_name);
goto bail;
}
NULL, &send_token,
(unsigned int *) &cflags, NULL);
if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) {
- debug_print (1, ("Error exchanging credentials\n"));
gss_release_name (&min_stat, &target_name);
goto err_abort_cmd;
while (rc == IMAP_CMD_CONTINUE);
if (rc != IMAP_CMD_RESPOND) {
- debug_print (1, ("Error receiving server response.\n"));
goto bail;
}
request_buf.length = mutt_from_base64 (buf2, idata->cmd.buf + 2);
maj_stat = gss_unwrap (&min_stat, context, &request_buf, &send_token,
&cflags, &quality);
if (maj_stat != GSS_S_COMPLETE) {
- debug_print (2, ("Couldn't unwrap security level data\n"));
gss_release_buffer (&min_stat, &send_token);
goto err_abort_cmd;
}
- debug_print (2, ("Credential exchange complete\n"));
/* first octet is security levels supported. We want NONE */
server_conf_flags = ((char *) send_token.value)[0];
if (!(((char *) send_token.value)[0] & GSS_AUTH_P_NONE)) {
- debug_print (2, ("Server requires integrity or privacy\n"));
gss_release_buffer (&min_stat, &send_token);
goto err_abort_cmd;
}
((char *) send_token.value)[0] = 0;
buf_size = ntohl (*((long *) send_token.value));
gss_release_buffer (&min_stat, &send_token);
- debug_print (2, ("Unwrapped security level flags: %c%c%c\n",
- server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-',
- server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-',
- server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'));
- debug_print (2, ("Maximum GSS token size is %ld\n", buf_size));
/* agree to terms (hack!) */
buf_size = htonl (buf_size); /* not relevant without integrity/privacy */
maj_stat = gss_wrap (&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
&cflags, &send_token);
if (maj_stat != GSS_S_COMPLETE) {
- debug_print (2, ("Error creating login request\n"));
goto err_abort_cmd;
}
mutt_to_base64 ((unsigned char *) buf1, send_token.value, send_token.length,
sizeof (buf1) - 2);
- debug_print (2, ("Requesting authorisation as %s\n", idata->conn->account.user));
m_strcat(buf1, sizeof(buf1), "\r\n");
mutt_socket_write (idata->conn, buf1);
rc = imap_cmd_step (idata);
while (rc == IMAP_CMD_CONTINUE);
if (rc == IMAP_CMD_RESPOND) {
- debug_print (1, ("Unexpected server continuation request.\n"));
goto err_abort_cmd;
}
if (imap_code (idata->cmd.buf)) {
/* flush the security context */
- debug_print (2, ("Releasing GSS credentials\n"));
maj_stat = gss_delete_sec_context (&min_stat, &context, &send_token);
- if (maj_stat != GSS_S_COMPLETE)
- debug_print (1, ("Error releasing credentials\n"));
/* send_token may contain a notification to the server to flush
* credentials. RFC 1731 doesn't specify what to do, and since this
#endif
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "imap_private.h"
#include "auth.h"
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
unsigned char client_start;
if (mutt_sasl_client_new (idata->conn, &saslconn) < 0) {
- debug_print (1, ("Error allocating SASL connection.\n"));
return IMAP_AUTH_FAILURE;
}
client_start = (olen > 0);
if (rc != SASL_OK && rc != SASL_CONTINUE) {
- if (method)
- debug_print (2, ("%s unavailable\n", method));
- else
- debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
/* SASL doesn't support LOGIN, so fall back */
-
return IMAP_AUTH_UNAVAIL;
}
while (irc == IMAP_CMD_CONTINUE);
if (method && irc == IMAP_CMD_NO) {
- debug_print (2, ("%s failed\n", method));
sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
goto bail;
if (irc == IMAP_CMD_RESPOND) {
- if (sasl_decode64
- (idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
- LONG_STRING - 1,
- &len) != SASL_OK) {
- debug_print (1, ("error base64-decoding server response.\n"));
+ if (sasl_decode64(idata->cmd.buf + 2, m_strlen(idata->cmd.buf + 2), buf,
+ LONG_STRING - 1, &len) != SASL_OK) {
goto bail;
}
}
/* send out response, or line break if none needed */
if (olen) {
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
- debug_print (1, ("error base64-encoding client response.\n"));
goto bail;
}
}
/* If SASL has errored out, send an abort string to the server */
if (rc < 0) {
mutt_socket_write (idata->conn, "*\r\n");
- debug_print (1, ("sasl_client_step error %d\n", rc));
}
olen = 0;
#include <lib-lib/str.h>
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-ui/enter.h>
m_strcpy(mbox, sizeof(mbox), buf);
n = m_strlen(mbox);
- debug_print (3, ("mbox: %s\n", mbox));
-
/* if our target exists and has inferiors, enter it if we
* aren't already going to */
if (mbox[n - 1] != idata->delim) {
mbox[n] = '\0';
if (showparents) {
- debug_print (3, ("adding parent %s\n", mbox));
imap_add_folder (idata->delim, mbox, 1, 0, state, 1);
}
/* Listing the home namespace, so INBOX should be included. Home
* namespace is not "", so we have to list it explicitly. We ask the
* server to see if it has descendants. */
- debug_print (3, ("adding INBOX\n"));
if (browse_add_list_result (idata, "string_list_t \"\" \"INBOX\"", state, 0))
goto fail;
}
nsup = state->entrylen;
- debug_print (3, ("Quoting mailbox scan: %s:\n", mbox));
snprintf (buf, sizeof (buf), "%s%%", mbox);
imap_quote_string (buf2, sizeof (buf2), buf);
- debug_print (3, ("%s\n", buf2));
snprintf (buf, sizeof (buf), "%s \"\" %s", list_cmd, buf2);
if (browse_add_list_result (idata, buf, state, 0))
goto fail;
if (nsi[i].listable && !nsi[i].home_namespace) {
imap_add_folder (nsi[i].delim, nsi[i].prefix, nsi[i].noselect,
nsi[i].noinferiors, state, 0);
- debug_print (3, ("adding namespace: %s\n", nsi[i].prefix));
}
}
short n;
if (imap_parse_path (folder, &mx) < 0) {
- debug_print (1, ("Bad starting path %s\n", folder));
return -1;
}
if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) {
- debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host));
goto fail;
}
char newname[SHORT_STRING];
if (imap_parse_path (mailbox, &mx) < 0) {
- debug_print (1, ("Bad source mailbox %s\n", mailbox));
return -1;
}
if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW))) {
- debug_print (1, ("Couldn't find open connection to %s\n", mx.account.host));
goto fail;
}
IMAP_MBOX mx;
if (imap_parse_path (state->folder, &mx)) {
- debug_print (2, ("current folder %s makes no sense\n", state->folder));
return -1;
}
}
/* skip "" namespaces, they are already listed at the root */
if ((ns[0] != '\0') && (nsbused < nsblen) && (*nns < nsilen)) {
- debug_print (3, ("adding %s\n", ns));
nsi->type = type;
/* Cyrus doesn't append the delimiter to the namespace,
* but UW-IMAP does. We'll strip it here and add it back
#include <lib-lib/mem.h>
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
-
#include "mutt.h"
#include "message.h"
if (len == cmd->blen) {
p_realloc(&cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE);
cmd->blen = cmd->blen + IMAP_CMD_BUFSIZE;
- debug_print (3, ("grew buffer to %u bytes\n", cmd->blen));
}
if (len)
c = mutt_socket_readln (cmd->buf + len, cmd->blen - len, idata->conn);
if (c <= 0) {
- debug_print (1, ("Error reading server response.\n"));
/* cmd_handle_fatal (idata); */
return IMAP_CMD_BAD;
}
if ((cmd->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE)) {
p_realloc(&cmd->buf, IMAP_CMD_BUFSIZE);
cmd->blen = IMAP_CMD_BUFSIZE;
- debug_print (3, ("shrank buffer to %u bytes\n", cmd->blen));
}
idata->lastread = time (NULL);
return -2;
if (rc != IMAP_CMD_OK) {
- if (flags & IMAP_CMD_FAIL_OK)
- return -2;
-
- debug_print (1, ("command failed: %s\n", idata->cmd.buf));
- return -1;
+ return (flags & IMAP_CMD_FAIL_OK) ? -2 : -1;
}
return 0;
(idata->reopen & IMAP_NEWMAIL_PENDING)
&& count > idata->ctx->msgcount) {
/* read new mail messages */
- debug_print (2, ("Fetching new mail\n"));
/* check_status: curs_main uses imap_check_mailbox to detect
* whether the index needs updating */
idata->check_status = IMAP_NEWMAIL_PENDING;
imap_read_headers (idata, idata->ctx->msgcount, count - 1);
}
else if (idata->reopen & IMAP_EXPUNGE_PENDING) {
- debug_print (2, ("Expunging mailbox\n"));
imap_expunge_mailbox (idata);
/* Detect whether we've gotten unexpected EXPUNGE messages */
if (idata->reopen & IMAP_EXPUNGE_PENDING &&
* connection, so update that one.
*/
if (ascii_strncasecmp ("EXISTS", s, 6) == 0) {
- debug_print (2, ("Handling EXISTS\n"));
-
/* new mail arrived */
count = atoi (pn);
/* at least the InterChange server sends EXISTS messages freely,
* even when there is no new mail */
else if (count == idata->ctx->msgcount)
- debug_print (3, ("superfluous EXISTS message.\n"));
+ ;
else {
if (!(idata->reopen & IMAP_EXPUNGE_PENDING)) {
- debug_print (2, ("New mail in %s - %d messages total.\n", idata->mailbox, count));
idata->reopen |= IMAP_NEWMAIL_PENDING;
}
idata->newMailCount = count;
else if (ascii_strncasecmp ("SEARCH", s, 6) == 0)
cmd_parse_search (idata, s);
else if (ascii_strncasecmp ("BYE", s, 3) == 0) {
- debug_print (2, ("Handling BYE\n"));
-
/* check if we're logging out */
if (idata->status == IMAP_BYE)
return 0;
}
else if (option (OPTIMAPSERVERNOISE)
&& (ascii_strncasecmp ("NO", s, 2) == 0)) {
- debug_print (2, ("Handling untagged NO\n"));
-
/* Display the warning message from the server */
mutt_error ("%s", s + 3);
mutt_sleep (2);
unsigned int uid;
int msgno;
- debug_print (2, ("Handling SEARCH\n"));
-
while ((s = imap_next_word (s)) && *s != '\0') {
uid = atoi (s);
msgno = uid2msgno (idata, uid);
-
+
if (msgno >= 0)
idata->ctx->hdrs[uid2msgno (idata, uid)]->matched = 1;
}
{
int x;
- debug_print (2, ("Handling CAPABILITY\n"));
-
s = imap_next_word (s);
p_delete(&idata->capstr);
idata->capstr = m_strdup(s);
int expno, cur;
HEADER *h;
- debug_print (2, ("Handling EXPUNGE\n"));
-
expno = atoi (s);
/* walk headers, zero seqno of expunged message, decrement seqno of those
int msgno, cur;
HEADER *h = NULL;
- debug_print (2, ("Handling FETCH\n"));
-
msgno = atoi (s);
if (msgno <= idata->ctx->msgcount)
break;
if (h->active && h->index + 1 == msgno) {
- debug_print (2, ("Message UID %d updated\n", HEADER_DATA (h)->uid));
break;
}
}
if (!h) {
- debug_print (1, ("FETCH response ignored for this message\n"));
return;
}
s = imap_next_word (s);
if (*s != '(') {
- debug_print (1, ("Malformed FETCH response\n"));
return;
}
s++;
if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
- debug_print (2, ("Only handle FLAGS updates\n"));
return;
}
s = imap_next_word (s); /* flags */
if (*s != '(') {
- debug_print (1, ("Bad LSUB response\n"));
return;
}
if (s) {
imap_unmunge_mbox_name (s);
- debug_print (2, ("Subscribing to %s\n", s));
m_strcpy(buf, sizeof(buf), "mailboxes \"");
mutt_account_tourl (&idata->conn->account, &url);
p_clear(&token, 1);
err.data = errstr;
err.dsize = sizeof (errstr);
- if (mutt_parse_rc_line (buf, &token, &err))
- debug_print (1, ("Error adding subscribed mailbox: %s\n", errstr));
+ mutt_parse_rc_line (buf, &token, &err);
p_delete(&token.data);
}
- else
- debug_print (1, ("Bad LSUB response\n"));
}
/* cmd_parse_myrights: set rights bits according to MYRIGHTS response */
static void cmd_parse_myrights (IMAP_DATA * idata, char *s)
{
- debug_print (2, ("Handling MYRIGHTS\n"));
-
s = imap_next_word (s);
s = imap_next_word (s);
#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/buffer.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "mx.h"
else if (mutt_bit_isset (idata->capabilities, STATUS))
snprintf (buf, sizeof (buf), "STATUS %s (UID-VALIDITY)", mbox);
else {
- debug_print (2, ("STATUS not supported?\n"));
return -1;
}
if (imap_exec (idata, buf, IMAP_CMD_FAIL_OK) < 0) {
- debug_print (1, ("Can't check STATUS of %s\n", mbox));
return -1;
}
int r = 0;
- debug_print (2, ("reading %ld bytes\n", bytes));
-
for (pos = 0; pos < bytes; pos++) {
if (mutt_socket_readchar (idata->conn, &c) != 1) {
- debug_print (1, ("error during read, %ld bytes read\n", pos));
idata->status = IMAP_FATAL;
return -1;
fputc (c, fp);
if (bar && !(pos % 1024))
mutt_progress_bar (bar, pos);
-#ifdef DEBUG
- if (DebugFile && DebugLevel >= IMAP_LOG_LTRL)
- fputc (c, DebugFile);
-#endif
}
return 0;
h = idata->ctx->hdrs[i];
if (h->index == -1) {
- debug_print (2, ("Expunging message UID %d.\n", HEADER_DATA (h)->uid));
-
h->active = 0;
/* free cached body from disk, if neccessary */
}
while (rc == IMAP_CMD_CONTINUE);
- if (rc != IMAP_CMD_OK) {
- debug_print (1, ("failed.\n"));
- return -1;
- }
-
- debug_print (2, ("Delimiter: %c\n", idata->delim));
-
return -1;
}
if (idata->state == IMAP_CONNECTED) {
if (!imap_authenticate (idata)) {
idata->state = IMAP_AUTHENTICATED;
- if (idata->conn->ssf)
- debug_print (2, ("Communication encrypted at %d bits\n", idata->conn->ssf));
}
else
mutt_account_unsetpass (&idata->conn->account);
/* sanity-check string */
if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
- debug_print (1, ("not a FLAGS response: %s\n", s));
return NULL;
}
s = vskipspaces(s + 5);
if (*s != '(') {
- debug_print (1, ("bogus FLAGS response: %s\n", s));
return NULL;
}
/* note bad flags response */
if (*s != ')') {
- debug_print (1, ("Unterminated FLAGS response: %s\n", s));
string_list_wipe(hflags);
return NULL;
if (ascii_strncasecmp ("FLAGS", pc, 5) == 0) {
/* don't override PERMANENTFLAGS */
if (!idata->flags) {
- debug_print (2, ("Getting mailbox FLAGS\n"));
if ((pc = imap_get_flags (&(idata->flags), pc)) == NULL)
goto fail;
}
}
/* PERMANENTFLAGS are massaged to look like FLAGS, then override FLAGS */
else if (ascii_strncasecmp ("OK [PERMANENTFLAGS", pc, 18) == 0) {
- debug_print (2, ("Getting mailbox PERMANENTFLAGS\n"));
/* safe to call on NULL */
string_list_wipe(&(idata->flags));
/* skip "OK [PERMANENT" so syntax is the same as FLAGS */
#ifdef USE_HCACHE
/* save UIDVALIDITY for the header cache */
else if (ascii_strncasecmp ("OK [UIDVALIDITY", pc, 14) == 0) {
- debug_print (2, ("Getting mailbox UIDVALIDITY\n"));
pc += 3;
pc = imap_next_word (pc);
if (!ascii_strncasecmp
(imap_get_qualifier (idata->cmd.buf), "[READ-ONLY]", 11)
&& !mutt_bit_isset (idata->capabilities, ACL)) {
- debug_print (2, ("Mailbox is read-only.\n"));
ctx->readonly = 1;
}
-#ifdef DEBUG
- /* dump the mailbox flags we've found */
- if (DebugLevel > 2) {
- if (!idata->flags)
- debug_print (3, ("No folder flags found\n"));
- else {
- string_list_t *t = idata->flags;
-
- debug_print (3, ("Mailbox flags:\n"));
-
- t = t->next;
- while (t) {
- debug_print (3, ("[%s]\n", t->data));
- t = t->next;
- }
- }
- }
-#endif
-
if (mutt_bit_isset (idata->capabilities, ACL)) {
if (imap_check_acl (idata))
goto fail;
goto fail;
}
- debug_print (2, ("msgcount is %d\n", ctx->msgcount));
p_delete(&mx.mbox);
return 0;
/*
int imap_close_connection (CONTEXT *ctx)
{
- debug_print (1, (debugfile, "imap_close_connection(): closing connection\n"));
if (CTX_DATA->status != IMAP_BYE)
{
mutt_message _("Closing connection to IMAP server...");
idata = (IMAP_DATA *) ctx->data;
if (idata->state != IMAP_SELECTED) {
- debug_print (2, ("no mailbox selected\n"));
return -1;
}
* This works better if we're expunging, of course. */
if ((ctx->hdrs[n]->env && (ctx->hdrs[n]->env->refs_changed || ctx->hdrs[n]->env->irt_changed)) ||
ctx->hdrs[n]->attach_del) {
- debug_print (3, ("Attachments to be deleted, falling back to _mutt_save_message\n"));
if (!appendctx)
appendctx = mx_open_mailbox (ctx->path, M_APPEND | M_QUIET, NULL);
- if (!appendctx) {
- debug_print (1, ("Error opening mailbox in append mode\n"));
- }
- else
+ if (appendctx) {
_mutt_save_message (ctx->hdrs[n], appendctx, 1, 0, 0);
+ }
}
if (imap_sync_message (idata, ctx->hdrs[n], &cmd, &err_continue) < 0) {
if (isdigit ((unsigned char) *s)) {
if (*s != '0') {
msgcount = atoi (s);
- debug_print (2, ("%d new messages in %s\n", msgcount, path));
}
}
}
- else
- debug_print (1, ("STATUS response doesn't match requested mailbox.\n"));
}
}
while (rc == IMAP_CMD_CONTINUE);
err.dsize = sizeof (errstr);
snprintf (mbox, sizeof (mbox), "%smailboxes \"%s\"",
subscribe ? "" : "un", path);
- if (mutt_parse_rc_line (mbox, &token, &err))
- debug_print (1, ("Error adding subscribed mailbox: %s\n", errstr));
+ mutt_parse_rc_line (mbox, &token, &err);
p_delete(&token.data);
}
#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/buffer.h>
-#include <lib-lib/debug.h>
#include <lib-ui/curses.h>
if (uid_validity != NULL && *uid_validity == idata->uid_validity) {
ctx->hdrs[msgno] = mutt_hcache_restore((unsigned char *) uid_validity, 0);
ctx->hdrs[msgno]->index = h.sid - 1;
- if (h.sid != ctx->msgcount + 1)
- debug_print (1, ("imap_read_headers: msgcount and sequence ID are inconsistent!"));
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
ctx->hdrs[msgno]->active = 1;
ctx->hdrs[msgno] = header_new();
ctx->hdrs[msgno]->index = h.sid - 1;
- if (h.sid != ctx->msgcount + 1)
- debug_print (1, ("msgcount and sequence ID are inconsistent!\n"));
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
ctx->hdrs[msgno]->active = 1;
if (rc != IMAP_CMD_RESPOND) {
char *pc;
- debug_print (1, ("command failed: %s\n", idata->cmd.buf));
-
pc = vskipspaces(idata->cmd.buf + SEQLEN);
pc = imap_next_word (pc);
mutt_error ("%s", pc);
if (!imap_code (idata->cmd.buf)) {
char *pc;
- debug_print (1, ("command failed: %s\n", idata->cmd.buf));
pc = vskipspaces(idata->cmd.buf + SEQLEN);
pc = imap_next_word (pc);
mutt_error ("%s", pc);
idata = (IMAP_DATA *) ctx->data;
if (imap_parse_path (dest, &mx)) {
- debug_print (1, ("bad destination %s\n", dest));
return -1;
}
/* check that the save-to folder is in the same account */
if (!mutt_account_match (&(CTX_DATA->conn->account), &(mx.account))) {
- debug_print (3, ("%s not same server as %s\n", dest, ctx->path));
return 1;
}
if (h && h->attach_del) {
- debug_print (3, ("Message contains attachments to be deleted\n"));
return 1;
}
* remainder. */
for (n = 0; n < ctx->msgcount; n++) {
if (ctx->hdrs[n]->tagged && ctx->hdrs[n]->attach_del) {
- debug_print (3, ("Message contains attachments to be deleted\n"));
return 1;
}
rc = imap_sync_message (idata, ctx->hdrs[n], &sync_cmd, &err_continue);
if (rc < 0)
{
- debug_print (1, ("could not sync\n"));
goto fail;
}
}
rc = imap_make_msg_set (idata, &cmd, M_TAG, 0);
if (!rc) {
- debug_print (1, ("No messages tagged\n"));
goto fail;
}
mutt_message (_("Copying %d messages to %s..."), rc, mbox);
rc = imap_sync_message (idata, h, &sync_cmd, &err_continue);
if (rc < 0)
{
- debug_print (1, ("could not sync\n"));
goto fail;
}
}
imap_error ("imap_copy_messages", idata->cmd.buf);
goto fail;
}
- debug_print (2, ("server suggests TRYCREATE\n"));
snprintf (mmbox, sizeof (mmbox), _("Create %s?"), mbox);
if (option (OPTCONFIRMCREATE) && mutt_yesorno (mmbox, 1) < 1) {
mutt_clear_error ();
p_clear(&newh, 1);
newh.data = p_new(IMAP_HEADER_DATA, 1);
- debug_print (2, ("parsing FLAGS\n"));
if ((s = msg_parse_flags (&newh, s)) == NULL) {
p_delete(&newh.data);
return NULL;
else if (ascii_strncasecmp ("INTERNALDATE", s, 12) == 0) {
s = vskipspaces(s + 12);
if (*s != '\"') {
- debug_print (1, ("bogus INTERNALDATE entry: %s\n", s));
return -1;
}
s++;
/* sanity-check string */
if (ascii_strncasecmp ("FLAGS", s, 5) != 0) {
- debug_print (1, ("not a FLAGS response: %s\n", s));
return NULL;
}
s = vskipspaces(s + 5);
if (*s != '(') {
- debug_print (1, ("bogus FLAGS response: %s\n", s));
return NULL;
}
s++;
s++;
}
else {
- debug_print (1, ("Unterminated FLAGS response: %s\n", s));
return NULL;
}
#include <lib-sys/mutt_ssl.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <stdlib.h>
#include <ctype.h>
ImapPort = ntohs (service->s_port);
else
ImapPort = IMAP_PORT;
- debug_print (3, ("Using default IMAP port %d\n", ImapPort));
}
if (!ImapsPort) {
service = getservbyname ("imaps", "tcp");
ImapsPort = ntohs (service->s_port);
else
ImapsPort = IMAP_SSL_PORT;
- debug_print (3, ("Using default IMAPS port %d\n", ImapsPort));
}
/* Defaults */
#include <lib-lib/macros.h>
#include <lib-lib/buffer.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-lib/rx.h>
#include <lib-sys/unix.h>
/* this checks that numbers are >= 0 */
static int check_num (const char* option, unsigned long val,
char* errbuf, ssize_t errlen);
-#ifdef DEBUG
-static int check_debug (const char* option, unsigned long val,
- char* errbuf, ssize_t errlen);
-#endif
/* use this to check only */
static int check_special (const char* option, unsigned long val,
#endif
{ "history", check_history },
{ "pager_index_lines", check_num },
-#ifdef DEBUG
- { "debug_level", check_debug },
-#endif
/* last */
{ NULL, NULL }
};
ssize_t l = 0;
if (!(option = hash_find (ConfigOptions, val))) {
- debug_print (1, ("var '%s' not found\n", val));
*dst = '\0';
return (0);
}
/* as we get things of type $var=value and don't want to bloat the
* above "just" for expansion, we do the stripping here */
- debug_print (1, ("orig == '%s'\n", tmp));
t = strchr (tmp, '=');
t++;
l = m_strlen(t);
}
memcpy (dst, t, l+1);
p_delete(&tmp);
- debug_print (1, ("stripped == '%s'\n", dst));
return (1);
}
/* Find the last item in the list that data points to. */
lastp = NULL;
- debug_print (5, ("parse_attach_list: ldata = %p, *ldata = %p\n",
- ldata, *ldata));
for (listp = *ldata; listp; listp = listp->next) {
a = (ATTACH_MATCH *)listp->data;
- debug_print (5, ("parse_attach_list: skipping %s/%s\n", a->major, a->minor));
lastp = listp;
}
p_delete(&tmpminor);
- debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
- a->major, a->minor, a->major_int));
-
listp = p_new(string_list_t, 1);
listp->data = (char *)a;
listp->next = NULL;
lastp = NULL;
for(lp = *ldata; lp; ) {
a = (ATTACH_MATCH *)lp->data;
- debug_print(5, ("parse_unattach_list: check %s/%s [%d] : %s/%s [%d]\n",
- a->major, a->minor, a->major_int, tmp, minor, major));
if (a->major_int == major && !m_strcasecmp(minor, a->minor)) {
- debug_print(5, ("parse_unattach_list: removed %s/%s [%d]\n",
- a->major, a->minor, a->major_int));
regfree(&a->minor_rx);
p_delete(&a->major);
mutt_extract_token (buf, s, 0);
- debug_print (2, ("first token is '%s'.\n", buf->data));
-
/* check to see if an alias with this name already exists */
for (; tmp; tmp = tmp->next) {
if (!m_strcasecmp(tmp->name, buf->data))
mutt_extract_token (buf, s,
M_TOKEN_QUOTE | M_TOKEN_SPACE | M_TOKEN_SEMICOLON);
- debug_print (2, ("second token is '%s'.\n", buf->data));
tmp->addr = mutt_parse_adrlist (tmp->addr, buf->data);
if (last)
last->next = tmp;
_("Warning: Bad IDN '%s' in alias '%s'.\n"), estr, tmp->name);
return -1;
}
-#ifdef DEBUG
- if (DebugLevel >= 2) {
- address_t *a;
- /* A group is terminated with an empty address, so check a->mailbox */
- for (a = tmp->addr; a && a->mailbox; a = a->next) {
- if (!a->group)
- debug_print (2, ("%s\n", a->mailbox));
- else
- debug_print (2, ("group %s\n", a->mailbox));
- }
- }
-#endif
return 0;
}
short type, short dodup) {
struct option_t* option = p_new(struct option_t, 1);
- debug_print (1, ("adding $%s\n", name));
-
option->option = m_strdup(name);
option->type = type;
if (init)
static void del_option (void* p) {
struct option_t *ptr = (struct option_t*) p;
char* s = (char*) ptr->data;
- debug_print (1, ("removing option '%s' from table\n", NONULL (ptr->option)));
p_delete(&ptr->option);
p_delete(&s);
p_delete(&ptr->init);
return (1);
}
-#ifdef DEBUG
-static int check_debug (const char* option, unsigned long p,
- char* errbuf, ssize_t errlen) {
- if ((int) p <= DEBUG_MAX_LEVEL &&
- (int) p >= DEBUG_MIN_LEVEL)
- return (1);
-
- if (errbuf)
- snprintf (errbuf, errlen, _("'%d' is invalid for $%s"), (int) p, option);
- return (0);
-}
-#endif
-
static int check_history (const char* option __attribute__ ((unused)), unsigned long p,
char* errbuf, ssize_t errlen) {
if (!check_num ("history", p, errbuf, errlen))
/* there's no option named like this yet so only add one
* if the action isn't any of: reset, unset, query */
if (!(reset || unset || query || *s->dptr != '=')) {
- debug_print (1, ("adding user option '%s'\n", tmp->data));
option = add_user_option (tmp->data);
hash_insert (ConfigOptions, option->option, option, 0);
}
ssize_t buflen;
pid_t pid;
- debug_print (2, ("reading configuration file '%s'.\n", rcfile));
-
if ((f = mutt_open_read (rcfile, &pid)) == NULL) {
snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno));
return (-1);
*err->data = 0;
- debug_print (1, ("expand '%s'\n", line));
-
expn.dptr = vskipspaces(expn.dptr);
while (*expn.dptr) {
if (*expn.dptr == '#')
Shell = m_strdup((p = getenv ("SHELL")) ? p : "/bin/sh");
}
- debug_start(Homedir);
-
/* And about the host... */
uname (&utsname);
/* some systems report the FQDN instead of just the hostname */
# include "sort.h"
#endif
-#include <lib-lib/debug.h>
-
#include "buffy.h"
#include "mutt.h"
#include "version.h"
** rest of the string are expanded in the \fIC\fP locale (that is in US
** English).
*/
-#ifdef DEBUG
- {"debug_level", DT_NUM, R_NONE, UL &DebugLevel, "1" },
- /*
- ** .pp
- ** Availability: debug
- **
- ** .pp
- ** This variable specifies the current debug level and
- ** may be used to increase or decrease the verbosity level
- ** during runtime. It overrides the level given with the
- ** \fT-d\fP command line option.
- **
- ** .pp
- ** Currently, this number must be >= 0 and <= 5 and madmutt
- ** must be started with \fT-d\fP to enable debugging at all;
- ** enabling at runtime is not possible.
- */
-#endif
{"default_hook", DT_STR, R_NONE, UL &DefaultHook, "~f %s !~P | (~P ~C %s)"},
/*
** .pp
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
gpgme_release (ctx);
state_attach_puts (_("[-- End signature information --]\n\n"), s);
- debug_print (1, ("returning %d.\n", badsig));
return badsig ? 1 : anywarn ? 2 : 0;
}
char body_charset[STRING]; /* Only used for clearsigned messages. */
- debug_print (2, ("Entering pgp_application_pgp handler\n"));
-
/* For clearsigned messages we won't be able to get a character set
but we know that this may only be text thus we assume Latin-1
here. */
" of PGP message! --]\n\n"), s);
return (-1);
}
- debug_print (2, ("Leaving pgp_application_pgp handler\n"));
return (err);
}
int is_signed;
int rc = 0;
- debug_print (2, ("Entering pgp_encrypted handler\n"));
a = a->parts;
if (!a || a->type != TYPEAPPLICATION || !a->subtype
|| ascii_strcasecmp ("pgp-encrypted", a->subtype)
fclose (fpout);
mutt_unlink (tempfile);
- debug_print (2, ("Leaving pgp_encrypted handler\n"));
return (rc);
}
int is_signed;
int rc = 0;
- debug_print (2, ("Entering smime_encrypted handler\n"));
-
a->warnsig = 0;
mutt_mktemp (tempfile);
if (!(fpout = safe_fopen (tempfile, "w+"))) {
fclose (fpout);
mutt_unlink (tempfile);
- debug_print (2, ("Leaving smime_encrypted handler\n"));
return (rc);
}
if (!keys)
return NULL;
- debug_print (5, ("looking for %s <%s>.\n", a->personal, a->mailbox));
-
for (k = keys; k; k = k->next) {
- debug_print (5, (" looking at key: %s `%.15s'\n", crypt_keyid (k), k->uid));
-
if (abilities && !(k->flags & abilities)) {
- debug_print (5, (" insufficient abilities: Has %x, want %x\n", k->flags, abilities));
continue;
}
continue;
match = 0;
- debug_print (5, ("matching \"%s\" against " "key %s, \"%s\":\n", p, crypt_keyid (k), k->uid));
if (!*p || !m_strcasecmp(p, crypt_keyid (k))
|| (!m_strncasecmp(p, "0x", 2)
|| m_stristr(k->uid, p)) {
crypt_key_t *tmp;
- debug_print (5, ("match.\n"));
-
*matches_endp = tmp = crypt_copy_key (k);
matches_endp = &tmp->next;
}
}
-#if defined(HAVE_SETRLIMIT) && (!defined(DEBUG))
+#if defined(HAVE_SETRLIMIT)
static void disable_coredumps (void)
{
{
int ret = 0;
-# if defined(HAVE_SETRLIMIT) &&(!defined(DEBUG))
+# if defined(HAVE_SETRLIMIT)
disable_coredumps ();
# endif
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/date.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
if (!*buf)
return NULL;
- debug_print (2, ("buf = `%s'\n", buf));
-
for (p = buf; p; p = pend) {
if ((pend = strchr (p, ':')))
*pend++ = 0;
switch (field) {
case 1: /* record type */
{
- debug_print (2, ("record type: %s\n", p));
-
if (!m_strcmp(p, "pub"));
else if (!m_strcmp(p, "sub"))
*is_subkey = 1;
}
case 2: /* trust info */
{
- debug_print (2, ("trust info: %s\n", p));
-
switch (*p) { /* look only at the first letter */
case 'e':
flags |= KEYFLAG_EXPIRED;
}
case 3: /* key length */
{
-
- debug_print (2, ("key len: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
k->keylen = atoi (p); /* fixme: add validation checks */
break;
}
case 4: /* pubkey algo */
{
-
- debug_print (2, ("pubkey algorithm: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB))) {
k->numalg = atoi (p);
k->algorithm = pgp_pkalgbytype (atoi (p));
}
case 5: /* 16 hex digits with the long keyid. */
{
- debug_print (2, ("key id: %s\n", p));
-
if (!(*is_subkey && option (OPTPGPIGNORESUB)))
m_strreplace(&k->keyid, p);
break;
char tstr[11];
struct tm st_time;
- debug_print (2, ("time stamp: %s\n", p));
-
if (!p)
break;
st_time.tm_sec = 0;
if (!is_uid && (*is_subkey && option (OPTPGPIGNORESUB)))
break;
- debug_print (2, ("user ID: %s\n", p));
-
uid = p_new(pgp_uid_t, 1);
fix_uid (p);
uid->addr = m_strdup(p);
case 11: /* signature class */
break;
case 12: /* key capabilities */
- debug_print (2, ("capabilities info: %s\n", p));
-
while (*p) {
switch (*p++) {
case 'D':
#include <lib-ui/curses.h>
#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "handler.h"
while ((line = mutt_read_line (line, &linelen, fpin, &lineno)) != NULL) {
if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) {
- debug_print (2, ("\"%s\" matches regexp.\n", line));
rv = 0;
}
- else
- debug_print (2, ("\"%s\" doesn't match regexp.\n", line));
if (strncmp (line, "[GNUPG:] ", 9) == 0)
continue;
p_delete(&line);
}
else {
- debug_print (2, ("No pattern.\n"));
mutt_copy_stream (fpin, fpout);
rv = 1;
}
if ((rv = mutt_wait_filter (thepid)))
badsig = -1;
-
- debug_print (1, ("mutt_wait_filter returned %d.\n", rv));
}
safe_fclose (&pgperr);
mutt_unlink (sigfile);
mutt_unlink (pgperrfile);
- debug_print (1, ("returning %d.\n", badsig));
-
return badsig;
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/unix.h>
{
mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
(unsigned long) cctx, 0);
- debug_print (2, ("%s\n", d));
}
/*
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
if (!keys)
return NULL;
- debug_print (5, ("looking for %s <%s>\n", a->personal, a->mailbox));
-
for (k = keys; k; k = kn) {
kn = k->next;
- debug_print (5, (" looking at key: %s\n", pgp_keyid (k)));
-
if (abilities && !(k->flags & abilities)) {
- debug_print (5, (" insufficient abilities: Has %x, want %x\n",
- k->flags, abilities));
continue;
}
match = 0;
for (a = k->address; a; a = a->next) {
- debug_print (5, ("matching \"%s\" against key %s, \"%s\":\n", p, pgp_keyid (k), a->addr));
if (!*p || m_strcasecmp(p, pgp_keyid (k)) == 0
|| (!m_strncasecmp(p, "0x", 2)
&& !m_strcasecmp(p + 2, pgp_keyid (k)))
|| (option (OPTPGPLONGIDS) && !m_strncasecmp(p, "0x", 2)
&& !m_strcasecmp(p + 2, k->keyid + 8))
|| m_stristr(a->addr, p)) {
- debug_print (5, ("match.\n"));
match = 1;
break;
}
#include <ctype.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
break;
}
if (r == NULL) {
- debug_print (1, ("Can't find begin of ASCII armor.\n"));
return;
}
break;
}
if (r == NULL) {
- debug_print (1, ("Armor header doesn't end.\n"));
return;
}
break;
}
if (r == NULL) {
- debug_print (1, ("Can't find end of ASCII armor.\n"));
return;
}
if ((end = ftello (in) - m_strlen(line)) < start) {
- debug_print (1, ("end < start???\n"));
return;
}
if (fseeko (in, start, SEEK_SET) == -1) {
- debug_print (1, ("Can't seekto start.\n"));
return;
}
{
/* is signature? */
if ((p[0] & 0x3f) != PT_SIG) {
- debug_print (1, ("tag = %d, want %d.\n", p[0] & 0x3f, PT_SIG));
return -1;
}
/* version 4 signature */
return (short) p[4];
else {
- debug_print (1, ("Bad signature packet.\n"));
return -1;
}
}
if ((p = pgp_read_packet (out, &l)) != NULL) {
rv = pgp_mic_from_packet (p, l);
}
- else {
- debug_print (1, ("No packet.\n"));
- }
bye:
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
{
mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_smime_command,
(unsigned long) cctx, 0);
- debug_print (2, ("%s\n", d));
}
static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
liblib_a_SOURCES = mem.h str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
str.c ascii.c buffer.c hash.c list.c file.c mapping.c \
\
- date.h debug.h rx.h url.h \
- date.c debug.c rx.c url.c
+ date.h rx.h url.h \
+ date.c rx.c url.c
noinst_HEADERS = mem.h str.h ascii.h buffer.h hash.h list.h file.h mapping.h \
- date.h debug.h rx.h url.h
+ date.h rx.h url.h
-include ../cflags.mk
#include "ascii.h"
#include "buffer.h"
#include "file.h"
-#include "debug.h"
#include "mutt.h"
}
} while (pc && *pc != '`');
if (!pc) {
- debug_print (1, ("mismatched backtics\n"));
return (-1);
}
cmd = p_dupstr(tok->dptr, pc - tok->dptr);
if ((pid = mutt_create_filter(cmd, NULL, &fp, NULL)) < 0) {
- debug_print(1, ("unable to fork command: %s\n", cmd));
p_delete(&cmd);
return -1;
}
+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Copyright © 2006 Pierre Habouzit
- */
-/*
- * written for mutt-ng by:
- * Rocco Rutte <pdmef@cs.tu-berlin.de>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if DEBUG
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <time.h>
-
-#include "str.h"
-#include "file.h"
-#include "debug.h"
-
-#include "mutt.h"
-#include "globals.h"
-
-short DebugLevel = -1;
-FILE* DebugFile = NULL;
-
-void debug_setlevel(short level) {
- DebugLevel = level;
-}
-
-void debug_start(const char* basedir) {
- time_t t;
- int i;
- char buf[_POSIX_PATH_MAX];
- char buf2[_POSIX_PATH_MAX];
-
- if (DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL
- || !basedir || !*basedir)
- return;
- /* rotate the old debug logs */
- for (i = 3; i >= 0; i--) {
- snprintf(buf, sizeof (buf), "%s/.madmuttdebug%d", NONULL(basedir), i);
- snprintf(buf2, sizeof (buf2), "%s/.madmuttdebug%d", NONULL(basedir), i + 1);
- rename (buf, buf2);
- }
-
- if ((DebugFile = safe_fopen (buf, "w")) != NULL) {
- t = time (NULL);
- setbuf(DebugFile, NULL); /* don't buffer the debugging output! */
- fprintf(DebugFile,
- "Madmutt %s started at %s\nDebugging at level %d\n\n",
- MUTT_VERSION, asctime (localtime (&t)), DebugLevel);
- }
-}
-
-void _debug_print_intro(const char* file, int line, const char *function, int level) {
- if (!DebugFile || DebugLevel < DEBUG_MIN_LEVEL || DebugLevel > DEBUG_MAX_LEVEL)
- return;
- fprintf(DebugFile, "[%d:%s:%d", level, NONULL(file), line);
- if (function && *function)
- fprintf(DebugFile, ":%s()", function);
- fprintf(DebugFile, "] ");
-}
-
-void _debug_print_msg (const char* fmt, ...) {
- va_list ap;
-
- if (!DebugFile || DebugLevel < 0)
- return;
- va_start(ap, fmt);
- vfprintf(DebugFile, fmt, ap);
- va_end(ap);
-}
-
-#endif /* DEBUG */
+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Copyright © 2006 Pierre Habouzit
- */
-/*
- * written for mutt-ng by:
- * Rocco Rutte <pdmef@cs.tu-berlin.de>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-
-/* generic interface for debug messages */
-
-#ifndef MUTT_LIB_LIB_DEBUG_H
-#define MUTT_LIB_LIB_DEBUG_H
-
-#include <stdio.h>
-
-#define DEBUG_MIN_LEVEL 1
-#define DEBUG_MIN_LEVEL_S "1"
-#define DEBUG_MAX_LEVEL 5
-#define DEBUG_MAX_LEVEL_S "5"
-
-#ifdef DEBUG
-
-extern short DebugLevel;
-extern FILE* DebugFile;
-
-void debug_setlevel (short);
-void debug_start (const char*);
-
-void _debug_print_intro (const char*, int, const char*, int);
-void _debug_print_msg (const char*, ...);
-
-/*
- * the debug_print() macro will (in the end) print debug messages of the
- * following format:
- *
- * (file:line:function:level): message
- *
- * for GCC and:
- *
- * (file:line:level): message
- *
- * otherwise
- */
-#ifdef __GNUC__
-
-#define debug_print(level,msg) \
- do { \
- if (DebugLevel >= level) { \
- _debug_print_intro (__FILE__,__LINE__,__func__,level); \
- _debug_print_msg msg; \
- } \
- } while(0)
-
-#else /* __GNUC__ */
-
-#define debug_print(level,msg) \
- do { \
- if (DebugLevel >= level) { \
- _debug_print_intro (__FILE__,__LINE__,NULL,level); \
- _debug_print_msg msg; \
- } \
- } while(0)
-
-#endif /* !__GNUC__ */
-
-#else /* DEBUG */
-
-/*
- * without debug support, we don't need these
- * (this also kills the dozens of #ifdef for debug...
- */
-#define debug_start(basedir)
-#define debug_setlevel(level)
-#define debug_print(level,msg)
-
-#endif /* !DEBUG */
-
-#endif /* MUTT_LIB_LIB_DEBUG_H */
#include "mem.h"
#include "str.h"
#include "file.h"
-#include "debug.h"
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
if (lstat (path, &osb) < 0 || fstat(fd, &nsb) < 0
|| compare_stat(&osb, &nsb) == -1)
{
- debug_print(1, ("%s is a symlink!\n", path));
close(fd);
return -1;
}
if ((chunk = fread(buf, 1, chunk, in)) < 1)
break;
if (fwrite(buf, 1, chunk, out) != chunk) {
- debug_print(1, ("fwrite() returned short byte count\n"));
return -1;
}
size -= chunk;
#include <lib-lib/macros.h>
#include <lib-lib/buffer.h>
#include <lib-lib/date.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include "recvattach.h"
if (!*p)
continue;
} else {
- debug_print (1, ("bogus MIME header: %s\n", line));
break;
}
}
if (count < 4) { /* don't check for missing timezone */
- debug_print (1, ("error parsing date format, using received time\n"));
return -1;
}
rfc2047_decode_envelope(e);
/* check for missing or invalid date */
if (hdr->date_sent <= 0) {
- debug_print(1, ("no date found, using received "
- "time from msg separator\n"));
hdr->date_sent = hdr->received;
}
}
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "globals.h"
{
int rc = -1;
- if (conn->fd < 0)
- debug_print (1, ("Attempt to close closed connection.\n"));
- else
+ if (conn->fd >= 0)
rc = conn->conn_close (conn);
conn->fd = -1;
int rc;
if (conn->fd < 0) {
- debug_print (1, ("attempt to read from closed connection\n"));
return -1;
}
int rc;
int len;
- debug_print (dbg, ("> %s", buf));
-
if (conn->fd < 0) {
- debug_print (1, ("attempt to write to closed connection\n"));
return -1;
}
len = m_strlen(buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0) {
- debug_print (1, ("error writing, closing socket\n"));
mutt_socket_close (conn);
return -1;
}
- if (rc < len) {
- debug_print (1, ("ERROR: wrote %d of %d bytes!\n", rc, len));
- }
-
return rc;
}
conn->available =
conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
else {
- debug_print (1, ("attempt to read from closed connection.\n"));
return -1;
}
conn->bufpos = 0;
else
buf[i] = '\0';
- debug_print (dbg, ("< %s\n", buf));
-
/* number of bytes read, not m_strlen*/
return i + 1;
}
int save_errno;
if (m_strlen(Preconnect)) {
- debug_print (2, ("Executing preconnect: %s\n", Preconnect));
rc = mutt_system (Preconnect);
- debug_print (2, ("Preconnect result: %d\n", rc));
if (rc) {
save_errno = errno;
mutt_perror (_("Preconnect command failed."));
sa_size = sizeof (struct sockaddr_in6);
#endif
else {
- debug_print (1, ("Unknown address family!\n"));
return -1;
}
if (connect (fd, sa, sa_size) < 0) {
save_errno = errno;
- debug_print (2, ("Connection failed. errno: %d...\n", errno));
SigInt = 0; /* reset in case we caught SIGINTR while in connect() */
}
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-ui/curses.h>
#include <lib-ui/menu.h>
ssldata = p_new(sslsockdata, 1);
/* the ssl_use_xxx protocol options don't apply. We must use TLS in TLS. */
if (!(ssldata->ctx = SSL_CTX_new (TLSv1_client_method ()))) {
- debug_print (1, ("Error allocating SSL_CTX\n"));
goto bail_ssldata;
}
ssl_get_client_cert (ssldata, conn);
if (!(ssldata->ssl = SSL_new (ssldata->ctx))) {
- debug_print (1, ("Error allocating SSL\n"));
goto bail_ctx;
}
if (SSL_set_fd (ssldata->ssl, conn->fd) != 1) {
- debug_print (1, ("Error setting fd\n"));
goto bail_ssl;
}
if (option (OPTSSLSYSTEMCERTS)) {
if (X509_STORE_set_default_paths (ctx))
pass++;
- else
- debug_print (2, ("X509_STORE_set_default_paths failed\n"));
}
if (X509_STORE_load_locations (ctx, SslCertFile, NULL))
pass++;
- else
- debug_print (2, ("X509_STORE_load_locations_failed\n"));
if (pass == 0) {
/* nothing to do */
X509_STORE_CTX_init (&xsc, ctx, peercert, NULL);
pass = (X509_verify_cert (&xsc) > 0);
-#ifdef DEBUG
- if (!pass) {
- char buf[SHORT_STRING];
- int err;
-
- err = X509_STORE_CTX_get_error (&xsc);
- snprintf (buf, sizeof (buf), "%s (%d)",
- X509_verify_cert_error_string (err), err);
- debug_print (2, ("X509_verify_cert: %s\n", buf));
- }
-#endif
X509_STORE_CTX_cleanup (&xsc);
X509_STORE_free (ctx);
/* expiration check */
if (X509_cmp_current_time (X509_get_notBefore (peercert)) >= 0) {
- debug_print (2, ("Server certificate is not yet valid\n"));
mutt_error (_("Server certificate is not yet valid"));
mutt_sleep (2);
return 0;
}
if (X509_cmp_current_time (X509_get_notAfter (peercert)) <= 0) {
- debug_print (2, ("Server certificate has expired\n"));
mutt_error (_("Server certificate has expired"));
mutt_sleep (2);
return 0;
/* check session cache first */
if (check_certificate_cache (data->cert)) {
- debug_print (1, ("ssl_check_certificate: using cached certificate\n"));
return 1;
}
if (check_certificate_by_signer (data->cert)) {
- debug_print (1, ("signer check passed\n"));
return 1;
}
/* automatic check from user's database */
if (SslCertFile && check_certificate_by_digest (data->cert)) {
- debug_print (1, ("digest check passed\n"));
return 1;
}
static void ssl_get_client_cert (sslsockdata * ssldata, CONNECTION * conn)
{
if (SslClientCert) {
- debug_print (2, ("Using client certificate %s\n", SslClientCert));
SSL_CTX_set_default_passwd_cb_userdata (ssldata->ctx, &conn->account);
SSL_CTX_set_default_passwd_cb (ssldata->ctx, ssl_passwd_cb);
SSL_CTX_use_certificate_file (ssldata->ctx, SslClientCert,
if (mutt_account_getuser (account))
return 0;
- debug_print (2, ("getting password for %s@%s:%u\n",
- account->user, account->host, account->port));
-
if (mutt_account_getpass (account))
return 0;
#include <lib-lib/macros.h>
#include <lib-lib/buffer.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include "curses.h"
init_pair (i, fg, bg);
- debug_print (1, ("Color pairs used so far: %d\n", UserColors));
-
return (COLOR_PAIR (p->index));
}
return;
UserColors--;
- debug_print (1, ("Color pairs used so far: %d\n", UserColors));
if (p == ColorList) {
ColorList = ColorList->next;
if (!m_strcmp(buf->data, tmp->pattern)) {
if (!do_cache)
do_cache = 1;
- debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern));
if (last)
last->next = tmp->next;
else
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/unix.h>
#include <lib-sys/mutt_signal.h>
#ifdef HAVE_LANGINFO_YESEXPR
answer[0] = ch.ch;
- if (reyes_ok ? (regexec (&reyes, answer, 0, 0, 0) == 0) :
+ if (reyes_ok ? (regexec (&reyes, answer, 0, 0, 0) == 0) : tolower (ch.ch) == *yes)
#else
- if (
+ if (tolower (ch.ch) == *yes)
#endif
- (tolower (ch.ch) == *yes)) {
+ {
def = M_YES;
break;
}
(tolower (ch.ch) == *no)) {
def = M_NO;
break;
- }
- else {
+ } else {
BEEP ();
}
}
vsnprintf (Errorbuf, sizeof (Errorbuf), fmt, ap);
va_end (ap);
- debug_print (1, ("%s\n", Errorbuf));
mutt_format_string (TmpErrorbuf, sizeof (TmpErrorbuf),
0, COLS - 2, 0, 0, Errorbuf, sizeof (Errorbuf), 0);
snprintf (Errorbuf, sizeof (Errorbuf), "%s", TmpErrorbuf); /* overkill */
void _mutt_perror (const char *s, const char* filename, int line)
{
char *p = strerror (errno);
-
- debug_print (1, ("%s: %s (errno = %d)\n", s, p ? p : "unknown error", errno));
mutt_error ("%s: %s (errno = %d) from %s:%i", s, p ? p : _("unknown error"), errno, filename, line);
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <pop/pop.h>
op = km_dokey (MENU_MAIN);
- debug_print (4, ("Got op %d\n", op));
-
if (op == -1)
continue; /* either user abort or timeout */
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include <lib-sys/mutt_signal.h>
-a <file>\tattach a file to the message\n\
-b <address>\tspecify a blind carbon-copy (BCC) address\n\
-c <address>\tspecify a carbon-copy (CC) address");
-#if DEBUG
- puts _(" -d <level>\tlog debugging output to ~/.madmuttdebug0");
-#endif
puts _("\
-e <command>\tspecify a command to be executed after initialization\n\
-f <file>\tspecify which mailbox to read\n\
puts (_("Compile Options:"));
-#ifdef DEBUG
- puts (" +DEBUG");
-#else
- puts (" -DEBUG");
-#endif
-
puts (
#ifdef HOMESPOOL
" +HOMESPOOL "
#ifdef USE_NNTP
while ((i =
getopt (argc, argv,
- "A:a:b:F:f:c:d:e:g:GH:s:i:hm:npQ:RTtvyzZ")) != EOF)
+ "A:a:b:F:f:c:e:g:GH:s:i:hm:npQ:RTtvyzZ")) != EOF)
#else
while ((i =
- getopt (argc, argv, "A:a:b:F:f:c:d:e:H:s:i:hm:npQ:RTtvyzZ")) != EOF)
+ getopt (argc, argv, "A:a:b:F:f:c:e:H:s:i:hm:npQ:RTtvyzZ")) != EOF)
#endif
switch (i) {
case 'A':
msg->env->cc = rfc822_parse_adrlist (msg->env->cc, optarg);
break;
- case 'd':
- {
- char buf[LONG_STRING];
- int level = atoi (optarg);
-
- snprintf (buf, sizeof (buf), "set debug_level=%d", level);
- commands = mutt_add_list (commands, buf);
- debug_setlevel (level);
- }
- break;
-
case 't':
dump_variables = 2;
break;
enum output_formats_t OutputFormat = F_NONE;
char *Progname;
-short Debug = 0;
static char *get_token (char *, size_t, char *);
static char *skip_ws (char *);
case 's':
OutputFormat = F_SGML;
break;
- case 'd':
- Debug++;
- break;
default:
{
fprintf (stderr, "%s: bad command line parameter.\n", Progname);
if (!(p = get_token (token, sizeof (token), buffer)))
continue;
- if (Debug) {
- fprintf (stderr, "%s: line %d. first token: \"%s\".\n",
- Progname, line, token);
- }
-
if (!strcmp (token, "/*++*/"))
active = 1;
else if (!strcmp (token, "/*--*/")) {
short is_quoted = 0;
char *dd = d;
- if (Debug)
- fprintf (stderr, "%s: get_token called for `%s'.\n", Progname, s);
-
s = skip_ws (s);
- if (Debug > 1)
- fprintf (stderr, "%s: argumet after skip_ws(): `%s'.\n", Progname, s);
-
if (!*s) {
- if (Debug)
- fprintf (stderr, "%s: no more tokens on this line.\n", Progname);
return NULL;
}
if (strchr (single_char_tokens, *s)) {
- if (Debug) {
- fprintf (stderr, "%s: found single character token `%c'.\n",
- Progname, *s);
- }
d[0] = *s++;
d[1] = 0;
return s;
}
if (*s == '"') {
- if (Debug) {
- fprintf (stderr, "%s: found quote character.\n", Progname);
- }
-
s++;
is_quoted = 1;
}
*d = '\0';
- if (Debug) {
- fprintf (stderr, "%s: Got %stoken: `%s'.\n",
- Progname, is_quoted ? "quoted " : "", dd);
- fprintf (stderr, "%s: Remainder: `%s'.\n", Progname, t);
- }
-
return t;
}
return;
if (!strcmp (buff, "|")) {
- if (Debug)
- fprintf (stderr, "%s: Expecting <subtype> <comma>.\n", Progname);
/* ignore subtype and comma */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (Debug)
- fprintf (stderr, "%s: Expecting default value.\n", Progname);
-
/* <default value> or UL <default value> */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
if (!strcmp (buff, "UL")) {
- if (Debug)
- fprintf (stderr, "%s: Skipping UL.\n", Progname);
if (!(s = get_token (buff, sizeof (buff), s)))
return;
}
l = skip_ws (l);
- if (Debug)
- fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l);
-
if (!strncmp (l, ".pp", 3))
return print_it (SP_NEWPAR, NULL, docstat);
else if (!strncmp (l, ".ts", 3))
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/mutt_signal.h>
if (fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL) {
/* TODO: memory leak??? */
- debug_print (1, ("unexpected EOF\n"));
break;
}
if (!is_from (buf, return_path, sizeof (return_path), &t)) {
if (fseeko (ctx->fp, loc, SEEK_SET) != 0) {
- debug_print (1, ("fseeko() failed\n"));
mutt_error _("Mailbox is corrupt!");
return (-1);
if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
fgets (buf, sizeof (buf) - 1, ctx->fp) == NULL ||
m_strcmp(MMDF_SEP, buf) != 0) {
- if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
- debug_print (1, ("fseeko() failed\n"));
+ fseeko (ctx->fp, loc, SEEK_SET);
hdr->content->length = -1;
}
}
ctx->msgcount++;
}
else {
- debug_print (1, ("corrupt mailbox!\n"));
mutt_error _("Mailbox is corrupt!");
return (-1);
if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
fgets (buf, sizeof (buf), ctx->fp) == NULL ||
m_strncmp("From ", buf, 5) != 0) {
- debug_print (1, ("bad content-length in message %d (cl=%zd)\n",
- curhdr->index, curhdr->content->length));
- debug_print (1, ("LINE: %s\n", buf));
- if (fseeko (ctx->fp, loc, SEEK_SET) != 0) { /* nope, return the previous position */
- debug_print (1, ("fseeko() failed\n"));
- }
+ fseeko (ctx->fp, loc, SEEK_SET); /* nope, return the previous position */
curhdr->content->length = -1;
}
}
int cl = curhdr->content->length;
/* count the number of lines in this message */
- if (fseeko (ctx->fp, loc, SEEK_SET) != 0)
- debug_print (1, ("fseeko() failed\n"));
+ fseeko (ctx->fp, loc, SEEK_SET);
while (cl-- > 0) {
if (fgetc (ctx->fp) == '\n')
curhdr->lines++;
}
/* return to the offset of the next message separator */
- if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0)
- debug_print (1, ("fseeko() failed\n"));
+ fseeko(ctx->fp, tmploc, SEEK_SET);
}
}
* see the message separator at *exactly* what used to be the end of the
* folder.
*/
- if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
- debug_print (1, ("fseeko() failed\n"));
+ fseeko (ctx->fp, ctx->size, SEEK_SET);
if (fgets (buffer, sizeof (buffer), ctx->fp) != NULL) {
if ((ctx->magic == M_MBOX && m_strncmp("From ", buffer, 5) == 0)
|| (ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buffer) == 0)) {
- if (fseeko (ctx->fp, ctx->size, SEEK_SET) != 0)
- debug_print (1, ("fseeko() failed\n"));
+ fseeko (ctx->fp, ctx->size, SEEK_SET);
if (ctx->magic == M_MBOX)
mbox_parse_mailbox (ctx);
else
}
else
modified = 1;
- }
- else {
- debug_print (1, ("fgets returned NULL.\n"));
+ } else {
modified = 1;
}
- }
- else
+ } else {
modified = 1;
+ }
}
if (modified) {
mutt_error
_("sync: mbox modified, but no modified messages! (report this bug)");
mutt_sleep (5); /* the mutt_error /will/ get cleared! */
- debug_print (1, ("no modified messages.\n"));
unlink (tempfile);
goto bail;
}
if (fclose (fp) != 0) {
fp = NULL;
- debug_print (1, ("fclose() returned non-zero.\n"));
unlink (tempfile);
mutt_perror (tempfile);
mutt_sleep (5);
if ((fp = fopen (tempfile, "r")) == NULL) {
mutt_unblock_signals ();
mx_fastclose_mailbox (ctx);
- debug_print (1, ("unable to reopen temp copy of mailbox!\n"));
mutt_perror (tempfile);
mutt_sleep (5);
return (-1);
fgets (buf, sizeof (buf), ctx->fp) == NULL ||
(ctx->magic == M_MBOX && m_strncmp("From ", buf, 5) != 0) ||
(ctx->magic == M_MMDF && m_strcmp(MMDF_SEP, buf) != 0)) {
- debug_print (1, ("message not in expected position.\n"));
- debug_print (1, ("LINE: %s\n", buf));
i = -1;
}
else {
if (fseeko (ctx->fp, offset, SEEK_SET) != 0) { /* return to proper offset */
i = -1;
- debug_print (1, ("fseeko() failed\n"));
- }
- else {
+ } else {
/* copy the temp mailbox back into place starting at the first
* change/deleted message
*/
case M_MBOX:
case M_MMDF:
if (fseeko (ctx->fp, 0, SEEK_SET) != 0) {
- debug_print (1, ("fseeko() failed\n"));
rc = -1;
}
else {
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "mx.h"
/* FOO - really ignore the return value? */
- debug_print (2, ("parsing %s\n", de->d_name));
maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
#if HAVE_DIRENT_D_INO
de->d_ino
while (md) {
- debug_print (2, ("considering %s\n", NONULL (md->canon_fname)));
-
if (md->h) {
- debug_print (2, ("flags: %s%s%s%s%s\n", md->h->flagged ? "f" : "",
- md->h->deleted ? "D" : "", md->h->replied ? "r" : "",
- md->h->old ? "O" : "", md->h->read ? "R" : ""));
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory (ctx);
dest->path, subdir, (long) time (NULL),
(unsigned int) getpid (), Counter++, NONULL (Hostname), suffix);
- debug_print (2, ("trying %s.\n", path));
-
umask (Umask);
if ((fd = open (path, O_WRONLY | O_EXCL | O_CREAT, 0666)) == -1) {
if (errno != EEXIST) {
mutt_perror (path);
return -1;
}
- }
- else {
- debug_print (2, ("success.\n"));
+ } else {
msg->path = m_strdup(path);
break;
}
NONULL (Hostname), suffix);
snprintf (full, _POSIX_PATH_MAX, "%s/%s", ctx->path, path);
- debug_print (2, ("renaming %s to %s.\n", msg->path, full));
-
if (safe_rename (msg->path, full) == 0) {
if (hdr)
m_strreplace(&hdr->path, path);
char *p;
if ((p = strrchr (h->path, '/')) == NULL) {
- debug_print (1, ("%s: unable to find subdir!\n", h->path));
return (-1);
}
p++;
#include <lib-lib/ascii.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "charset.h"
if (!irrev && idna_to_ascii_8z (tmp, &t2, 1) != IDNA_SUCCESS)
irrev = 1;
if (!irrev && ascii_strcasecmp (t2, in)) {
- debug_print (1, ("not reversible. in = '%s', t2 = '%s'.\n", in, t2));
irrev = 1;
}
#include <netinet/in.h>
#include <lib-lib/mem.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "account.h"
switch (ret) {
case EAI_AGAIN:
- debug_print (1, ("The name could not be resolved at this time. Future attempts may succeed.\n"));
err = SASL_TRYAGAIN;
break;
case EAI_BADFLAGS:
- debug_print (1, ("The flags had an invalid value.\n"));
err = SASL_BADPARAM;
break;
case EAI_FAIL:
- debug_print (1, ("A non-recoverable error occurred.\n"));
err = SASL_FAIL;
break;
case EAI_FAMILY:
- debug_print (1, ("The address family was not recognized or the address length was invalid for the specified family.\n"));
err = SASL_BADPROT;
break;
case EAI_MEMORY:
- debug_print (1, ("There was a memory allocation failure.\n"));
err = SASL_NOMEM;
break;
case EAI_NONAME:
- debug_print (1, ("The name does not resolve for the supplied parameters. NI_NAMEREQD is set and the host's name cannot be located, or both nodename and servname were null.\n"));
err = SASL_FAIL; /* no real equivalent */
break;
case EAI_SYSTEM:
- debug_print (1, ("A system error occurred. The error code can be found in errno(%d,%s)).\n",
- errno, strerror (errno)));
err = SASL_FAIL; /* no real equivalent */
break;
default:
- debug_print (1, ("Unknown error %d\n", ret));
err = SASL_FAIL; /* no real equivalent */
break;
}
static int mutt_sasl_start (void);
/* callbacks */
-static int mutt_sasl_cb_log (void *context, int priority,
- const char *message);
static int mutt_sasl_cb_authname (void *context, int id, const char **result,
unsigned int *len);
static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
return SASL_OK;
}
+/* mutt_sasl_cb_log: callback to log SASL messages */
+static int mutt_sasl_cb_log (void *context, int priority, const char *message)
+{
+ return SASL_OK;
+}
+
/* mutt_sasl_start: called before doing a SASL exchange - initialises library
* (if necessary). */
int mutt_sasl_start (void)
rc = sasl_client_init (callbacks);
if (rc != SASL_OK) {
- debug_print (1, ("libsasl initialisation failed.\n"));
return SASL_FAIL;
}
service = "pop";
break;
default:
- debug_print (1, ("account type unset\n"));
return -1;
}
size = sizeof (local);
if (getsockname (conn->fd, (struct sockaddr *) &local, &size)) {
- debug_print (1, ("getsockname for local failed\n"));
return -1;
}
else
- if (iptostring
- ((struct sockaddr *) &local, size, iplocalport,
+ if (iptostring((struct sockaddr *)&local, size, iplocalport,
IP_PORT_BUFLEN) != SASL_OK) {
- debug_print (1, ("iptostring for local failed\n"));
return -1;
}
size = sizeof (remote);
if (getpeername (conn->fd, (struct sockaddr *) &remote, &size)) {
- debug_print (1, ("getsockname for remote failed\n"));
return -1;
}
else
if (iptostring
((struct sockaddr *) &remote, size, ipremoteport,
IP_PORT_BUFLEN) != SASL_OK) {
- debug_print (1, ("iptostring for remote failed\n"));
return -1;
}
- debug_print (1, ("local ip: %s, remote ip:%s\n", iplocalport, ipremoteport));
-
- rc =
- sasl_client_new (service, conn->account.host, iplocalport, ipremoteport,
- mutt_sasl_get_callbacks (&conn->account), 0, saslconn);
+ rc = sasl_client_new(service, conn->account.host, iplocalport, ipremoteport,
+ mutt_sasl_get_callbacks(&conn->account), 0, saslconn);
if (rc != SASL_OK) {
- debug_print (1, ("Error allocating SASL connection\n"));
return -1;
}
#ifdef SASL_IP_LOCAL
if (sasl_setprop (*saslconn, SASL_IP_LOCAL, &local) != SASL_OK) {
- debug_print (1, ("Error setting local IP address\n"));
return -1;
}
#endif
#ifdef SASL_IP_REMOTE
if (sasl_setprop (*saslconn, SASL_IP_REMOTE, &remote) != SASL_OK) {
- debug_print (1, ("Error setting remote IP address\n"));
return -1;
}
#endif
secprops.maxbufsize = M_SASL_MAXBUF;
secprops.security_flags |= SASL_SEC_NOPLAINTEXT;
if (sasl_setprop (*saslconn, SASL_SEC_PROPS, &secprops) != SASL_OK) {
- debug_print (1, ("Error setting security properties\n"));
return -1;
}
if (conn->ssf) {
- debug_print (2, ("External SSF: %d\n", conn->ssf));
if (sasl_setprop (*saslconn, SASL_SSF_EXTERNAL, &(conn->ssf)) != SASL_OK)
{
- debug_print (1, ("Error setting external properties\n"));
return -1;
}
- debug_print (2, ("External authentication name: %s\n", conn->account.user));
if (sasl_setprop (*saslconn, SASL_AUTH_EXTERNAL, conn->account.user) !=
SASL_OK) {
- debug_print (1, ("Error setting external properties\n"));
return -1;
}
}
char resp[SHORT_STRING];
while (interaction->id != SASL_CB_LIST_END) {
- debug_print (2, ("filling in SASL interaction %ld.\n", interaction->id));
-
snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt);
resp[0] = '\0';
if (mutt_get_field (prompt, resp, sizeof (resp), 0))
sasldata->saslconn = saslconn;
/* get ssf so we know whether we have to (en|de)code read/write */
sasl_getprop (saslconn, SASL_SSF, (const void **)(void *)&sasldata->ssf);
- debug_print (3, ("SASL protection strength: %u\n", *sasldata->ssf));
+
/* Add SASL SSF to transport SSF */
conn->ssf += *sasldata->ssf;
sasl_getprop (saslconn, SASL_MAXOUTBUF,
(const void **)(void *)&sasldata->pbufsize);
- debug_print (3, ("SASL protection buffer size: %u\n", *sasldata->pbufsize));
/* clear input buffer */
sasldata->buf = NULL;
sasl_done ();
}
-/* mutt_sasl_cb_log: callback to log SASL messages */
-static int mutt_sasl_cb_log (void *context, int priority, const char *message)
-{
- debug_print (priority, ("SASL: %s\n", message));
-
- return SASL_OK;
-}
-
/* mutt_sasl_cb_authname: callback to retrieve authname or user from ACCOUNT */
static int mutt_sasl_cb_authname (void *context, int id, const char **result,
unsigned *len)
if (!account)
return SASL_BADPARAM;
- debug_print (2, ("getting %s for %s:%u\n",
- id == SASL_CB_AUTHNAME ? "authname" : "user",
- account->host, account->port));
-
if (id == SASL_CB_AUTHNAME) {
if (mutt_account_getlogin (account))
return SASL_FAIL;
if (!account || !psecret)
return SASL_BADPARAM;
- debug_print (2, ("getting password for %s@%s:%u\n",
- account->login, account->host, account->port));
-
if (mutt_account_getpass (account))
return SASL_FAIL;
rc = sasl_decode (sasldata->saslconn, buf, rc, &sasldata->buf,
&sasldata->blen);
if (rc != SASL_OK) {
- debug_print (1, ("SASL decode failed: %s\n",
- sasl_errstring (rc, NULL, NULL)));
goto out;
}
}
rc = sasl_encode (sasldata->saslconn, buf, olen, &pbuf, &plen);
if (rc != SASL_OK) {
- debug_print (1, ("SASL encoding failed: %s\n",
- sasl_errstring (rc, NULL, NULL)));
goto fail;
}
#include <lib-lib/macros.h>
#include <lib-lib/buffer.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include <lib-mime/mime.h>
if (b->parameter)
parameter_list_wipe(&b->parameter);
if (b->unlink && b->filename) {
- debug_print (1, ("unlinking %s.\n", b->filename));
unlink (b->filename);
}
- else if (b->filename)
- debug_print (1, ("not unlinking %s.\n", b->filename));
p_delete(&b->filename);
p_delete(&b->content);
snprintf (s, _POSIX_PATH_MAX, "%s/madmutt-%s-%d-%d-%d-%x%x", NONULL (Tempdir),
NONULL (Hostname), (int) getuid (), (int) getpid (), Counter++,
(unsigned int) rand(), (unsigned int) rand());
- debug_print (1, ("%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
unlink (s);
}
/* Does this pattern match? */
if (regexec(l->rx->rx, s, l->nmatch, (regmatch_t *)pmatch, (int) 0) == 0)
{
- debug_print (5, ("%s matches %s\n%d subst", s, l->rx->pattern, l->rx->rx->re_nsub));
-
/* Copy template into text, with substitutions. */
for (p = l->template; *p;) {
if (*p == '%') {
}
}
text[tlen] = '\0';
- debug_print (5, ("\"%s\"\n", text));
return 1;
}
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include <lib-sys/unix.h>
while (fcntl (fd, F_SETLK, &lck) == -1) {
struct stat sb;
- debug_print (1, ("fcntl errno %d.\n", errno));
if (errno != EAGAIN && errno != EACCES) {
mutt_perror ("fcntl");
return (-1);
address_t *p = NULL;
if (!MX_IDX(dest->magic-1)) {
- debug_print (1, ("function unimplemented for mailbox type %d.\n", dest->magic));
return (NULL);
}
return (MX_COMMAND(ctx->magic-1,mx_check_mailbox)(ctx, index_hint, lock));
}
- debug_print (1, ("null or invalid context.\n"));
return (-1);
-
}
/* return a stream pointer for a message */
if (msg->fp == NULL) {
mutt_perror (path);
- debug_print (1, ("fopen: %s: %s (errno %d).\n", path, strerror (errno), errno));
p_delete(&msg);
}
}
#endif /* USE_NNTP */
default:
- debug_print (1, ("function not implemented for mailbox type %d.\n", ctx->magic));
p_delete(&msg);
break;
}
int mx_commit_message (MESSAGE * msg, CONTEXT * ctx) {
if (!(msg->write && ctx->append)) {
- debug_print (1, ("msg->write = %d, ctx->append = %d\n", msg->write, ctx->append));
return -1;
}
if (!ctx || !MX_IDX(ctx->magic-1) || !MX_COMMAND(ctx->magic-1,mx_commit_message))
(*msg)->fp = NULL;
if ((*msg)->path) {
- debug_print (1, ("unlinking %s\n", (*msg)->path));
unlink ((*msg)->path);
p_delete(&(*msg)->path);
}
}
void mx_init (void) {
-#ifdef DEBUG
- int i = 0;
-#endif
list_push_back (&MailboxFormats, (void*) mbox_reg_mx ());
list_push_back (&MailboxFormats, (void*) mmdf_reg_mx ());
list_push_back (&MailboxFormats, (void*) mh_reg_mx ());
list_push_back (&MailboxFormats, (void*) nntp_reg_mx ());
#endif
list_push_back (&MailboxFormats, (void*) compress_reg_mx ());
-#ifdef DEBUG
- /* check module registration for completeness with debug versions */
-#define EXITWITHERR(m) do { fprintf(stderr, "error: incomplete mx module: %s is missing for type %i\n",m,i);exit(1); } while (0)
- for (i = 0; i < MailboxFormats->length; i++) {
- if (MX_COMMAND(i,type) < 1) EXITWITHERR("type");
- if (!MX_COMMAND(i,mx_is_magic)) EXITWITHERR("mx_is_magic");
- if (!MX_COMMAND(i,mx_open_mailbox)) EXITWITHERR("mx_open_mailbox");
-/* if (!MX_COMMAND(i,mx_sync_mailbox)) EXITWITHERR("mx_sync_mailbox");*/
- }
-#undef EXITWITHERR
-#endif /* DEBUG */
}
int mx_rebuild_cache (void) {
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
data->lastMessage = data->entries[x - 1].last;
data->num = x;
mutt_newsgroup_stat (data);
- debug_print (2, ("Newsgroup %s\n", data->group));
return 0;
}
data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group);
if (!data) {
-#ifdef DEBUG
- if (group)
- debug_print (3, ("newsgroup %s not found\n", group));
-#endif
return;
}
/* if file not exist, create it */
if ((ifp = safe_fopen (filename, "a")))
fclose (ifp);
- debug_print (1, ("Opening %s\n", filename));
if (!(ifp = safe_fopen (filename, "r"))) {
mutt_error (_("Unable to open %s for reading"), filename);
return -1;
m_strcpy(buf, sizeof(buf), filename);
m_strcpy(tmpfile, sizeof(tmpfile), basename(filename));
mutt_adv_mktemp ((const char*) dirname (buf), tmpfile, sizeof (tmpfile));
- debug_print (1, ("Opening %s\n", tmpfile));
if (!(ofp = fopen (tmpfile, "w"))) {
fclose (ifp);
mutt_error (_("Unable to open %s for writing"), tmpfile);
link[0] = '\0';
if ((l = readlink (filename, link, sizeof (link)-1)) > 0)
link[l] = '\0';
- debug_print (1, ("Renaming %s to %s\n",tmpfile, l > 0 ? link : filename));
if (rename (tmpfile, l > 0 ? link : filename) < 0) {
unlink (tmpfile);
mutt_error (_("Can't rename %s to %s"), tmpfile, l > 0 ? link : filename);
if (!data || !data->rc)
continue;
nntp_create_newsrc_line (data, &buf, &line, &llen);
- debug_print (2, ("Added to newsrc: %s\n", line));
line += m_strlen(line);
}
/* newrc being fully rewritten */
if (!data || data->subscribed || !data->cache)
continue;
nntp_delete_cache (data);
- debug_print (2, ("Removed from .index: %s\n", data->group));
}
return;
}
#include <lib-lib/str.h>
#include <lib-lib/file.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
tmp->msgcount = data->lastMessage - data->firstMessage;
}
-static void nntp_error (const char *where, const char *msg) {
- debug_print (1, ("unexpected response in %s: %s\n", where, msg));
-}
-
static int nntp_auth (NNTP_SERVER * serv)
{
CONNECTION *conn = serv->conn;
return -1;
}
-#ifdef DEBUG
- /* don't print the password unless we're at the ungodly debugging level */
- if (DebugLevel < M_SOCK_LOG_FULL)
- debug_print (M_SOCK_LOG_CMD, ("> AUTHINFO PASS *\n"));
-#endif
snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
mutt_socket_write_d (conn, buf, M_SOCK_LOG_FULL);
if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) {
ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
if (ret) {
- if (ret != -1)
- debug_print (1, ("%s\n", buf));
fclose (f);
unlink (tempfile);
return (ret == -1 ? -1 : 1);
d++;
while (*d && (*d == '\t' || *d == ' '))
d++;
- debug_print (2, ("group: %s, desc: %s\n", line, d));
if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
m_strcmp(d, data->desc)) {
p_delete(&data->desc);
snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask);
if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
0) {
-#ifdef DEBUG
- nntp_error ("nntp_get_desc()", buf);
-#endif
}
}
0) {
mutt_error (_("LISTGROUP command failed: %s"), buf);
sleep (2);
-#ifdef DEBUG
- nntp_error ("nntp_fetch_headers()", buf);
-#endif
p_delete(&fc.messages);
return -1;
}
mx_update_context (ctx, ctx->msgcount - oldmsgcount);
if (ret != 0) {
mutt_error (_("XOVER command failed: %s"), buf);
-#ifdef DEBUG
- nntp_error ("nntp_fetch_headers()", buf);
-#endif
p_delete(&fc.messages);
return -1;
}
buf[0] = 0;
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
- nntp_error ("nntp_open_mailbox()", buf);
-#endif
return -1;
}
if (ret == 1) {
mutt_error (_("Article %d not found on server"),
ctx->hdrs[msgno]->article_num);
- debug_print (1, ("%s\n", buf));
}
if (ret) {
buf[0] = 0;
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
- nntp_error ("nntp_check_mailbox()", buf);
-#endif
return -1;
}
if (m_strncmp("211", buf, 3)) {
buf[0] = 0;
if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
- nntp_error ("nntp_check_mailbox()", buf);
-#endif
return -1;
}
}
l = serv->tail;
if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
add_group, serv, 0) != 0) {
-#ifdef DEBUG
- nntp_error ("nntp_check_newgroups()", buf);
-#endif
return -1;
}
nntp_data.group = NULL;
if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) {
-#ifdef DEBUG
- nntp_error ("nntp_get_active()", "string_list_t\r\n");
-#endif
return -1;
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-lib/rx.h>
#include <lib-ui/curses.h>
}
else if (*p == '\033' && *(p + 1) == ']'
&& check_attachment_marker ((char *) p) == 0) {
- debug_print (2, ("seen attachment marker.\n"));
while (*p++ != '\a') /* skip pseudo-ANSI sequence */
;
}
k = mbrtowc (&wc, (char *) buf + ch, cnt - ch, &mbstate);
if (k == -2 || k == -1) {
- debug_print (1, ("mbrtowc returned %d; errno = %d.\n", k, errno));
if (col + 4 > wrap_cols)
break;
col += 4;
#include <lib-lib/file.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-ui/curses.h>
if (pop_data->cmd_top == CMD_UNKNOWN) {
if (ret == PQ_OK) {
pop_data->cmd_top = CMD_AVAILABLE;
-
- debug_print (1, ("set TOP capability\n"));
}
if (ret == PQ_ERR) {
pop_data->cmd_top = CMD_NOT_AVAILABLE;
-
- debug_print (1, ("unset TOP capability\n"));
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
_("Command TOP is not supported by server."));
}
break;
if (i == ctx->msgcount) {
- debug_print (1, ("new header %d %s\n", idx, line));
-
if (i >= ctx->hdrmax)
mx_alloc_memory (ctx);
if (pop_data->cmd_uidl == CMD_UNKNOWN) {
if (ret == PQ_OK) {
pop_data->cmd_uidl = CMD_AVAILABLE;
-
- debug_print (1, ("set UIDL capability\n"));
}
if (ret == PQ_ERR && pop_data->cmd_uidl == CMD_UNKNOWN) {
pop_data->cmd_uidl = CMD_NOT_AVAILABLE;
- debug_print (1, ("unset UIDL capability\n"));
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
_("Command UIDL is not supported by server."));
}
if (!pop_data->clear_cache)
return;
- debug_print (1, ("delete cached messages\n"));
-
for (i = 0; i < POP_CACHE_LEN; i++) {
if (pop_data->cache[i].path) {
unlink (pop_data->cache[i].path);
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-hash/hash.h>
-#include <lib-lib/debug.h>
#include "mutt.h"
#include "mx.h"
unsigned char client_start;
if (mutt_sasl_client_new (pop_data->conn, &saslconn) < 0) {
- debug_print (1, ("Error allocating SASL connection.\n"));
return POP_A_FAILURE;
}
}
if (rc != SASL_OK && rc != SASL_CONTINUE) {
- debug_print (1, ("Failure starting authentication exchange. No shared mechanisms?\n"));
-
/* SASL doesn't support suggested mechanisms, so fall back */
return POP_A_UNAVAIL;
}
&len) != SASL_OK)
#endif
{
- debug_print (1, ("error base64-decoding server response.\n"));
goto bail;
}
/* send out response, or line break if none needed */
if (pc) {
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK) {
- debug_print (1, ("error base64-encoding client response.\n"));
goto bail;
}
if (pop_data->cmd_user == CMD_UNKNOWN) {
if (ret == PQ_OK) {
pop_data->cmd_user = CMD_AVAILABLE;
-
- debug_print (1, ("set USER capability\n"));
}
if (ret == PQ_ERR) {
pop_data->cmd_user = CMD_NOT_AVAILABLE;
- debug_print (1, ("unset USER capability\n"));
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
_("Command USER is not supported by server."));
}
if (ret == PQ_OK) {
snprintf (buf, sizeof (buf), "PASS %s\r\n", pop_data->conn->account.pass);
- ret = pop_query_d (pop_data, buf, sizeof (buf),
-#ifdef DEBUG
- /* don't print the password unless we're at the ungodly debugging level */
- DebugLevel < M_SOCK_LOG_FULL ? "PASS *\r\n" :
-#endif
- NULL);
+ ret = pop_query_d (pop_data, buf, sizeof (buf), NULL);
}
switch (ret) {
comma = strchr (method, ':');
if (comma)
*comma++ = '\0';
- debug_print (2, ("Trying method %s\n", method));
authenticator = pop_authenticators;
while (authenticator->authenticate) {
}
else {
/* Fall back to default: any authenticator */
- debug_print (2, ("Using any available method.\n"));
authenticator = pop_authenticators;
while (authenticator->authenticate) {
#include <lib-lib/str.h>
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include "mutt.h"
if (pop_data->status != POP_CONNECTED)
return PQ_NOT_CONNECTED;
-#ifdef DEBUG
- /* print msg instaed of real command */
- if (msg) {
- dbg = M_SOCK_LOG_FULL;
- debug_print (M_SOCK_LOG_CMD, ("> %s", msg));
- }
-#endif
-
mutt_socket_write_d (pop_data->conn, buf, dbg);
c = strpbrk (buf, " \r\n");
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-mime/mime.h>
newpc = imap_mailbox_check (Postponed, 0);
if (newpc >= 0) {
PostCount = newpc;
- debug_print (2, ("%d postponed IMAP messages found.\n", PostCount));
}
- else
- debug_print (2, ("using old IMAP postponed count.\n"));
}
return PostCount;
}
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
#include <lib-lib/mapping.h>
-#include <lib-lib/debug.h>
#include <lib-ui/menu.h>
mutt_expand_file_fmt (cmd, sizeof (cmd), QueryCmd, s);
if ((thepid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) {
- debug_print (1, ("unable to fork command: %s\n", cmd));
return 0;
}
if (!quiet)
p_delete(&buf);
fclose (fp);
if (mutt_wait_filter (thepid)) {
- debug_print (1, ("Error: %s\n", msg));
if (!quiet)
mutt_error ("%s", msg);
}
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/unix.h>
/* ignore comments */
if (*buf == '#')
continue;
- debug_print (2, ("mailcap entry: %s\n", buf));
/* check type */
ch = get_field (buf);
while (ch) {
field = ch;
ch = get_field (ch);
- debug_print (2, ("field: %s\n", field));
if (!ascii_strcasecmp (field, "needsterminal")) {
if (entry)
path[x] = '\0';
mutt_expand_path (path, sizeof (path));
- debug_print (2, ("Checking mailcap file: %s\n", path));
found = rfc1524_mailcap_parse (a, path, type, entry, opt);
}
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-ui/curses.h>
* the end of the string w/ pos */
if (pos < line + len) {
if (*pos == ' ') {
- debug_print (4, ("f=f: found space directly at width\n"));
*pos = '\0';
++pos;
}
else {
char *save = pos;
- debug_print (4, ("f=f: need to search for space\n"));
while (pos >= oldpos && *pos != ' ') {
--pos;
}
if (pos < oldpos) {
- debug_print (4, ("f=f: no space found while searching "
- "to left; going right\n"));
pos = save;
while (pos < line + len && *pos && *pos != ' ') {
++pos;
}
- debug_print (4, ("f=f: found space at pos %d\n", pos-line));
- } else {
- debug_print (4, ("f=f: found space while searching to left\n"));
}
*pos = '\0';
++pos;
}
}
- else {
- debug_print (4, ("f=f: line completely fits on screen\n"));
- }
+
if (s->prefix)
state_puts (s->prefix, s);
t = NULL;
}
- debug_print (2, ("f=f: DelSp: %s\n", delsp ? "yes" : "no"));
while (bytes > 0 && fgets (buf, sizeof (buf), s->fpin)) {
}
void rfc3676_space_stuff (HEADER* hdr) {
-#if DEBUG
- int lc = 0;
- size_t len = 0;
- unsigned char c = '\0';
-#endif
FILE* in = NULL, *out = NULL;
char buf[LONG_STRING];
char tmpfile[_POSIX_PATH_MAX];
if (!hdr || !hdr->content || !hdr->content->filename)
return;
- debug_print (2, ("f=f: postprocess %s\n", hdr->content->filename));
if ((in = safe_fopen (hdr->content->filename, "r")) == NULL)
return;
mutt_mktemp (tmpfile);
while (fgets (buf, sizeof (buf), in)) {
if (ascii_strncmp ("From ", buf, 4) == 0 || buf[0] == ' ') {
fputc (' ', out);
-#if DEBUG
- lc++;
- len = m_strlen(buf);
- if (len > 0) {
- c = buf[len-1];
- buf[len-1] = '\0';
- }
- debug_print (4, ("f=f: line %d needs space-stuffing: '%s'\n",
- lc, buf));
- if (len > 0)
- buf[len-1] = c;
-#endif
}
fputs (buf, out);
}
#include <lib-lib/ascii.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-lib/url.h>
#include <lib-mime/mime.h>
}
if (!tempfp) {
- debug_print (1, ("can't create tempfile %s (errno=%d)\n",
- msg->content->filename, errno));
mutt_perror (msg->content->filename);
goto cleanup;
}
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
-#include <lib-lib/debug.h>
#include <lib-sys/exit.h>
#include <lib-sys/mutt_signal.h>
if (a->type == TYPEMULTIPART) {
/* First, find the boundary to use */
if (!(p = mutt_get_parameter ("boundary", a->parameter))) {
- debug_print (1, ("no boundary parameter found!\n"));
mutt_error _("No boundary parameter found! [report this error]");
return (-1);
}
if ((fpin = fopen (a->filename, "r")) == NULL) {
- debug_print (1, ("%s no longer exists!\n", a->filename));
mutt_error (_("%s no longer exists!"), a->filename);
return -1;
}
}
if ((fp = fopen (fname, "r")) == NULL) {
- debug_print (1, ("%s: %s (errno %d).\n", fname, strerror (errno), errno));
return (NULL);
}
m_strcpy(buf, sizeof(buf), SYSCONFDIR "/mime.types");
break;
default:
- debug_print (1, ("Internal error, count = %d.\n", count));
goto bye; /* shouldn't happen */
}
}
if (dup) {
- debug_print (2, ("Removing %s\n", addr->mailbox));
-
*last = addr->next;
addr->next = NULL;
set_noconv_flags (hdr->content, 1);
if (mx_open_mailbox (path, M_APPEND | M_QUIET, &f) == NULL) {
- debug_print (1, ("unable to open mailbox %s in append-mode, aborting.\n", path));
return (-1);
}
fflush (tempfp);
if (ferror (tempfp)) {
- debug_print (1, ("%s: write failed.\n", tempfile));
fclose (tempfp);
unlink (tempfile);
mx_commit_message (msg, &f); /* XXX - really? */
#include <stdio.h>
#include <stdarg.h>
-#include <lib-lib/debug.h>
-
#include "mutt.h"
#include "state.h"
#include "rfc3676.h"
char buf[2 * SHORT_STRING];
int j = 0, offset = 0;
regmatch_t pmatch[1];
-#ifdef DEBUG
- unsigned char save = '\0';
-#endif
state_reset_prefix (s);
while (regexec
else
snprintf (buf, sizeof (buf), "%s%s", NONULL (s->prefix), Quotebuf);
-#ifdef DEBUG
- if (m_strlen(buf) >= 2) {
- save = buf[m_strlen(buf) - 1];
- buf[m_strlen(buf) - 1] = '\0';
- debug_print (2, ("buf = '%s'\n", buf));
- buf[m_strlen(buf)] = save;
- }
-#endif
-
state_puts (buf, s);
}
}