HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
s
strtoacl(3C) strtoacl(3C)
if ((nentries = strtoacl (string, nentries, NACLENTRIES, acl,
statbuf.st_uid, statbuf.st_gid)) < 0)
{
error (...);
}
if (setacl ("../myfile2", nentries, acl) < 0)
error (...);
The following code fragment calls strtoacl() with special values of fuid and fgid, then checks to see if
they show up in acl[].
#include <acllib.h>
int perfile = 0; /* need to stat() and reparse per file? */
int entry;
if ((nentries = strtoacl (string, 0, NACLENTRIES, acl,
ACL_FILEOWNER, ACL_FILEGROUP)) < 0)
{
error (...);
}
for (entry = 0; entry < nentries; entry++)
{
if ((acl[entry].uid == ACL_FILEOWNER)
|| (acl[entry].gid == ACL_FILEGROUP))
{
perfile = 1;
break;
}
}
The following code fragment converts an ACL pattern from a string to an array of pattern entries.
#include <acllib.h>
int nentries;
struct acl_entry_patt acl [NACLENTRIES];
if ((nentries = strtoaclpatt (string, NACLENTRIES, acl)) < 0)
error (...);
The following code fragment inside a for loop checks an entry pattern (p*, onmask, and
offmask vari-
able names) against an entry in a file’s ACL (
a* variable names) using the file’s user and group IDs (
f*
variable names).
include <unistd.h>
if (((puid == ACL_FILEOWNER) && (fuid != auid))
|| ((puid != ACL_ANYUSER) && (puid != auid)))
{
continue;
}
if (((pgid == ACL_FILEGROUP) && (fgid != agid))
|| ((pgid != ACL_ANYGROUP) && (pgid != agid)))
{
continue;
}
if (((( amode) & MODEMASK & onmask ) != onmask)
|| (((˜ amode) & MODEMASK & offmask) != offmask))
{
continue;
}
DEPENDENCIES
strtoacl() and strtoaclpatt()
are only supported on HFS file system on standalone HP-UX
operating system.
HP-UX Release 11i: December 2000 − 4 − Section 3−−897
___
___