aboutsummaryrefslogtreecommitdiff
path: root/mailutils/sendmail.c
diff options
context:
space:
mode:
Diffstat (limited to 'mailutils/sendmail.c')
-rw-r--r--mailutils/sendmail.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 1bdc1c300..1a01b7110 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -102,13 +102,6 @@
102// set to 0 to not limit 102// set to 0 to not limit
103#define MAX_HEADERS 256 103#define MAX_HEADERS 256
104 104
105static void send_r_n(const char *s)
106{
107 if (verbose)
108 bb_error_msg("send:'%s'", s);
109 printf("%s\r\n", s);
110}
111
112static int smtp_checkp(const char *fmt, const char *param, int code) 105static int smtp_checkp(const char *fmt, const char *param, int code)
113{ 106{
114 char *answer; 107 char *answer;
@@ -119,8 +112,9 @@ static int smtp_checkp(const char *fmt, const char *param, int code)
119 // if code = -1 then just return this number 112 // if code = -1 then just return this number
120 // if code != -1 then checks whether the number equals the code 113 // if code != -1 then checks whether the number equals the code
121 // if not equal -> die saying msg 114 // if not equal -> die saying msg
115//FIXME: limit max len!!!
122 while ((answer = xmalloc_fgetline(stdin)) != NULL) { 116 while ((answer = xmalloc_fgetline(stdin)) != NULL) {
123 if (verbose) 117 if (G.verbose)
124 bb_error_msg("recv:'%.*s'", (int)(strchrnul(answer, '\r') - answer), answer); 118 bb_error_msg("recv:'%.*s'", (int)(strchrnul(answer, '\r') - answer), answer);
125 if (strlen(answer) <= 3 || '-' != answer[3]) 119 if (strlen(answer) <= 3 || '-' != answer[3])
126 break; 120 break;
@@ -128,7 +122,7 @@ static int smtp_checkp(const char *fmt, const char *param, int code)
128 } 122 }
129 if (answer) { 123 if (answer) {
130 int n = atoi(answer); 124 int n = atoi(answer);
131 if (timeout) 125 if (G.timeout)
132 alarm(0); 126 alarm(0);
133 free(answer); 127 free(answer);
134 if (-1 == code || n == code) { 128 if (-1 == code || n == code) {
@@ -223,6 +217,7 @@ static void rcptto_list(const char *list)
223int sendmail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 217int sendmail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
224int sendmail_main(int argc UNUSED_PARAM, char **argv) 218int sendmail_main(int argc UNUSED_PARAM, char **argv)
225{ 219{
220 unsigned opts;
226 char *opt_connect; 221 char *opt_connect;
227 char *opt_from = NULL; 222 char *opt_from = NULL;
228 char *s; 223 char *s;
@@ -276,7 +271,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
276 // -v is a counter, -H and -S are mutually exclusive, -a is a list 271 // -v is a counter, -H and -S are mutually exclusive, -a is a list
277 "vv:H--S:S--H", 272 "vv:H--S:S--H",
278 &opt_from, NULL, 273 &opt_from, NULL,
279 &timeout, &opt_connect, &opt_connect, &list, &verbose 274 &G.timeout, &opt_connect, &opt_connect, &list, &G.verbose
280 ); 275 );
281 //argc -= optind; 276 //argc -= optind;
282 argv += optind; 277 argv += optind;
@@ -425,6 +420,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
425 // this means we scan stdin for To:, Cc:, Bcc: lines until an empty line 420 // this means we scan stdin for To:, Cc:, Bcc: lines until an empty line
426 // and then use the rest of stdin as message body 421 // and then use the rest of stdin as message body
427 code = 0; // set "analyze headers" mode 422 code = 0; // set "analyze headers" mode
423//FIXME: limit max len!!!
428 while ((s = xmalloc_fgetline(G.fp0)) != NULL) { 424 while ((s = xmalloc_fgetline(G.fp0)) != NULL) {
429 dump: 425 dump:
430 // put message lines doubling leading dots 426 // put message lines doubling leading dots