xref: /titanic_50/usr/src/lib/libfsmgt/common/fs_shares.c (revision a237e38e9161f0acd6451439d4a7dd597e66291d)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*a237e38eSth199096  * Common Development and Distribution License (the "License").
6*a237e38eSth199096  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*a237e38eSth199096 
227c478bd9Sstevel@tonic-gate /*
23*a237e38eSth199096  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * Traverses /etc/dfs/sharetab in order to find shared file systems
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <stdio.h>
347c478bd9Sstevel@tonic-gate #include <stdlib.h>
357c478bd9Sstevel@tonic-gate #include <strings.h>
367c478bd9Sstevel@tonic-gate #include <errno.h>
377c478bd9Sstevel@tonic-gate #include <thread.h>
387c478bd9Sstevel@tonic-gate #include <synch.h>
397c478bd9Sstevel@tonic-gate #include "libfsmgt.h"
40*a237e38eSth199096 #include <sharefs/share.h>
417c478bd9Sstevel@tonic-gate #include "sharetab.h"
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #define	SECMODES 5
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Private variables
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate static mutex_t	sharetab_lock = DEFAULTMUTEX;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /*
517c478bd9Sstevel@tonic-gate  * Private method declarations
527c478bd9Sstevel@tonic-gate  */
537c478bd9Sstevel@tonic-gate fs_sharelist_t	*create_sharelist_entry(struct share *sharetab_entry,
547c478bd9Sstevel@tonic-gate 					int *errp);
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * Public methods
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate void
fs_free_share_list(fs_sharelist_t * headp)617c478bd9Sstevel@tonic-gate fs_free_share_list(fs_sharelist_t *headp)
627c478bd9Sstevel@tonic-gate {
637c478bd9Sstevel@tonic-gate 	fs_sharelist_t	*tmp;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate 	while (headp != NULL) {
667c478bd9Sstevel@tonic-gate 		tmp = headp->next;
677c478bd9Sstevel@tonic-gate 		free(headp->path);
687c478bd9Sstevel@tonic-gate 		free(headp->resource);
697c478bd9Sstevel@tonic-gate 		free(headp->fstype);
707c478bd9Sstevel@tonic-gate 		free(headp->options);
717c478bd9Sstevel@tonic-gate 		free(headp->description);
727c478bd9Sstevel@tonic-gate 		headp->next = NULL;
737c478bd9Sstevel@tonic-gate 		free(headp);
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 		headp = tmp;
767c478bd9Sstevel@tonic-gate 	}
777c478bd9Sstevel@tonic-gate }
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Get a linked list of all the shares on the system from /etc/dfs/dfstab
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate fs_sharelist_t *
fs_get_share_list(int * errp)837c478bd9Sstevel@tonic-gate fs_get_share_list(int *errp)
847c478bd9Sstevel@tonic-gate {
857c478bd9Sstevel@tonic-gate 	fs_sharelist_t	*newp;
867c478bd9Sstevel@tonic-gate 	fs_sharelist_t	*headp;
877c478bd9Sstevel@tonic-gate 	fs_sharelist_t	*tailp;
887c478bd9Sstevel@tonic-gate 	FILE		*fp;
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate 	headp = NULL;
917c478bd9Sstevel@tonic-gate 	tailp = NULL;
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 	if ((fp = fopen(SHARETAB, "r")) != NULL) {
947c478bd9Sstevel@tonic-gate 		struct share	*sharetab_entry;
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate 		(void) mutex_lock(&sharetab_lock);
977c478bd9Sstevel@tonic-gate 		while (getshare(fp, &sharetab_entry) > 0) {
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate 			newp = create_sharelist_entry(sharetab_entry, errp);
1007c478bd9Sstevel@tonic-gate 			if (newp == NULL) {
1017c478bd9Sstevel@tonic-gate 				/*
1027c478bd9Sstevel@tonic-gate 				 * Out of memory
1037c478bd9Sstevel@tonic-gate 				 */
1047c478bd9Sstevel@tonic-gate 				fs_free_share_list(headp);
1057c478bd9Sstevel@tonic-gate 				(void) mutex_unlock(&sharetab_lock);
1067c478bd9Sstevel@tonic-gate 				(void) fclose(fp);
1077c478bd9Sstevel@tonic-gate 				return (NULL);
1087c478bd9Sstevel@tonic-gate 			}
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate 			if (headp == NULL) {
1117c478bd9Sstevel@tonic-gate 				headp = newp;
1127c478bd9Sstevel@tonic-gate 				tailp = newp;
1137c478bd9Sstevel@tonic-gate 			} else {
1147c478bd9Sstevel@tonic-gate 				tailp->next = newp;
1157c478bd9Sstevel@tonic-gate 				tailp = newp;
1167c478bd9Sstevel@tonic-gate 			}
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate 		} /* while (getshare(fp, &sharetab_entry) != 0) */
1197c478bd9Sstevel@tonic-gate 		(void) mutex_unlock(&sharetab_lock);
1207c478bd9Sstevel@tonic-gate 		(void) fclose(fp);
1217c478bd9Sstevel@tonic-gate 	} else {
1227c478bd9Sstevel@tonic-gate 		*errp = errno;
1237c478bd9Sstevel@tonic-gate 	} /* if ((fp = fopen(SHARETAB, "r")) != NULL) */
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate 	/*
1267c478bd9Sstevel@tonic-gate 	 * Caller must free the mount list
1277c478bd9Sstevel@tonic-gate 	 */
1287c478bd9Sstevel@tonic-gate 	return (headp);
1297c478bd9Sstevel@tonic-gate } /* fs_get_share_list */
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * fs_parse_opts_for_sec_modes
1347c478bd9Sstevel@tonic-gate  * Get an array of strings of all the security modes of the option string.
1357c478bd9Sstevel@tonic-gate  *
1367c478bd9Sstevel@tonic-gate  * char *cmd - The option string from the share command.
1377c478bd9Sstevel@tonic-gate  * int *count - pointer to the number of elements in the returned array.
1387c478bd9Sstevel@tonic-gate  * int *error - error pointer for returning any errors.
1397c478bd9Sstevel@tonic-gate  */
1407c478bd9Sstevel@tonic-gate char **
fs_parse_opts_for_sec_modes(char * cmd,int * count,int * error)1417c478bd9Sstevel@tonic-gate fs_parse_opts_for_sec_modes(char *cmd, int *count, int *error)
1427c478bd9Sstevel@tonic-gate {
1437c478bd9Sstevel@tonic-gate 	char *temp_str;
1447c478bd9Sstevel@tonic-gate 	char **secstringarray;
1457c478bd9Sstevel@tonic-gate 	char *strptr;
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate 	*count = 0;
1487c478bd9Sstevel@tonic-gate 	strptr = strdup(cmd);
1497c478bd9Sstevel@tonic-gate 	if (strptr == NULL) {
1507c478bd9Sstevel@tonic-gate 		*error = ENOMEM;
1517c478bd9Sstevel@tonic-gate 		return (NULL);
1527c478bd9Sstevel@tonic-gate 	}
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate 	temp_str = strptr;
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate 	secstringarray =
1577c478bd9Sstevel@tonic-gate 	    (char **)calloc((size_t)SECMODES, (size_t)(sizeof (char *)));
1587c478bd9Sstevel@tonic-gate 	if (secstringarray == NULL) {
1597c478bd9Sstevel@tonic-gate 		*error = ENOMEM;
1607c478bd9Sstevel@tonic-gate 		return (NULL);
1617c478bd9Sstevel@tonic-gate 	}
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate 	if (strstr(strptr, "sec=") != NULL) {
1647c478bd9Sstevel@tonic-gate 		char *next_str;
1657c478bd9Sstevel@tonic-gate 		next_str = strptr;
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 		while (next_str != NULL) {
1687c478bd9Sstevel@tonic-gate 			next_str = strstr(strptr, "sec=");
1697c478bd9Sstevel@tonic-gate 			if (next_str != NULL) {
1707c478bd9Sstevel@tonic-gate 				if (strncmp(strptr, "sec=", 4) != 0) {
1717c478bd9Sstevel@tonic-gate 					*(next_str - 1) = '\0';
1727c478bd9Sstevel@tonic-gate 				}
1737c478bd9Sstevel@tonic-gate 				strptr = next_str;
1747c478bd9Sstevel@tonic-gate 				next_str = strstr(strptr + 4, "sec=");
1757c478bd9Sstevel@tonic-gate 				if (next_str != NULL) {
1767c478bd9Sstevel@tonic-gate 					*(next_str - 1) = '\0';
1777c478bd9Sstevel@tonic-gate 				}
1787c478bd9Sstevel@tonic-gate 				secstringarray[*count] = strdup(strptr);
1797c478bd9Sstevel@tonic-gate 				if (secstringarray[*count] == NULL) {
1807c478bd9Sstevel@tonic-gate 					*error = ENOMEM;
1817c478bd9Sstevel@tonic-gate 					if (*count > 0) {
1827c478bd9Sstevel@tonic-gate 						fileutil_free_string_array(
1837c478bd9Sstevel@tonic-gate 						    secstringarray, *count);
1847c478bd9Sstevel@tonic-gate 					} else {
1857c478bd9Sstevel@tonic-gate 						free(secstringarray);
1867c478bd9Sstevel@tonic-gate 					}
1877c478bd9Sstevel@tonic-gate 					free(temp_str);
1887c478bd9Sstevel@tonic-gate 					return (NULL);
1897c478bd9Sstevel@tonic-gate 				}
1907c478bd9Sstevel@tonic-gate 				strptr = next_str;
1917c478bd9Sstevel@tonic-gate 				(*count)++;
1927c478bd9Sstevel@tonic-gate 			}
1937c478bd9Sstevel@tonic-gate 		}
1947c478bd9Sstevel@tonic-gate 	} else {
1957c478bd9Sstevel@tonic-gate 		secstringarray[*count] = strdup(temp_str);
1967c478bd9Sstevel@tonic-gate 		if (secstringarray[*count] == NULL) {
1977c478bd9Sstevel@tonic-gate 			*error = ENOMEM;
1987c478bd9Sstevel@tonic-gate 			if (*count > 0) {
1997c478bd9Sstevel@tonic-gate 				fileutil_free_string_array(
2007c478bd9Sstevel@tonic-gate 				    secstringarray, *count);
2017c478bd9Sstevel@tonic-gate 			} else {
2027c478bd9Sstevel@tonic-gate 				free(secstringarray);
2037c478bd9Sstevel@tonic-gate 			}
2047c478bd9Sstevel@tonic-gate 			free(temp_str);
2057c478bd9Sstevel@tonic-gate 			return (NULL);
2067c478bd9Sstevel@tonic-gate 		}
2077c478bd9Sstevel@tonic-gate 		(*count)++;
2087c478bd9Sstevel@tonic-gate 	}
2097c478bd9Sstevel@tonic-gate 	free(temp_str);
2107c478bd9Sstevel@tonic-gate 	return (secstringarray);
2117c478bd9Sstevel@tonic-gate }
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate /*
2147c478bd9Sstevel@tonic-gate  * fs_create_array_from_accesslist
2157c478bd9Sstevel@tonic-gate  * Takes the colon seperated access list parses the list into an array
2167c478bd9Sstevel@tonic-gate  * containing all the elements of the list. The array created is returned
2177c478bd9Sstevel@tonic-gate  * and count is set to the number of elements in the array.
2187c478bd9Sstevel@tonic-gate  *
2197c478bd9Sstevel@tonic-gate  * char *access_list - The string containing the colon sperated access list.
2207c478bd9Sstevel@tonic-gate  * int *count - Will contain the number of elements in the array.
2217c478bd9Sstevel@tonic-gate  * int *err - any errors encountered.
2227c478bd9Sstevel@tonic-gate  */
2237c478bd9Sstevel@tonic-gate char **
fs_create_array_from_accesslist(char * access_list,int * count,int * err)2247c478bd9Sstevel@tonic-gate fs_create_array_from_accesslist(char *access_list, int *count, int *err)
2257c478bd9Sstevel@tonic-gate {
2267c478bd9Sstevel@tonic-gate 	char *delimiter = ":";
2277c478bd9Sstevel@tonic-gate 	char *server_string;
2287c478bd9Sstevel@tonic-gate 	char **list_array = NULL;
2297c478bd9Sstevel@tonic-gate 	char *list_copy;
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate 	*count = 0;
2327c478bd9Sstevel@tonic-gate 	if (access_list != NULL) {
2337c478bd9Sstevel@tonic-gate 		list_copy = strdup(access_list);
2347c478bd9Sstevel@tonic-gate 		if (list_copy != NULL) {
2357c478bd9Sstevel@tonic-gate 			server_string = strtok(list_copy, delimiter);
2367c478bd9Sstevel@tonic-gate 			if (server_string != NULL) {
2377c478bd9Sstevel@tonic-gate 				while (server_string != NULL) {
2387c478bd9Sstevel@tonic-gate 					if (!fileutil_add_string_to_array(
2397c478bd9Sstevel@tonic-gate 					    &list_array, server_string, count,
2407c478bd9Sstevel@tonic-gate 					    err)) {
2417c478bd9Sstevel@tonic-gate 						fileutil_free_string_array(
2427c478bd9Sstevel@tonic-gate 						    list_array, *count);
2437c478bd9Sstevel@tonic-gate 						free(list_copy);
2447c478bd9Sstevel@tonic-gate 						goto return_err;
2457c478bd9Sstevel@tonic-gate 					}
2467c478bd9Sstevel@tonic-gate 					server_string =
2477c478bd9Sstevel@tonic-gate 					    strtok(NULL, delimiter);
2487c478bd9Sstevel@tonic-gate 				}
2497c478bd9Sstevel@tonic-gate 			} else {
2507c478bd9Sstevel@tonic-gate 				list_array =
2517c478bd9Sstevel@tonic-gate 				    (char **)calloc(((*count) + 1),
2527c478bd9Sstevel@tonic-gate 				    sizeof (char *));
2537c478bd9Sstevel@tonic-gate 				if (list_array == NULL) {
2547c478bd9Sstevel@tonic-gate 					*err = ENOMEM;
2557c478bd9Sstevel@tonic-gate 					free(list_copy);
2567c478bd9Sstevel@tonic-gate 					goto return_err;
2577c478bd9Sstevel@tonic-gate 				}
2587c478bd9Sstevel@tonic-gate 				list_array[*count] = strdup(access_list);
2597c478bd9Sstevel@tonic-gate 				if (list_array[*count] == NULL) {
2607c478bd9Sstevel@tonic-gate 					*err = ENOMEM;
2617c478bd9Sstevel@tonic-gate 					free(list_array);
2627c478bd9Sstevel@tonic-gate 					list_array = NULL;
2637c478bd9Sstevel@tonic-gate 					goto return_err;
2647c478bd9Sstevel@tonic-gate 				}
2657c478bd9Sstevel@tonic-gate 				(*count)++;
2667c478bd9Sstevel@tonic-gate 			}
2677c478bd9Sstevel@tonic-gate 			free(list_copy);
2687c478bd9Sstevel@tonic-gate 		} else {
2697c478bd9Sstevel@tonic-gate 			*err = ENOMEM;
2707c478bd9Sstevel@tonic-gate 		}
2717c478bd9Sstevel@tonic-gate 	}
2727c478bd9Sstevel@tonic-gate return_err:
2737c478bd9Sstevel@tonic-gate 	return (list_array);
2747c478bd9Sstevel@tonic-gate } /* fs_create_array_from_accesslist */
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate /*
2787c478bd9Sstevel@tonic-gate  * Private Methods
2797c478bd9Sstevel@tonic-gate  */
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate fs_sharelist_t *
create_sharelist_entry(struct share * sharetab_entry,int * errp)2827c478bd9Sstevel@tonic-gate create_sharelist_entry(struct share *sharetab_entry, int *errp)
2837c478bd9Sstevel@tonic-gate {
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate 	fs_sharelist_t	*newp;
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate 	newp = (fs_sharelist_t *)calloc((size_t)1,
2887c478bd9Sstevel@tonic-gate 	    (size_t)sizeof (fs_sharelist_t));
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate 	if (newp == NULL) {
2917c478bd9Sstevel@tonic-gate 		/*
2927c478bd9Sstevel@tonic-gate 		 * Out of memory
2937c478bd9Sstevel@tonic-gate 		 */
2947c478bd9Sstevel@tonic-gate 		*errp = errno;
2957c478bd9Sstevel@tonic-gate 		return (NULL);
2967c478bd9Sstevel@tonic-gate 	}
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 	newp->path = strdup(sharetab_entry->sh_path);
2997c478bd9Sstevel@tonic-gate 	if (newp->path == NULL) {
3007c478bd9Sstevel@tonic-gate 		/*
3017c478bd9Sstevel@tonic-gate 		 * Out of memory
3027c478bd9Sstevel@tonic-gate 		 */
3037c478bd9Sstevel@tonic-gate 		*errp = errno;
3047c478bd9Sstevel@tonic-gate 		fs_free_share_list(newp);
3057c478bd9Sstevel@tonic-gate 		return (NULL);
3067c478bd9Sstevel@tonic-gate 	}
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate 	newp->resource = strdup(sharetab_entry->sh_res);
3097c478bd9Sstevel@tonic-gate 	if (newp->path == NULL) {
3107c478bd9Sstevel@tonic-gate 		/*
3117c478bd9Sstevel@tonic-gate 		 * Out of memory
3127c478bd9Sstevel@tonic-gate 		 */
3137c478bd9Sstevel@tonic-gate 		*errp = errno;
3147c478bd9Sstevel@tonic-gate 		fs_free_share_list(newp);
3157c478bd9Sstevel@tonic-gate 		return (NULL);
3167c478bd9Sstevel@tonic-gate 	}
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 	newp->fstype = strdup(sharetab_entry->sh_fstype);
3197c478bd9Sstevel@tonic-gate 	if (newp->fstype == NULL) {
3207c478bd9Sstevel@tonic-gate 		/*
3217c478bd9Sstevel@tonic-gate 		 * Out of memory
3227c478bd9Sstevel@tonic-gate 		 */
3237c478bd9Sstevel@tonic-gate 		*errp = errno;
3247c478bd9Sstevel@tonic-gate 		fs_free_share_list(newp);
3257c478bd9Sstevel@tonic-gate 		return (NULL);
3267c478bd9Sstevel@tonic-gate 	}
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate 	newp->options = strdup(sharetab_entry->sh_opts);
3297c478bd9Sstevel@tonic-gate 	if (newp->options == NULL) {
3307c478bd9Sstevel@tonic-gate 		/*
3317c478bd9Sstevel@tonic-gate 		 * Out of memory
3327c478bd9Sstevel@tonic-gate 		 */
3337c478bd9Sstevel@tonic-gate 		*errp = errno;
3347c478bd9Sstevel@tonic-gate 		fs_free_share_list(newp);
3357c478bd9Sstevel@tonic-gate 		return (NULL);
3367c478bd9Sstevel@tonic-gate 	}
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate 	newp->description = strdup(sharetab_entry->sh_descr);
3397c478bd9Sstevel@tonic-gate 	if (newp->description == NULL) {
3407c478bd9Sstevel@tonic-gate 		/*
3417c478bd9Sstevel@tonic-gate 		 * Out of memory
3427c478bd9Sstevel@tonic-gate 		 */
3437c478bd9Sstevel@tonic-gate 		*errp = errno;
3447c478bd9Sstevel@tonic-gate 		fs_free_share_list(newp);
3457c478bd9Sstevel@tonic-gate 		return (NULL);
3467c478bd9Sstevel@tonic-gate 	}
3477c478bd9Sstevel@tonic-gate 	newp->next = NULL;
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate 	return (newp);
3507c478bd9Sstevel@tonic-gate } /* create_sharelist_entry */
351