profiles.c revision 14839a76b454c7de413fbc7c57842b674873ee79
/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <string.h>
#include <libintl.h>
#include <locale.h>
#include <deflt.h>
#include <user_attr.h>
#include <prof_attr.h>
#include <exec_attr.h>
#include <auth_attr.h>
#define EXIT_OK 0
#define EXIT_FATAL 1
#define EXIT_NON_FATAL 2
#define PRINT_DEFAULT 0x0000
#define PRINT_NAME 0x0010
#define PRINT_LONG 0x0020
#ifndef TEXT_DOMAIN /* Should be defined by cc -D */
#define TEXT_DOMAIN "SYS_TEST"
#endif
#define PROFLIST_SEP ","
static void usage();
static int show_profs(char *, int);
static int list_profs(userattr_t *, int);
static void print_profs_long(char *, void *, int);
static void print_profs(char *, char **, int, int);
static void format_attr(int *, int, char *);
static void getProfiles(char *, char **, int *);
static void getDefaultProfiles(char **, int *);
static char *progname = "profiles";
int
{
extern int optind;
register int c;
int print_flag = PRINT_DEFAULT;
(void) textdomain(TEXT_DOMAIN);
switch (c) {
case 'l':
print_flag |= PRINT_LONG;
break;
default:
usage();
return (EXIT_FATAL);
}
}
} else {
do {
if (status == EXIT_FATAL) {
break;
}
} while (*++argv);
}
return (status);
}
static int
{
register userattr_t *user;
int profcnt = 0;
return (status);
}
return (status);
}
} else {
if (profcnt == 0) {
} else {
if (print_flag & PRINT_LONG) {
exec, print_flag);
} else {
}
}
}
}
if (status == EXIT_NON_FATAL) {
}
return (status);
}
static int
{
int profcnt = 0;
if (print_flag & PRINT_LONG) {
}
} else {
}
/* Also get any default profiles */
if (profcnt == 0) {
}
}
if (print_flag & PRINT_LONG) {
} else {
}
}
return (status);
}
static void
{
register int i;
register int len;
int outlen;
char tmpstr[TMP_BUF_LEN];
register char *empty = "";
register char *key;
register char *val;
register execattr_t *exec;
if (print_flag & PRINT_NAME) {
}
(void) printf("\n");
}
(void) printf("\n");
continue;
}
break;
}
if (i > 0) {
}
}
(void) printf("\n");
}
}
static void
{
int newline = 0;
newline = 1;
}
if (newline) {
(void) printf("\n");
} else {
}
}
static void
usage()
{
gettext(" usage: profiles [-l] [user1 user2 ...]\n"));
}
static void
char *prof;
char *lasts;
}
}
static void
{
int i;
if (print_flag & PRINT_NAME) {
}
for (i = 0; i < profcnt; i++) {
}
}
/*
* Get the list of default profiles from /etc/security/policy.conf
*/
static void
{
}
}
}