pw_group.c (20303) | pw_group.c (20679) |
---|---|
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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * | 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * $Id: pw_group.c,v 1.1.1.2 1996/12/09 23:55:25 joerg Exp $ | 26 * $Id: pw_group.c,v 1.1.1.3 1996/12/10 23:59:01 joerg Exp $ |
27 */ 28 29#include <unistd.h> 30#include <ctype.h> 31#include <termios.h> 32 33#include "pw.h" 34#include "bitmap.h" --- 79 unchanged lines hidden (view full) --- 114 return EXIT_SUCCESS; 115 } else if (mode == M_PRINT) 116 return print_group(grp, getarg(args, 'P') != NULL); 117 118 if (a_gid) 119 grp->gr_gid = (gid_t) atoi(a_gid->val); 120 121 if ((arg = getarg(args, 'l')) != NULL) | 27 */ 28 29#include <unistd.h> 30#include <ctype.h> 31#include <termios.h> 32 33#include "pw.h" 34#include "bitmap.h" --- 79 unchanged lines hidden (view full) --- 114 return EXIT_SUCCESS; 115 } else if (mode == M_PRINT) 116 return print_group(grp, getarg(args, 'P') != NULL); 117 118 if (a_gid) 119 grp->gr_gid = (gid_t) atoi(a_gid->val); 120 121 if ((arg = getarg(args, 'l')) != NULL) |
122 grp->gr_name = arg->val; | 122 grp->gr_name = pw_checkname((u_char *)arg->val, 0); |
123 } else { 124 if (a_name == NULL) /* Required */ 125 cmderr(EX_DATAERR, "group name required\n"); 126 else if (grp != NULL) /* Exists */ 127 cmderr(EX_DATAERR, "group name `%s' already exists\n", a_name->val); 128 129 memset(members, 0, sizeof members); 130 grp = &fakegroup; | 123 } else { 124 if (a_name == NULL) /* Required */ 125 cmderr(EX_DATAERR, "group name required\n"); 126 else if (grp != NULL) /* Exists */ 127 cmderr(EX_DATAERR, "group name `%s' already exists\n", a_name->val); 128 129 memset(members, 0, sizeof members); 130 grp = &fakegroup; |
131 grp->gr_name = a_name->val; | 131 grp->gr_name = pw_checkname((u_char *)a_name->val, 0); |
132 grp->gr_passwd = "*"; 133 grp->gr_gid = gr_gidpolicy(cnf, args); 134 grp->gr_mem = members; 135 } 136 137 /* 138 * This allows us to set a group password Group passwords is an 139 * antique idea, rarely used and insecure (no secure database) Should --- 175 unchanged lines hidden --- | 132 grp->gr_passwd = "*"; 133 grp->gr_gid = gr_gidpolicy(cnf, args); 134 grp->gr_mem = members; 135 } 136 137 /* 138 * This allows us to set a group password Group passwords is an 139 * antique idea, rarely used and insecure (no secure database) Should --- 175 unchanged lines hidden --- |