Update foreport manifest

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Add strmaxcpy and strmaxcat inline functions

These functions check if the destination buffer has room, and
if so, copy or concatenate the string and return 0. The destination
will be null terminated (and these functions assume the source
strings are null terminated also).

If there isn't enough room, the destination is unchanged and
the functions return -1.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit dc4ce5074da368a7fdc962bd36bef6489dd25bb8)

Conflicts:
	src/include/common_utils.h

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Replace caddr_t with void* in common_utils

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Make sure buffers have enough space for the null

Add 1 to the size of buffers dimensioned with MAXNAMLEN, MAXPATHLEN
MAXHOSTNAMELEN, PATH_MAX, GSS_DEFINE_LEN_TEMP, and SOCK_NAME_MAX

In general, we should be removing a lot of the buffers of this sort
that are located on the stack.

This is a re-implementation of Frank Filz's patch:

884bab2474cec2c200abeeb3ea97f96078d1154f

    Add space for null char in MAXNAMELEN/FSAL_MAX_NAME_LEN buffers

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Cleanup string length issues in log_functions.c

Also use gsh_malloc instead of malloc in normal path.

This patch does not touch get_debug_info().

Also remove unused GetNameFunction.

Also remove log_vnsprintf

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 3b9ccf403451699a0094fbbadaf6727fbce7f0ba)

Conflicts:
	src/Log/log_functions.c
	src/include/log.h

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Replace strncpy and strlcpy with strmaxcpy, check overflow and null terminate strings

Also check result of strmaxcpy and report error if overflow
would have occurred.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 358f583d0957b97d2e55a83fbcc07990dc39f725)

Conflicts:
	src/MainNFSD/nfs_init.c
	src/MainNFSD/nfs_stats_snmp.c
	src/Protocols/NFS/mnt_Export.c
	src/Protocols/NFS/nfs4_op_setclientid.c
	src/support/nfs_read_conf.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Don't gsh_malloc then strcpy

A reimplementation of

commit 27fcc2c9b210c1cea4bb63ad76ab660d919b4543
Author: Frank S. Filz <ffilz@us.ibm.com>
Date:   Wed Nov 14 11:15:33 2012 -0800

    Replace gsh_malloc + strcpy with gsh_strdup

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Remove utf8 functions from nfs_proto_tools

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Fixup nfs_ParseConfLine to take the size of the buffers

And use strmaxcpy to fill buffers.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit e0312150059d890ca0d674788396705acdb95db9)

Conflicts:
	src/MainNFSD/nfs_stat_exporter_thread.c
	src/Protocols/NFS/nfs4_pseudo.c
	src/support/exports.c
	src/support/nfs_read_conf.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Simplify nfs_ParseConfLine and have it's users handle buffer sizes

Instead of allocating memory all over the place, considering the
input string to nfs_ParseConfLine is modified to null terminate
every token, just return pointers to those sub-strings.

Also, length check each token if requested (some callers benefit
from this, other callers don't bother since they aren't copying
the tokens into another string buffer).

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit f78da371335c2edab39f987bc494738b22802b6a)

Conflicts:
	src/Protocols/NFS/nfs4_pseudo.c
	src/support/exports.c
	src/support/nfs_read_conf.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Clean out some unused functions in common_utils

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 24e73a596dd47fae99b2f026c50dadb80712934c)

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Remove dirname from exportlist_t

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 3ba75036351a19b0827b56d3c9542b1d4105b429)

Conflicts:
	src/Protocols/NLM/nlm_util.c
	src/include/nfs_exports.h
	src/support/exports.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Replace constant with sizeof for snprintf

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 88fa26292b7796342a3f19623dde55522f67484d)

Conflicts:
	src/MainNFSD/nfs_recovery_thread.c
	src/MainNFSD/nfs_rpc_callback.c
	src/MainNFSD/nfs_stats_thread.c
	src/SAL/nfs4_recovery.c
	src/snmp_adm/libdaemon.c
	src/support/nfs_ip_stats.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Fixup nfs_ip_name funcs to account for null terminating char

Make sure buffer is right size, use strmaxcpy to copy into
buffer and not overflow and make sure buffer is null terminated.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 9f16238e06be88eb3c1a09784ea0b4837ce9ae73)

Conflicts:
	src/include/nfs_ip_stats.h
	src/support/nfs_ip_name.c
	src/support/test_nfs_ip_name.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Get rid of hash table stats

Unused now that we don't have the stats thread stuff.

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Convert auth_stat2str to return const char * instead of copy into buffer

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 307d6aeeae67650022f60db896a621a8dd3465f8)

Conflicts:
	src/include/nfs_core.h
	src/support/nfs_convert.c

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Fix up two CMake warnings

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Make NodeList optional, default compiled out

NodeList allows specification of client ranges in EXPORT Access
lists using ranges or lists of numbers as part of the name, such
as:
Access = "foo[1,3,100-125]";

While this is a useful capability, it is not without problems and
should be optional.

Some of the problems with it:

- syntax may suprise admins used to other NFS servers
- the list is expanded into a longer string, for example:
  "foo1,foo3,foo100,foo101,...,foo125"
  this may run afoul of two limitations:
  * limit of 128 entries in a single Access list string
  * limit of 1023 characters in a single Access list string
  (note that multiple Access lists can be provided and will be appended
  without hitting these limits)

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit 66c684a94f02d8446b1d8e2600c341efbd8629c2)

Conflicts:
	src/MainNFSD/Makefile.am
	src/MainNFSD/nfs_stat_exporter_thread.c
	src/Makefile.am
	src/configure.ac
	src/shell/Makefile.am
	src/support/exports.c
	src/test/Makefile.am

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Replace strncpy with strmaxcpy in nfs_main.c

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit b0c2e68cd9b1e141f966b2c2db9287ca6304e62e)

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>
Remove cname and oidstr from saved GSS credentials

These are never used and strncpy isn't safe since it
doesn't guarantee null termination.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
(cherry picked from commit bbab3d448792ff3bb6177f8124e4d15c0318dfac)

Conflicts:
	src/include/nfs_exports.h

Signed-off-by: Adam C. Emerson <aemerson@linuxbox.com>