102 |
*****************************/ |
*****************************/ |
103 |
|
|
104 |
void |
void |
105 |
parse_mtaport(char *opt, char *host, unsigned int *port) |
parse_mtaport (char *opt, char *host, unsigned int *port) |
106 |
{ |
{ |
107 |
struct servent *p; |
struct servent *p; |
108 |
char opt_tmp[256]; |
char opt_tmp[256]; |
109 |
char *port_tmp = 0; |
char *port_tmp = NULL; |
110 |
safe_strcpy(opt_tmp, opt); |
safe_strcpy(opt_tmp, opt); |
111 |
|
|
112 |
if ((port_tmp = strrchr(opt_tmp, ':'))) { |
if ((port_tmp = strrchr(opt_tmp, ':'))) { |
117 |
*port = (unsigned int)atoi(port_tmp); |
*port = (unsigned int)atoi(port_tmp); |
118 |
} |
} |
119 |
strncpy(host, opt_tmp, sizeof(session.mta) - 1); |
strncpy(host, opt_tmp, sizeof(session.mta) - 1); |
|
return; |
|
120 |
} |
} |
121 |
|
|
122 |
/************************** |
/************************** |
124 |
***************************/ |
***************************/ |
125 |
|
|
126 |
void |
void |
127 |
parse_mtahost(char *opt, char *host, unsigned int *port) |
parse_mtahost (char *opt, char *host, unsigned int *port) |
128 |
{ |
{ |
129 |
struct servent *p; |
struct servent *p; |
130 |
char opt_tmp[256]; |
char opt_tmp[256]; |
131 |
char *port_tmp = 0; |
char *port_tmp = NULL; |
132 |
safe_strcpy(opt_tmp, opt); |
safe_strcpy(opt_tmp, opt); |
133 |
|
|
134 |
if ((port_tmp = strrchr(opt_tmp, ':'))) { |
if ((port_tmp = strrchr(opt_tmp, ':'))) { |
145 |
else |
else |
146 |
*port = (unsigned int)atoi(opt); |
*port = (unsigned int)atoi(opt); |
147 |
} |
} |
|
return; |
|
148 |
} |
} |
149 |
|
|
150 |
/********************* |
/********************* |
152 |
**********************/ |
**********************/ |
153 |
|
|
154 |
void |
void |
155 |
remline(char *s, char *line) |
remline (char *s, char *line) |
156 |
{ |
{ |
157 |
char *pos1 = 0; |
char *pos1 = NULL; |
158 |
char *pos2 = 0; |
char *pos2 = NULL; |
159 |
int len; |
int len; |
160 |
|
|
161 |
if (s == 0 || line == 0) |
if (!s || !line) |
162 |
return; |
return; |
163 |
pos1 = strstr(s, line); |
pos1 = strstr(s, line); |
164 |
if (pos1 == 0) |
if (!pos1) |
165 |
return; |
return; |
166 |
|
|
167 |
pos2 = pos1; |
pos2 = pos1; |
172 |
len = strlen(pos2); |
len = strlen(pos2); |
173 |
pos2 = (char *)memmove(pos1, pos2, len); |
pos2 = (char *)memmove(pos1, pos2, len); |
174 |
pos2[len] = '\0'; |
pos2[len] = '\0'; |
|
return; |
|
175 |
} |
} |
176 |
|
|
177 |
void |
void |
178 |
remcrlf(char *s) |
remcrlf (char *s) |
179 |
{ |
{ |
180 |
int len; |
int len; |
181 |
|
|
182 |
if (s == 0) |
if (!s) |
183 |
return; |
return; |
184 |
len = strlen(s); |
len = strlen(s); |
185 |
|
|
193 |
s[len - 1] = '\0'; |
s[len - 1] = '\0'; |
194 |
else if (len >= 1 && s[len - 1] == '\n') /* LF */ |
else if (len >= 1 && s[len - 1] == '\n') /* LF */ |
195 |
s[len - 1] = '\0'; |
s[len - 1] = '\0'; |
|
return; |
|
196 |
} |
} |
197 |
|
|
198 |
/*********************************** |
/*********************************** |
200 |
************************************/ |
************************************/ |
201 |
|
|
202 |
static char * |
static char * |
203 |
insert(char *inbuf, char *sign, char *fill_in) |
insert (char *inbuf, char *sign, char *fill_in) |
204 |
{ |
{ |
205 |
int len1 = 0; |
int len1 = 0; |
206 |
int len2 = 0; |
int len2 = 0; |
207 |
int psign_len = 0; |
int psign_len = 0; |
208 |
char *psign = 0; |
char *psign = NULL; |
209 |
char *outbuf = 0; |
char *outbuf = NULL; |
210 |
|
|
211 |
if (inbuf == 0 || sign == 0 || fill_in == 0) |
if (!inbuf || !sign || !fill_in) |
212 |
return 0; |
return NULL; |
213 |
|
|
214 |
psign = strstr(inbuf, sign); |
psign = strstr(inbuf, sign); |
215 |
if (psign == 0) |
if (!psign) |
216 |
return 0; |
return NULL; |
217 |
|
|
218 |
psign_len = strlen(psign); |
psign_len = strlen(psign); |
219 |
len1 = strlen(inbuf); |
len1 = strlen(inbuf); |
231 |
strcat(outbuf, psign); |
strcat(outbuf, psign); |
232 |
|
|
233 |
if (strstr(outbuf, sign)) { |
if (strstr(outbuf, sign)) { |
234 |
char *outbuf2 = 0; |
char *outbuf2 = insert(outbuf, sign, fill_in); |
|
outbuf2 = insert(outbuf, sign, fill_in); |
|
235 |
free(outbuf); |
free(outbuf); |
236 |
outbuf = outbuf2; |
outbuf = outbuf2; |
237 |
} |
} |
240 |
} |
} |
241 |
|
|
242 |
char * |
char * |
243 |
substitute(char *inbuf, char **subbuf) |
substitute (char *inbuf, char **subbuf) |
244 |
{ |
{ |
245 |
char **tmp = subbuf; |
char **tmp = subbuf; |
246 |
char *tmpout = 0; |
char *tmpout = NULL; |
247 |
char *tmpbuf = 0; |
char *tmpbuf = NULL; |
248 |
char sign[5]; |
char sign[5]; |
249 |
int i = 0; |
int i = 0; |
250 |
|
|
251 |
if (inbuf == 0 || subbuf == 0) |
if (!inbuf || !subbuf) |
252 |
return 0; |
return NULL; |
253 |
|
|
254 |
tmpbuf = allocbuf(inbuf, 0); |
tmpbuf = allocbuf(inbuf, 0); |
255 |
tmp++; |
tmp++; |
268 |
return tmpbuf; |
return tmpbuf; |
269 |
} |
} |
270 |
|
|
271 |
/*************************** |
/******************** |
272 |
Change to lower characters |
Change to lowercase |
273 |
****************************/ |
*********************/ |
274 |
|
|
275 |
void |
void |
276 |
change_to_lower(char *s) |
make_lowercase (char *s) |
277 |
{ |
{ |
278 |
int c; |
int c, len; |
|
int len; |
|
279 |
|
|
280 |
if (s == 0) |
if (!s) |
281 |
return; |
return; |
282 |
len = strlen(s); |
len = strlen(s); |
283 |
|
|
284 |
for (c = len - 1; c >= 0; c--) |
for (c = len - 1; c >= 0; c--) |
285 |
s[c] = tolower((unsigned char)s[c]); |
s[c] = tolower((unsigned char)s[c]); |
|
return; |
|
286 |
} |
} |
287 |
|
|
288 |
char * |
char * |
289 |
get_localname () |
get_localname (void) |
290 |
{ |
{ |
291 |
static char *localname = NULL; |
static char *localname = NULL; |
292 |
|
|
326 |
} |
} |
327 |
|
|
328 |
char * |
char * |
329 |
get_localdomain() |
get_localdomain (void) |
330 |
{ |
{ |
331 |
if (!anubis_domain) { |
if (!anubis_domain) { |
332 |
char *localname = get_localname(), |
char *localname = get_localname(), |
338 |
} |
} |
339 |
return anubis_domain; |
return anubis_domain; |
340 |
} |
} |
341 |
|
|
342 |
/* EOF */ |
/* EOF */ |
343 |
|
|