Print this page
re #11201 nss: need local netgroup implementation

Split Close
Expand all
Collapse all
          --- old/usr/src/head/nss_dbdefs.h
          +++ new/usr/src/head/nss_dbdefs.h
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  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 + * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  22   23   * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  23   24   *
  24   25   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25   26   * Use is subject to license terms.
  26   27   *
  27   28   * Database-specific definitions for the getXXXbyYYY routines
  28   29   * (e.g getpwuid_r(), ether_ntohost()) that use the name-service switch.
  29   30   * Database-independent definitions are in <nss_common.h>
  30   31   *
  31   32   * Ideally, this is the only switch header file one would add things
↓ open down ↓ 109 lines elided ↑ open up ↑
 141  142  /*
 142  143   * Line-lengths that the "files" and "compat" backends will try to support.
 143  144   * It may be reasonable (even advisable) to use smaller values than these.
 144  145   */
 145  146  
 146  147  #define NSS_BUFSIZ              1024
 147  148  
 148  149  #define NSS_LINELEN_GROUP       ((NSS_BUFSIZ) * 8)
 149  150  #define NSS_LINELEN_HOSTS       ((NSS_BUFSIZ) * 8)
 150  151  #define NSS_LINELEN_IPNODES     ((NSS_BUFSIZ) * 8)
      152 +#define NSS_LINELEN_NETGROUP    ((NSS_BUFSIZ) * 32)
 151  153  #define NSS_LINELEN_NETMASKS    NSS_BUFSIZ
 152  154  #define NSS_LINELEN_NETWORKS    NSS_BUFSIZ
 153  155  #define NSS_LINELEN_PASSWD      NSS_BUFSIZ
 154  156  #define NSS_LINELEN_PRINTERS    NSS_BUFSIZ
 155  157  #define NSS_LINELEN_PROJECT     ((NSS_BUFSIZ) * 4)
 156  158  #define NSS_LINELEN_PROTOCOLS   NSS_BUFSIZ
 157  159  #define NSS_LINELEN_PUBLICKEY   NSS_BUFSIZ
 158  160  #define NSS_LINELEN_RPC         NSS_BUFSIZ
 159  161  #define NSS_LINELEN_SERVICES    NSS_BUFSIZ
 160  162  #define NSS_LINELEN_SHADOW      NSS_BUFSIZ
↓ open down ↓ 190 lines elided ↑ open up ↑
 351  353  };
 352  354  
 353  355  struct nss_innetgr_args {
 354  356  /* in: */
 355  357          struct nss_innetgr_1arg arg[NSS_NETGR_N];
 356  358          struct nss_innetgr_1arg groups;
 357  359  /* out: */
 358  360          enum nss_netgr_status   status;
 359  361  };
 360  362  
      363 +/* For NSS_DBOP_NETGROUP_BYNAME */
      364 +struct nss_netgrent {
      365 +        char    *netgr_name;
      366 +        char    *netgr_members;
      367 +};
      368 +
 361  369  /*
 362  370   * nss_XbyY_buf_t -- structure containing the generic arguments passwd to
 363  371   *   getXXXbyYYY_r() and getXXXent_r() routines.  The (void *) value points to
 364  372   *   a struct of the appropriate type, e.g. struct passwd or struct hostent.
 365  373   *
 366  374   * The functions that allocate and free these structures do no locking at
 367  375   * all, since the routines that use them are inherently MT-unsafe anyway.
 368  376   */
 369  377  
 370  378  typedef struct {
↓ open down ↓ 401 lines elided ↑ open up ↑
 772  780  #define NSS_DBOP_ETHERS_HOSTTON (NSS_DBOP_next_noiter)
 773  781  #define NSS_DBOP_ETHERS_NTOHOST (NSS_DBOP_ETHERS_HOSTTON + 1)
 774  782  
 775  783  #define NSS_DBOP_BOOTPARAMS_BYNAME      (NSS_DBOP_next_noiter)
 776  784  #define NSS_DBOP_NETMASKS_BYNET (NSS_DBOP_next_noiter)
 777  785  
 778  786  #define NSS_DBOP_PRINTERS_BYNAME        (NSS_DBOP_next_iter)
 779  787  
 780  788  /*
 781  789   * The "real" backend for netgroup (__multi_innetgr, setnetgrent)
      790 + * Note: _BYNAME is implemented only in "files" (for now).
 782  791   */
 783  792  #define NSS_DBOP_NETGROUP_IN            (NSS_DBOP_next_iter)
 784  793  #define NSS_DBOP_NETGROUP_SET           (NSS_DBOP_NETGROUP_IN  + 1)
      794 +#define NSS_DBOP_NETGROUP_BYNAME        (NSS_DBOP_NETGROUP_SET + 1)
 785  795  
 786  796  /*
 787  797   * The backend for getpublickey and getsecretkey (getkeys)
 788  798   */
 789  799  #define NSS_DBOP_KEYS_BYNAME            (NSS_DBOP_next_iter)
 790  800  
 791  801  /*
 792  802   * The pseudo-backend for netgroup (returned by setnetgrent) doesn't have
 793  803   *   any getXXXbyYYY operations, just the usual destr/end/set/get ops,
 794  804   *   so needs no definitions here.
↓ open down ↓ 29 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX