Commit af96cdc3 af96cdc399175c645643d5cb2ca5fe56670e94b7 by Wojciech Polak

Moved from ../../mailbox

1 parent adb05c0b
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #ifdef ENABLE_SENDMAIL
24
25 #include <errno.h>
26 #include <stdlib.h>
27 #include <string.h>
28
29 #ifdef HAVE_PATHS_H
30 # include <paths.h>
31 #endif
32
33 #ifndef _PATH_SENDMAIL
34 # define _PATH_SENDMAIL "/usr/lib/sendmail"
35 #endif
36
37 #include <registrar0.h>
38 #include <url0.h>
39
40 static void url_sendmail_destroy (mu_url_t purl);
41
42 static void
43 url_sendmail_destroy (mu_url_t url MU_ARG_UNUSED)
44 {
45 }
46
47 /*
48 Sendmail URL:
49 sendmail:/path/to/sendmail
50 */
51
52 int
53 _url_sendmail_init (mu_url_t url)
54 {
55 int status = mu_url_init (url, 0, "sendmail");
56 if (status)
57 return status;
58
59 url->_destroy = url_sendmail_destroy;
60
61 /* not valid in a sendmail url */
62 if (url->user || url->passwd || url->auth || url->query
63 || url->host || url->port)
64 return EINVAL;
65
66 if (url->path == 0)
67 if ((url->path = strdup (_PATH_SENDMAIL)) == 0)
68 status = ENOMEM;
69
70 return status;
71 }
72
73 #endif /* ENABLE_SENDMAIL */
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #ifdef ENABLE_SMTP
24
25 #include <errno.h>
26 #include <stdlib.h>
27 #include <string.h>
28
29 #include <registrar0.h>
30 #include <url0.h>
31
32 int
33 _url_smtp_init (mu_url_t url)
34 {
35 int status = mu_url_init (url, MU_SMTP_PORT, "smtp");
36 if (status)
37 return status;
38
39 /* host isn't optional */
40 if (!url->host)
41 return EINVAL;
42
43 /* accept url->user, pass, and auth
44 for the ESMTP authentication */
45
46 /* all other fields must be NULL */
47 if (url->path || url->query)
48 return EINVAL;
49
50 return 0;
51 }
52
53 #endif /* ENABLE_SMTP */