Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c4d6a2e7
...
c4d6a2e7d0c139dc6568a20c2807366c62f4bb00
authored
2001-12-18 02:42:53 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Now takes advantage of url_parse().
1 parent
1ba8fe22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
28 deletions
mailbox/url_sendmail.c
mailbox/url_sendmail.c
View file @
c4d6a2e
...
...
@@ -23,6 +23,14 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#ifndef _PATH_SENDMAIL
# define _PATH_SENDMAIL "/usr/lib/sendmail"
#endif
#include <registrar0.h>
#include <url0.h>
...
...
@@ -35,41 +43,35 @@ url_sendmail_destroy (url_t url)
}
/*
UNIX Sendmail
sendmail:path
Sendmail URL:
sendmail:/path/to/sendmail
*/
int
_url_sendmail_init
(
url_t
url
)
{
const
char
*
name
=
url_to_string
(
url
);
size_t
len
=
strlen
(
name
);
int
status
=
0
;
url
->
_destroy
=
url_sendmail_destroy
;
status
=
url_parse
(
url
);
if
(
status
)
return
status
;
/* reject the obvious */
if
(
name
==
NULL
||
strncmp
(
MU_SENDMAIL_SCHEME
,
name
,
MU_SENDMAIL_SCHEME_LEN
)
!=
0
||
len
<
(
MU_SENDMAIL_SCHEME_LEN
+
1
)
/* (scheme)+1(path)*/
)
/* is it sendmail? */
if
(
strcmp
(
"sendmail"
,
url
->
scheme
)
!=
0
)
return
EINVAL
;
/* do I need to decode url encoding '% hex hex' ? */
/* not valid in a sendmail url */
if
(
url
->
user
||
url
->
passwd
||
url
->
auth
||
url
->
query
||
url
->
host
||
url
->
port
)
return
EINVAL
;
/* TYPE */
url
->
_destroy
=
url_sendmail_destroy
;
if
(
url
->
path
==
0
)
if
((
url
->
path
=
strdup
(
_PATH_SENDMAIL
))
==
0
)
status
=
ENOMEM
;
/* SCHEME */
url
->
scheme
=
strdup
(
MU_SENDMAIL_SCHEME
);
if
(
url
->
scheme
==
NULL
)
{
url_sendmail_destroy
(
url
);
return
ENOMEM
;
}
/* PATH */
name
+=
MU_SENDMAIL_SCHEME_LEN
;
/* pass the scheme */
url
->
path
=
strdup
(
name
);
if
(
url
->
path
==
NULL
)
{
url_sendmail_destroy
(
url
);
return
ENOMEM
;
}
return
0
;
return
status
;
}
...
...
Please
register
or
sign in
to post a comment