Make sure all strings properly handled in fsal_strings.c

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Pass in_str_maxlen=0 to FSAL_str2name/FSAL_str2path if str is null term

Signed-off-by: Frank Filz <ffilz@us.ibm.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>
Reuse p_pdirent[*p_nb_entries].name to get handle for dirent

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Replace gsh_malloc + strcpy with gsh_strdup

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use memcpy instead of strncpy when we know string length

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use strcpy(x, y) instead of memcpy(x, y, strlen(y) + 1)

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Use free_utf8 instead of gsh_free

Signed-off-by: Frank Filz <ffilz@us.ibm.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>
Have stat exporter use parseAccessParam instead of having it's own version.

Signed-off-by: Frank Filz <ffilz@us.ibm.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>
Clean out some unused functions in common_utils

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove dirname from exportlist_t

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Rework exports.c to not overflow string buffers

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Strip pseudo="/" handling from nfs4_op_lookup_pseudo

We guarantee pseudo is not "/" so no sense dealing with
that in nfs4_op_lookup_pseudo.

With this, nfs4_pseudo.c is clean of any string buffer overflow
issues.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Replace constant with sizeof for snprintf

Signed-off-by: Frank Filz <ffilz@us.ibm.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>
Fixup id mapper functions to take buffer size parms and use strmaxcpy

Signed-off-by: Frank Filz <ffilz@us.ibm.com>

Conflicts:

	src/IdMapper/idmapper_cache.c
Convert auth_stat2str to return const char * instead of copy into buffer

Signed-off-by: Frank Filz <ffilz@us.ibm.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>