Deleted Added
sdiff udiff text old ( 273043 ) new ( 274082 )
full compact
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#ifndef lint
29static const char rcsid[] =
30 "$FreeBSD: stable/10/usr.sbin/pw/pw_user.c 273043 2014-10-13 15:56:47Z des $";
31#endif /* not lint */
32
33#include <ctype.h>
34#include <err.h>
35#include <fcntl.h>
36#include <sys/param.h>
37#include <dirent.h>
38#include <paths.h>

--- 277 unchanged lines hidden (view full) ---

316 * know.
317 */
318 if (mode != M_ADD && pwd == NULL
319 && strspn(a_name->val, "0123456789") == strlen(a_name->val)
320 && *a_name->val) {
321 (a_uid = a_name)->ch = 'u';
322 a_name = NULL;
323 }
324 }
325
326 /*
327 * Update, delete & print require that the user exists
328 */
329 if (mode == M_UPDATE || mode == M_DELETE ||
330 mode == M_PRINT || mode == M_LOCK || mode == M_UNLOCK) {
331

--- 414 unchanged lines hidden (view full) ---

746 }
747 }
748
749 /*
750 * Ok, user is created or changed - now edit group file
751 */
752
753 if (mode == M_ADD || getarg(args, 'G') != NULL) {
754 int i;
755 for (i = 0; cnf->groups[i] != NULL; i++) {
756 grp = GETGRNAM(cnf->groups[i]);
757 grp = gr_add(grp, pwd->pw_name);
758 /*
759 * grp can only be NULL in 2 cases:
760 * - the new member is already a member
761 * - a problem with memory occurs
762 * in both cases we want to skip now.

--- 562 unchanged lines hidden ---