annotate toys/pending/useradd.c @ 1276:d48bdc1cb017 draft

Switch human_readable() to just outputing decimal kilo/mega/gigabytes, make du use it, move it from lib/pending.c to lib.c.
author Rob Landley <rob@landley.net>
date Tue, 06 May 2014 06:31:28 -0500
parents 0752b2d58909
children 85f297591693
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* useradd.c - add a new user
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * Copyright 2013 Ashwini Kumar <ak.ashwini@gmail.com>
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 * Copyright 2013 Kyungwan Han <asura321@gmail.com>
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
5 *
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 * See http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/useradd.html
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 USE_USERADD(NEWTOY(useradd, "<1>2u#<0G:s:g:h:SDH", TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 USE_USERADD(OLDTOY(adduser, useradd, OPTSTR_useradd, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 config USERADD
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 bool "useradd"
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 default n
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 help
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 usage: useradd [-SDH] [-hDIR] [-sSHELL] [-G GRP] [-gGECOS] [-uUID] USER [GROUP]
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
16
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 Create new user, or add USER to GROUP
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
18
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 -h DIR Home directory
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 -g GECOS GECOS field
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 -s SHELL Login shell
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 -G GRP Add user to existing group
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 -S Create a system user
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 -D Don't assign a password
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 -H Don't create home directory
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 -u UID User id
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
28
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 #define FOR_useradd
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 #include "toys.h"
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
31
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 GLOBALS(
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 char *dir;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 char *gecos;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 char *shell;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
36 char *u_grp;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
37 long uid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 long gid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 )
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
40
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
41 static char* get_shell(void)
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 char *shell = getenv("SHELL");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
44
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
45 if (!shell) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 struct passwd *pw;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
47 pw = getpwuid(getuid());
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
48 if (pw && pw->pw_shell && pw->pw_shell[0])
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
49 shell = pw->pw_shell;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
50 else shell = "/bin/sh";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
51 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
52 return xstrdup(shell);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
53 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
54
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
55 /* exec_wait() function does a fork(), and exec the command,
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
56 * waits for the child to exit and return the status to parent
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
57 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
58 static int exec_wait(char **args)
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
59 {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
60 int status = 0;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
61 pid_t pid = fork();
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
62
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
63 if (!pid) xexec(args);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
64 else if (pid > 0) waitpid(pid, &status, 0);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
65 else perror_exit("fork failed");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
66 return WEXITSTATUS(status);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
67 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
68
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
69 /* create_copy_skel(), This function will create the home directory of the
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
70 * user, by copying /etc/skel/ contents to /home/<username>.
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
71 * Then change the ownership of home dir to the UID and GID of new user,
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
72 * and Mode to 0700, i.e. rwx------ for user.
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
73 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
74 static void create_copy_skel(char *skel, char *hdir)
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
75 {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
76 char *args[5];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
77 struct stat sb;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
78
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
79 if (toys.optflags & FLAG_H) return;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
80
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
81 umask(0);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
82 args[4] = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
83 if (stat(hdir, &sb)) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 args[0] = "cp";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
85 args[1] = "-R";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
86 args[2] = skel;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
87 args[3] = hdir;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 // Copy /etc/skel to home dir
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
89 toys.exitval = exec_wait(args);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
90
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
91 args[0] = "chown";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
92 args[1] = "-R";
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
93 args[2] = xmprintf("%u:%u", TT.uid, TT.gid);
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
94 args[3] = hdir;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
95 //Change ownership to that of UID and GID of new user
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
96 toys.exitval = exec_wait(args);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
97
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
98 } else xprintf("Warning: home directory for the user already exists\n"
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
99 "Not copying any file from skel directory into it.\n");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
100
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
101 if (chown(hdir, TT.uid, TT.gid) || chmod(hdir, 0700))
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
102 perror_exit("chown/chmod failed for '%s'", hdir);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
103 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
104
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
105 /* Add a new group to the system, if UID is given then that is validated
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
106 * to be free, else a free UID is choosen by self.
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
107 * SYSTEM IDs are considered in the range 100 ... 999
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
108 * add_user(), add a new entry in /etc/passwd, /etc/shadow files
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
109 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
110 static void new_user()
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
111 {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
112 struct passwd pwd;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
113 char *entry, *args[4];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
114 int max = INT_MAX;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
115
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 pwd.pw_name = *toys.optargs;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
117 pwd.pw_passwd = (char *)"x";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
118 if (toys.optflags & FLAG_g) pwd.pw_gecos = TT.gecos;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
119 else pwd.pw_gecos = "Linux User,";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
120 if (toys.optflags & FLAG_h) pwd.pw_dir = TT.dir;
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
121 else pwd.pw_dir = xmprintf("/home/%s", *toys.optargs);
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
122 if (toys.optflags & FLAG_s) pwd.pw_shell = TT.shell;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
123 else pwd.pw_shell = get_shell();
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
124
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
125 if (toys.optflags & FLAG_u) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
126 if (TT.uid > INT_MAX) error_exit("uid should be less than '%d' ", INT_MAX);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
127 if (getpwuid(TT.uid)) error_exit("user '%ld' is in use", TT.uid);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
128 pwd.pw_uid = TT.uid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
129 } else {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
130 if (toys.optflags & FLAG_S) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
131 TT.uid = SYS_FIRST_ID;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
132 max = SYS_LAST_ID;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
133 } else {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
134 TT.uid = SYS_LAST_ID + 1; //i.e. starting from 1000
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
135 max = 60000; // as per config file on Linux desktop
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
136 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
137 //find unused uid
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
138 while (TT.uid <= max) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
139 if (!getpwuid(TT.uid)) break;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
140 if (TT.uid == max) error_exit("no more free uids left");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
141 TT.uid++;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
142 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
143 pwd.pw_uid = TT.uid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
144 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
145
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
146 if (toys.optflags & FLAG_G) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
147 struct group *gr = getgrnam(TT.u_grp);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
148 if (!gr) error_exit("The group '%s' doesn't exist", TT.u_grp);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
149 TT.gid = gr->gr_gid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
150 } else {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
151 // Set the GID for the user, if not specified
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
152 if (toys.optflags & FLAG_S) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
153 TT.gid = SYS_FIRST_ID;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
154 max = SYS_LAST_ID;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
155 } else TT.gid = ((TT.uid > SYS_LAST_ID) ? TT.uid : SYS_LAST_ID + 1);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
156 if (getgrnam(pwd.pw_name)) error_exit("group '%s' is in use", pwd.pw_name);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
157 //find unused gid
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
158 while (TT.gid <= max) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
159 if (!getgrgid(TT.gid)) break;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
160 if (TT.gid == max) error_exit("no more free gids left");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
161 TT.gid++;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
162 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
163 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
164 pwd.pw_gid = TT.gid;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
165
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
166 if (!(toys.optflags & FLAG_G)) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
167 // Create a new group for user
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
168 //add group, invoke addgroup command
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
169 args[0] = "groupadd";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
170 args[1] = toys.optargs[0];
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
171 args[2] = xmprintf("-g%ld", pwd.pw_gid);
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
172 args[3] = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
173 if (exec_wait(args)) error_msg("addgroup fail");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
174 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
175
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
176 /*add user to system
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
177 * 1. add an entry to /etc/passwd and /etcshadow file
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
178 * 2. Copy /etc/skel dir contents to use home dir
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
179 * 3. update the user passwd by running 'passwd' utility
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
180 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
181
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
182 // 1. add an entry to /etc/passwd and /etc/shadow file
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
183 entry = xmprintf("%s:%s:%ld:%ld:%s:%s:%s", pwd.pw_name, pwd.pw_passwd,
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
184 pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
185 if (update_password("/etc/passwd", pwd.pw_name, entry)) error_exit("updating passwd file failed");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
186 free(entry);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
187
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
188 if (toys.optflags & FLAG_S)
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
189 entry = xmprintf("%s:!!:%u::::::", pwd.pw_name,
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
190 (unsigned)(time(NULL))/(24*60*60)); //passwd is not set initially
1183
0752b2d58909 Rename xmsprintf() to just xmprintf().
Rob Landley <rob@landley.net>
parents: 1091
diff changeset
191 else entry = xmprintf("%s:!!:%u:%ld:%ld:%ld:::", pwd.pw_name,
1091
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
192 (unsigned)(time(NULL))/(24*60*60), 0, 99999, 7); //passwd is not set initially
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
193 update_password("/etc/shadow", pwd.pw_name, entry);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
194 free(entry);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
195
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
196 //2. craete home dir & copy skel dir to home
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
197 if (!(toys.optflags & FLAG_S)) create_copy_skel("/etc/skel", pwd.pw_dir);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
198
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
199 //3. update the user passwd by running 'passwd' utility
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
200 if (!(toys.optflags & FLAG_D)) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
201 args[0] = "passwd";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
202 args[1] = pwd.pw_name;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
203 args[2] = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
204 if (exec_wait(args)) error_exit("changing user passwd failed");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
205 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
206 if (toys.optflags & FLAG_G) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
207 /*add user to the existing group, invoke addgroup command */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
208 args[0] = "groupadd";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
209 args[1] = toys.optargs[0];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
210 args[2] = TT.u_grp;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
211 args[3] = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
212 if (exec_wait(args)) error_exit("adding user to group Failed");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
213 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
214 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
215
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
216 /* Entry point for useradd feature
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
217 * Specifying options and User, Group at cmdline is treated as error.
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
218 * If only 2 parameters (Non-Option) are given, then User is added to the
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
219 * Group
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
220 */
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
221 void useradd_main(void)
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
222 {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
223 struct passwd *pwd = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
224
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
225 if (toys.optflags && toys.optc == 2) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
226 toys.exithelp = 1;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
227 error_exit("options, user and group can't be together");
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
228 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
229
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
230 if (toys.optc == 2) {
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
231 //add user to group
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
232 //toys.optargs[0]- user, toys.optargs[1] - group
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
233 char *args[4];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
234 args[0] = "groupadd";
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
235 args[1] = toys.optargs[0];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
236 args[2] = toys.optargs[1];
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
237 args[3] = NULL;
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
238 toys.exitval = exec_wait(args);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
239 } else { //new user to be created
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
240 // investigate the user to be created
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
241 if ((pwd = getpwnam(*toys.optargs)))
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
242 error_exit("user '%s' is in use", *toys.optargs);
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
243 is_valid_username(*toys.optargs); //validate the user name
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
244 new_user();
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
245 }
c4d4a6e7473f useradd, groupadd, and mkpasswd submitted by Ashwini Sharma.
Rob Landley <rob@landley.net>
parents:
diff changeset
246 }