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>
        
*** 24,33 ****
--- 24,36 ----
   */
  
  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  /*        All Rights Reserved   */
  
+ /*
+  * Copyright (c) 2013 RackTop Systems.
+  */
  
  #include        <sys/types.h>
  #include        <sys/stat.h>
  #include        <sys/param.h>
  #include        <stdio.h>
*** 38,47 ****
--- 41,51 ----
  #include        <userdefs.h>
  #include        <errno.h>
  #include        <project.h>
  #include        <unistd.h>
  #include        <user_attr.h>
+ #include        <libcmdutils.h>
  #include        "users.h"
  #include        "messages.h"
  #include        "userdisp.h"
  #include        "funcs.h"
  
*** 80,90 ****
  extern struct userdefs *getusrdef();
  extern void dispusrdef();
  
  static void cleanup();
  
- extern uid_t findnextuid(void);
  extern int check_perm(), valid_expire();
  extern int putusrdef(), valid_uid();
  extern int call_passmgmt(), edit_group(), create_home();
  extern int edit_project();
  extern int **valid_lgroup();
--- 84,93 ----
*** 130,141 ****
  int
  main(argc, argv)
  int argc;
  char *argv[];
  {
!         int ch, ret, mflag = 0, oflag = 0, Dflag = 0, **gidlist;
!         projid_t **projlist;
          char *ptr;                      /* loc in a str, may be set by strtol */
          struct group *g_ptr;
          struct project p_ptr;
          char mybuf[PROJECT_BUFSZ];
          struct stat statbuf;            /* status buffer for stat */
--- 133,144 ----
  int
  main(argc, argv)
  int argc;
  char *argv[];
  {
!         int ch, ret, mflag = 0, oflag = 0, Dflag = 0, **gidlist = NULL;
!         projid_t **projlist = NULL;
          char *ptr;                      /* loc in a str, may be set by strtol */
          struct group *g_ptr;
          struct project p_ptr;
          char mybuf[PROJECT_BUFSZ];
          struct stat statbuf;            /* status buffer for stat */
*** 423,433 ****
                          break;
                  }
  
          } else {
  
!                 if ((uid = findnextuid()) < 0) {
                          errmsg(M_INVALID, "default id", "user id");
                          exit(EX_ID_EXISTS);
                  }
          }
  
--- 426,436 ----
                          break;
                  }
  
          } else {
  
!                 if (findnextuid(DEFRID+1, MAXUID, &uid) != 0) {
                          errmsg(M_INVALID, "default id", "user id");
                          exit(EX_ID_EXISTS);
                  }
          }
  
*** 632,642 ****
                           */
                          if (uidstr != NULL) {
                                  errmsg(M_UID_USED, uid);
                                  exit(EX_ID_EXISTS);
                          } else {
!                                 if ((uid = findnextuid()) < 0) {
                                          errmsg(M_INVALID, "default id",
                                              "user id");
                                          exit(EX_ID_EXISTS);
                                  }
                                  (void) sprintf(uidstring, "%u", uid);
--- 635,645 ----
                           */
                          if (uidstr != NULL) {
                                  errmsg(M_UID_USED, uid);
                                  exit(EX_ID_EXISTS);
                          } else {
!                                 if (findnextuid(DEFRID+1, MAXUID, &uid) != 0) {
                                          errmsg(M_INVALID, "default id",
                                              "user id");
                                          exit(EX_ID_EXISTS);
                                  }
                                  (void) sprintf(uidstring, "%u", uid);