Mercurial > masqmail
comparison src/smtp_out.c @ 15:f671821d8222
code beautifying; 0 -> \0 if appropriate
author | meillo@marmaro.de |
---|---|
date | Thu, 06 Nov 2008 09:18:38 +0100 |
parents | 26e34ae9a3e3 |
children | a80ebfa16cd5 |
comparison
equal
deleted
inserted
replaced
14:a8f3424347dc | 15:f671821d8222 |
---|---|
166 psb->error = smtp_eof; | 166 psb->error = smtp_eof; |
167 return FALSE; | 167 return FALSE; |
168 } | 168 } |
169 for (i = 0; i < 4; i++) | 169 for (i = 0; i < 4; i++) |
170 code[i] = psb->buffer[buf_pos + i]; | 170 code[i] = psb->buffer[buf_pos + i]; |
171 code[i] = 0; | 171 code[i] = '\0'; |
172 psb->last_code = atoi(code); | 172 psb->last_code = atoi(code); |
173 | 173 |
174 buf_pos += len; | 174 buf_pos += len; |
175 | 175 |
176 } while (code[3] == '-'); | 176 } while (code[3] == '-'); |
221 while (*p && (*p != '\n') && isspace(*p)) | 221 while (*p && (*p != '\n') && isspace(*p)) |
222 p++; | 222 p++; |
223 if (*p && (*p != '\n')) { | 223 if (*p && (*p != '\n')) { |
224 while (*p && (*p != '\n') && (*p != '\r') && (q < buf + SMTP_BUF_LEN - 1)) | 224 while (*p && (*p != '\n') && (*p != '\r') && (q < buf + SMTP_BUF_LEN - 1)) |
225 *(q++) = *(p++); | 225 *(q++) = *(p++); |
226 *q = 0; | 226 *q = '\0'; |
227 return g_strdup(buf); | 227 return g_strdup(buf); |
228 } | 228 } |
229 return NULL; | 229 return NULL; |
230 } | 230 } |
231 | 231 |
354 /* According to RFC 821 each line should be terminated with CRLF. | 354 /* According to RFC 821 each line should be terminated with CRLF. |
355 Since a dot on a line itself marks the end of data, each line | 355 Since a dot on a line itself marks the end of data, each line |
356 beginning with a dot is prepended with another dot. | 356 beginning with a dot is prepended with another dot. |
357 */ | 357 */ |
358 gchar *ptr; | 358 gchar *ptr; |
359 gboolean new_line = TRUE; /* previous versions assumed that each item was exactly one line. This is no longer the case */ | 359 gboolean new_line = TRUE; /* previous versions assumed that each item was exactly one line. |
360 This is no longer the case */ | |
360 | 361 |
361 ptr = data; | 362 ptr = data; |
362 while (*ptr) { | 363 while (*ptr) { |
363 int c = (int) (*ptr); | 364 int c = (int) (*ptr); |
364 if (c == '.') | 365 if (c == '.') |
565 hmac_md5(chall, chall_size, psb->auth_secret, strlen(psb->auth_secret), digest); | 566 hmac_md5(chall, chall_size, psb->auth_secret, strlen(psb->auth_secret), digest); |
566 #endif | 567 #endif |
567 | 568 |
568 for (i = 0; i < 16; i++) | 569 for (i = 0; i < 16; i++) |
569 sprintf(&(digest_string[i + i]), "%02x", (unsigned int) (digest[i])); | 570 sprintf(&(digest_string[i + i]), "%02x", (unsigned int) (digest[i])); |
570 digest_string[32] = 0; | 571 digest_string[32] = '\0'; |
571 | 572 |
572 DEBUG(5) debugf("digest = %s\n", digest_string); | 573 DEBUG(5) debugf("digest = %s\n", digest_string); |
573 | 574 |
574 reply = g_strdup_printf("%s %s", psb->auth_login, digest_string); | 575 reply = g_strdup_printf("%s %s", psb->auth_login, digest_string); |
575 DEBUG(5) debugf("unencoded reply = %s\n", reply); | 576 DEBUG(5) debugf("unencoded reply = %s\n", reply); |
744 give up. */ | 745 give up. */ |
745 if ((psb->error != smtp_trylater) && (psb->error != smtp_fail)) { | 746 if ((psb->error != smtp_trylater) && (psb->error != smtp_fail)) { |
746 ok = FALSE; | 747 ok = FALSE; |
747 break; | 748 break; |
748 } else { | 749 } else { |
749 logwrite(LOG_NOTICE, "%s == %s host=%s failed: %s", msg->uid, addr_string(rcpt), psb->remote_host, psb->buffer); | 750 logwrite(LOG_NOTICE, "%s == %s host=%s failed: %s", |
751 msg->uid, addr_string(rcpt), psb->remote_host, psb->buffer); | |
750 if (psb->error == smtp_trylater) { | 752 if (psb->error == smtp_trylater) { |
751 addr_mark_defered(rcpt); | 753 addr_mark_defered(rcpt); |
752 } else { | 754 } else { |
753 addr_mark_failed(rcpt); | 755 addr_mark_failed(rcpt); |
754 } | 756 } |