[7ce3a7]: doc / man3 / get_attrib.3  Maximize  Restore  History

Download this file

137 lines (130 with data), 4.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.\"
.\" $Id: get_attrib.3,v 1.1 2000/07/27 16:59:03 alaffin Exp $
.\"
.\" Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of version 2 of the GNU General Public License as
.\" published by the Free Software Foundation.
.\"
.\" This program is distributed in the hope that it would be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" Further, this software is distributed without any warranty that it is
.\" free of the rightful claim of any third person regarding infringement
.\" or the like. Any license provided herein, whether implied or
.\" otherwise, applies only to this software file. Patent licenses, if
.\" any, provided herein do not apply to combinations of this program with
.\" other software, or any other product whatsoever.
.\"
.\" You should have received a copy of the GNU General Public License along
.\" with this program; if not, write the Free Software Foundation, Inc., 59
.\" Temple Place - Suite 330, Boston MA 02111-1307, USA.
.\"
.\" Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
.\" Mountain View, CA 94043, or:
.\"
.\" http://www.sgi.com
.\"
.\" For further information regarding this notice, see:
.\"
.\" http://oss.sgi.com/projects/GenInfo/NoticeExplan/
.\"
.TH GET_ATTRIB 3 07/25/2000 "Linux Test Project"
.SH NAME
\fBget_attrib\fR \- Returns needed attributes to execute a command successfully on any system.
.SH SYNOPSIS
.sp
\fB#include "get_attrib.h"\fR
.sp
\fBchar *get_attrib (char *\fIcommand_name\fB, char *\fIpermits\fB, char *\fIactive_categories\fB, char *\fIauthorized_categories\fB, long \fIflag\fR);\fR
.SH DESCRIPTION
The \fBget_attributes\fR routine is designed to determine the system type
currently running and return the needed \fBruncmd(1)\fR string to run the
command specified successfully on any 7.0 and above systems. On systems
with TFM configured 'ON' some commands need special attributes that can't
be determined easily, this routine then uses an internal table to return the
needed attributes to run the command. On other system types the needed
attributes are easily determined without use of this table.
.PP
The \fBget_attrib\fR arguments are as follows:
.TP 10
\fIcommand_name\fR
Pointer to the command the attributes are to be returned about.
.TP
\fIpermits\fR
Pointer to either an octal or name string of permits to be
added to string returned.
.TP
\fIactive_category\fR
Pointer to either an octal or name string of active categories to be
added to string returned.
.TP
\fIauthorized_categories\fR
Pointer to either an octal or name string of categories to be
added to string returned.
.TP
\fIflag\fR
Long set to any combination of values defined in get_attrib.h. These values
are used to specify that the string returned should be for the specified
system type.
.sp
\fBGA_BOTH_OFF \fR PRIV_SU and PRIV_TFM off.
.sp
\fBGA_SU_ON \fR PRIV_SU on.
.sp
\fBGA_TFM_ON \fR PRIV_TFM on.
.sp
\fBGA_BOTH_ON \fR PRIV_SU and PRIV_TFM on.
.sp
\fBGA_CURRENT_SYS\fR Current system type.
.sp
.PP
.SH "EXAMPLE"
.P
The following example shows how \fBget_attrib\fR can be used to determine
the needed attributes to run a command successfully:
.P
.nf
#include <stdio.h>
#include "get_attrib.h"
main()
{
char cmd[256];
char *string;
if ((string =
get_attrib("mount",NULL,NULL,NULL,GA_CURRENT_SYS)) == (char *)NULL) {
printf("get_attrib() failed\en");
exit(1);
} else {
sprintf(cmd, "runcmd %s mount /dev/dsk/qtest3 /qtest3", string);
printf("Command = %s\en",cmd);
}
if ((string =
get_attrib("mount", NULL, NULL, NULL, GA_BOTH_OFF))==(char *)NULL) {
printf("get_attrib() failed\en");
exit(1);
} else {
sprintf(cmd, "runcmd %s mount /dev/dsk/qtest3 /qtest3", string);
printf("Command = %s\en",cmd);
}
}
.ni
On an MLS system with PRIV_SU ON the first sprintf would return,
\fBruncmd -u root mount /dev/dsk/qtest3 /qtest3\fR.
On the same system the second sprintf would return, \fBruncmd -J secadm -j
secadm mount /dev/dsk/qtest3 /qtest3\fR Which is as if PRIV_TFM and PRIV_SU
were OFF.
.PP
.SH "RETURN VALUE"
If \fBget_attrib()\fR completes successfully, a pointer to a string
containing the options of the runcmd string is returned; otherwise NULL is
returned.
.SH ERRORS
If \fBget_attrib()\fR has problems, an error message will be put in GA_Err_Msg
and NULL will be returned.
.SH "SEE ALSO"
\fBget_attrib\fR(1)
.P
\fBruncmd\fR(1)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks