masqmail

view src/libident/support.c @ 246:4cff8638dd9b

SMTP client: tries EHLO now always first Changed the behavior of the SMTP client. Now always an EHLO greeting is sent, no matter what kind of greeting text the server had sent. If the EHLO failed, an HELO greeting is tried as fall back. This is the behavior RFC 2821 requires (section 3.2). This change will fix setups that were not possible to sent to a server because that requires AUTH but hadn't said ``ESMTP'' in its greeting message. See also: Debian bug #349211 Thanks to Steffen (inne)
author markus schnalke <meillo@marmaro.de>
date Thu, 28 Oct 2010 16:40:02 -0300
parents 08114f7dcc23
children
line source
1 /*
2 ** support.c
3 **
4 ** Author: Pr Emanuelsson <pell@lysator.liu.se>
5 ** Hacked by: Peter Eriksson <pen@lysator.liu.se>
6 */
7 #include <stdio.h>
8 #include <ctype.h>
10 #ifdef HAVE_ANSIHEADERS
11 # include <stdlib.h>
12 # include <string.h>
13 #else
14 # define strchr(str, c) index(str, c)
15 #endif
17 #define IN_LIBIDENT_SRC
18 #include "ident.h"
21 char*
22 id_strdup __P1(char *, str)
23 {
24 char *cp;
26 cp = (char *) malloc(strlen(str) + 1);
27 if (cp == NULL) {
28 #ifdef DEBUG
29 perror("libident: malloc");
30 #endif
31 return NULL;
32 }
34 strcpy(cp, str);
36 return cp;
37 }
40 char*
41 id_strtok __P3(char *, cp, char *, cs, char *, dc)
42 {
43 static char *bp = 0;
45 if (cp)
46 bp = cp;
48 /*
49 ** No delimitor cs - return whole buffer and point at end
50 */
51 if (!cs) {
52 while (*bp)
53 bp++;
54 return cs;
55 }
57 /*
58 ** Skip leading spaces
59 */
60 while (isspace(*bp))
61 bp++;
63 /*
64 ** No token found?
65 */
66 if (!*bp)
67 return 0;
69 cp = bp;
70 while (*bp && !strchr(cs, *bp))
71 bp++;
73 /*
74 ** Remove trailing spaces
75 */
76 *dc = *bp;
77 for (dc = bp - 1; dc > cp && isspace(*dc); dc--);
78 *++dc = '\0';
80 bp++;
82 return cp;
83 }