IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Use nwrap_ed_inventarize() instead of nwrap_add_ai().
This not only removes code duplication, but also
more correctly adds more than one line for a given
IP address in a list behind this address.
The original code would only have inventarized
the first line for an IP found.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This reduces code duplication and abstracts the logic out.
It was not special to hname or hname_alias.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Checking whether the passed in name (node) is a valid IPv6 or IPv4
address, we can do the checking for these two error conditions
properly up front.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
When looping through the entry list and remember the
EAI_ADDRINFO case, so that we can differentiate
the cases
- no entry found at all
- an entry found buy wrong address type
Adapt return codes accordingly.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Use the return codes of nwrap_add_hname() and nwrap_add_ai().
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Use return codes from called functions.
Remove now unneeded asserts.
Make failure to add an entry for an alias an error.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
use return codes from the called function.
Remove asserts becaus the cases are caught
by the called functions.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
The data structures were wrong:
- The nwrap_entdata structures reflects one line of the hosts
file, with ip, fqdn and aliases.
But they also had a linked list structure.
- Now the hash table was used to point each
ip address, fqdn and alias name occurring in the hosts
file to the list of lines (entdata structs) that contain
this name/address.
The problem was that these list heads were pointing to the same
entdata structures, while the list should actually be individual
for each entity (ip, fqdn, alias). This lead to wrong assiciations
of lines to IP addresse and also endless loops in the list, when
one line was put into one list twice starting from two different
points.
This patch fixes this by lifting the linked list structure to
a layer nwrap_entlist above nwrap_entdata. The entlist
entries just contain pointers to the entdata, and hence
each line can be referenced independetly by several lists.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This is never given an alias name, so remove
the h_name_a argument.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This always uses the provided h_name_a alias name.
No need to fall back to the fqdn name from the entry.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Instead of calling libc_getaddrinfo on spec and throwing
away the result when we are certain that we don't need it,
call libc only if we really need it.
This fixes another memleak for the libc result.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Untangle a (a ? b : c) statement and add an explanatory
comment, since the intention is not immediately obvious.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
If the specified service is not a valid service name (or port number),
EAI_NONAME should be returned.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
If the AI_NUMERICSERV flag is specified, the the port number
has to specified as a string representing a decimal number
or left NULL.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Only a string that can be converted to a number, is
allowed as a numeric port specification. Trailing
characters are not allowed.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11501
Patch use strtol() instead of atoi() to convert strings to numbers.
This helps better check sanity of service input string.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Fix reimplements how memory is used.
Results from vector are copied to user provided buf.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Memory leak was introduced by deep copy code.
Item ai_tmp->ai_addr should not have deep copy.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Replace for loop by nwrap_vector_foreach in nwrap_lines_unload().
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
getline() allocates memory even if return code is < 0.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
BSD libc stores data in thread local storage.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Previous patches introduced nwrap vectors and hash functions.
This patch will join all together.
Main purpose of this patch is:
- support more records per hostname.
For example: hostname now can have associated IPv4 and IPv6 address.
- better handling of big number of hostname records
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>