summarylogtreecommitdiffstats
path: root/ssmtp-c99.patch
blob: 337c046c4e3b92b482bbc66e88d7e312abcc84ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
(char)NULL is not a null pointer constant, and current compilers
flag it as an int-conversion type error.

While at it, also replace other uses of (char)NULL with a character
constant.

Submitted upstream:

  <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1060065>

diff --git a/ssmtp.c b/ssmtp.c
index ec5d693af325ecef..162ce8ee9e1c94a0 100644
--- a/ssmtp.c
+++ b/ssmtp.c
@@ -57,24 +57,24 @@ bool_t use_oldauth = False;		/* use old AUTH LOGIN username style */
 
 #define ARPADATE_LENGTH 32		/* Current date in RFC format */
 char arpadate[ARPADATE_LENGTH];
-char *auth_user = (char)NULL;
-char *auth_pass = (char)NULL;
-char *auth_method = (char)NULL;		/* Mechanism for SMTP authentication */
-char *mail_domain = (char)NULL;
-char *from = (char)NULL;		/* Use this as the From: address */
+char *auth_user = NULL;
+char *auth_pass = NULL;
+char *auth_method = NULL;		/* Mechanism for SMTP authentication */
+char *mail_domain = NULL;
+char *from = NULL;		/* Use this as the From: address */
 char *hostname;
 char *mailhost = "mailhub";
-char *minus_f = (char)NULL;
-char *minus_F = (char)NULL;
+char *minus_f = NULL;
+char *minus_F = NULL;
 char *gecos;
-char *prog = (char)NULL;
+char *prog = NULL;
 char *root = NULL;
 char *tls_cert = "/etc/pki/tls/private/ssmtp.pem";	/* Default Certificate */
 char *tls_key = "/etc/pki/tls/private/ssmtp.pem";    /* Default private key */
 char *tls_ca_file = NULL;      /* Trusted Certificate file */
 char *tls_ca_dir = NULL;       /* Trusted Certificate directory */
-char *uad = (char)NULL;
-char *config_file = (char)NULL;		/* alternate configuration file */
+char *uad = NULL;
+char *config_file = NULL;		/* alternate configuration file */
 
 headers_t headers, *ht;
 
@@ -266,7 +266,7 @@ char *strip_post_ws(char *str)
 
 	p = (str + strlen(str));
 	while(isspace(*--p)) {
-		*p = (char)NULL;
+		*p = '\0';
 	}
 
 	return(p);
@@ -292,7 +292,7 @@ char *addr_parse(char *str)
 		q++;
 
 		if((p = strchr(q, '>'))) {
-			*p = (char)NULL;
+			*p = '\0';
 		}
 
 #if 0
@@ -315,7 +315,7 @@ char *addr_parse(char *str)
 	q = strip_post_ws(p);
 	if(*q == ')') {
 		while((*--q != '('));
-		*q = (char)NULL;
+		*q = '\0';
 	}
 	(void)strip_post_ws(p);
 
@@ -368,7 +368,7 @@ bool_t standardise(char *str, bool_t *linestart)
 	*linestart = False;
 
 	if((p = strchr(str, '\n'))) {
-		*p = (char)NULL;
+		*p = '\0';
 		*linestart = True;
 	}
 	return(leadingdot);
@@ -389,7 +389,7 @@ void revaliases(struct passwd *pw)
 		while(fgets(buf, sizeof(buf), fp)) {
 			/* Make comments invisible */
 			if((p = strchr(buf, '#'))) {
-				*p = (char)NULL;
+				*p = '\0';
 			}
 
 			/* Ignore malformed lines and comments */
@@ -445,7 +445,7 @@ char *aliases_lookup(char *str)
 		while(fgets(buf, sizeof(buf), fp)) {
 			/* Make comments invisible */
 			if((p = strchr(buf, '#'))) {
-				*p = (char)NULL;
+				*p = '\0';
 			}
 
 			/* Ignore malformed lines and comments */
@@ -568,7 +568,7 @@ void rcpt_save(char *str)
 #endif
 
 	/* Ignore missing usernames */
-	if(*str == (char)NULL) {
+	if(*str == '\0') {
 		return;
 	}
 
@@ -625,7 +625,7 @@ void rcpt_parse(char *str)
 		}
 
 		/* End of string? */
-		if(*(q + 1) == (char)NULL) {
+		if(*(q + 1) == '\0') {
 			got_addr = True;
 		}
 
@@ -633,7 +633,7 @@ void rcpt_parse(char *str)
 		if((*q == ',') && (in_quotes == False)) {
 			got_addr = True;
 
-			*q = (char)NULL;
+			*q = '\0';
 		}
 
 		if(got_addr) {
@@ -730,7 +730,7 @@ void header_save(char *str)
 	if(strncasecmp(ht->string, "From:", 5) == 0) {
 #if 1
 		/* Hack check for NULL From: line */
-		if(*(p + 6) == (char)NULL) {
+		if(*(p + 6) == '\0') {
 			return;
 		}
 #endif
@@ -795,7 +795,7 @@ void header_parse(FILE *stream)
 	size_t size = BUF_SZ, len = 0;
 	char *p = (char *)NULL, *q;
 	bool_t in_header = True;
-	char l = (char)NULL;
+	char l = '\0';
 	int c;
 
 	while(in_header && ((c = fgetc(stream)) != EOF)) {
@@ -830,9 +830,9 @@ void header_parse(FILE *stream)
 						in_header = False;
 
 				default:
-						*q = (char)NULL;
+						*q = '\0';
 						if((q = strrchr(p, '\n'))) {
-							*q = (char)NULL;
+							*q = '\0';
 						}
 						header_save(p);
 
@@ -863,9 +863,9 @@ void header_parse(FILE *stream)
 						in_header = False;
 
 				default:
-						*q = (char)NULL;
+						*q = '\0';
 						if((q = strrchr(p, '\n'))) {
-							*q = (char)NULL;
+							*q = '\0';
 						}
 						header_save(p);
 
@@ -930,7 +930,7 @@ bool_t read_config()
 		char *rightside;
 		/* Make comments invisible */
 		if((p = strchr(buf, '#'))) {
-			*p = (char)NULL;
+			*p = '\0';
 		}
 
 		/* Ignore malformed lines and comments */
@@ -1408,7 +1408,7 @@ char *fd_gets(char *buf, int size, int fd)
 			buf[i++] = c;
 		}
 	}
-	buf[i] = (char)NULL;
+	buf[i] = '\0';
 
 	return(buf);
 }
@@ -1840,7 +1840,7 @@ char **parse_options(int argc, char *argv[])
 		j = 0;
 
 		add = 1;
-		while(argv[i][++j] != (char)NULL) {
+		while(argv[i][++j] != '\0') {
 			switch(argv[i][j]) {
 #ifdef INET6
 			case '6':