/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
*/
/*
*/
/*
* Network name to unix credential database generator.
* create the database.
*
* If some user appears in passwd, they get an entry like:
* sun.<uid>@<domainname> <uid>:<gid1>,<gid2>,...
* If some host appears in hosts, it gets an entry like:
* sun.<hostname>@<domainname> 0:<hostname>
*
* to the database.
*/
#include <stdio.h>
#include <pwd.h>
#include <limits.h>
#include <rpc/key_prot.h>
extern char **getaline();
extern char *malloc();
extern char *strcpy();
/*
* The group list
*/
struct group_list {
char *user;
int group_len;
};
/*
* General purpose list of strings
*/
struct string_list {
char *str;
};
static char *scanargs();
static int atoi();
/*
* Various separaters
*/
void dohostfile(char *, FILE *);
static int Atoi(char *);
void check_getname(char **, char *, char *, char *, char *);
void multdef(char *);
static int wasprinted(char *);
void storegid(int, char *);
void printgroups(char *, int);
int parseargs(int, char *[]);
void put_s(char *);
void put_d(int);
int
int argc;
char *argv[];
{
"usage: %s [-q] [-pghm filename]\n", cmdname);
exit(1);
}
}
return (0);
/* NOTREACHED */
}
/*
* Parse the network id mapping file
*/
void
char *mapfile;
{
char **lp;
curline = 0;
if (wasprinted(name)) {
continue;
}
(void) putchar(' ');
(void) putchar(':');
if (uid == 0) {
(void) putchar(' ');
} else {
"#") >= 0) {
(void) putchar(',');
}
}
(void) putchar('\n');
}
}
/*
* Parse the groups file
*/
void
char *grpfile;
{
char **lp;
int gid;
curline = 0;
if (name[0] == '+') {
continue;
}
"") >= 0) {
}
}
}
/*
* Parse the password file
*/
void
char *pwdfile;
{
char **lp;
curline = 0;
continue; /* NIS entry */
}
if (wasprinted(name)) {
continue;
}
(void) putchar(' ');
(void) putchar(':');
}
}
/*
* Parse the hosts file
*/
void
char *hostfile;
{
char **lp;
curline = 0;
continue;
}
if (wasprinted(netname)) {
continue;
}
}
}
/*
* Open a file, exit on failure
*/
static FILE *
char *fname;
{
FILE *f;
if (f == NULL) {
exit(1);
}
return (f);
}
/*
* Print syntax error message, then exit
*/
void
{
exit(1);
}
/*
* an atoi() that prints a message and exits upong failure
*/
static int
char *str;
{
int res;
syntaxerror();
}
return (res);
}
/*
* Attempt to get a token from a file, print a message and exit upon failure
*/
void
char **lp;
char *name;
char *skip;
char *term;
char *com;
{
syntaxerror();
}
}
/*
* Something was defined more than once
*/
void
char *name;
{
if (!quietmode) {
"%s: %s multiply defined, other definitions ignored\n",
}
}
static int
unsigned char *str;
int size;
{
unsigned val;
int flip;
val = 0;
flip = 0;
while (*str) {
if (flip) {
} else {
}
}
}
/*
* Check if an item has been printed
* If not, store the item into the printed item table
*/
static int
char *name;
{
struct string_list *s;
int val;
;
if (s != NULL) {
return (1);
}
return (0);
}
/*
* Add gid to the list of a user's groups
*/
void
int gid;
char *user;
{
struct group_list *g;
int i;
int val;
;
if (g == NULL) {
g->group_len = 1;
} else {
for (i = 0; i < g->group_len; i++) {
return;
}
}
return;
}
}
}
/*
* print out a user's groups
*/
void
char *user;
int gid;
{
struct group_list *g;
int i;
int val;
;
if (g != NULL) {
for (i = 0; i < g->group_len; i++) {
(void) putchar(',');
}
}
}
(void) putchar('\n');
}
/*
* Parse command line arguments
*/
int
int argc;
char *argv[];
{
int i;
int j;
static struct {
char letter;
char *standard;
char **filename;
} whattodo[] = {
};
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
if (argv[i][2] != 0) {
return (0);
}
quietmode = 1;
continue;
}
for (j = 0; j < TABSIZE; j++) {
return (0);
}
if (++i == argc) {
return (0);
}
break;
}
}
if (j == TABSIZE) {
return (0);
}
}
}
return (1);
}
/*
* Print a string, quickly
*/
void
put_s(s)
char *s;
{
}
/*
* Print an integer, quickly
*/
void
put_d(d)
int d;
{
char *p;
if (d == 0) {
(void) putchar('0');
return;
}
if (d < 0) {
(void) putchar('-');
d = -d;
}
*--p = 0;
while (d > 0) {
*--p = (d % 10) + '0';
d /= 10;
}
put_s(p);
}