Print this page
5861 clean up obsolete init scripts


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 /*
  28  * NFS specific functions
  29  */
  30 #include <stdio.h>
  31 #include <string.h>
  32 #include <ctype.h>
  33 #include <stdlib.h>
  34 #include <unistd.h>
  35 #include <zone.h>
  36 #include <errno.h>
  37 #include <locale.h>
  38 #include <signal.h>
  39 #include <strings.h>
  40 #include "libshare.h"
  41 #include "libshare_impl.h"
  42 #include <nfs/export.h>
  43 #include <pwd.h>
  44 #include <grp.h>


1880                                 err = SA_NO_MEMORY;
1881                                 (void) printf(dgettext(TEXT_DOMAIN,
1882                                     "NFS: Cannot share %s: "
1883                                     "no memory\n"), path);
1884                                 goto out;
1885                         }
1886                         sec = (sa_security_t)sa_get_derived_security(
1887                             share, sectype, "nfs", 1);
1888                         sp[i].s_window = DEF_WIN;
1889                         sp[i].s_rootcnt = 0;
1890                         sp[i].s_rootnames = NULL;
1891                         (void) fill_security_from_secopts(&sp[i], sec);
1892                         if (sec != NULL)
1893                                 sa_free_derived_security(sec);
1894                         if (sectype != NULL)
1895                                 sa_free_attr_string(sectype);
1896                 }
1897         }
1898         /*
1899          * when we get here, we can do the exportfs system call and
1900          * initiate things. We probably want to enable the nfs.server
1901          * service first if it isn't running within SMF.
1902          */
1903         /* check nfs.server status and start if needed */
1904         /* now add the share to the internal tables */
1905         printarg(path, &export);
1906         /*
1907          * call the exportfs system call which is implemented
1908          * via the nfssys() call as the EXPORTFS subfunction.
1909          */
1910         if (iszfs) {
1911                 struct exportfs_args ea;
1912                 share_t sh;
1913                 char *str;
1914                 priv_set_t *priv_effective;
1915                 int privileged;
1916 
1917                 /*
1918                  * If we aren't a privileged user
1919                  * and NFS server service isn't running
1920                  * then print out an error message
1921                  * and return EPERM
1922                  */
1923 




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  25  */
  26 
  27 /*
  28  * NFS specific functions
  29  */
  30 #include <stdio.h>
  31 #include <string.h>
  32 #include <ctype.h>
  33 #include <stdlib.h>
  34 #include <unistd.h>
  35 #include <zone.h>
  36 #include <errno.h>
  37 #include <locale.h>
  38 #include <signal.h>
  39 #include <strings.h>
  40 #include "libshare.h"
  41 #include "libshare_impl.h"
  42 #include <nfs/export.h>
  43 #include <pwd.h>
  44 #include <grp.h>


1880                                 err = SA_NO_MEMORY;
1881                                 (void) printf(dgettext(TEXT_DOMAIN,
1882                                     "NFS: Cannot share %s: "
1883                                     "no memory\n"), path);
1884                                 goto out;
1885                         }
1886                         sec = (sa_security_t)sa_get_derived_security(
1887                             share, sectype, "nfs", 1);
1888                         sp[i].s_window = DEF_WIN;
1889                         sp[i].s_rootcnt = 0;
1890                         sp[i].s_rootnames = NULL;
1891                         (void) fill_security_from_secopts(&sp[i], sec);
1892                         if (sec != NULL)
1893                                 sa_free_derived_security(sec);
1894                         if (sectype != NULL)
1895                                 sa_free_attr_string(sectype);
1896                 }
1897         }
1898         /*
1899          * when we get here, we can do the exportfs system call and
1900          * initiate things. We probably want to enable the
1901          * svc:/network/nfs/server service first if it isn't running.
1902          */
1903         /* check svc:/network/nfs/server status and start if needed */
1904         /* now add the share to the internal tables */
1905         printarg(path, &export);
1906         /*
1907          * call the exportfs system call which is implemented
1908          * via the nfssys() call as the EXPORTFS subfunction.
1909          */
1910         if (iszfs) {
1911                 struct exportfs_args ea;
1912                 share_t sh;
1913                 char *str;
1914                 priv_set_t *priv_effective;
1915                 int privileged;
1916 
1917                 /*
1918                  * If we aren't a privileged user
1919                  * and NFS server service isn't running
1920                  * then print out an error message
1921                  * and return EPERM
1922                  */
1923