Print this page
NEX-16802 bypass warning if multiple entries are found in the /etc/system file and values are the same
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
7287 smb pam module not picking up libsmb from proto area (fix LDLIBS order)
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
7444 fs/xattr.c should be more transparent (zfs_acl_test)
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
NEX-10318 add /etc/system.d support (fix mismerge)
NEX-10318 add /etc/system.d support
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
        
*** 20,30 ****
   */
  
  /*
   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
!  * Copyright 2016 Nexenta Systems, Inc.
   */
  
  #include <sys/types.h>
  #include <sys/inttypes.h>
  #include <sys/param.h>
--- 20,30 ----
   */
  
  /*
   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
!  * Copyright 2018 Nexenta Systems, Inc.
   */
  
  #include <sys/types.h>
  #include <sys/inttypes.h>
  #include <sys/param.h>
*** 62,71 ****
--- 62,72 ----
  
  static char class_file[] = CLASSFILE;
  static char dafile[] = DAFILE;
  static char dacffile[] = DACFFILE;
  
+ char *self_assembly = "/etc/system.d/.self-assembly";
  char *systemfile = "/etc/system";       /* name of ascii system file */
  
  static struct sysparam *sysparam_hd;    /* head of parameters list */
  static struct sysparam *sysparam_tl;    /* tail of parameters list */
  static vmem_t *mod_sysfile_arena;       /* parser memory */
*** 749,779 ****
  bad:
          kobj_find_eol(file);
          return (NULL);
  }
  
! void
! mod_read_system_file(int ask)
  {
          register struct sysparam *sp;
          register struct _buf *file;
          register token_t token, last_tok;
          char tokval[MAXLINESIZE];
  
!         mod_sysfile_arena = vmem_create("mod_sysfile", NULL, 0, 8,
!             segkmem_alloc, segkmem_free, heap_arena, 0, VM_SLEEP);
! 
!         if (ask)
!                 mod_askparams();
! 
!         if (systemfile != NULL) {
! 
!                 if ((file = kobj_open_file(systemfile)) ==
                      (struct _buf *)-1) {
                          cmn_err(CE_WARN, "cannot open system file: %s",
!                             systemfile);
                  } else {
                          sysparam_tl = (struct sysparam *)&sysparam_hd;
  
                          last_tok = NEWLINE;
                          while ((token = kobj_lex(file, tokval,
                              sizeof (tokval))) != EOF) {
--- 750,774 ----
  bad:
          kobj_find_eol(file);
          return (NULL);
  }
  
! static void
! read_system_file(char *name)
  {
          register struct sysparam *sp;
          register struct _buf *file;
          register token_t token, last_tok;
          char tokval[MAXLINESIZE];
  
!         if ((file = kobj_open_file(name)) ==
              (struct _buf *)-1) {
+                 if (strcmp(name, systemfile) == 0)
                          cmn_err(CE_WARN, "cannot open system file: %s",
!                             name);
          } else {
+                 if (sysparam_tl == NULL)
                          sysparam_tl = (struct sysparam *)&sysparam_hd;
  
                  last_tok = NEWLINE;
                  while ((token = kobj_lex(file, tokval,
                      sizeof (tokval))) != EOF) {
*** 809,821 ****
                                          break;
                                  }
                          }
                          kobj_close_file(file);
                  }
!         }
  
          /*
           * Sanity check of /etc/system.
           */
          check_system_file();
  
          param_preset();
--- 804,835 ----
                                  break;
                          }
                  }
                  kobj_close_file(file);
          }
! }
  
+ void
+ mod_read_system_file(int ask)
+ {
+         mod_sysfile_arena = vmem_create("mod_sysfile", NULL, 0, 8,
+             segkmem_alloc, segkmem_free, heap_arena, 0, VM_SLEEP);
+ 
+         if (ask)
+                 mod_askparams();
+ 
          /*
+          * Read the user self-assembly file first
+          * to preserve existing system settings.
+          */
+         if (self_assembly != NULL)
+                 read_system_file(self_assembly);
+ 
+         if (systemfile != NULL)
+                 read_system_file(systemfile);
+ 
+         /*
           * Sanity check of /etc/system.
           */
          check_system_file();
  
          param_preset();
*** 951,961 ****
  
          if (sysp->sys_modnam != NULL && entry->sys_modnam != NULL &&
              strcmp(sysp->sys_modnam, entry->sys_modnam) != 0)
                  return (1);
  
!         return (strcmp(sysp->sys_ptr, entry->sys_ptr));
  }
  
  /*
   * Translate a sysparam type value to a string.
   */
--- 965,981 ----
  
          if (sysp->sys_modnam != NULL && entry->sys_modnam != NULL &&
              strcmp(sysp->sys_modnam, entry->sys_modnam) != 0)
                  return (1);
  
!         if (strcmp(sysp->sys_ptr, entry->sys_ptr) != 0)
!                 return (1);
! 
!         if (sysp->sys_info == entry->sys_info)
!                 return (1);
! 
!         return (0);
  }
  
  /*
   * Translate a sysparam type value to a string.
   */