autofs-5.0.8 - fix portmap not trying proto v2

The latest change to fix a problem with getting an exports list
from a server doesn't try portmap version 2 when trying to get
a service port number. This causes servers that offer only
version 2 to not be able to provide a service port number.
autofs-5.0.8 - fix rpc_getport() when libtirpc is disabled

Fix an obvious function declaration error with rpc_getport() when
libtirpc usage is disabled.
autofs-5.0.8 - fix rpc_getrpcbport() when libtirpc is disabled

When the rpc_getrpcbport() function was introduced the port number
returned is in network byte order. But, when libtirpc is disabled
the function was returning the port in host byte order instead
causing connection failures.
autofs-5.0.8 - don't reset errno

Do not reset the error code that might just have been set to ENOTDIR.
autofs-5.0.8 - extend libldap serialization

It's necessary to serialize calls to ldap_unbind() as well as the
initial bind.
Fix deadlock in init_ldap_connection()

Commit 9fc20db13 ("fix crash due to thread unsafe use of libldap")
introduced a deadlock in init_ldap_connection(). When TLS is on,
this function will call itself recursively and try to lock a mutex
that's already owned by the thread. Fix the problem by using the
lockless version.
autofs-5.0.8 - fix negative status being reset on map read

The map entry status field, which holds the negative cache timeout,
gets reset on a map re-read.

If the negative map entry was added at the same time as the map
read and it was for an entry that was never in the map, the
status gets reset even though the entry is still a valid
negative entry.

Consequently lookups for non-existent map entries are never
seen as negative and the lookup always continues.
autofs-5.0.8 - check for existing offset mount before mounting

The change that introduced the miscellaneous device for autofs
mount control removed a mount point mounted check from the
mount_autofs_offset() function for when the miscellaneous
device is not used.

But a subsequent change that enabled limited update of the exports
of a hosts mount needed that check. Without it a second occurance
of the offset (corresponding to an export) could be mounted upon
a map re-read.
autofs-5.0.8 - remove macro debug prints

Remove a couple of missed debugging prints from macro_setenv();
autofs-5.0.8 - fix max() declaration

Use a name other than the already defined max().
autofs-5.0.8 - fix symlink fail message in mount_bind.c
autofs-5.0.8 - fix cache readlock not taken on lookup

In modules/lookup_yp.c:check_map_indirect() there's a missing cache
readlock.
autofs-5.0.8 - pass map_source as function paramter where possible

Some unnecessary complexity has been added along the way when passing
the map source to functions in lookup modules. Improve that where
possible.
autofs-5.0.8 - check for bind onto self in mount_bind.c

Check for an obviously impossible request to bind or symlink to the
same patch for source and target.
autofs-5.0.8 - fix symlink expire

The expire code uses the list of mounts to decide if additional expire
check requests should be sent to the kernel. This doesn't take into
account the possibility there could be symlinks that might be able to
be expired.

count_mounts() does count symlinks so use that only when working out
how many expire requests should be sent.
autofs-5.0.8 - dont clobber mapent for negative cache

When negative caching a map entry on mount fail don't save the mapent
and restore it when the negative cache timeout expires.

Deleting the mapent, as is done now, can be expensive especially when
it causes a file read for a large file map.
autofs-5.0.8 - fix macro_addvar() and move init to main thread

- move macro table initialization to the main thread.
- change to using malloc() instead of realloc() in macro_global_addvar()
  and macro_addvar().
- fix possible incorrect return from macro_addvar().
autofs-5.0.8 - change walk_tree() to take ap

Change walk_tree() to take an autofs_point pointer instead of
logopt.
autofs-5.0.8 - add negative cache lookup to hesiod lookup

Warning, this is completely untested.

I don't have a hesiod test environment so I can't test this at all.
If we do in fact have hesiod users then I'll need to work with them
to fix any reported problems.
autofs-5.0.8 - fix external env configure

Macro lookup can also resolve names in the external environment.
The configure script disables this by default but the configure
help implies it is enabled by default.