opensmtpd / libasr Goto Github PK
View Code? Open in Web Editor NEWPortable asr. Discontinued, it's only maintained as part of OpenSMPTD now.
License: Other
Portable asr. Discontinued, it's only maintained as part of OpenSMPTD now.
License: Other
so far I used only OpenBSD version
today, Iโm trying to compile OpenSMTPD cloned from git on OS X
Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
instructions from README.md
during make, I ended with
Making all in openbsd-compat
gcc -DHAVE_CONFIG_H -I. -I.. -I../smtpd -I../openbsd-compat -I/opt/local -I/opt/local -g -O2 -Qunused-arguments -Wunknown-warning-option -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -c -o arc4random.o arc4random.c
In file included from arc4random.c:27:
In file included from ./includes.h:77:
./openbsd-compat.h:152:5: warning: incompatible redeclaration of library function 'snprintf' [-Wincompatible-library-redeclaration]
int snprintf(char , size_t, SNPRINTF_CONST char *, ...);
^
./openbsd-compat.h:152:5: note: 'snprintf' is a builtin with type 'int (char *, unsigned long, const char *, ...)'
1 warning generated.
gcc -DHAVE_CONFIG_H -I. -I.. -I../smtpd -I../openbsd-compat -I/opt/local -I/opt/local -g -O2 -Qunused-arguments -Wunknown-warning-option -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -fno-builtin-memset -c -o base64.o base64.c
In file included from base64.c:47:
In file included from ./includes.h:77:
./openbsd-compat.h:152:5: warning: incompatible redeclaration of library function 'snprintf' [-Wincompatible-library-redeclaration]
int snprintf(char *, size_t, SNPRINTF_CONST char *, ...);
^
./openbsd-compat.h:152:5: note: 'snprintf' is a builtin with type 'int (char *, unsigned long, const char *, ...)'
In file included from base64.c:58:
/usr/include/stdio.h:421:6: error: conflicting types for 'snprintf'
int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4);
^
./openbsd-compat.h:152:5: note: previous declaration is here
int snprintf(char *, size_t, SNPRINTF_CONST char *, ...);
^
1 warning and 1 error generated.
make[2]: ** [base64.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Problem:
[...]
configure.ac:44: installing './missing'
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/fgetln.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
automake-1.15: warning: possible forward-incompatibility.
automake-1.15: At least a source file is in a subdirectory, but the 'subdir-objects'
automake-1.15: automake option hasn't been enabled. For now, the corresponding output
automake-1.15: object file(s) will be placed in the top-level directory. However,
automake-1.15: this behaviour will change in future Automake versions: they will
automake-1.15: unconditionally cause object files to be placed in the same subdirectory
automake-1.15: of the corresponding sources.
automake-1.15: You are advised to start using 'subdir-objects' option throughout your
automake-1.15: project, to avoid future incompatibilities.
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/res_hnok.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/strlcat.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/strlcpy.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/strsep.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
src/Makefile.am:3: warning: source file '$(top_srcdir)/openbsd-compat/strtonum.c' is in a subdirectory,
src/Makefile.am:3: but option 'subdir-objects' is disabled
src/Makefile.am: installing './depcomp'
[...]
Patch:
perl -i.bak -ple 's|^AM_INIT_AUTOMAKE$|AM_INIT_AUTOMAKE([subdir-objects])|' configure.ac;
Result:
[...]
configure.ac:44: installing './missing'
src/Makefile.am: installing './depcomp'
Comments:
no comment
On systems such as Linux with musl that do not define NETDB_SUCCESS, the definition from openbsd-compat/defines.h
is used. This definition uses the wrong number, -1, which is defined immediately above to signify an internal error. OpenSMTPD expects the value to be zero on success, which matches the glibc definition. As it is now, this causes all DNS lookups in OpenSMTPD to hit the failure case here, and so mail fails to relay with smtp-out: Failed to resolve MX for [relay:domain.tld]: Temporary failure in MX lookup
.
Hi
I'm trying to build libasr master, which fails, unlike when building version 1.0.2.
The goal is to be able to build OpenSMTPD with all the latest tweaks and features for testing, rather than working with stable and then having to change things when the next stable is out.
Is it absolutely necessary to be using master for libasr in order to build master for OpenSMTPD at this point?
$ git clone git://github.com/OpenSMTPD/libasr.git
$ cd libasr
$ ./bootstrap
$ CFLAGS="-O2 -fPIC -fstack-protector" CXXFLAGS="-O2 -fPIC -fstack-protector" ./configure --prefix=/pkg/libasr/20180820 --enable-static=no --build=x86_64-slackware-linux
$ make
make all-recursive
make[1]: Entering directory `/home/admin/src/opensmtpd/libasr/libasr'
Making all in src
make[2]: Entering directory `/home/admin/src/opensmtpd/libasr/libasr/src'
Makefile:414: ../openbsd-compat/.deps/libasr_la-clock_gettime.Plo: No such file or directory
Makefile:415: ../openbsd-compat/.deps/libasr_la-fgetln.Plo: No such file or directory
Makefile:416: ../openbsd-compat/.deps/libasr_la-reallocarray.Plo: No such file or directory
Makefile:417: ../openbsd-compat/.deps/libasr_la-res_hnok.Plo: No such file or directory
Makefile:418: ../openbsd-compat/.deps/libasr_la-strlcat.Plo: No such file or directory
Makefile:419: ../openbsd-compat/.deps/libasr_la-strlcpy.Plo: No such file or directory
Makefile:420: ../openbsd-compat/.deps/libasr_la-strsep.Plo: No such file or directory
Makefile:421: ../openbsd-compat/.deps/libasr_la-strtonum.Plo: No such file or directory
make[2]: *** No rule to make target `../openbsd-compat/.deps/libasr_la-strtonum.Plo'. Stop.
make[2]: Leaving directory `/home/admin/src/opensmtpd/libasr/libasr/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/admin/src/opensmtpd/libasr/libasr'
make: *** [all] Error 2
I'm unfamiliar with building Makefiles, so unsure where to begin looking for this issue.
Could someone take a peek at this or point me in the right direction?
Thanks
Hello, I'm building packages for my operating system, and I could use a new release with the last modifications on the master branch.
Currently, I have an automake with version 0.16 and it's not working with the last release (but works fine with master).
Thanks!
I tried to built opensmtpd 6.6.1p1
on CentOS 7, but it exited with the following error:
...
checking for asr.h... yes
checking for asr_run in -lasr... no
configure: error: *** libasr missing - please install first or check config.log ***
I had already successfuly built libasr 1.0.3 from git OpenSMTPD/libasr and added it to ldconfig by writing a config file /etc/ld.so.conf.d/libasr.conf
with the following content: /usr/local/lib/
; and then running $ sudo ldconfig
.
$ ldconfig -p | grep libasr
shows:
libasr.so.0 (libc6,x86-64) => /usr/local/lib/libasr.so.0
libasr.so (libc6,x86-64) => /usr/local/lib/libasr.so
Here is the config.log from attempting the OpenSMTPd ./configure
step.
The error in there is: .../builds/opensmtpd/conftest.c:133: undefined reference to
explicit_bzero'` on line 10988.
Someone says that asr.c has a mistake.
https://github.com/OpenSMTPD/libasr/blob/master/src/asr.c#L890
CAVEATS
If the last line in a file does not contain a newline, the returned text won't contain a newline either.
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/fgetln.3
libasr has copied many resolver functions from OpenBSD. However the function res_randomid(), which is used in res_send_async() and res_mkquery() seems to have been forgotten.
Because of this libasr currently only works with glibc and uclibc>=0.9.33 as these libc's provide the function. It however seems to be a non-standard function with no real documentation.
Could res_randomid() be provided, inclusion possibly depending on a configure test?
configure.ac, line 1560, test use '${srcdir}/smtpd/smtpd.8' but this file don't exist
It would be good to clean those warnings.
asr.c: In function '_asr_strdname':
asr.c:789:31: warning: pointer targets in initialization of 'const unsigned char *' from 'const char *' differ in signedness [-Wpointer-sign]
789 | const unsigned char *dname = _dname;
| ^~~~~~
In file included from asr_private.h:20,
from asr.c:39:
At top level:
asr_compat.h:22:26: warning: '__thread_name__asr' defined but not used [-Wunused-variable]
22 | #define __THREAD_NAME(x) __thread_name_ ## x
| ^~~~~~~~~~~~~~
asr.c:61:14: note: in expansion of macro '__THREAD_NAME'
61 | static void *__THREAD_NAME(_asr);
| ^~~~~~~~~~~~~
res_send_async.c: In function 'res_send_async':
res_send_async.c:80:23: warning: pointer targets in passing argument 2 of '_asr_unpack_init' differ in signedness [-Wpointer-sign]
80 | _asr_unpack_init(&p, buf, buflen);
| ^~~
| |
| const unsigned char *
In file included from res_send_async.c:39:
asr_private.h:296:44: note: expected 'const char *' but argument is of type 'const unsigned char *'
296 | void _asr_unpack_init(struct asr_unpack *, const char *, size_t);
| ^~~~~~~~~~~~
res_send_async.c: In function 'setup_query':
res_send_async.c:399:31: warning: pointer targets in passing argument 2 of '_asr_pack_init' differ in signedness [-Wpointer-sign]
399 | _asr_pack_init(&p, as->as.dns.obuf, as->as.dns.obufsize);
| ~~~~~~~~~~^~~~~
| |
| unsigned char *
In file included from res_send_async.c:39:
asr_private.h:292:40: note: expected 'char *' but argument is of type 'unsigned char *'
292 | void _asr_pack_init(struct asr_pack *, char *, size_t);
| ^~~~~~
res_send_async.c: In function 'tcp_read':
res_send_async.c:643:6: warning: pointer targets in assignment from 'unsigned char *' to 'char *' differ in signedness [-Wpointer-sign]
643 | pos = as->as.dns.ibuf + offset;
| ^
res_send_async.c: In function 'ensure_ibuf':
res_send_async.c:692:18: warning: pointer targets in assignment from 'char *' to 'unsigned char *' differ in signedness [-Wpointer-sign]
692 | as->as.dns.ibuf = t;
| ^
res_send_async.c: In function 'validate_packet':
res_send_async.c:711:33: warning: pointer targets in passing argument 2 of '_asr_unpack_init' differ in signedness [-Wpointer-sign]
711 | _asr_unpack_init(&p, as->as.dns.ibuf, as->as.dns.ibuflen);
| ~~~~~~~~~~^~~~~
| |
| unsigned char *
In file included from res_send_async.c:39:
asr_private.h:296:44: note: expected 'const char *' but argument is of type 'unsigned char *'
296 | void _asr_unpack_init(struct asr_unpack *, const char *, size_t);
| ^~~~~~~~~~~~
asr_utils.c: In function 'dname_expand':
asr_utils.c:144:39: warning: pointer targets in passing argument 1 of 'dname_check_label' differ in signedness [-Wpointer-sign]
144 | if (dname_check_label(data + offset + 1, n) == -1)
| ~~~~~~~~~~~~~~^~~
| |
| const unsigned char *
asr_utils.c:58:31: note: expected 'const char *' but argument is of type 'const unsigned char *'
58 | dname_check_label(const char *s, size_t l)
| ~~~~~~~~~~~~^
asr_utils.c: In function 'unpack_dname':
asr_utils.c:246:20: warning: pointer targets in passing argument 1 of 'dname_expand' differ in signedness [-Wpointer-sign]
246 | e = dname_expand(p->buf, p->len, p->offset, &p->offset, dst, max);
| ~^~~~~
| |
| const char *
asr_utils.c:117:35: note: expected 'const unsigned char *' but argument is of type 'const char *'
117 | dname_expand(const unsigned char *data, size_t len, size_t offset,
| ~~~~~~~~~~~~~~~~~~~~~^~~~
getaddrinfo_async.c: In function 'get_port':
getaddrinfo_async.c:479:18: warning: unused variable 'se' [-Wunused-variable]
479 | struct servent se;
| ^~
Executing the following test code in Alpine Linux will result in a BADFLAGS error.
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <asr.h>
int main() {
struct asr_query *query;
struct asr_result result;
struct addrinfo hints;
const char *hostname = "www.yahoo.co.jp";
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
query = getaddrinfo_async(hostname, NULL, &hints, NULL);
asr_run_sync(query, &result);
if (errno != 0) {
printf("asr run error: %s\n", strerror(errno));
return 1;
} else if (result.ar_gai_errno) {
printf("gataddrinfo error: %s\n", gai_strerror(result.ar_gai_errno));
return 1;
}
return 0;
}
$ cc test.c -lasr
$ ./a.out
gataddrinfo error: Invalid flags
Only of the AI_CANONNAME and AI_FQDN bits can be set, Only the AI_CANONNAME and AI_FQDN bits can be set, and are verified in getaddrinfo_async_run() as follows:
libasr/src/getaddrinfo_async.c
Lines 168 to 173 in 15fdb71
However, on systems such as Linux with musl that do not define AI_FQDN, it is defined as AI_CANONNAME at build time:
Lines 42 to 44 in 15fdb71
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.