2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-31 06:05:37 +00:00

postfix-2.4-20060930

This commit is contained in:
Wietse Venema
2006-09-30 00:00:00 -05:00
committed by Viktor Dukhovni
parent c66aa67bb6
commit 911ee6f582
27 changed files with 172 additions and 76 deletions

View File

@@ -12741,14 +12741,33 @@ Apologies for any names omitted.
Cleanup: record loop detection. File: global/record.c.
20060929
Workaround: AIX 5.[1-3] getaddrinfo() creates socket address
structures with a non-zero port value. This breaks the
smtp_bind_address etc. features, and breaks inet_interfaces
settings with only one IP address. Problem reported by
Hamish Marson. Files: util/sock_addr.[hc], util/myaddrinfo.c.
Bugfix (introduced with the Postfix TLS patch): memory leak
in verify_extract_peer(). The OpenSSL documentation provides
no information on how subjectAltNames are managed. Sam
Rushing, ironport. File: tls/tls_client.c.
Bugfix (introduced with Postfix 2.2): smtp_generic_maps
turned on MIME conversion. File: smtp/smtp_proto.c.
Wish list:
Update FILTER_README with mailing list suggestions to tag
with a badness indicator and then filter down-stream.
Either document or remove the internal_mail_filter_classes
feature (it's disabled by default).
Build a command-line test driver for the cleanup engine.
This allows us to generate arbitrary record sequences without
having to hijack mail from the queue.
This allows us to test it with arbitrary record sequences
without having to use a live mail queue.
Make null local-part handling configurable: either expand
into mailer-daemon (current bahavior) or disallow (strict

View File

@@ -35,6 +35,13 @@ mysqlclient library (and libm) to AUXLIBS, for example:
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
On Solaris, use this instead:
make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
-lmysqlclient -lz -lm'
Then, just run 'make'. This requires libz, the compression library. Older mysql
implementations build without libz.

View File

@@ -19,7 +19,7 @@
# Postfix queue message distribution in time and by sender domain
# or recipient domain. The program needs read access to the queue
# directories and queue files, so it must run as the superuser or
# the \fBmail_owner\fR specified in \fImain.cf\fR (typically
# the \fBmail_owner\fR specified in \fBmain.cf\fR (typically
# \fBpostfix\fR).
#
# Options:
@@ -73,8 +73,8 @@
# the incoming and active queues. To display a different set of
# queues, just list their directory names on the command line.
# Absolute paths are used as is, other paths are taken relative
# to the \fImain.cf\fR \fBqueue_directory\fR parameter setting.
# While \fImain.cf\fR supports the use of \fI$variable\fR expansion
# to the \fBmain.cf\fR \fBqueue_directory\fR parameter setting.
# While \fBmain.cf\fR supports the use of \fI$variable\fR expansion
# in the definition of the \fBqueue_directory\fR parameter, the
# \fBqshape\fR program does not. If you must use variable expansions
# in the \fBqueue_directory\fR setting, you must specify an explicit

View File

@@ -57,13 +57,24 @@ make -f Makefile.init makefiles \
</pre>
</blockquote>
<p> On Solaris, use this instead: </p>
<blockquote>
<pre>
make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
-lmysqlclient -lz -lm'
</pre>
</blockquote>
<p> Then, just run 'make'. This requires libz, the compression
library. Older mysql implementations build without libz. </p>
<h2>Using MySQL tables</h2>
<p> Once Postfix is built with mysql support, you can specify a
map type in main.cf like this: </p>
map type in <a href="postconf.5.html">main.cf</a> like this: </p>
<blockquote>
<pre>
@@ -126,7 +137,7 @@ will be deferred until at least one of those hosts is reachable.
Marcus, IC Group, Inc.</li>
<li> Liviu Daia revised the configuration interface and added the
main.cf configuration feature.</li>
<a href="postconf.5.html">main.cf</a> configuration feature.</li>
<li> Liviu Daia with further refinements from Jose Luis Tallon and
Victor Duchovni developed the common query, result_format, domain and

View File

@@ -21,13 +21,13 @@ POSTALIAS(1) POSTALIAS(1)
able for the use as NIS alias maps.
If the result files do not exist they will be created with
the same group and other read permissions as the source
the same group and other read permissions as their source
file.
While a database update is in progress, signal delivery is
postponed, and an exclusive, advisory, lock is placed on
the entire database, in order to avoid surprises in spec-
tator programs.
tator processes.
The format of Postfix alias input files is described in
<a href="aliases.5.html"><b>aliases</b>(5)</a>.

View File

@@ -22,13 +22,13 @@ POSTMAP(1) POSTMAP(1)
<b>makemap</b> <i>file</i><b>_</b><i>type file</i><b>_</b><i>name</i> &lt; <i>file</i><b>_</b><i>name</i>
If the result files do not exist they will be created with
the same group and other read permissions as the source
the same group and other read permissions as their source
file.
While the table update is in progress, signal delivery is
postponed, and an exclusive, advisory, lock is placed on
the entire table, in order to avoid surprises in spectator
programs.
processes.
<b>INPUT FILE FORMAT</b>
The format of a lookup table input file is as follows:

View File

@@ -52,10 +52,10 @@ POSTSUPER(1) POSTSUPER(1)
print $1 }
' | tr -d '*!' | postsuper -d -
Specify <b>-d ALL</b> to remove all messages; for example,
specify <b>-d ALL deferred</b> to delete mail in the
<b>deferred</b> queue. As a safety measure, the word <b>ALL</b>
must be specified in upper case.
Specify "<b>-d ALL</b>" to remove all messages; for exam-
ple, specify "<b>-d ALL deferred</b>" to delete all mail
in the <b>deferred</b> queue. As a safety measure, the
word <b>ALL</b> must be specified in upper case.
Warning: Postfix queue IDs are reused. There is a
very small possibility that postsuper deletes the
@@ -91,8 +91,8 @@ POSTSUPER(1) POSTSUPER(1)
If a <i>queue</i><b>_</b><i>id</i> of <b>-</b> is specified, the program reads
queue IDs from standard input.
Specify <b>-h ALL</b> to hold all messages; for example,
specify <b>-h ALL deferred</b> to hold mail in the
Specify "<b>-h ALL</b>" to hold all messages; for example,
specify "<b>-h ALL deferred</b>" to hold all mail in the
<b>deferred</b> queue. As a safety measure, the word <b>ALL</b>
must be specified in upper case.
@@ -110,12 +110,12 @@ POSTSUPER(1) POSTSUPER(1)
If a <i>queue</i><b>_</b><i>id</i> of <b>-</b> is specified, the program reads
queue IDs from standard input.
Note: use "<b>postsuper -r</b>" to release mail that was
kept on hold for a significant fraction of <b>$<a href="postconf.5.html#maximal_queue_lifetime">maxi</a>-</b>
<b><a href="postconf.5.html#maximal_queue_lifetime">mal_queue_lifetime</a></b> or <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>, or
longer.
Note: specify "<b>postsuper -r</b>" to release mail that
was kept on hold for a significant fraction of
<b>$<a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_lifetime</a></b> or <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>,
or longer.
Specify <b>-H ALL</b> to release all mail that is "on
Specify "<b>-H ALL</b>" to release all mail that is "on
hold". As a safety measure, the word <b>ALL</b> must be
specified in upper case.
@@ -131,9 +131,9 @@ POSTSUPER(1) POSTSUPER(1)
Alternatively, if a <i>queue</i><b>_</b><i>id</i> of <b>-</b> is specified, the
program reads queue IDs from standard input.
Specify <b>-r ALL</b> to requeue all messages. As a safety
measure, the word <b>ALL</b> must be specified in upper
case.
Specify "<b>-r ALL</b>" to requeue all messages. As a
safety measure, the word <b>ALL</b> must be specified in
upper case.
A requeued message is moved to the <b>maildrop</b> queue,
from where it is copied by the <a href="pickup.8.html"><b>pickup</b>(8)</a> and

View File

@@ -20,7 +20,7 @@ QSHAPE(1) QSHAPE(1)
Postfix queue message distribution in time and by sender
domain or recipient domain. The program needs read access
to the queue directories and queue files, so it must run
as the superuser or the <b><a href="postconf.5.html#mail_owner">mail_owner</a></b> specified in <i<a href="postconf.5.html">>main.cf</</a>i>
as the superuser or the <b><a href="postconf.5.html#mail_owner">mail_owner</a></b> specified in <a href="postconf.5.html"><b>main.cf</b></a>
(typically <b>postfix</b>).
Options:
@@ -90,8 +90,8 @@ QSHAPE(1) QSHAPE(1)
a different set of queues, just list their direc-
tory names on the command line. Absolute paths are
used as is, other paths are taken relative to the
<i<a href="postconf.5.html">>main.cf</</a>i> <b><a href="postconf.5.html#queue_directory">queue_directory</a></b> parameter setting. While
<i<a href="postconf.5.html">>main.cf</</a>i> supports the use of <i>$variable</i> expansion in
<a href="postconf.5.html"><b>main.cf</a> <a href="postconf.5.html#queue_directory">queue_directory</a></b> parameter setting. While
<a href="postconf.5.html"><b>main.cf</b></a> supports the use of <i>$variable</i> expansion in
the definition of the <b><a href="postconf.5.html#queue_directory">queue_directory</a></b> parameter,
the <b>qshape</b> program does not. If you must use vari-
able expansions in the <b><a href="postconf.5.html#queue_directory">queue_directory</a></b> setting, you

View File

@@ -439,11 +439,6 @@ SENDMAIL(1) SENDMAIL(1)
process name in syslog records, so that "smtpd"
becomes, for example, "postfix/smtpd".
<b><a href="postconf.5.html#trigger_timeout">trigger_timeout</a> (10s)</b>
The time limit for sending a trigger to a Postfix
daemon (for example, the <a href="pickup.8.html"><b>pickup</b>(8)</a> or <a href="qmgr.8.html"><b>qmgr</b>(8)</a> dae-
mon).
<b>FILES</b>
/var/spool/postfix, mail queue
/etc/postfix, configuration files

View File

@@ -21,12 +21,12 @@ file formats are expected to be compatible with Sendmail version 8,
and are expected to be suitable for the use as NIS alias maps.
If the result files do not exist they will be created with the
same group and other read permissions as the source file.
same group and other read permissions as their source file.
While a database update is in progress, signal delivery is
postponed, and an exclusive, advisory, lock is placed on the
entire database, in order to avoid surprises in spectator
programs.
processes.
The format of Postfix alias input files is described in
\fBaliases\fR(5).

View File

@@ -23,12 +23,12 @@ file formats are expected to be compatible with:
\fBmakemap \fIfile_type\fR \fIfile_name\fR < \fIfile_name\fR
If the result files do not exist they will be created with the
same group and other read permissions as the source file.
same group and other read permissions as their source file.
While the table update is in progress, signal delivery is
postponed, and an exclusive, advisory, lock is placed on the
entire table, in order to avoid surprises in spectator
programs.
processes.
.SH "INPUT FILE FORMAT"
.na
.nf

View File

@@ -52,8 +52,8 @@ print $1 }
.br
\' | tr -d '*!' | postsuper -d -
.sp
Specify \fB-d ALL\fR to remove all messages; for example, specify
\fB-d ALL deferred\fR to delete mail in the \fBdeferred\fR queue.
Specify "\fB-d ALL\fR" to remove all messages; for example, specify
"\fB-d ALL deferred\fR" to delete all mail in the \fBdeferred\fR queue.
As a safety measure, the word \fBALL\fR must be specified in upper
case.
.sp
@@ -87,8 +87,8 @@ mail queue(s) (default: \fBincoming\fR, \fBactive\fR and
If a \fIqueue_id\fR of \fB-\fR is specified, the program reads
queue IDs from standard input.
.sp
Specify \fB-h ALL\fR to hold all messages; for example, specify
\fB-h ALL deferred\fR to hold mail in the \fBdeferred\fR queue.
Specify "\fB-h ALL\fR" to hold all messages; for example, specify
"\fB-h ALL deferred\fR" to hold all mail in the \fBdeferred\fR queue.
As a safety measure, the word \fBALL\fR must be specified in upper
case.
.sp
@@ -104,11 +104,11 @@ mail queue(s) (default: \fBhold\fR) to the \fBdeferred\fR queue.
If a \fIqueue_id\fR of \fB-\fR is specified, the program reads
queue IDs from standard input.
.sp
Note: use "\fBpostsuper -r\fR" to release mail that was kept on
Note: specify "\fBpostsuper -r\fR" to release mail that was kept on
hold for a significant fraction of \fB$maximal_queue_lifetime\fR
or \fB$bounce_queue_lifetime\fR, or longer.
.sp
Specify \fB-H ALL\fR to release all mail that is "on hold".
Specify "\fB-H ALL\fR" to release all mail that is "on hold".
As a safety measure, the word \fBALL\fR must be specified in upper
case.
.IP \fB-p\fR
@@ -124,7 +124,7 @@ command-line options.
Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified,
the program reads queue IDs from standard input.
.sp
Specify \fB-r ALL\fR to requeue all messages. As a safety
Specify "\fB-r ALL\fR" to requeue all messages. As a safety
measure, the word \fBALL\fR must be specified in upper case.
.sp
A requeued message is moved to the \fBmaildrop\fR queue,

View File

@@ -20,7 +20,7 @@ The \fBqshape\fR program helps the administrator understand the
Postfix queue message distribution in time and by sender domain
or recipient domain. The program needs read access to the queue
directories and queue files, so it must run as the superuser or
the \fBmail_owner\fR specified in \fImain.cf\fR (typically
the \fBmail_owner\fR specified in \fBmain.cf\fR (typically
\fBpostfix\fR).
Options:
@@ -74,8 +74,8 @@ By default \fBqshape\fR displays the combined distribution of
the incoming and active queues. To display a different set of
queues, just list their directory names on the command line.
Absolute paths are used as is, other paths are taken relative
to the \fImain.cf\fR \fBqueue_directory\fR parameter setting.
While \fImain.cf\fR supports the use of \fI$variable\fR expansion
to the \fBmain.cf\fR \fBqueue_directory\fR parameter setting.
While \fBmain.cf\fR supports the use of \fI$variable\fR expansion
in the definition of the \fBqueue_directory\fR parameter, the
\fBqshape\fR program does not. If you must use variable expansions
in the \fBqueue_directory\fR setting, you must specify an explicit

View File

@@ -369,9 +369,6 @@ The syslog facility of Postfix logging.
.IP "\fBsyslog_name (postfix)\fR"
The mail system name that is prepended to the process name in syslog
records, so that "smtpd" becomes, for example, "postfix/smtpd".
.IP "\fBtrigger_timeout (10s)\fR"
The time limit for sending a trigger to a Postfix daemon (for
example, the \fBpickup\fR(8) or \fBqmgr\fR(8) daemon).
.SH "FILES"
.na
.nf

View File

@@ -57,6 +57,17 @@ make -f Makefile.init makefiles \
</pre>
</blockquote>
<p> On Solaris, use this instead: </p>
<blockquote>
<pre>
make -f Makefile.init makefiles \
'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
-lmysqlclient -lz -lm'
</pre>
</blockquote>
<p> Then, just run 'make'. This requires libz, the compression
library. Older mysql implementations build without libz. </p>

View File

@@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
#define MAIL_RELEASE_DATE "20060903"
#define MAIL_RELEASE_DATE "20060930"
#define MAIL_VERSION_NUMBER "2.4"
#ifdef SNAPSHOT

View File

@@ -15,12 +15,12 @@
/* and are expected to be suitable for the use as NIS alias maps.
/*
/* If the result files do not exist they will be created with the
/* same group and other read permissions as the source file.
/* same group and other read permissions as their source file.
/*
/* While a database update is in progress, signal delivery is
/* postponed, and an exclusive, advisory, lock is placed on the
/* entire database, in order to avoid surprises in spectator
/* programs.
/* processes.
/*
/* The format of Postfix alias input files is described in
/* \fBaliases\fR(5).

View File

@@ -17,12 +17,12 @@
/* \fBmakemap \fIfile_type\fR \fIfile_name\fR < \fIfile_name\fR
/*
/* If the result files do not exist they will be created with the
/* same group and other read permissions as the source file.
/* same group and other read permissions as their source file.
/*
/* While the table update is in progress, signal delivery is
/* postponed, and an exclusive, advisory, lock is placed on the
/* entire table, in order to avoid surprises in spectator
/* programs.
/* processes.
/* INPUT FILE FORMAT
/* .ad
/* .fi

View File

@@ -46,8 +46,8 @@
/* .br
/* \' | tr -d '*!' | postsuper -d -
/* .sp
/* Specify \fB-d ALL\fR to remove all messages; for example, specify
/* \fB-d ALL deferred\fR to delete mail in the \fBdeferred\fR queue.
/* Specify "\fB-d ALL\fR" to remove all messages; for example, specify
/* "\fB-d ALL deferred\fR" to delete all mail in the \fBdeferred\fR queue.
/* As a safety measure, the word \fBALL\fR must be specified in upper
/* case.
/* .sp
@@ -81,8 +81,8 @@
/* If a \fIqueue_id\fR of \fB-\fR is specified, the program reads
/* queue IDs from standard input.
/* .sp
/* Specify \fB-h ALL\fR to hold all messages; for example, specify
/* \fB-h ALL deferred\fR to hold mail in the \fBdeferred\fR queue.
/* Specify "\fB-h ALL\fR" to hold all messages; for example, specify
/* "\fB-h ALL deferred\fR" to hold all mail in the \fBdeferred\fR queue.
/* As a safety measure, the word \fBALL\fR must be specified in upper
/* case.
/* .sp
@@ -98,11 +98,11 @@
/* If a \fIqueue_id\fR of \fB-\fR is specified, the program reads
/* queue IDs from standard input.
/* .sp
/* Note: use "\fBpostsuper -r\fR" to release mail that was kept on
/* Note: specify "\fBpostsuper -r\fR" to release mail that was kept on
/* hold for a significant fraction of \fB$maximal_queue_lifetime\fR
/* or \fB$bounce_queue_lifetime\fR, or longer.
/* .sp
/* Specify \fB-H ALL\fR to release all mail that is "on hold".
/* Specify "\fB-H ALL\fR" to release all mail that is "on hold".
/* As a safety measure, the word \fBALL\fR must be specified in upper
/* case.
/* .IP \fB-p\fR
@@ -118,7 +118,7 @@
/* Alternatively, if a \fIqueue_id\fR of \fB-\fR is specified,
/* the program reads queue IDs from standard input.
/* .sp
/* Specify \fB-r ALL\fR to requeue all messages. As a safety
/* Specify "\fB-r ALL\fR" to requeue all messages. As a safety
/* measure, the word \fBALL\fR must be specified in upper case.
/* .sp
/* A requeued message is moved to the \fBmaildrop\fR queue,

View File

@@ -343,9 +343,6 @@
/* .IP "\fBsyslog_name (postfix)\fR"
/* The mail system name that is prepended to the process name in syslog
/* records, so that "smtpd" becomes, for example, "postfix/smtpd".
/* .IP "\fBtrigger_timeout (10s)\fR"
/* The time limit for sending a trigger to a Postfix daemon (for
/* example, the \fBpickup\fR(8) or \fBqmgr\fR(8) daemon).
/* FILES
/* /var/spool/postfix, mail queue
/* /etc/postfix, configuration files

View File

@@ -230,6 +230,11 @@ char *xfer_request[SMTP_STATE_LAST] = {
"QUIT command",
};
#define SMTP_MIME_DOWNGRADE(session, request) \
(var_disable_mime_oconv == 0 \
&& (session->features & SMTP_FEATURE_8BITMIME) == 0 \
&& strcmp(request->encoding, MAIL_ATTR_ENC_7BIT) != 0)
static int smtp_start_tls(SMTP_STATE *);
/* smtp_helo - perform initial handshake with SMTP server */
@@ -1172,7 +1177,9 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
QUOTE_ADDRESS(session->scratch, vstring_str(session->scratch2));
vstring_sprintf(next_command, "MAIL FROM:<%s>",
vstring_str(session->scratch));
if (session->features & SMTP_FEATURE_SIZE) /* RFC 1870 */
/* XXX Don't announce SIZE if we're going to MIME downgrade. */
if (session->features & SMTP_FEATURE_SIZE /* RFC 1870 */
&& !SMTP_MIME_DOWNGRADE(session, request))
vstring_sprintf_append(next_command, " SIZE=%lu",
request->data_size);
if (session->features & SMTP_FEATURE_8BITMIME) { /* RFC 1652 */
@@ -1619,13 +1626,13 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
* transaction in progress.
*/
if (send_state == SMTP_STATE_DOT && nrcpt > 0) {
downgrading =
(var_disable_mime_oconv == 0
&& (session->features & SMTP_FEATURE_8BITMIME) == 0
&& strcmp(request->encoding, MAIL_ATTR_ENC_7BIT) != 0);
downgrading = SMTP_MIME_DOWNGRADE(session, request);
/* XXX Don't downgrade just because generic_maps is turned on. */
if (downgrading || smtp_generic_maps)
session->mime_state = mime_state_alloc(MIME_OPT_DOWNGRADE
| MIME_OPT_REPORT_NESTING,
session->mime_state = mime_state_alloc(downgrading ?
MIME_OPT_DOWNGRADE
| MIME_OPT_REPORT_NESTING :
MIME_OPT_REPORT_NESTING,
smtp_generic_maps ?
smtp_header_rewrite :
smtp_header_out,

View File

@@ -143,6 +143,13 @@ void smtpd_peer_init(SMTPD_STATE *state)
* Milter applications as {if_name} and {if_addr}, then we also must be
* able to provide this via the XCLIENT command for Milter testing.
*
* XXX If we make local or remote port information available to policy
* servers or Milter applications, then we must also make this testable
* with the XCLIENT command, otherwise there will be confusion.
*
* XXX If we make local or remote port information available via logging,
* then we must also support these attributes with the XFORWARD command.
*
* XXX If support were to be added for Milter applications in down-stream
* MTAs, then consistency demands that we propagate a lot of Sendmail
* macro information via the XFORWARD command. Otherwise we could end up

View File

@@ -565,7 +565,7 @@ static void verify_extract_peer(const char *nexthop, const char *hname,
break;
}
}
sk_GENERAL_NAME_free(gens);
sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);
}
}
if (dNSName_found) {

View File

@@ -400,8 +400,12 @@ int hostname_to_sockaddr(const char *hostname, const char *service,
* might blow up. Instead we turn off IPV6_V6ONLY in inet_listen(), and
* supply a protocol-dependent hard-coded string value to getaddrinfo()
* below, so that it will convert into the appropriate wild-card address.
*
* XXX AIX 5.[1-3] getaddrinfo() may return a non-null port when a null
* service argument is specified.
*/
struct addrinfo hints;
int err;
memset((char *) &hints, 0, sizeof(hints));
hints.ai_family = inet_proto_info()->ai_family;
@@ -423,7 +427,18 @@ int hostname_to_sockaddr(const char *hostname, const char *service,
}
#endif
}
return (getaddrinfo(hostname, service, &hints, res));
err = getaddrinfo(hostname, service, &hints, res);
#if defined(BROKEN_AI_NULL_SERVICE)
if (service == 0 && err == 0) {
struct addrinfo *r;
unsigned short *portp;
for (r = *res; r != 0; r = r->ai_next)
if (*(portp = SOCK_ADDR_PORTP(r->ai_addr)) != 0)
*portp = 0;
}
#endif
return (err);
#endif
}
@@ -500,8 +515,12 @@ int hostaddr_to_sockaddr(const char *hostaddr, const char *service,
* ai_family=PF_UNSPEC, ai_flags=AI_NUMERICHOST, ai_socktype=SOCK_STREAM,
* ai_protocol=0 or IPPROTO_TCP, and service=0. The workaround is to
* ignore all but the first result.
*
* XXX AIX 5.[1-3] getaddrinfo() may return a non-null port when a null
* service argument is specified.
*/
struct addrinfo hints;
int err;
memset(&hints, 0, sizeof(hints));
hints.ai_family = inet_proto_info()->ai_family;
@@ -524,7 +543,18 @@ int hostaddr_to_sockaddr(const char *hostaddr, const char *service,
}
#endif
}
return (getaddrinfo(hostaddr, service, &hints, res));
err = getaddrinfo(hostaddr, service, &hints, res);
#if defined(BROKEN_AI_NULL_SERVICE)
if (service == 0 && err == 0) {
struct addrinfo *r;
unsigned short *portp;
for (r = *res; r != 0; r = r->ai_next)
if (*(portp = SOCK_ADDR_PORTP(r->ai_addr)) != 0)
*portp = 0;
}
#endif
return (err);
#endif
}

View File

@@ -28,6 +28,8 @@
/* struct sockaddr *SOCK_ADDR_PTR(ptr)
/* unsigned char SOCK_ADDR_FAMILY(ptr)
/* unsigned char SOCK_ADDR_LEN(ptr)
/* unsigned short SOCK_ADDR_PORT(ptr)
/* unsigned short *SOCK_ADDR_PORTP(ptr)
/*
/* struct sockaddr_in *SOCK_ADDR_IN_PTR(ptr)
/* unsigned char SOCK_ADDR_IN_FAMILY(ptr)
@@ -66,7 +68,9 @@
/* address family and length of the real structure that hides
/* inside a generic sockaddr structure. On systems where struct
/* sockaddr has no sa_len member, SOCK_ADDR_LEN() cannot be
/* used as lvalue.
/* used as lvalue. SOCK_ADDR_PORT() returns the IPv4 or IPv6
/* port number, in network byte order; it must not be used as
/* lvalue. SOCK_ADDR_PORTP() returns a pointer to the same.
/*
/* The macros SOCK_ADDR_IN{,6}_{PTR,FAMILY,PORT,ADDR}() cast
/* a generic pointer to a specific socket address structure

View File

@@ -45,6 +45,13 @@ extern int sock_addr_in_loopback(const struct sockaddr *);
sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
#endif
#define SOCK_ADDR_PORT(sa) \
(SOCK_ADDR_PTR(sa)->sa_family == AF_INET6 ? \
SOCK_ADDR_IN6_PORT(sa) : SOCK_ADDR_IN_PORT(sa))
#define SOCK_ADDR_PORTP(sa) \
(SOCK_ADDR_PTR(sa)->sa_family == AF_INET6 ? \
&SOCK_ADDR_IN6_PORT(sa) : &SOCK_ADDR_IN_PORT(sa))
#define SOCK_ADDR_IN6_PTR(sa) ((struct sockaddr_in6 *)(sa))
#define SOCK_ADDR_IN6_FAMILY(sa) SOCK_ADDR_IN6_PTR(sa)->sin6_family
#define SOCK_ADDR_IN6_PORT(sa) SOCK_ADDR_IN6_PTR(sa)->sin6_port
@@ -71,6 +78,9 @@ extern int sock_addr_in_loopback(const struct sockaddr *);
#define SOCK_ADDR_LEN(sa) sizeof(struct sockaddr_in)
#endif
#define SOCK_ADDR_PORT(sa) SOCK_ADDR_IN_PORT(sa))
#define SOCK_ADDR_PORTP(sa) &SOCK_ADDR_IN_PORT(sa))
#define SOCK_ADDR_EQ_ADDR(sa, sb) \
(SOCK_ADDR_FAMILY(sa) == AF_INET && SOCK_ADDR_FAMILY(sb) == AF_INET \
&& SOCK_ADDR_IN_ADDR(sa).s_addr == SOCK_ADDR_IN_ADDR(sb).s_addr)

View File

@@ -513,6 +513,7 @@ extern int opterr;
# define HAS_IPV6
#endif
#define BROKEN_AI_PASSIVE_NULL_HOST
#define BROKEN_AI_NULL_SERVICE
#endif
#ifdef AIX4