summaryrefslogtreecommitdiff
path: root/alpine
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-03-27 12:43:03 -0600
committerEduardo Chappa <chappa@washington.edu>2021-03-27 12:43:03 -0600
commita5c42906261fefe477422cf106cbd0ce934e0173 (patch)
tree3ab4135304ff155eae681e12c55d5bcfec37e790 /alpine
parent903b5ac6305612d16e6053b4a4e8957d8ada9bde (diff)
downloadalpine-a5c42906261fefe477422cf106cbd0ce934e0173.tar.xz
* new http option for debug. This is mostly useful to debug XOAUTH2
autentication and reveals sensitive login information. Use with care. Remove your .pine-debug file after using this option.
Diffstat (limited to 'alpine')
-rw-r--r--alpine/alpine.c12
-rw-r--r--alpine/arg.c10
-rw-r--r--alpine/imap.c12
-rw-r--r--alpine/osdep/debuging.c6
4 files changed, 31 insertions, 9 deletions
diff --git a/alpine/alpine.c b/alpine/alpine.c
index 7c63e77..3831b89 100644
--- a/alpine/alpine.c
+++ b/alpine/alpine.c
@@ -388,6 +388,11 @@ main(int argc, char **argv)
#endif
mail_parameters(NULL, SET_TCPDEBUG, (void *) TRUE);
+#ifndef DEBUGJOURNAL
+ if(ps_global->debug_http)
+#endif
+ mail_parameters(NULL, SET_HTTPDEBUG, (void *) TRUE);
+
#ifdef _WINDOWS
mswin_setdebug(debug, debugfile);
mswin_setdebugoncallback (imap_telemetry_on);
@@ -821,7 +826,7 @@ main(int argc, char **argv)
pine_pico_puts, pine_pico_seek, NULL, NULL);
#ifdef DEBUG
- if(ps_global->debug_imap > 4 || debug > 9){
+ if(ps_global->debug_imap > 4 || debug > 9 || ps_global->debug_http > 0){
q_status_message(SM_ORDER | SM_DING, 5, 9,
_("Warning: sensitive authentication data included in debug file"));
flush_status_messages(0);
@@ -1808,6 +1813,11 @@ main_menu_screen(struct pine *pine_state)
else if(debug <= 7 && olddebug > 7 && !ps_global->debugmem)
mail_parameters(NULL, SET_TCPDEBUG, (void *) FALSE);
+ if(debug > 7 && olddebug <= 7)
+ mail_parameters(NULL, SET_HTTPDEBUG, (void *) TRUE);
+ else if(debug <= 7 && olddebug > 7 && !ps_global->debugmem)
+ mail_parameters(NULL, SET_HTTPDEBUG, (void *) FALSE);
+
dprint((1, "*** Debug level set to %d ***\n", debug));
if(debugfile)
fflush(debugfile);
diff --git a/alpine/arg.c b/alpine/arg.c
index 8e00a21..72ab064 100644
--- a/alpine/arg.c
+++ b/alpine/arg.c
@@ -107,7 +107,7 @@ N_("\t\toption on the command line"),
N_(" -bail\t\tExit if pinerc file doesn't already exist"),
#ifdef DEBUG
N_(" -d n\t\tDebug - set debug level to 'n', or use the following:"),
-N_(" -d keywords...\tflush,timestamp,imap=0..4,tcp,numfiles=0..31,verbose=0..9"),
+N_(" -d keywords...\tflush,timestamp,imap=0..4,tcp,http,numfiles=0..31,verbose=0..9"),
#endif
N_(" -f <folder>\tFolder - give folder name to open"),
N_(" -c <number>\tContext - which context to apply to -f arg"),
@@ -1144,6 +1144,10 @@ process_debug_str(char *debug_str)
|| struncmp(*p, "tcpdebug", 8) == 0){
ps_global->debug_tcp = 1;
}
+ else if(struncmp(*p, "http", 4) == 0
+ || struncmp(*p, "httpdebug", 9) == 0){
+ ps_global->debug_http = 1;
+ }
else if(struncmp(*p, "verbose", 7) == 0){
q = *p + 7;
if(!*q || !*(q+1) || *q != '=' ||
@@ -1213,8 +1217,10 @@ process_debug_str(char *debug_str)
}
else{
debug = atoi(debug_str);
- if(debug > 9)
+ if(debug > 9){
ps_global->debug_imap = 5;
+ ps_global->debug_http = 1;
+ }
else if(debug > 7)
ps_global->debug_imap = 4;
else if(debug > 6)
diff --git a/alpine/imap.c b/alpine/imap.c
index 00b5c99..2e02ef6 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -1265,7 +1265,7 @@ mm_notify(MAILSTREAM *stream, char *string, long int errflg)
/* be sure to log the message... */
#ifdef DEBUG
if(ps_global->debug_imap || ps_global->debugmem)
- dprint((errflg == TCPDEBUG ? 7 : 2,
+ dprint((errflg == TCPDEBUG || errflg == HTTPDEBUG ? 7 : 2,
"IMAP %2.2d:%2.2d:%2.2d %d/%d mm_notify %s: %s: %s\n",
tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec,
tm_now->tm_mon+1, tm_now->tm_mday,
@@ -1274,7 +1274,8 @@ mm_notify(MAILSTREAM *stream, char *string, long int errflg)
(errflg == WARN) ? "warning" :
(errflg == PARSE) ? "parse" :
(errflg == TCPDEBUG) ? "tcp" :
- (errflg == BYE) ? "bye" : "unknown",
+ (errflg == HTTPDEBUG) ? "http" :
+ (errflg == BYE) ? "bye" : "unknown",
(stream && stream->mailbox) ? stream->mailbox : "-no folder-",
string ? string : "?"));
#endif
@@ -1357,7 +1358,9 @@ mm_log(char *string, long int errflg)
tm_now = localtime(&now);
dprint((((errflg == TCPDEBUG) && ps_global->debug_tcp) ? 1 :
- (errflg == TCPDEBUG) ? 10 : 2,
+ (errflg == TCPDEBUG) ? 10 :
+ ((errflg == HTTPDEBUG) && ps_global->debug_http) ? 1 :
+ (errflg == HTTPDEBUG) ? 10 : 2,
"IMAP %2.2d:%2.2d:%2.2d %d/%d mm_log %s: %s\n",
tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec,
tm_now->tm_mon+1, tm_now->tm_mday,
@@ -1366,7 +1369,8 @@ mm_log(char *string, long int errflg)
(errflg == WARN) ? "warning" :
(errflg == PARSE) ? "parse" :
(errflg == TCPDEBUG) ? "tcp" :
- (errflg == BYE) ? "bye" : "unknown",
+ (errflg == HTTPDEBUG) ? "http" :
+ (errflg == BYE) ? "bye" : "unknown",
string ? string : "?"));
if(errflg == ERROR && !strncmp(string, "[TRYCREATE]", 11)){
diff --git a/alpine/osdep/debuging.c b/alpine/osdep/debuging.c
index f7a2971..f7f83ff 100644
--- a/alpine/osdep/debuging.c
+++ b/alpine/osdep/debuging.c
@@ -74,7 +74,7 @@ init_debug(void)
char newfname[MAXPATH+1], filename[MAXPATH+1], *dfile = NULL;
int i, fd;
- if(!((debug || ps_global->debug_imap || ps_global->debug_tcp) && ps_global->write_debug_file))
+ if(!((debug || ps_global->debug_imap || ps_global->debug_tcp || ps_global->debug_http) && ps_global->write_debug_file))
return;
for(i = ps_global->debug_nfiles - 1; i > 0; i--){
@@ -130,7 +130,8 @@ init_debug(void)
dprint((0, "Starting after the reading_pinerc calls, the data in this file should\nbe encoded as UTF-8. Before that it will be in the user's native charset.\n"));
if(dfile && (debug > DEFAULT_DEBUG ||
ps_global->debug_imap > 0 ||
- ps_global->debug_tcp > 0)){
+ ps_global->debug_tcp > 0 ||
+ ps_global->debug_http > 0)){
snprintf(newfname, sizeof(newfname), "Debug file: %s (level=%d imap=%d)", dfile,
debug, ps_global->debug_imap);
init_error(ps_global, SM_ORDER, 3, 5, newfname);
@@ -258,6 +259,7 @@ do_debug(FILE *debug_fp)
if(debug <= DEFAULT_DEBUG
&& !ps_global->debug_flush
&& !ps_global->debug_tcp
+ && !ps_global->debug_http
&& !ps_global->debug_timestamp
&& !ps_global->debug_imap
&& ok