/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <grp.h>
#include <unistd.h>
#include <userdefs.h>
#include <errno.h>
#include <limits.h>
#include "users.h"
#include "messages.h"
/* Corresponds to MYBUFSIZE in grpck.c, BUFCONST in nss_dbdefs.c */
int
{
char **memptr;
int fd;
int i;
int modified = 0;
long g_curr = 0L;
return (EX_UPDATE);
return (EX_UPDATE);
}
return (EX_UPDATE);
}
return (EX_UPDATE);
}
/*
* Get ownership and permissions correct
*/
return (EX_UPDATE);
}
/* Make TMP file look like we want GROUP file to look */
return (EX_UPDATE);
}
/*
* bufsize contains the size of the currently allocated buffer
* buffer size, which is initially MYBUFSIZE but when a line
* greater than MYBUFSIZE is encountered then bufsize gets increased
* by MYBUFSIZE.
* g_string always points to the beginning of the buffer (even after
* realloc()).
* gstr_off = g_string + MYBUFSIZE * (n), where n >= 0.
*/
g_length = 0;
break;
if (new_g_string == NULL) {
return (EX_UPDATE);
}
}
if (g_length == 0) {
continue;
}
/* While there is another group string */
errno = 0;
/* tried to parse a group string over MYBUFSIZ char */
else
modified = 0; /* bad group file: cannot rebuild */
break;
}
/* first delete the login from the group, if it's there */
memptr++) {
/* Delete this one */
do {
} while (*from++);
modified++;
break;
}
}
}
}
/* now check to see if group is one to add to */
if (gids) {
for (i = 0; gids[i] != -1; i++) {
/* Find end */
memptr++)
;
modified++;
}
}
}
}
return (EX_UPDATE);
}
/* Now, update GROUP file, if it was modified */
if (modified) {
return (EX_UPDATE);
}
return (EX_SUCCESS);
} else {
return (EX_SUCCESS);
}
}