Print this page
4078 groupadd execs getent unnecessarily
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Milan Jurik <milan.jurik@xylab.cz>
Reviewed by: Gordon Ross <Gordon.W.Ross@gmail.com>


  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 
  32 #pragma ident   "%Z%%M% %I%     %E% SMI"

  33 
  34 /*LINTLIBRARY*/
  35 
  36 #include        <sys/types.h>
  37 #include        <stdio.h>
  38 #include        <string.h>
  39 #include        <userdefs.h>
  40 #include        <user_attr.h>
  41 #include        <limits.h>
  42 #include        <stdlib.h>
  43 #include        <stddef.h>
  44 #include        <time.h>
  45 #include        <unistd.h>
  46 #include        "userdisp.h"
  47 #include        "funcs.h"
  48 #include        "messages.h"
  49 
  50 /* Print out a NL when the line gets too long */
  51 #define PRINTNL()       \
  52         if (outcount > 40) { \
  53                 outcount = 0; \
  54                 (void) fprintf(fptr, "\n"); \
  55         }
  56 
  57 #define SKIPWS(ptr)     while (*ptr && *ptr == ' ' || *ptr == '\t') ptr++
  58 
  59 static char *dup_to_nl(char *);
  60 
  61 static struct userdefs defaults = {
  62         DEFRID, DEFGROUP, DEFGNAME, DEFPARENT, DEFSKL,
  63         DEFSHL, DEFINACT, DEFEXPIRE, DEFAUTH, DEFPROF,
  64         DEFROLE, DEFPROJ, DEFPROJNAME, DEFLIMPRIV,
  65         DEFDFLTPRIV, DEFLOCK_AFTER_RETRIES
  66 };
  67 
  68 #define INT     0
  69 #define STR     1
  70 #define PROJID  2
  71 
  72 #define DEFOFF(field)           offsetof(struct userdefs, field)
  73 #define FIELD(up, pe, type)     (*(type *)((char *)(up) + (pe)->off))
  74 
  75 typedef struct parsent {
  76         const char *name;       /* deffoo= */
  77         const size_t nmsz;      /* length of def= string (excluding \0) */




  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 /*
  32  * Copyright (c) 2013 RackTop Systems.
  33  */
  34 
  35 /*LINTLIBRARY*/
  36 
  37 #include        <sys/types.h>
  38 #include        <stdio.h>
  39 #include        <string.h>
  40 #include        <userdefs.h>
  41 #include        <user_attr.h>
  42 #include        <limits.h>
  43 #include        <stdlib.h>
  44 #include        <stddef.h>
  45 #include        <time.h>
  46 #include        <unistd.h>
  47 #include        "userdisp.h"
  48 #include        "funcs.h"
  49 #include        "messages.h"
  50 
  51 /* Print out a NL when the line gets too long */
  52 #define PRINTNL()       \
  53         if (outcount > 40) { \
  54                 outcount = 0; \
  55                 (void) fprintf(fptr, "\n"); \
  56         }
  57 
  58 #define SKIPWS(ptr)     while (*ptr && (*ptr == ' ' || *ptr == '\t')) ptr++
  59 
  60 static char *dup_to_nl(char *);
  61 
  62 static struct userdefs defaults = {
  63         DEFRID, DEFGROUP, DEFGNAME, DEFPARENT, DEFSKL,
  64         DEFSHL, DEFINACT, DEFEXPIRE, DEFAUTH, DEFPROF,
  65         DEFROLE, DEFPROJ, DEFPROJNAME, DEFLIMPRIV,
  66         DEFDFLTPRIV, DEFLOCK_AFTER_RETRIES
  67 };
  68 
  69 #define INT     0
  70 #define STR     1
  71 #define PROJID  2
  72 
  73 #define DEFOFF(field)           offsetof(struct userdefs, field)
  74 #define FIELD(up, pe, type)     (*(type *)((char *)(up) + (pe)->off))
  75 
  76 typedef struct parsent {
  77         const char *name;       /* deffoo= */
  78         const size_t nmsz;      /* length of def= string (excluding \0) */