xref: /illumos-gate/usr/src/head/prof_attr.h (revision ba3594ba)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5499fd601Sgww  * Common Development and Distribution License (the "License").
6499fd601Sgww  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23134a1f4eSCasper H.S. Dik  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_PROF_ATTR_H
277c478bd9Sstevel@tonic-gate #define	_PROF_ATTR_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <sys/types.h>
357c478bd9Sstevel@tonic-gate #include <secdb.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	PROFATTR_FILENAME		"/etc/security/prof_attr"
397c478bd9Sstevel@tonic-gate #define	PROFATTR_DB_NAME		"prof_attr.org_dir"
407c478bd9Sstevel@tonic-gate #define	PROFATTR_DB_NCOL		5	/* total columns */
417c478bd9Sstevel@tonic-gate #define	PROFATTR_DB_NKEYCOL		1	/* total searchable columns */
427c478bd9Sstevel@tonic-gate #define	PROFATTR_DB_TBLT		"prof_attr_tbl"
437c478bd9Sstevel@tonic-gate #define	PROFATTR_NAME_DEFAULT_KW	"nobody"
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #define	PROFATTR_COL0_KW		"name"
467c478bd9Sstevel@tonic-gate #define	PROFATTR_COL1_KW		"res1"
477c478bd9Sstevel@tonic-gate #define	PROFATTR_COL2_KW		"res2"
487c478bd9Sstevel@tonic-gate #define	PROFATTR_COL3_KW		"desc"
497c478bd9Sstevel@tonic-gate #define	PROFATTR_COL4_KW		"attr"
507c478bd9Sstevel@tonic-gate 
51134a1f4eSCasper H.S. Dik #define	PROFILE_STOP			"Stop"
52134a1f4eSCasper H.S. Dik 
537c478bd9Sstevel@tonic-gate #define	DEF_PROF			"PROFS_GRANTED="
54499fd601Sgww #define	DEF_CONSUSER			"CONSOLE_USER="
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	MAXPROFS			4096
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * indices of searchable columns
607c478bd9Sstevel@tonic-gate  */
617c478bd9Sstevel@tonic-gate #define	PROFATTR_KEYCOL0		0	/* name */
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Key words used in the prof_attr database
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate #define	PROFATTR_AUTHS_KW		"auths"
687c478bd9Sstevel@tonic-gate #define	PROFATTR_PROFS_KW		"profiles"
697c478bd9Sstevel@tonic-gate #define	PROFATTR_PRIVS_KW		"privs"
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * Nsswitch representation of profile attributes.
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate typedef struct profstr_s {
777c478bd9Sstevel@tonic-gate 	char   *name;	/* proforization name */
787c478bd9Sstevel@tonic-gate 	char   *res1;	/* RESERVED */
797c478bd9Sstevel@tonic-gate 	char   *res2;	/* RESERVED */
807c478bd9Sstevel@tonic-gate 	char   *desc;	/* description */
817c478bd9Sstevel@tonic-gate 	char   *attr;	/* string of key-value pair attributes */
827c478bd9Sstevel@tonic-gate } profstr_t;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate typedef struct profattr_s {
857c478bd9Sstevel@tonic-gate 	char   *name;	/* proforization name */
867c478bd9Sstevel@tonic-gate 	char   *res1;	/* RESERVED */
877c478bd9Sstevel@tonic-gate 	char   *res2;	/* RESERVED */
887c478bd9Sstevel@tonic-gate 	char   *desc;	/* description */
897c478bd9Sstevel@tonic-gate 	kva_t  *attr;	/* array of key-value pair attributes */
907c478bd9Sstevel@tonic-gate } profattr_t;
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate extern profattr_t *getprofnam(const char *);
937c478bd9Sstevel@tonic-gate extern profattr_t *getprofattr(void);
947c478bd9Sstevel@tonic-gate extern void getproflist(const char *, char **, int *);
957c478bd9Sstevel@tonic-gate extern void setprofattr(void);
967c478bd9Sstevel@tonic-gate extern void endprofattr(void);
977c478bd9Sstevel@tonic-gate extern void free_profattr(profattr_t *);
987c478bd9Sstevel@tonic-gate extern void free_proflist(char **, int);
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1017c478bd9Sstevel@tonic-gate }
1027c478bd9Sstevel@tonic-gate #endif
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #endif	/* _PROF_ATTR_H */
105