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
af07c2ad
...
af07c2ad4690de7c4c536ad6edb1b03632a8c380
authored
2002-05-09 01:57:25 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
_url_smtp_init(): using url_parse(), now accepts host AND port as args
1 parent
ae646ae4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
36 deletions
mailbox/url_smtp.c
mailbox/url_smtp.c
View file @
af07c2a
...
...
@@ -26,51 +26,30 @@
#include <registrar0.h>
#include <url0.h>
static
void
url_smtp_destroy
(
url_t
purl
);
static
void
url_smtp_destroy
(
url_t
url
)
{
(
void
)
url
;
}
/*
UNIX File
file:path
*/
int
_url_smtp_init
(
url_t
url
)
{
const
char
*
name
=
url_to_string
(
url
);
size_t
len
=
strlen
(
name
);
int
status
=
0
;
/* reject the obvious */
if
(
name
==
NULL
||
strncmp
(
MU_SMTP_SCHEME
,
name
,
MU_SMTP_SCHEME_LEN
)
!=
0
||
len
<
(
MU_SMTP_SCHEME_LEN
+
1
)
/* (scheme)+1(path)*/
)
if
((
status
=
url_parse
(
url
)))
return
status
;
if
(
!
url_is_scheme
(
url
,
"smtp"
))
return
EINVAL
;
/*
do I need to decode url encoding '% hex hex' ?
*/
/*
host isn't optional
*/
/* TYPE */
url
->
_destroy
=
url_smtp_destroy
;
if
(
!
url
->
host
)
return
EINVAL
;
/* SCHEME */
url
->
scheme
=
strdup
(
MU_SMTP_SCHEME
);
if
(
url
->
scheme
==
NULL
)
{
url_smtp_destroy
(
url
);
return
ENOMEM
;
}
/* port has a default */
if
(
!
url
->
port
)
url
->
port
=
MU_SMTP_PORT
;
/* PATH */
name
+=
MU_SMTP_SCHEME_LEN
;
/* pass the scheme */
url
->
host
=
strdup
(
name
);
if
(
url
->
host
==
NULL
)
{
url_smtp_destroy
(
url
);
return
ENOMEM
;
}
url
->
port
=
MU_SMTP_PORT
;
/* all other fields must be NULL */
if
(
url
->
user
||
url
->
passwd
||
url
->
auth
||
url
->
path
||
url
->
query
)
return
EINVAL
;
return
0
;
}
...
...
Please
register
or
sign in
to post a comment