Print this page
NEX-17457 kernel share list fails to be updated after fs import
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
NEX-10098 Disabling SMB server service does not change the sharestate of a smb share to “offline”.
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-3550 Replace smb2_enable with max_protocol (fix fksmbd noise)
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-3611 CLONE NEX-3550 Replace smb2_enable with max_protocol
Reviewed by: Yuri Pankov <Yuri.Pankov@nexenta.com>
NEX-2346 SMB server debug logging cleanup after NEX-2314
NEX-2314 SMB server debug logging needs improvement
NEX-2188 Browsing top level share produces RPC error 1728
NEX-1810 extended security Kerberos (inbound)
SMB-72 Improve startup/shudown debug features
SMB-70 Hang during boot after SMB-50 (fix elfchk noise)
SMB-70 Hang during boot after SMB-50
SMB-50 User-mode SMB server (missed some things)
SMB-56 extended security NTLMSSP, inbound
SMB-39 Use AF_UNIX pipes for RPC
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>
SMB-65 SMB server in non-global zones (data structure changes)
Many things move to the smb_server_t object, and
many functions gain an sv arg (which server).
re #6812 rb1753 backport illumos 1604 smbd print_enable doesn't really work

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/smbsrv/smbd/smbd_main.c
          +++ new/usr/src/cmd/smbsrv/smbd/smbd_main.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  #include <sys/types.h>
  27   27  #include <sys/stat.h>
  28   28  #include <sys/ioccom.h>
  29   29  #include <sys/corectl.h>
  30   30  #include <stdio.h>
  31   31  #include <string.h>
  32   32  #include <strings.h>
  33   33  #include <stdlib.h>
↓ open down ↓ 361 lines elided ↑ open up ↑
 395  395          pset = priv_allocset();
 396  396          if (pset == NULL)
 397  397                  return;
 398  398  
 399  399          priv_basicset(pset);
 400  400  
 401  401          /* list of privileges for smbd */
 402  402          (void) priv_addset(pset, PRIV_NET_MAC_AWARE);
 403  403          (void) priv_addset(pset, PRIV_NET_PRIVADDR);
 404  404          (void) priv_addset(pset, PRIV_PROC_AUDIT);
      405 +        (void) priv_addset(pset, PRIV_SYS_CONFIG);
 405  406          (void) priv_addset(pset, PRIV_SYS_DEVICES);
 406  407          (void) priv_addset(pset, PRIV_SYS_SMB);
 407  408          (void) priv_addset(pset, PRIV_SYS_MOUNT);
 408  409  
 409  410          priv_inverse(pset);
 410  411  
 411  412          /* turn off unneeded privileges */
 412  413          (void) setppriv(PRIV_OFF, PRIV_EFFECTIVE, pset);
 413  414  
 414  415          priv_freeset(pset);
↓ open down ↓ 154 lines elided ↑ open up ↑
 569  570  
 570  571          smb_kmod_stop();
 571  572          smb_logon_abort();
 572  573          smb_lgrp_stop();
 573  574          smbd_pipesvc_stop();
 574  575          smbd_door_stop();
 575  576          smbd_authsvc_stop();
 576  577          smbd_spool_stop();
 577  578          smbd_kernel_unbind();
 578  579          smbd_share_stop();
      580 +        smb_shr_unload();
 579  581          smb_shr_stop();
 580  582          dyndns_stop();
 581  583          smbd_nicmon_stop();
 582  584          smb_ccache_remove(SMB_CCACHE_PATH);
 583  585          smb_pwd_fini();
 584  586          smb_domain_fini();
 585  587          mlsvc_fini();
 586  588          smb_netbios_stop();
 587  589          smbd_cups_fini();
 588  590  
↓ open down ↓ 34 lines elided ↑ open up ↑
 623  625          if (smbd_nicmon_refresh() != 0)
 624  626                  smbd_report("NIC monitor refresh failed");
 625  627  
 626  628          smb_netbios_name_reconfig();
 627  629          smb_browser_reconfig();
 628  630          dyndns_update_zones();
 629  631  
 630  632          /* This reloads the in-kernel config. */
 631  633          (void) smbd_kernel_bind();
 632  634  
 633      -        smbd_load_shares();
      635 +        /* On refresh load share properties only, not the shares themselves */
      636 +        smb_shr_load_execinfo();
      637 +
 634  638          smbd_load_printers();
 635  639          smbd_spool_start();
 636  640  }
 637  641  
 638  642  void
 639  643  smbd_set_secmode(int secmode)
 640  644  {
 641  645          switch (secmode) {
 642  646          case SMB_SECMODE_WORKGRP:
 643  647          case SMB_SECMODE_DOMAIN:
↓ open down ↓ 38 lines elided ↑ open up ↑
 682  686  /*
 683  687   * If the door has already been opened by another process (non-zero pid
 684  688   * in target), we assume that another smbd is already running.  If there
 685  689   * is a race here, it will be caught later when smbsrv is opened because
 686  690   * only one process is allowed to open the device at a time.
 687  691   */
 688  692  static int
 689  693  smbd_already_running(void)
 690  694  {
 691  695          door_info_t     info;
 692      -        char            *door_name;
      696 +        char            *door_name;
 693  697          int             door;
 694  698  
 695  699          door_name = getenv("SMBD_DOOR_NAME");
 696  700          if (door_name == NULL)
 697  701                  door_name = SMBD_DOOR_NAME;
 698  702  
 699  703          if ((door = open(door_name, O_RDONLY)) < 0)
 700  704                  return (0);
 701  705  
 702  706          if (door_info(door, &info) < 0)
↓ open down ↓ 123 lines elided ↑ open up ↑
 826  830  
 827  831          (void) pthread_attr_init(&attr);
 828  832          (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 829  833          rc = pthread_create(&tid, &attr, smbd_share_loader, NULL);
 830  834          (void) pthread_attr_destroy(&attr);
 831  835  
 832  836          if (rc != 0)
 833  837                  smbd_report("unable to load disk shares: %s", strerror(errno));
 834  838  }
 835  839  
      840 +/*
      841 + * This wrapper function is used to avoid casting smb_shr_load() in
      842 + * pthread_create() above. It is called very infrequently.
      843 + */
 836  844  static void *
 837  845  smbd_share_loader(void *args)
 838  846  {
 839  847          (void) smb_shr_load(args);
 840  848          return (NULL);
 841  849  }
 842  850  
 843  851  /*
 844  852   * Initialization of the localtime thread.
 845  853   * Returns 0 on success, an error number if thread creation fails.
↓ open down ↓ 175 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX